website/static/internal/headerwebsite/runtime.js

4395 lines
1.3 MiB

var oA=Object.create;var Pl=Object.defineProperty,aA=Object.defineProperties,lA=Object.getOwnPropertyDescriptor,cA=Object.getOwnPropertyDescriptors,uA=Object.getOwnPropertyNames,Ag=Object.getOwnPropertySymbols,hA=Object.getPrototypeOf,_g=Object.prototype.hasOwnProperty,dA=Object.prototype.propertyIsEnumerable;var Tg=(r,e,t)=>e in r?Pl(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ue=(r,e)=>{for(var t in e||(e={}))_g.call(e,t)&&Tg(r,t,e[t]);if(Ag)for(var t of Ag(e))dA.call(e,t)&&Tg(r,t,e[t]);return r},tt=(r,e)=>aA(r,cA(e)),Eg=r=>Pl(r,"__esModule",{value:!0});var Ng=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),fA=(r,e)=>{Eg(r);for(var t in e)Pl(r,t,{get:e[t],enumerable:!0})},pA=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of uA(e))!_g.call(r,n)&&n!=="default"&&Pl(r,n,{get:()=>e[n],enumerable:!(t=lA(e,n))||t.enumerable});return r},Cg=r=>pA(Eg(Pl(r!=null?oA(hA(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var Y0=Ng($h=>{"use strict";$h.byteLength=Z2;$h.toByteArray=eI;$h.fromByteArray=iI;var yr=[],Li=[],Q2=typeof Uint8Array!="undefined"?Uint8Array:Array,Om="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Po=0,X0=Om.length;Po<X0;++Po)yr[Po]=Om[Po],Li[Om.charCodeAt(Po)]=Po;var Po,X0;Li["-".charCodeAt(0)]=62;Li["_".charCodeAt(0)]=63;function q0(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function Z2(r){var e=q0(r),t=e[0],n=e[1];return(t+n)*3/4-n}function $2(r,e,t){return(e+t)*3/4-t}function eI(r){var e,t=q0(r),n=t[0],i=t[1],s=new Q2($2(r,n,i)),o=0,a=i>0?n-4:n,l;for(l=0;l<a;l+=4)e=Li[r.charCodeAt(l)]<<18|Li[r.charCodeAt(l+1)]<<12|Li[r.charCodeAt(l+2)]<<6|Li[r.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Li[r.charCodeAt(l)]<<2|Li[r.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=Li[r.charCodeAt(l)]<<10|Li[r.charCodeAt(l+1)]<<4|Li[r.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function tI(r){return yr[r>>18&63]+yr[r>>12&63]+yr[r>>6&63]+yr[r&63]}function nI(r,e,t){for(var n,i=[],s=e;s<t;s+=3)n=(r[s]<<16&16711680)+(r[s+1]<<8&65280)+(r[s+2]&255),i.push(tI(n));return i.join("")}function iI(r){for(var e,t=r.length,n=t%3,i=[],s=16383,o=0,a=t-n;o<a;o+=s)i.push(nI(r,o,o+s>a?a:o+s));return n===1?(e=r[t-1],i.push(yr[e>>2]+yr[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(yr[e>>10]+yr[e>>4&63]+yr[e<<2&63]+"=")),i.join("")}});var tA=Ng((Xd,eA)=>{(function(r,e){typeof Xd=="object"&&typeof eA!="undefined"?e(Xd):typeof define=="function"&&define.amd?define(["exports"],e):e((r=typeof globalThis!="undefined"?globalThis:r||self).SVDJS={})})(Xd,function(r){"use strict";r.SVD=function(e,t,n,i,s){if(t=t===void 0||t,n=n===void 0||n,s=1e-64/(i=i||Math.pow(2,-52)),!e)throw new TypeError("Matrix a is not defined");var o,a,l,c,u,h,d,f,p,m,v,g,y=e[0].length,x=e.length;if(x<y)throw new TypeError("Invalid matrix: m < n");for(var b=[],w=[],_=[],S=t==="f"?x:y,A=m=d=0;A<x;A++)w[A]=new Array(S).fill(0);for(A=0;A<y;A++)_[A]=new Array(y).fill(0);var T,L=new Array(y).fill(0);for(A=0;A<x;A++)for(o=0;o<y;o++)w[A][o]=e[A][o];for(A=0;A<y;A++){for(b[A]=d,p=0,l=A+1,o=A;o<x;o++)p+=Math.pow(w[o][A],2);if(p<s)d=0;else for(f=(h=w[A][A])*(d=h<0?Math.sqrt(p):-Math.sqrt(p))-p,w[A][A]=h-d,o=l;o<y;o++){for(p=0,a=A;a<x;a++)p+=w[a][A]*w[a][o];for(h=p/f,a=A;a<x;a++)w[a][o]=w[a][o]+h*w[a][A]}for(L[A]=d,p=0,o=l;o<y;o++)p+=Math.pow(w[A][o],2);if(p<s)d=0;else{for(f=(h=w[A][A+1])*(d=h<0?Math.sqrt(p):-Math.sqrt(p))-p,w[A][A+1]=h-d,o=l;o<y;o++)b[o]=w[A][o]/f;for(o=l;o<x;o++){for(p=0,a=l;a<y;a++)p+=w[o][a]*w[A][a];for(a=l;a<y;a++)w[o][a]=w[o][a]+p*b[a]}}m<(v=Math.abs(L[A])+Math.abs(b[A]))&&(m=v)}if(n)for(A=y-1;0<=A;A--){if(d!==0){for(f=w[A][A+1]*d,o=l;o<y;o++)_[o][A]=w[A][o]/f;for(o=l;o<y;o++){for(p=0,a=l;a<y;a++)p+=w[A][a]*_[a][o];for(a=l;a<y;a++)_[a][o]=_[a][o]+p*_[a][A]}}for(o=l;o<y;o++)_[A][o]=0,_[o][A]=0;_[A][A]=1,d=b[A],l=A}if(t){if(t==="f")for(A=y;A<x;A++){for(o=y;o<x;o++)w[A][o]=0;w[A][A]=1}for(A=y-1;0<=A;A--){for(l=A+1,d=L[A],o=l;o<S;o++)w[A][o]=0;if(d!==0){for(f=w[A][A]*d,o=l;o<S;o++){for(p=0,a=l;a<x;a++)p+=w[a][A]*w[a][o];for(h=p/f,a=A;a<x;a++)w[a][o]=w[a][o]+h*w[a][A]}for(o=A;o<x;o++)w[o][A]=w[o][A]/d}else for(o=A;o<x;o++)w[o][A]=0;w[A][A]=w[A][A]+1}}for(i*=m,a=y-1;0<=a;a--)for(var C=0;C<50;C++){for(T=!1,l=a;0<=l;l--){if(Math.abs(b[l])<=i){T=!0;break}if(Math.abs(L[l-1])<=i)break}if(!T){for(u=0,c=l-(p=1),A=l;A<a+1&&(h=p*b[A],b[A]=u*b[A],!(Math.abs(h)<=i));A++)if(d=L[A],L[A]=Math.sqrt(h*h+d*d),u=d/(f=L[A]),p=-h/f,t)for(o=0;o<x;o++)v=w[o][c],g=w[o][A],w[o][c]=v*u+g*p,w[o][A]=-v*p+g*u}if(g=L[a],l===a){if(g<0&&(L[a]=-g,n))for(o=0;o<y;o++)_[o][a]=-_[o][a];break}for(m=L[l],h=(((v=L[a-1])-g)*(v+g)+((d=b[a-1])-(f=b[a]))*(d+f))/(2*f*v),d=Math.sqrt(h*h+1),h=((m-g)*(m+g)+f*(v/(h<0?h-d:h+d)-f))/m,A=l+(p=u=1);A<a+1;A++){if(d=b[A],v=L[A],f=p*d,d*=u,g=Math.sqrt(h*h+f*f),h=m*(u=h/(b[A-1]=g))+d*(p=f/g),d=-m*p+d*u,f=v*p,v*=u,n)for(o=0;o<y;o++)m=_[o][A-1],g=_[o][A],_[o][A-1]=m*u+g*p,_[o][A]=-m*p+g*u;if(g=Math.sqrt(h*h+f*f),h=(u=h/(L[A-1]=g))*d+(p=f/g)*v,m=-p*d+u*v,t)for(o=0;o<x;o++)v=w[o][A-1],g=w[o][A],w[o][A-1]=v*u+g*p,w[o][A]=-v*p+g*u}b[l]=0,b[a]=h,L[a]=m}for(A=0;A<y;A++)L[A]<i&&(L[A]=0);return{u:w,q:L,v:_}},r.VERSION="1.1.1",Object.defineProperty(r,"__esModule",{value:!0})})});var Lg="131",Us={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ks={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},mA=0,Ig=1,gA=2;var Pg=1,qd=2,Dl=3,Oi=0,kt=1,Xt=2,Dg=1;var It=0,Vs=1,Rg=2,Bg=3,Og=4,yA=5,Vo=100,vA=101,xA=102,Fg=103,zg=104,bA=200,wA=201,SA=202,MA=203,Gg=204,Ug=205,AA=206,_A=207,TA=208,EA=209,NA=210,CA=0,LA=1,IA=2,Yd=3,PA=4,DA=5,RA=6,BA=7,yu=0,OA=1,FA=2,Hs=0,zA=1,GA=2,UA=3,kA=4,VA=5,Kd=300,js=301,Ws=302,vu=303,xu=304,Js=306,Ho=307,di=1e3,Zt=1001,qr=1002,Pt=1003,Xs=1004;var qs=1005;var $e=1006,jo=1007;var Ai=1008;var At=1009,HA=1010,jA=1011,bu=1012,WA=1013,Wo=1014,Tr=1015,Jo=1016,JA=1017,XA=1018,qA=1019,Ys=1020,YA=1021,Nt=1022,zt=1023,Qd=1024,KA=1025,QA=zt,Xo=1026,Ks=1027,ZA=1028,$A=1029,e_=1030,t_=1031,n_=1032,i_=1033,kg=33776,Vg=33777,Hg=33778,jg=33779,Wg=35840,Jg=35841,Xg=35842,qg=35843,r_=36196,Yg=37492,Kg=37496,s_=37808,o_=37809,a_=37810,l_=37811,c_=37812,u_=37813,h_=37814,d_=37815,f_=37816,p_=37817,m_=37818,g_=37819,y_=37820,v_=37821,x_=36492,b_=37840,w_=37841,S_=37842,M_=37843,A_=37844,__=37845,T_=37846,E_=37847,N_=37848,C_=37849,L_=37850,I_=37851,P_=37852,D_=37853,R_=2200,B_=2201,O_=2202,Yr=2300,Er=2301,Zd=2302,qo=2400,Yo=2401,wu=2402,$d=2500,Qg=2501,ef=0,Su=1,Ko=2,ln=3e3,Fi=3001,Qs=3007,Rl=3002,F_=3003,Mu=3004,Au=3005,_u=3006,Kr=3200,z_=3201,Qr=0,G_=1;var tf=7680;var U_=519,Bl=35044,Tu=35048;var Zg="300 es",cn=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let i=this._listeners[e];if(i!==void 0){let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let n=this._listeners[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}},Cn=[];for(let r=0;r<256;r++)Cn[r]=(r<16?"0":"")+r.toString(16);var Eu=1234567,Qo=Math.PI/180,Ol=180/Math.PI;function fi(){let r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Cn[r&255]+Cn[r>>8&255]+Cn[r>>16&255]+Cn[r>>24&255]+"-"+Cn[e&255]+Cn[e>>8&255]+"-"+Cn[e>>16&15|64]+Cn[e>>24&255]+"-"+Cn[t&63|128]+Cn[t>>8&255]+"-"+Cn[t>>16&255]+Cn[t>>24&255]+Cn[n&255]+Cn[n>>8&255]+Cn[n>>16&255]+Cn[n>>24&255]).toUpperCase()}function Ln(r,e,t){return Math.max(e,Math.min(t,r))}function nf(r,e){return(r%e+e)%e}function k_(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function V_(r,e,t){return r!==e?(t-r)/(e-r):0}function Fl(r,e,t){return(1-t)*r+t*e}function H_(r,e,t,n){return Fl(r,e,1-Math.exp(-t*n))}function j_(r,e=1){return e-Math.abs(nf(r,e*2)-e)}function W_(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function J_(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function X_(r,e){return r+Math.floor(Math.random()*(e-r+1))}function q_(r,e){return r+Math.random()*(e-r)}function Y_(r){return r*(.5-Math.random())}function K_(r){return r!==void 0&&(Eu=r%2147483647),Eu=Eu*16807%2147483647,(Eu-1)/2147483646}function Q_(r){return r*Qo}function Z_(r){return r*Ol}function rf(r){return(r&r-1)==0&&r!==0}function $g(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function ey(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function $_(r,e,t,n,i){let s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),h=s((e-n)/2),d=o((e-n)/2),f=s((n-e)/2),p=o((n-e)/2);switch(i){case"XYX":r.set(a*u,l*h,l*d,a*c);break;case"YZY":r.set(l*d,a*u,l*h,a*c);break;case"ZXZ":r.set(l*h,l*d,a*u,a*c);break;case"XZX":r.set(a*u,l*p,l*f,a*c);break;case"YXY":r.set(l*f,a*u,l*p,a*c);break;case"ZYZ":r.set(l*p,l*f,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}var Ee=Object.freeze({__proto__:null,DEG2RAD:Qo,RAD2DEG:Ol,generateUUID:fi,clamp:Ln,euclideanModulo:nf,mapLinear:k_,inverseLerp:V_,lerp:Fl,damp:H_,pingpong:j_,smoothstep:W_,smootherstep:J_,randInt:X_,randFloat:q_,randFloatSpread:Y_,seededRandom:K_,degToRad:Q_,radToDeg:Z_,isPowerOfTwo:rf,ceilPowerOfTwo:$g,floorPowerOfTwo:ey,setQuaternionFromProperEuler:$_}),O=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){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,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,n){return n!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}};O.prototype.isVector2=!0;var Dt=class{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,n,i,s,o,a,l,c){let u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],h=n[7],d=n[2],f=n[5],p=n[8],m=i[0],v=i[3],g=i[6],y=i[1],x=i[4],b=i[7],w=i[2],_=i[5],S=i[8];return s[0]=o*m+a*y+l*w,s[3]=o*v+a*x+l*_,s[6]=o*g+a*b+l*S,s[1]=c*m+u*y+h*w,s[4]=c*v+u*x+h*_,s[7]=c*g+u*b+h*S,s[2]=d*m+f*y+p*w,s[5]=d*v+f*x+p*_,s[8]=d*g+f*b+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+i*s*c-i*o*l}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,d=a*l-u*s,f=c*s-o*l,p=t*h+n*d+i*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=h*m,e[1]=(i*c-u*n)*m,e[2]=(a*n-i*o)*m,e[3]=d*m,e[4]=(u*t-i*l)*m,e[5]=(i*s-a*t)*m,e[6]=f*m,e[7]=(n*l-c*t)*m,e[8]=(o*t-n*s)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,o,a){let l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){let n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){let t=Math.cos(e),n=Math.sin(e),i=this.elements,s=i[0],o=i[3],a=i[6],l=i[1],c=i[4],u=i[7];return i[0]=t*s+n*l,i[3]=t*o+n*c,i[6]=t*a+n*u,i[1]=-n*s+t*l,i[4]=-n*o+t*c,i[7]=-n*a+t*u,this}translate(e,t){let n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Dt.prototype.isMatrix3=!0;var Zo,Zs=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Zo===void 0&&(Zo=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Zo.width=e.width,Zo.height=e.height;let n=Zo.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Zo}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")}},e1=0,xt=class extends cn{constructor(e=xt.DEFAULT_IMAGE,t=xt.DEFAULT_MAPPING,n=Zt,i=Zt,s=$e,o=Ai,a=zt,l=At,c=1,u=ln){super();Object.defineProperty(this,"id",{value:e1++}),this.uuid=fi(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new O(0,0),this.repeat=new O(1,1),this.center=new O(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Dt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u,this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}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){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={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){let i=this.image;if(i.uuid===void 0&&(i.uuid=fi()),!t&&e.images[i.uuid]===void 0){let s;if(Array.isArray(i)){s=[];for(let o=0,a=i.length;o<a;o++)i[o].isDataTexture?s.push(sf(i[o].image)):s.push(sf(i[o]))}else s=sf(i);e.images[i.uuid]={uuid:i.uuid,url:s}}n.image=i.uuid}return t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Kd)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case di:e.x=e.x-Math.floor(e.x);break;case Zt:e.x=e.x<0?0:1;break;case qr: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 di:e.y=e.y-Math.floor(e.y);break;case Zt:e.y=e.y<0?0:1;break;case qr: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++}};xt.DEFAULT_IMAGE=void 0;xt.DEFAULT_MAPPING=Kd;xt.prototype.isTexture=!0;function sf(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?Zs.getDataURL(r):r.data?{data:Array.prototype.slice.call(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var Qe=class{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}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,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,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.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s,o=.01,a=.1,l=e.elements,c=l[0],u=l[4],h=l[8],d=l[1],f=l[5],p=l[9],m=l[2],v=l[6],g=l[10];if(Math.abs(u-d)<o&&Math.abs(h-m)<o&&Math.abs(p-v)<o){if(Math.abs(u+d)<a&&Math.abs(h+m)<a&&Math.abs(p+v)<a&&Math.abs(c+f+g-3)<a)return this.set(1,0,0,0),this;t=Math.PI;let x=(c+1)/2,b=(f+1)/2,w=(g+1)/2,_=(u+d)/4,S=(h+m)/4,A=(p+v)/4;return x>b&&x>w?x<o?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(x),i=_/n,s=S/n):b>w?b<o?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(b),n=_/i,s=A/i):w<o?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(w),n=S/s,i=A/s),this.set(n,i,s,t),this}let y=Math.sqrt((v-p)*(v-p)+(h-m)*(h-m)+(d-u)*(d-u));return Math.abs(y)<.001&&(y=1),this.x=(v-p)/y,this.y=(h-m)/y,this.z=(d-u)/y,this.w=Math.acos((c+f+g-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,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,n){return n!==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}};Qe.prototype.isVector4=!0;var bt=class extends cn{constructor(e,t,n={}){super();this.width=e,this.height=t,this.depth=1,this.scissor=new Qe(0,0,e,t),this.scissorTest=!1,this.viewport=new Qe(0,0,e,t),this.texture=new xt(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:e,height:t,depth:1},this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:$e,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null}setTexture(e){e.image={width:this.width,height:this.height,depth:this.depth},this.texture=e}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,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.texture.image=Ue({},this.texture.image),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}};bt.prototype.isWebGLRenderTarget=!0;var ty=class extends bt{constructor(e,t,n){super(e,t);let i=this.texture;this.texture=[];for(let s=0;s<n;s++)this.texture[s]=i.clone()}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.texture.length;i<s;i++)this.texture[i].image.width=e,this.texture[i].image.height=t,this.texture[i].image.depth=n;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this.texture.length=0;for(let t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone();return this}};ty.prototype.isWebGLMultipleRenderTargets=!0;var Zr=class extends bt{constructor(e,t,n){super(e,t,n);this.samples=4}copy(e){return super.copy.call(this,e),this.samples=e.samples,this}};Zr.prototype.isWebGLMultisampleRenderTarget=!0;var Tt=class{constructor(e=0,t=0,n=0,i=1){this._x=e,this._y=t,this._z=n,this._w=i}static slerp(e,t,n,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(e,t,i)}static slerpFlat(e,t,n,i,s,o,a){let l=n[i+0],c=n[i+1],u=n[i+2],h=n[i+3],d=s[o+0],f=s[o+1],p=s[o+2],m=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,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]=m;return}if(h!==m||l!==d||c!==f||u!==p){let v=1-a,g=l*d+c*f+u*p+h*m,y=g>=0?1:-1,x=1-g*g;if(x>Number.EPSILON){let w=Math.sqrt(x),_=Math.atan2(w,g*y);v=Math.sin(v*_)/w,a=Math.sin(a*_)/w}let b=a*y;if(l=l*v+d*b,c=c*v+f*b,u=u*v+p*b,h=h*v+m*b,v===1-a){let w=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=w,c*=w,u*=w,h*=w}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,o){let a=n[i],l=n[i+1],c=n[i+2],u=n[i+3],h=s[o],d=s[o+1],f=s[o+2],p=s[o+3];return e[t]=a*p+u*h+l*f-c*d,e[t+1]=l*p+u*d+c*h-a*f,e[t+2]=c*p+u*f+a*d-l*h,e[t+3]=u*p-a*h-l*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,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.");let n=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(i/2),h=a(s/2),d=l(n/2),f=l(i/2),p=l(s/2);switch(o){case"XYZ":this._x=d*u*h+c*f*p,this._y=c*f*h-d*u*p,this._z=c*u*p+d*f*h,this._w=c*u*h-d*f*p;break;case"YXZ":this._x=d*u*h+c*f*p,this._y=c*f*h-d*u*p,this._z=c*u*p-d*f*h,this._w=c*u*h+d*f*p;break;case"ZXY":this._x=d*u*h-c*f*p,this._y=c*f*h+d*u*p,this._z=c*u*p+d*f*h,this._w=c*u*h-d*f*p;break;case"ZYX":this._x=d*u*h-c*f*p,this._y=c*f*h+d*u*p,this._z=c*u*p-d*f*h,this._w=c*u*h+d*f*p;break;case"YZX":this._x=d*u*h+c*f*p,this._y=c*f*h+d*u*p,this._z=c*u*p-d*f*h,this._w=c*u*h-d*f*p;break;case"XZY":this._x=d*u*h-c*f*p,this._y=c*f*h-d*u*p,this._z=c*u*p+d*f*h,this._w=c*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){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],d=n+a+h;if(d>0){let f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(u-l)*f,this._y=(s-c)*f,this._z=(o-i)*f}else if(n>a&&n>h){let f=2*Math.sqrt(1+n-a-h);this._w=(u-l)/f,this._x=.25*f,this._y=(i+o)/f,this._z=(s+c)/f}else if(a>h){let f=2*Math.sqrt(1+a-n-h);this._w=(s-c)/f,this._x=(i+o)/f,this._y=.25*f,this._z=(l+u)/f}else{let f=2*Math.sqrt(1+h-n-a);this._w=(o-i)/f,this._x=(s+c)/f,this._y=(l+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ln(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,i),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){let n=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+i*c-s*l,this._y=i*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-i*a,this._w=o*u-n*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let n=this._x,i=this._y,s=this._z,o=this._w,a=o*e._w+n*e._x+i*e._y+s*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=n,this._y=i,this._z=s,this;let l=1-a*a;if(l<=Number.EPSILON){let f=1-t;return this._w=f*o+t*this._w,this._x=f*n+t*this._x,this._y=f*i+t*this._y,this._z=f*s+t*this._z,this.normalize(),this._onChangeCallback(),this}let c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=o*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=s*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){this.copy(e).slerp(t,n)}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(){}};Tt.prototype.isQuaternion=!0;var M=class{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,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(ny.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(ny.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*i-a*n,u=l*n+a*t-s*i,h=l*i+s*n-o*t,d=-s*t-o*n-a*i;return this.x=c*l+d*-s+u*-a-h*-o,this.y=u*l+d*-o+h*-s-c*-a,this.z=h*l+d*-a+c*-o-u*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,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){let n=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-n*l,this.z=n*a-i*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return of.copy(this).projectOnVector(e),this.sub(of)}reflect(e){return this.sub(of.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ln(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}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,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,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,n){return n!==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}};M.prototype.isVector3=!0;var of=new M,ny=new Tt,tn=class{constructor(e=new M(1/0,1/0,1/0),t=new M(-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,n=1/0,i=1/0,s=-1/0,o=-1/0,a=-1/0;for(let l=0,c=e.length;l<c;l+=3){let u=e[l],h=e[l+1],d=e[l+2];u<t&&(t=u),h<n&&(n=h),d<i&&(i=d),u>s&&(s=u),h>o&&(o=h),d>a&&(a=d)}return this.min.set(t,n,i),this.max.set(s,o,a),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,s=-1/0,o=-1/0,a=-1/0;for(let l=0,c=e.count;l<c;l++){let u=e.getX(l),h=e.getY(l),d=e.getZ(l);u<t&&(t=u),h<n&&(n=h),d<i&&(i=d),u>s&&(s=u),h>o&&(o=h),d>a&&(a=d)}return this.min.set(t,n,i),this.max.set(s,o,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=zl.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),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 this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e){e.updateWorldMatrix(!1,!1);let t=e.geometry;t!==void 0&&(t.boundingBox===null&&t.computeBoundingBox(),af.copy(t.boundingBox),af.applyMatrix4(e.matrixWorld),this.union(af));let n=e.children;for(let i=0,s=n.length;i<s;i++)this.expandByObject(n[i]);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,zl),zl.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Gl),Nu.subVectors(this.max,Gl),$o.subVectors(e.a,Gl),ea.subVectors(e.b,Gl),ta.subVectors(e.c,Gl),$r.subVectors(ea,$o),es.subVectors(ta,ea),$s.subVectors($o,ta);let t=[0,-$r.z,$r.y,0,-es.z,es.y,0,-$s.z,$s.y,$r.z,0,-$r.x,es.z,0,-es.x,$s.z,0,-$s.x,-$r.y,$r.x,0,-es.y,es.x,0,-$s.y,$s.x,0];return!lf(t,$o,ea,ta,Nu)||(t=[1,0,0,0,1,0,0,0,1],!lf(t,$o,ea,ta,Nu))?!1:(Cu.crossVectors($r,es),t=[Cu.x,Cu.y,Cu.z],lf(t,$o,ea,ta,Nu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return zl.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(zl).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:(Nr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Nr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Nr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Nr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Nr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Nr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Nr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Nr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Nr),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)}};tn.prototype.isBox3=!0;var Nr=[new M,new M,new M,new M,new M,new M,new M,new M],zl=new M,af=new tn,$o=new M,ea=new M,ta=new M,$r=new M,es=new M,$s=new M,Gl=new M,Nu=new M,Cu=new M,eo=new M;function lf(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){eo.fromArray(r,s);let a=i.x*Math.abs(eo.x)+i.y*Math.abs(eo.y)+i.z*Math.abs(eo.z),l=e.dot(eo),c=t.dot(eo),u=n.dot(eo);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var t1=new tn,iy=new M,cf=new M,uf=new M,ti=class{constructor(e=new M,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):t1.setFromPoints(e).getCenter(n);let i=0;for(let s=0,o=e.length;s<o;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){uf.subVectors(e,this.center);let t=uf.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.add(uf.multiplyScalar(i/n)),this.radius+=i}return this}union(e){return cf.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(iy.copy(e.center).add(cf)),this.expandByPoint(iy.copy(e.center).sub(cf)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},Cr=new M,hf=new M,Lu=new M,ts=new M,df=new M,Iu=new M,ff=new M,or=class{constructor(e=new M,t=new M(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.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,Cr)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Cr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Cr.copy(this.direction).multiplyScalar(t).add(this.origin),Cr.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){hf.copy(e).add(t).multiplyScalar(.5),Lu.copy(t).sub(e).normalize(),ts.copy(this.origin).sub(hf);let s=e.distanceTo(t)*.5,o=-this.direction.dot(Lu),a=ts.dot(this.direction),l=-ts.dot(Lu),c=ts.lengthSq(),u=Math.abs(1-o*o),h,d,f,p;if(u>0)if(h=o*l-a,d=o*a-l,p=s*u,h>=0)if(d>=-p)if(d<=p){let m=1/u;h*=m,d*=m,f=h*(h+o*d+2*a)+d*(o*h+d+2*l)+c}else d=s,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*l)+c;else d=-s,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*l)+c;else d<=-p?(h=Math.max(0,-(-o*s+a)),d=h>0?-s:Math.min(Math.max(-s,-l),s),f=-h*h+d*(d+2*l)+c):d<=p?(h=0,d=Math.min(Math.max(-s,-l),s),f=d*(d+2*l)+c):(h=Math.max(0,-(o*s+a)),d=h>0?s:Math.min(Math.max(-s,-l),s),f=-h*h+d*(d+2*l)+c);else d=o>0?-s:s,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*l)+c;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(Lu).multiplyScalar(d).add(hf),f}intersectSphere(e,t){Cr.subVectors(e.center,this.origin);let n=Cr.dot(this.direction),i=Cr.dot(Cr)-n*n,s=e.radius*e.radius;if(i>s)return null;let o=Math.sqrt(s-i),a=n-o,l=n+o;return a<0&&l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,o,a,l,c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,i=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,i=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||s>i||((s>n||n!==n)&&(n=s),(o<i||i!==i)&&(i=o),h>=0?(a=(e.min.z-d.z)*h,l=(e.max.z-d.z)*h):(a=(e.max.z-d.z)*h,l=(e.min.z-d.z)*h),n>l||a>i)||((a>n||n!==n)&&(n=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Cr)!==null}intersectTriangle(e,t,n,i,s){df.subVectors(t,e),Iu.subVectors(n,e),ff.crossVectors(df,Iu);let o=this.direction.dot(ff),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ts.subVectors(this.origin,e);let l=a*this.direction.dot(Iu.crossVectors(ts,Iu));if(l<0)return null;let c=a*this.direction.dot(df.cross(ts));if(c<0||l+c>o)return null;let u=-a*ts.dot(ff);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},me=class{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,n,i,s,o,a,l,c,u,h,d,f,p,m,v){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=s,g[5]=o,g[9]=a,g[13]=l,g[2]=c,g[6]=u,g[10]=h,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=v,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 me().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,n=e.elements,i=1/na.setFromMatrixColumn(e,0).length(),s=1/na.setFromMatrixColumn(e,1).length(),o=1/na.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[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.");let t=this.elements,n=e.x,i=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){let d=o*u,f=o*h,p=a*u,m=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=f+p*c,t[5]=d-m*c,t[9]=-a*l,t[2]=m-d*c,t[6]=p+f*c,t[10]=o*l}else if(e.order==="YXZ"){let d=l*u,f=l*h,p=c*u,m=c*h;t[0]=d+m*a,t[4]=p*a-f,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=f*a-p,t[6]=m+d*a,t[10]=o*l}else if(e.order==="ZXY"){let d=l*u,f=l*h,p=c*u,m=c*h;t[0]=d-m*a,t[4]=-o*h,t[8]=p+f*a,t[1]=f+p*a,t[5]=o*u,t[9]=m-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){let d=o*u,f=o*h,p=a*u,m=a*h;t[0]=l*u,t[4]=p*c-f,t[8]=d*c+m,t[1]=l*h,t[5]=m*c+d,t[9]=f*c-p,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let d=o*l,f=o*c,p=a*l,m=a*c;t[0]=l*u,t[4]=m-d*h,t[8]=p*h+f,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=f*h+p,t[10]=d-m*h}else if(e.order==="XZY"){let d=o*l,f=o*c,p=a*l,m=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=d*h+m,t[5]=o*u,t[9]=f*h-p,t[2]=p*h-f,t[6]=a*u,t[10]=m*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(n1,e,i1)}lookAt(e,t,n){let i=this.elements;return pi.subVectors(e,t),pi.lengthSq()===0&&(pi.z=1),pi.normalize(),ns.crossVectors(n,pi),ns.lengthSq()===0&&(Math.abs(n.z)===1?pi.x+=1e-4:pi.z+=1e-4,pi.normalize(),ns.crossVectors(n,pi)),ns.normalize(),Pu.crossVectors(pi,ns),i[0]=ns.x,i[4]=Pu.x,i[8]=pi.x,i[1]=ns.y,i[5]=Pu.y,i[9]=pi.y,i[2]=ns.z,i[6]=Pu.z,i[10]=pi.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){let n=e.elements,i=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],h=n[5],d=n[9],f=n[13],p=n[2],m=n[6],v=n[10],g=n[14],y=n[3],x=n[7],b=n[11],w=n[15],_=i[0],S=i[4],A=i[8],T=i[12],L=i[1],C=i[5],U=i[9],P=i[13],R=i[2],G=i[6],B=i[10],j=i[14],ne=i[3],le=i[7],W=i[11],z=i[15];return s[0]=o*_+a*L+l*R+c*ne,s[4]=o*S+a*C+l*G+c*le,s[8]=o*A+a*U+l*B+c*W,s[12]=o*T+a*P+l*j+c*z,s[1]=u*_+h*L+d*R+f*ne,s[5]=u*S+h*C+d*G+f*le,s[9]=u*A+h*U+d*B+f*W,s[13]=u*T+h*P+d*j+f*z,s[2]=p*_+m*L+v*R+g*ne,s[6]=p*S+m*C+v*G+g*le,s[10]=p*A+m*U+v*B+g*W,s[14]=p*T+m*P+v*j+g*z,s[3]=y*_+x*L+b*R+w*ne,s[7]=y*S+x*C+b*G+w*le,s[11]=y*A+x*U+b*B+w*W,s[15]=y*T+x*P+b*j+w*z,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],d=e[10],f=e[14],p=e[3],m=e[7],v=e[11],g=e[15];return p*(+s*l*h-i*c*h-s*a*d+n*c*d+i*a*f-n*l*f)+m*(+t*l*f-t*c*d+s*o*d-i*o*f+i*c*u-s*l*u)+v*(+t*c*h-t*a*f-s*o*h+n*o*f+s*a*u-n*c*u)+g*(-i*a*u-t*l*h+t*a*d+i*o*h-n*o*d+n*l*u)}transpose(){let e=this.elements,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,n){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],f=e[11],p=e[12],m=e[13],v=e[14],g=e[15],y=h*v*c-m*d*c+m*l*f-a*v*f-h*l*g+a*d*g,x=p*d*c-u*v*c-p*l*f+o*v*f+u*l*g-o*d*g,b=u*m*c-p*h*c+p*a*f-o*m*f-u*a*g+o*h*g,w=p*h*l-u*m*l-p*a*d+o*m*d+u*a*v-o*h*v,_=t*y+n*x+i*b+s*w;if(_===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/_;return e[0]=y*S,e[1]=(m*d*s-h*v*s-m*i*f+n*v*f+h*i*g-n*d*g)*S,e[2]=(a*v*s-m*l*s+m*i*c-n*v*c-a*i*g+n*l*g)*S,e[3]=(h*l*s-a*d*s-h*i*c+n*d*c+a*i*f-n*l*f)*S,e[4]=x*S,e[5]=(u*v*s-p*d*s+p*i*f-t*v*f-u*i*g+t*d*g)*S,e[6]=(p*l*s-o*v*s-p*i*c+t*v*c+o*i*g-t*l*g)*S,e[7]=(o*d*s-u*l*s+u*i*c-t*d*c-o*i*f+t*l*f)*S,e[8]=b*S,e[9]=(p*h*s-u*m*s-p*n*f+t*m*f+u*n*g-t*h*g)*S,e[10]=(o*m*s-p*a*s+p*n*c-t*m*c-o*n*g+t*a*g)*S,e[11]=(u*a*s-o*h*s-u*n*c+t*h*c+o*n*f-t*a*f)*S,e[12]=w*S,e[13]=(u*m*i-p*h*i+p*n*d-t*m*d-u*n*v+t*h*v)*S,e[14]=(p*a*i-o*m*i-p*n*l+t*m*l+o*n*v-t*a*v)*S,e[15]=(o*h*i-u*a*i+u*n*l-t*h*l-o*n*d+t*a*d)*S,this}scale(e){let t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-i*l,c*l+i*a,0,c*a+i*l,u*a+n,u*l-i*o,0,c*l-i*a,u*l+i*o,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,h=a+a,d=s*c,f=s*u,p=s*h,m=o*u,v=o*h,g=a*h,y=l*c,x=l*u,b=l*h,w=n.x,_=n.y,S=n.z;return i[0]=(1-(m+g))*w,i[1]=(f+b)*w,i[2]=(p-x)*w,i[3]=0,i[4]=(f-b)*_,i[5]=(1-(d+g))*_,i[6]=(v+y)*_,i[7]=0,i[8]=(p+x)*S,i[9]=(v-y)*S,i[10]=(1-(d+m))*S,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements,s=na.set(i[0],i[1],i[2]).length(),o=na.set(i[4],i[5],i[6]).length(),a=na.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],zi.copy(this);let c=1/s,u=1/o,h=1/a;return zi.elements[0]*=c,zi.elements[1]*=c,zi.elements[2]*=c,zi.elements[4]*=u,zi.elements[5]*=u,zi.elements[6]*=u,zi.elements[8]*=h,zi.elements[9]*=h,zi.elements[10]*=h,t.setFromRotationMatrix(zi),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,s,o){o===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");let a=this.elements,l=2*s/(t-e),c=2*s/(n-i),u=(t+e)/(t-e),h=(n+i)/(n-i),d=-(o+s)/(o-s),f=-2*o*s/(o-s);return a[0]=l,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=c,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,n,i,s,o){let a=this.elements,l=1/(t-e),c=1/(n-i),u=1/(o-s),h=(t+e)*l,d=(n+i)*c,f=(o+s)*u;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*c,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){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};me.prototype.isMatrix4=!0;var na=new M,zi=new me,n1=new M(0,0,0),i1=new M(1,1,1),ns=new M,Pu=new M,pi=new M,ry=new me,sy=new Tt,On=class{constructor(e=0,t=0,n=0,i=On.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}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,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],u=i[9],h=i[2],d=i[6],f=i[10];switch(t){case"XYZ":this._y=Math.asin(Ln(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ln(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ln(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,f),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ln(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Ln(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,f));break;case"XZY":this._z=Math.asin(-Ln(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,s)):(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,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ry.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ry,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return sy.setFromEuler(this),this.setFromQuaternion(sy,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 M(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}};On.prototype.isEuler=!0;On.DefaultOrder="XYZ";On.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var pf=class{constructor(){this.mask=1|0}set(e){this.mask=1<<e|0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=4294967295|0}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}},r1=0,oy=new M,ia=new Tt,Lr=new me,Du=new M,Ul=new M,s1=new M,o1=new Tt,ay=new M(1,0,0),ly=new M(0,1,0),cy=new M(0,0,1),a1={type:"added"},uy={type:"removed"},Ke=class extends cn{constructor(){super();Object.defineProperty(this,"id",{value:r1++}),this.uuid=fi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ke.DefaultUp.clone();let e=new M,t=new On,n=new Tt,i=new M(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._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:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new me},normalMatrix:{value:new Dt}}),this.matrix=new me,this.matrixWorld=new me,this.matrixAutoUpdate=Ke.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new pf,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)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ia.setFromAxisAngle(e,t),this.quaternion.multiply(ia),this}rotateOnWorldAxis(e,t){return ia.setFromAxisAngle(e,t),this.quaternion.premultiply(ia),this}rotateX(e){return this.rotateOnAxis(ay,e)}rotateY(e){return this.rotateOnAxis(ly,e)}rotateZ(e){return this.rotateOnAxis(cy,e)}translateOnAxis(e,t){return oy.copy(e).applyQuaternion(this.quaternion),this.position.add(oy.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ay,e)}translateY(e){return this.translateOnAxis(ly,e)}translateZ(e){return this.translateOnAxis(cy,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(Lr.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Du.copy(e):Du.set(e,t,n);let i=this.parent;this.updateWorldMatrix(!0,!1),Ul.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Lr.lookAt(Ul,Du,this.up):Lr.lookAt(Du,Ul,this.up),this.quaternion.setFromRotationMatrix(Lr),i&&(Lr.extractRotation(i.matrixWorld),ia.setFromRotationMatrix(Lr),this.quaternion.premultiply(ia.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(a1)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(uy)),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){let t=this.children[e];t.parent=null,t.dispatchEvent(uy)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),Lr.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Lr.multiply(e.parent.matrixWorld)),e.applyMatrix4(Lr),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 n=0,i=this.children.length;n<i;n++){let o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ul,e,s1),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ul,o1,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let 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);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(e===!0&&n!==null&&n.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){let i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){let h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];i.animations.push(s(e.animations,l))}}if(t){let a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),h=o(e.shapes),d=o(e.skeletons),f=o(e.animations);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f)}return n.object=i,n;function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.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 n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}};Ke.DefaultUp=new M(0,1,0);Ke.DefaultMatrixAutoUpdate=!0;Ke.prototype.isObject3D=!0;var Gi=new M,Ir=new M,mf=new M,Pr=new M,ra=new M,sa=new M,hy=new M,gf=new M,yf=new M,vf=new M,qt=class{constructor(e=new M,t=new M,n=new M){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Gi.subVectors(e,t),i.cross(Gi);let s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){Gi.subVectors(i,t),Ir.subVectors(n,t),mf.subVectors(e,t);let o=Gi.dot(Gi),a=Gi.dot(Ir),l=Gi.dot(mf),c=Ir.dot(Ir),u=Ir.dot(mf),h=o*c-a*a;if(h===0)return s.set(-2,-1,-1);let d=1/h,f=(c*l-a*u)*d,p=(o*u-a*l)*d;return s.set(1-f-p,p,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Pr),Pr.x>=0&&Pr.y>=0&&Pr.x+Pr.y<=1}static getUV(e,t,n,i,s,o,a,l){return this.getBarycoord(e,t,n,i,Pr),l.set(0,0),l.addScaledVector(s,Pr.x),l.addScaledVector(o,Pr.y),l.addScaledVector(a,Pr.z),l}static isFrontFacing(e,t,n,i){return Gi.subVectors(n,t),Ir.subVectors(e,t),Gi.cross(Ir).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),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 Gi.subVectors(this.c,this.b),Ir.subVectors(this.a,this.b),Gi.cross(Ir).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return qt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return qt.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return qt.getUV(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return qt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return qt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,i=this.b,s=this.c,o,a;ra.subVectors(i,n),sa.subVectors(s,n),gf.subVectors(e,n);let l=ra.dot(gf),c=sa.dot(gf);if(l<=0&&c<=0)return t.copy(n);yf.subVectors(e,i);let u=ra.dot(yf),h=sa.dot(yf);if(u>=0&&h<=u)return t.copy(i);let d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(ra,o);vf.subVectors(e,s);let f=ra.dot(vf),p=sa.dot(vf);if(p>=0&&f<=p)return t.copy(s);let m=f*c-l*p;if(m<=0&&c>=0&&p<=0)return a=c/(c-p),t.copy(n).addScaledVector(sa,a);let v=u*p-f*h;if(v<=0&&h-u>=0&&f-p>=0)return hy.subVectors(s,i),a=(h-u)/(h-u+(f-p)),t.copy(i).addScaledVector(hy,a);let g=1/(v+m+d);return o=m*g,a=d*g,t.copy(n).addScaledVector(ra,o).addScaledVector(sa,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},l1=0,nn=class extends cn{constructor(){super();Object.defineProperty(this,"id",{value:l1++}),this.uuid=fi(),this.name="",this.type="Material",this.fog=!0,this.blending=Vs,this.side=Oi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=Gg,this.blendDst=Ug,this.blendEquation=Vo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Yd,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=U_,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=tf,this.stencilZFail=tf,this.stencilZPass=tf,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}onBuild(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if(t==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===Dg;continue}let i=this[t];if(i===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularTint&&this.specularTint.isColor&&(n.specularTint=this.specularTint.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularTintMap&&this.specularTintMap.isTexture&&(n.specularTintMap=this.specularTintMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationTint!==void 0&&(n.attenuationTint=this.attenuationTint.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Vs&&(n.blending=this.blending),this.side!==Oi&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData);function i(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};nn.prototype.isMaterial=!0;var dy={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},Ui={h:0,s:0,l:0},Ru={h:0,s:0,l:0};function xf(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}function bf(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function wf(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var fe=class{constructor(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}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,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){if(e=nf(e,1),t=Ln(t,0,1),n=Ln(n,0,1),t===0)this.r=this.g=this.b=n;else{let i=n<=.5?n*(1+t):n+t-n*t,s=2*n-i;this.r=xf(s,i,e+1/3),this.g=xf(s,i,e),this.b=xf(s,i,e-1/3)}return this}setStyle(e){function t(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let i,s=n[1],o=n[2];switch(s){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){let a=parseFloat(i[1])/360,l=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return t(i[4]),this.setHSL(a,l,c)}break}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let i=n[1],s=i.length;if(s===3)return this.r=parseInt(i.charAt(0)+i.charAt(0),16)/255,this.g=parseInt(i.charAt(1)+i.charAt(1),16)/255,this.b=parseInt(i.charAt(2)+i.charAt(2),16)/255,this;if(s===6)return this.r=parseInt(i.charAt(0)+i.charAt(1),16)/255,this.g=parseInt(i.charAt(2)+i.charAt(3),16)/255,this.b=parseInt(i.charAt(4)+i.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){let t=dy[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){let n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.r=bf(e.r),this.g=bf(e.g),this.b=bf(e.b),this}copyLinearToSRGB(e){return this.r=wf(e.r),this.g=wf(e.g),this.b=wf(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){let t=this.r,n=this.g,i=this.b,s=Math.max(t,n,i),o=Math.min(t,n,i),a,l,c=(o+s)/2;if(o===s)a=0,l=0;else{let u=s-o;switch(l=c<=.5?u/(s+o):u/(2-s-o),s){case t:a=(n-i)/u+(n<i?6:0);break;case n:a=(i-t)/u+2;break;case i:a=(t-n)/u+4;break}a/=6}return e.h=a,e.s=l,e.l=c,e}getStyle(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"}offsetHSL(e,t,n){return this.getHSL(Ui),Ui.h+=e,Ui.s+=t,Ui.l+=n,this.setHSL(Ui.h,Ui.s,Ui.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,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Ui),e.getHSL(Ru);let n=Fl(Ui.h,Ru.h,t),i=Fl(Ui.s,Ru.s,t),s=Fl(Ui.l,Ru.l,t);return this.setHSL(n,i,s),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()}};fe.NAMES=dy;fe.prototype.isColor=!0;fe.prototype.r=1;fe.prototype.g=1;fe.prototype.b=1;var dn=class extends nn{constructor(e){super();this.type="MeshBasicMaterial",this.color=new fe(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=yu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",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}};dn.prototype.isMeshBasicMaterial=!0;var Rt=new M,Bu=new O,Re=class{constructor(e,t,n){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=n===!0,this.usage=Bl,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}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,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){let t=this.array,n=0;for(let i=0,s=e.length;i<s;i++){let o=e[i];o===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new fe),t[n++]=o.r,t[n++]=o.g,t[n++]=o.b}return this}copyVector2sArray(e){let t=this.array,n=0;for(let i=0,s=e.length;i<s;i++){let o=e[i];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),o=new O),t[n++]=o.x,t[n++]=o.y}return this}copyVector3sArray(e){let t=this.array,n=0;for(let i=0,s=e.length;i<s;i++){let o=e[i];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new M),t[n++]=o.x,t[n++]=o.y,t[n++]=o.z}return this}copyVector4sArray(e){let t=this.array,n=0;for(let i=0,s=e.length;i<s;i++){let o=e[i];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new Qe),t[n++]=o.x,t[n++]=o.y,t[n++]=o.z,t[n++]=o.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Bu.fromBufferAttribute(this,t),Bu.applyMatrix3(e),this.setXY(t,Bu.x,Bu.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Rt.fromBufferAttribute(this,t),Rt.applyMatrix3(e),this.setXYZ(t,Rt.x,Rt.y,Rt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Rt.x=this.getX(t),Rt.y=this.getY(t),Rt.z=this.getZ(t),Rt.applyMatrix4(e),this.setXYZ(t,Rt.x,Rt.y,Rt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Rt.x=this.getX(t),Rt.y=this.getY(t),Rt.z=this.getZ(t),Rt.applyNormalMatrix(e),this.setXYZ(t,Rt.x,Rt.y,Rt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Rt.x=this.getX(t),Rt.y=this.getY(t),Rt.z=this.getZ(t),Rt.transformDirection(e),this.setXYZ(t,Rt.x,Rt.y,Rt.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,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let 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!==Bl&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}};Re.prototype.isBufferAttribute=!0;var Sf=class extends Re{constructor(e,t,n){super(new Uint8Array(e),t,n)}};var Mf=class extends Re{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var is=class extends Re{constructor(e,t,n){super(new Uint32Array(e),t,n)}},fy=class extends Re{constructor(e,t,n){super(new Uint16Array(e),t,n)}};fy.prototype.isFloat16BufferAttribute=!0;var ge=class extends Re{constructor(e,t,n){super(new Float32Array(e),t,n)}};function py(r){if(r.length===0)return-1/0;let e=r[0];for(let t=1,n=r.length;t<n;++t)r[t]>e&&(e=r[t]);return e}var c1={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function oa(r,e){return new c1[r](e)}var u1=0,_i=new me,Af=new Ke,aa=new M,mi=new tn,kl=new tn,Mn=new M,we=class extends cn{constructor(){super();Object.defineProperty(this,"id",{value:u1++}),this.uuid=fi(),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(py(e)>65535?is:Mf)(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}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new Dt().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return _i.makeRotationFromQuaternion(e),this.applyMatrix4(_i),this}rotateX(e){return _i.makeRotationX(e),this.applyMatrix4(_i),this}rotateY(e){return _i.makeRotationY(e),this.applyMatrix4(_i),this}rotateZ(e){return _i.makeRotationZ(e),this.applyMatrix4(_i),this}translate(e,t,n){return _i.makeTranslation(e,t,n),this.applyMatrix4(_i),this}scale(e,t,n){return _i.makeScale(e,t,n),this.applyMatrix4(_i),this}lookAt(e){return Af.lookAt(e),Af.updateMatrix(),this.applyMatrix4(Af.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(aa).negate(),this.translate(aa.x,aa.y,aa.z),this}setFromPoints(e){let t=[];for(let n=0,i=e.length;n<i;n++){let s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new ge(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new tn);let 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 "false".',this),this.boundingBox.set(new M(-1/0,-1/0,-1/0),new M(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){let s=t[n];mi.setFromBufferAttribute(s),this.morphTargetsRelative?(Mn.addVectors(this.boundingBox.min,mi.min),this.boundingBox.expandByPoint(Mn),Mn.addVectors(this.boundingBox.max,mi.max),this.boundingBox.expandByPoint(Mn)):(this.boundingBox.expandByPoint(mi.min),this.boundingBox.expandByPoint(mi.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 ti);let 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 "false".',this),this.boundingSphere.set(new M,1/0);return}if(e){let n=this.boundingSphere.center;if(mi.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];kl.setFromBufferAttribute(a),this.morphTargetsRelative?(Mn.addVectors(mi.min,kl.min),mi.expandByPoint(Mn),Mn.addVectors(mi.max,kl.max),mi.expandByPoint(Mn)):(mi.expandByPoint(kl.min),mi.expandByPoint(kl.max))}mi.getCenter(n);let i=0;for(let s=0,o=e.count;s<o;s++)Mn.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(Mn));if(t)for(let s=0,o=t.length;s<o;s++){let a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)Mn.fromBufferAttribute(a,c),l&&(aa.fromBufferAttribute(e,c),Mn.add(aa)),i=Math.max(i,n.distanceToSquared(Mn))}this.boundingSphere.radius=Math.sqrt(i),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(){let 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}let n=e.array,i=t.position.array,s=t.normal.array,o=t.uv.array,a=i.length/3;t.tangent===void 0&&this.setAttribute("tangent",new Re(new Float32Array(4*a),4));let l=t.tangent.array,c=[],u=[];for(let L=0;L<a;L++)c[L]=new M,u[L]=new M;let h=new M,d=new M,f=new M,p=new O,m=new O,v=new O,g=new M,y=new M;function x(L,C,U){h.fromArray(i,L*3),d.fromArray(i,C*3),f.fromArray(i,U*3),p.fromArray(o,L*2),m.fromArray(o,C*2),v.fromArray(o,U*2),d.sub(h),f.sub(h),m.sub(p),v.sub(p);let P=1/(m.x*v.y-v.x*m.y);!isFinite(P)||(g.copy(d).multiplyScalar(v.y).addScaledVector(f,-m.y).multiplyScalar(P),y.copy(f).multiplyScalar(m.x).addScaledVector(d,-v.x).multiplyScalar(P),c[L].add(g),c[C].add(g),c[U].add(g),u[L].add(y),u[C].add(y),u[U].add(y))}let b=this.groups;b.length===0&&(b=[{start:0,count:n.length}]);for(let L=0,C=b.length;L<C;++L){let U=b[L],P=U.start,R=U.count;for(let G=P,B=P+R;G<B;G+=3)x(n[G+0],n[G+1],n[G+2])}let w=new M,_=new M,S=new M,A=new M;function T(L){S.fromArray(s,L*3),A.copy(S);let C=c[L];w.copy(C),w.sub(S.multiplyScalar(S.dot(C))).normalize(),_.crossVectors(A,C);let P=_.dot(u[L])<0?-1:1;l[L*4]=w.x,l[L*4+1]=w.y,l[L*4+2]=w.z,l[L*4+3]=P}for(let L=0,C=b.length;L<C;++L){let U=b[L],P=U.start,R=U.count;for(let G=P,B=P+R;G<B;G+=3)T(n[G+0]),T(n[G+1]),T(n[G+2])}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Re(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,f=n.count;d<f;d++)n.setXYZ(d,0,0,0);let i=new M,s=new M,o=new M,a=new M,l=new M,c=new M,u=new M,h=new M;if(e)for(let d=0,f=e.count;d<f;d+=3){let p=e.getX(d+0),m=e.getX(d+1),v=e.getX(d+2);i.fromBufferAttribute(t,p),s.fromBufferAttribute(t,m),o.fromBufferAttribute(t,v),u.subVectors(o,s),h.subVectors(i,s),u.cross(h),a.fromBufferAttribute(n,p),l.fromBufferAttribute(n,m),c.fromBufferAttribute(n,v),a.add(u),l.add(u),c.add(u),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(m,l.x,l.y,l.z),n.setXYZ(v,c.x,c.y,c.z)}else for(let d=0,f=t.count;d<f;d+=3)i.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),u.subVectors(o,s),h.subVectors(i,s),u.cross(h),n.setXYZ(d+0,u.x,u.y,u.z),n.setXYZ(d+1,u.x,u.y,u.z),n.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),n.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."));let n=this.attributes;for(let i in n){if(e.attributes[i]===void 0)continue;let o=n[i].array,a=e.attributes[i],l=a.array,c=a.itemSize*t,u=Math.min(l.length,o.length-c);for(let h=0,d=c;h<u;h++,d++)o[d]=l[h]}return this}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Mn.fromBufferAttribute(e,t),Mn.normalize(),e.setXYZ(t,Mn.x,Mn.y,Mn.z)}toNonIndexed(){function e(a,l){let c=a.array,u=a.itemSize,h=a.normalized,d=new c.constructor(l.length*u),f=0,p=0;for(let m=0,v=l.length;m<v;m++){a.isInterleavedBufferAttribute?f=l[m]*a.data.stride+a.offset:f=l[m]*u;for(let g=0;g<u;g++)d[p++]=c[f++]}return new Re(d,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new we,n=this.index.array,i=this.attributes;for(let a in i){let l=i[a],c=e(l,n);t.setAttribute(a,c)}let s=this.morphAttributes;for(let a in s){let l=[],c=s[a];for(let u=0,h=c.length;u<h;u++){let d=c[u],f=e(d,n);l.push(f)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,l=o.length;a<l;a++){let c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let i={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h<d;h++){let f=c[h];u.push(f.toJSON(e.data))}u.length>0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new we().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone(t));let i=e.attributes;for(let c in i){let u=i[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],h=s[c];for(let d=0,f=h.length;d<f;d++)u.push(h[d].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let c=0,u=o.length;c<u;c++){let h=o[c];this.addGroup(h.start,h.count,h.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}};we.prototype.isBufferGeometry=!0;var my=new me,la=new or,_f=new ti,rs=new M,ss=new M,os=new M,Tf=new M,Ef=new M,Nf=new M,Ou=new M,Fu=new M,zu=new M,Gu=new O,Uu=new O,ku=new O,Cf=new M,Vu=new M,gt=class extends Ke{constructor(e=new we,t=new dn){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(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){let a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{let 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){let n=this.geometry,i=this.material,s=this.matrixWorld;if(i===void 0||(n.boundingSphere===null&&n.computeBoundingSphere(),_f.copy(n.boundingSphere),_f.applyMatrix4(s),e.ray.intersectsSphere(_f)===!1)||(my.copy(s).invert(),la.copy(e.ray).applyMatrix4(my),n.boundingBox!==null&&la.intersectsBox(n.boundingBox)===!1))return;let o;if(n.isBufferGeometry){let a=n.index,l=n.attributes.position,c=n.morphAttributes.position,u=n.morphTargetsRelative,h=n.attributes.uv,d=n.attributes.uv2,f=n.groups,p=n.drawRange;if(a!==null)if(Array.isArray(i))for(let m=0,v=f.length;m<v;m++){let g=f[m],y=i[g.materialIndex],x=Math.max(g.start,p.start),b=Math.min(g.start+g.count,p.start+p.count);for(let w=x,_=b;w<_;w+=3){let S=a.getX(w),A=a.getX(w+1),T=a.getX(w+2);o=Hu(this,y,e,la,l,c,u,h,d,S,A,T),o&&(o.faceIndex=Math.floor(w/3),o.face.materialIndex=g.materialIndex,t.push(o))}}else{let m=Math.max(0,p.start),v=Math.min(a.count,p.start+p.count);for(let g=m,y=v;g<y;g+=3){let x=a.getX(g),b=a.getX(g+1),w=a.getX(g+2);o=Hu(this,i,e,la,l,c,u,h,d,x,b,w),o&&(o.faceIndex=Math.floor(g/3),t.push(o))}}else if(l!==void 0)if(Array.isArray(i))for(let m=0,v=f.length;m<v;m++){let g=f[m],y=i[g.materialIndex],x=Math.max(g.start,p.start),b=Math.min(g.start+g.count,p.start+p.count);for(let w=x,_=b;w<_;w+=3){let S=w,A=w+1,T=w+2;o=Hu(this,y,e,la,l,c,u,h,d,S,A,T),o&&(o.faceIndex=Math.floor(w/3),o.face.materialIndex=g.materialIndex,t.push(o))}}else{let m=Math.max(0,p.start),v=Math.min(l.count,p.start+p.count);for(let g=m,y=v;g<y;g+=3){let x=g,b=g+1,w=g+2;o=Hu(this,i,e,la,l,c,u,h,d,x,b,w),o&&(o.faceIndex=Math.floor(g/3),t.push(o))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}};gt.prototype.isMesh=!0;function h1(r,e,t,n,i,s,o,a){let l;if(e.side===kt?l=n.intersectTriangle(o,s,i,!0,a):l=n.intersectTriangle(i,s,o,e.side!==Xt,a),l===null)return null;Vu.copy(a),Vu.applyMatrix4(r.matrixWorld);let c=t.ray.origin.distanceTo(Vu);return c<t.near||c>t.far?null:{distance:c,point:Vu.clone(),object:r}}function Hu(r,e,t,n,i,s,o,a,l,c,u,h){rs.fromBufferAttribute(i,c),ss.fromBufferAttribute(i,u),os.fromBufferAttribute(i,h);let d=r.morphTargetInfluences;if(s&&d){Ou.set(0,0,0),Fu.set(0,0,0),zu.set(0,0,0);for(let p=0,m=s.length;p<m;p++){let v=d[p],g=s[p];v!==0&&(Tf.fromBufferAttribute(g,c),Ef.fromBufferAttribute(g,u),Nf.fromBufferAttribute(g,h),o?(Ou.addScaledVector(Tf,v),Fu.addScaledVector(Ef,v),zu.addScaledVector(Nf,v)):(Ou.addScaledVector(Tf.sub(rs),v),Fu.addScaledVector(Ef.sub(ss),v),zu.addScaledVector(Nf.sub(os),v)))}rs.add(Ou),ss.add(Fu),os.add(zu)}r.isSkinnedMesh&&(r.boneTransform(c,rs),r.boneTransform(u,ss),r.boneTransform(h,os));let f=h1(r,e,t,n,rs,ss,os,Cf);if(f){a&&(Gu.fromBufferAttribute(a,c),Uu.fromBufferAttribute(a,u),ku.fromBufferAttribute(a,h),f.uv=qt.getUV(Cf,rs,ss,os,Gu,Uu,ku,new O)),l&&(Gu.fromBufferAttribute(l,c),Uu.fromBufferAttribute(l,u),ku.fromBufferAttribute(l,h),f.uv2=qt.getUV(Cf,rs,ss,os,Gu,Uu,ku,new O));let p={a:c,b:u,c:h,normal:new M,materialIndex:0};qt.getNormal(rs,ss,os,p.normal),f.face=p}return f}var jn=class extends we{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super();this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};let a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);let l=[],c=[],u=[],h=[],d=0,f=0;p("z","y","x",-1,-1,n,t,e,o,s,0),p("z","y","x",1,-1,n,t,-e,o,s,1),p("x","z","y",1,1,e,n,t,i,o,2),p("x","z","y",1,-1,e,n,-t,i,o,3),p("x","y","z",1,-1,e,t,n,i,s,4),p("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new ge(c,3)),this.setAttribute("normal",new ge(u,3)),this.setAttribute("uv",new ge(h,2));function p(m,v,g,y,x,b,w,_,S,A,T){let L=b/S,C=w/A,U=b/2,P=w/2,R=_/2,G=S+1,B=A+1,j=0,ne=0,le=new M;for(let W=0;W<B;W++){let z=W*C-P;for(let D=0;D<G;D++){let K=D*L-U;le[m]=K*y,le[v]=z*x,le[g]=R,c.push(le.x,le.y,le.z),le[m]=0,le[v]=0,le[g]=_>0?1:-1,u.push(le.x,le.y,le.z),h.push(D/S),h.push(1-W/A),j+=1}}for(let W=0;W<A;W++)for(let z=0;z<S;z++){let D=d+z+G*W,K=d+z+G*(W+1),q=d+(z+1)+G*(W+1),ee=d+(z+1)+G*W;l.push(D,K,ee),l.push(K,q,ee),ne+=6}a.addGroup(f,ne,T),f+=ne,d+=j}}static fromJSON(e){return new jn(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function ca(r){let e={};for(let t in r){e[t]={};for(let n in r[t]){let i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Fn(r){let e={};for(let t=0;t<r.length;t++){let n=ca(r[t]);for(let i in n)e[i]=n[i]}return e}var ki={clone:ca,merge:Fn},d1=`void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,f1=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`,_t=class extends nn{constructor(e){super();this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=d1,this.fragmentShader=f1,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!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=ca(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.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let i in this.uniforms){let o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let n={};for(let i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}};_t.prototype.isShaderMaterial=!0;var Dr=class extends Ke{constructor(){super();this.type="Camera",this.matrixWorldInverse=new me,this.projectionMatrix=new me,this.projectionMatrixInverse=new me}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){this.updateWorldMatrix(!0,!1);let 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)}};Dr.prototype.isCamera=!0;var Vt=class extends Dr{constructor(e=50,t=1,n=.1,i=2e3){super();this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,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){let t=.5*this.getFilmHeight()/e;this.fov=Ol*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Qo*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ol*2*Math.atan(Math.tan(Qo*.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,n,i,s,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=n,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Qo*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*n/c,i*=o.width/l,n*=o.height/c}let a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}};Vt.prototype.isPerspectiveCamera=!0;var ua=90,ha=1,ju=class extends Ke{constructor(e,t,n){super();if(this.type="CubeCamera",n.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=n;let i=new Vt(ua,ha,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new M(1,0,0)),this.add(i);let s=new Vt(ua,ha,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new M(-1,0,0)),this.add(s);let o=new Vt(ua,ha,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new M(0,1,0)),this.add(o);let a=new Vt(ua,ha,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new M(0,-1,0)),this.add(a);let l=new Vt(ua,ha,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new M(0,0,1)),this.add(l);let c=new Vt(ua,ha,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new M(0,0,-1)),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();let n=this.renderTarget,[i,s,o,a,l,c]=this.children,u=e.xr.enabled,h=e.getRenderTarget();e.xr.enabled=!1;let d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,s),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,l),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(h),e.xr.enabled=u}},as=class extends xt{constructor(e,t,n,i,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:js,a=a!==void 0?a:Nt;super(e,t,n,i,s,o,a,l,c,u);this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};as.prototype.isCubeTexture=!0;var Lf=class extends bt{constructor(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n);super(e,e,t);t=t||{},this.texture=new as(void 0,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:$e,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.format=zt,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`
varying vec3 vWorldDirection;
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}
`,fragmentShader:`
uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
}
`},i=new jn(5,5,5),s=new _t({name:"CubemapFromEquirect",uniforms:ca(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:kt,blending:It});s.uniforms.tEquirect.value=t;let o=new gt(i,s),a=t.minFilter;return t.minFilter===Ai&&(t.minFilter=$e),new ju(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(s)}};Lf.prototype.isWebGLCubeRenderTarget=!0;var If=new M,p1=new M,m1=new Dt,ni=class{constructor(e=new M(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,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let i=If.subVectors(n,t).cross(p1.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){let n=e.delta(If),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(n).multiplyScalar(s).add(e.start)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||m1.getNormalMatrix(e),i=this.coplanarPoint(If).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}};ni.prototype.isPlane=!0;var da=new ti,Wu=new M,Vl=class{constructor(e=new ni,t=new ni,n=new ni,i=new ni,s=new ni,o=new ni){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){let t=this.planes,n=e.elements,i=n[0],s=n[1],o=n[2],a=n[3],l=n[4],c=n[5],u=n[6],h=n[7],d=n[8],f=n[9],p=n[10],m=n[11],v=n[12],g=n[13],y=n[14],x=n[15];return t[0].setComponents(a-i,h-l,m-d,x-v).normalize(),t[1].setComponents(a+i,h+l,m+d,x+v).normalize(),t[2].setComponents(a+s,h+c,m+f,x+g).normalize(),t[3].setComponents(a-s,h-c,m-f,x-g).normalize(),t[4].setComponents(a-o,h-u,m-p,x-y).normalize(),t[5].setComponents(a+o,h+u,m+p,x+y).normalize(),this}intersectsObject(e){let t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),da.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(da)}intersectsSprite(e){return da.center.set(0,0,0),da.radius=.7071067811865476,da.applyMatrix4(e.matrixWorld),this.intersectsSphere(da)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let i=t[n];if(Wu.x=i.normal.x>0?e.max.x:e.min.x,Wu.y=i.normal.y>0?e.max.y:e.min.y,Wu.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Wu)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function gy(){let r=null,e=!1,t=null,n=null;function i(s,o){t(s,o),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function g1(r,e){let t=e.isWebGL2,n=new WeakMap;function i(c,u){let h=c.array,d=c.usage,f=r.createBuffer();r.bindBuffer(u,f),r.bufferData(u,h,d),c.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?c.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||h instanceof Uint8ClampedArray)&&(p=5121),{buffer:f,type:p,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version}}function s(c,u,h){let d=u.array,f=u.updateRange;r.bindBuffer(h,c),f.count===-1?r.bufferSubData(h,0,d):(t?r.bufferSubData(h,f.offset*d.BYTES_PER_ELEMENT,d,f.offset,f.count):r.bufferSubData(h,f.offset*d.BYTES_PER_ELEMENT,d.subarray(f.offset,f.offset+f.count)),f.count=-1)}function o(c){return c.isInterleavedBufferAttribute&&(c=c.data),n.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);let u=n.get(c);u&&(r.deleteBuffer(u.buffer),n.delete(c))}function l(c,u){if(c.isGLBufferAttribute){let d=n.get(c);(!d||d.version<c.version)&&n.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}c.isInterleavedBufferAttribute&&(c=c.data);let h=n.get(c);h===void 0?n.set(c,i(c,u)):h.version<c.version&&(s(h.buffer,c,u),h.version=c.version)}return{get:o,remove:a,update:l}}var ls=class extends we{constructor(e=1,t=1,n=1,i=1){super();this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};let s=e/2,o=t/2,a=Math.floor(n),l=Math.floor(i),c=a+1,u=l+1,h=e/a,d=t/l,f=[],p=[],m=[],v=[];for(let g=0;g<u;g++){let y=g*d-o;for(let x=0;x<c;x++){let b=x*h-s;p.push(b,-y,0),m.push(0,0,1),v.push(x/a),v.push(1-g/l)}}for(let g=0;g<l;g++)for(let y=0;y<a;y++){let x=y+c*g,b=y+c*(g+1),w=y+1+c*(g+1),_=y+1+c*g;f.push(x,b,_),f.push(b,w,_)}this.setIndex(f),this.setAttribute("position",new ge(p,3)),this.setAttribute("normal",new ge(m,3)),this.setAttribute("uv",new ge(v,2))}static fromJSON(e){return new ls(e.width,e.height,e.widthSegments,e.heightSegments)}},y1=`#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, vUv ).g;
#endif`,v1=`#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,x1=`#ifdef ALPHATEST
if ( diffuseColor.a < ALPHATEST ) discard;
#endif`,b1=`#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_ENVMAP ) && defined( STANDARD )
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );
#endif
#endif`,w1=`#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
#endif`,S1="vec3 transformed = vec3( position );",M1=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
#endif`,A1=`vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
vec4 r = roughness * c0 + c1;
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
return vec2( -1.04, 1.04 ) * a004 + r.zw;
}
float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
#if defined ( PHYSICALLY_CORRECT_LIGHTS )
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
if( cutoffDistance > 0.0 ) {
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
}
return distanceFalloff;
#else
if( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );
}
return 1.0;
#endif
}
vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {
return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in vec3 f90, const in float dotVH ) {
float fresnel = exp2( ( -5.55473 * dotVH - 6.98316 ) * dotVH );
return ( f90 - f0 ) * fresnel + f0;
}
vec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {
float fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );
vec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;
return Fr * fresnel + F0;
}
float G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {
float a2 = pow2( alpha );
float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
return 1.0 / ( gl * gv );
}
float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
float a2 = pow2( alpha );
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
float a2 = pow2( alpha );
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
return RECIPROCAL_PI * a2 / pow2( denom );
}
vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in vec3 f90, const in float roughness ) {
float alpha = pow2( roughness );
vec3 halfDir = normalize( incidentLight.direction + viewDir );
float dotNL = saturate( dot( normal, incidentLight.direction ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
vec3 F = F_Schlick( f0, f90, dotLH );
float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
return F * ( G * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
const float LUT_SIZE = 64.0;
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
const float LUT_BIAS = 0.5 / LUT_SIZE;
float dotNV = saturate( dot( N, V ) );
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
uv = uv * LUT_SCALE + LUT_BIAS;
return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
float l = length( f );
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
float x = dot( v1, v2 );
float y = abs( x );
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
float b = 3.4175940 + ( 4.1616724 + y ) * y;
float v = a / b;
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
vec3 lightNormal = cross( v1, v2 );
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
vec3 T1, T2;
T1 = normalize( V - N * dot( V, N ) );
T2 = - cross( N, T1 );
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
vec3 coords[ 4 ];
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
coords[ 0 ] = normalize( coords[ 0 ] );
coords[ 1 ] = normalize( coords[ 1 ] );
coords[ 2 ] = normalize( coords[ 2 ] );
coords[ 3 ] = normalize( coords[ 3 ] );
vec3 vectorFormFactor = vec3( 0.0 );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
return vec3( result );
}
vec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
return specularColor * brdf.x + brdf.y;
}
void BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
vec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );
vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
vec3 FssEss = F * brdf.x + brdf.y;
float Ess = brdf.x + brdf.y;
float Ems = 1.0 - Ess;
vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
singleScatter += FssEss;
multiScatter += Fms * Ems;
}
float G_BlinnPhong_Implicit( ) {
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {
vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
float dotNH = saturate( dot( geometry.normal, halfDir ) );
float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
vec3 F = F_Schlick( specularColor, vec3( 1.0 ), dotLH );
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
}
float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {
return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );
}
float BlinnExponentToGGXRoughness( const in float blinnExponent ) {
return sqrt( 2.0 / ( blinnExponent + 2.0 ) );
}
#if defined( USE_SHEEN )
float D_Charlie(float roughness, float NoH) {
float invAlpha = 1.0 / roughness;
float cos2h = NoH * NoH;
float sin2h = max(1.0 - cos2h, 0.0078125); return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);
}
float V_Neubelt(float NoV, float NoL) {
return saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));
}
vec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {
vec3 N = geometry.normal;
vec3 V = geometry.viewDir;
vec3 H = normalize( V + L );
float dotNH = saturate( dot( N, H ) );
return specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );
}
#endif`,_1=`#ifdef USE_BUMPMAP
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
vec2 dSTdx = dFdx( vUv );
vec2 dSTdy = dFdy( vUv );
float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
return vec2( dBx, dBy );
}
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );
vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );
vec3 vN = surf_norm;
vec3 R1 = cross( vSigmaY, vN );
vec3 R2 = cross( vN, vSigmaX );
float fDet = dot( vSigmaX, R1 ) * faceDirection;
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
#endif`,T1=`#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#pragma unroll_loop_start
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
}
#pragma unroll_loop_end
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
bool clipped = true;
#pragma unroll_loop_start
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
}
#pragma unroll_loop_end
if ( clipped ) discard;
#endif
#endif`,E1=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,N1=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
#endif`,C1=`#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
#endif`,L1=`#if defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
#elif defined( USE_COLOR )
diffuseColor.rgb *= vColor;
#endif`,I1=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR )
varying vec3 vColor;
#endif`,P1=`#if defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
varying vec3 vColor;
#endif`,D1=`#if defined( USE_COLOR_ALPHA )
vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
vColor.xyz *= instanceColor.xyz;
#endif`,R1=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate(a) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement(a) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
highp float rand( const in vec2 uv ) {
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
return fract(sin(sn) * c);
}
#ifdef HIGH_PRECISION
float precisionSafeLength( vec3 v ) { return length( v ); }
#else
float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float precisionSafeLength( vec3 v ) {
float maxComponent = max3( abs( v ) );
return length( v / maxComponent ) * maxComponent;
}
#endif
struct IncidentLight {
vec3 color;
vec3 direction;
bool visible;
};
struct ReflectedLight {
vec3 directDiffuse;
vec3 directSpecular;
vec3 indirectDiffuse;
vec3 indirectSpecular;
};
struct GeometricContext {
vec3 position;
vec3 normal;
vec3 viewDir;
#ifdef CLEARCOAT
vec3 clearcoatNormal;
#endif
};
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
float distance = dot( planeNormal, point - pointOnPlane );
return - distance * planeNormal + point;
}
float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
return sign( dot( point - pointOnPlane, planeNormal ) );
}
vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;
}
mat3 transposeMat3( const in mat3 m ) {
mat3 tmp;
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
return tmp;
}
float linearToRelativeLuminance( const in vec3 color ) {
vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
return dot( weights, color.rgb );
}
bool isPerspectiveMatrix( mat4 m ) {
return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
return vec2( u, v );
}`,B1=`#ifdef ENVMAP_TYPE_CUBE_UV
#define cubeUV_maxMipLevel 8.0
#define cubeUV_minMipLevel 4.0
#define cubeUV_maxTileSize 256.0
#define cubeUV_minTileSize 16.0
float getFace( vec3 direction ) {
vec3 absDirection = abs( direction );
float face = - 1.0;
if ( absDirection.x > absDirection.z ) {
if ( absDirection.x > absDirection.y )
face = direction.x > 0.0 ? 0.0 : 3.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
} else {
if ( absDirection.z > absDirection.y )
face = direction.z > 0.0 ? 2.0 : 5.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
}
return face;
}
vec2 getUV( vec3 direction, float face ) {
vec2 uv;
if ( face == 0.0 ) {
uv = vec2( direction.z, direction.y ) / abs( direction.x );
} else if ( face == 1.0 ) {
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
} else if ( face == 2.0 ) {
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
} else if ( face == 3.0 ) {
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
} else if ( face == 4.0 ) {
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
} else {
uv = vec2( direction.x, direction.y ) / abs( direction.z );
}
return 0.5 * ( uv + 1.0 );
}
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
float face = getFace( direction );
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
mipInt = max( mipInt, cubeUV_minMipLevel );
float faceSize = exp2( mipInt );
float texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );
vec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );
vec2 f = fract( uv );
uv += 0.5 - f;
if ( face > 2.0 ) {
uv.y += faceSize;
face -= 3.0;
}
uv.x += face * faceSize;
if ( mipInt < cubeUV_maxMipLevel ) {
uv.y += 2.0 * cubeUV_maxTileSize;
}
uv.y += filterInt * 2.0 * cubeUV_minTileSize;
uv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );
uv *= texelSize;
vec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
uv.x += texelSize;
vec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
uv.y += texelSize;
vec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
uv.x -= texelSize;
vec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
vec3 tm = mix( tl, tr, f.x );
vec3 bm = mix( bl, br, f.x );
return mix( tm, bm, f.y );
}
#define r0 1.0
#define v0 0.339
#define m0 - 2.0
#define r1 0.8
#define v1 0.276
#define m1 - 1.0
#define r4 0.4
#define v4 0.046
#define m4 2.0
#define r5 0.305
#define v5 0.016
#define m5 3.0
#define r6 0.21
#define v6 0.0038
#define m6 4.0
float roughnessToMip( float roughness ) {
float mip = 0.0;
if ( roughness >= r1 ) {
mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;
} else if ( roughness >= r4 ) {
mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;
} else if ( roughness >= r5 ) {
mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;
} else if ( roughness >= r6 ) {
mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;
} else {
mip = - 2.0 * log2( 1.16 * roughness ); }
return mip;
}
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
float mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );
float mipF = fract( mip );
float mipInt = floor( mip );
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
if ( mipF == 0.0 ) {
return vec4( color0, 1.0 );
} else {
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
return vec4( mix( color0, color1, mipF ), 1.0 );
}
}
#endif`,O1=`vec3 transformedNormal = objectNormal;
#ifdef USE_INSTANCING
mat3 m = mat3( instanceMatrix );
transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
transformedNormal = m * transformedNormal;
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#ifdef FLIP_SIDED
transformedTangent = - transformedTangent;
#endif
#endif`,F1=`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
#endif`,z1=`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
#endif`,G1=`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vUv );
emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;
totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,U1=`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
#endif`,k1="gl_FragColor = linearToOutputTexel( gl_FragColor );",V1=`
vec4 LinearToLinear( in vec4 value ) {
return value;
}
vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {
return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );
}
vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {
return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );
}
vec4 sRGBToLinear( in vec4 value ) {
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 );
}
vec4 LinearTosRGB( in vec4 value ) {
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 );
}
vec4 RGBEToLinear( in vec4 value ) {
return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );
}
vec4 LinearToRGBE( in vec4 value ) {
float maxComponent = max( max( value.r, value.g ), value.b );
float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );
return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );
}
vec4 RGBMToLinear( in vec4 value, in float maxRange ) {
return vec4( value.rgb * value.a * maxRange, 1.0 );
}
vec4 LinearToRGBM( in vec4 value, in float maxRange ) {
float maxRGB = max( value.r, max( value.g, value.b ) );
float M = clamp( maxRGB / maxRange, 0.0, 1.0 );
M = ceil( M * 255.0 ) / 255.0;
return vec4( value.rgb / ( M * maxRange ), M );
}
vec4 RGBDToLinear( in vec4 value, in float maxRange ) {
return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );
}
vec4 LinearToRGBD( in vec4 value, in float maxRange ) {
float maxRGB = max( value.r, max( value.g, value.b ) );
float D = max( maxRange / maxRGB, 1.0 );
D = clamp( floor( D ) / 255.0, 0.0, 1.0 );
return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );
}
const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
vec4 LinearToLogLuv( in vec4 value ) {
vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );
vec4 vResult;
vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
vResult.w = fract( Le );
vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;
return vResult;
}
const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );
vec4 LogLuvToLinear( in vec4 value ) {
float Le = value.z * 255.0 + value.w;
vec3 Xp_Y_XYZp;
Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );
Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;
return vec4( max( vRGB, 0.0 ), 1.0 );
}`,H1=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToFrag = normalize( vWorldPosition - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
#else
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
#endif
#else
vec3 reflectVec = vReflect;
#endif
#ifdef ENVMAP_TYPE_CUBE
vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
#elif defined( ENVMAP_TYPE_CUBE_UV )
vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );
#else
vec4 envColor = vec4( 0.0 );
#endif
#ifndef ENVMAP_TYPE_CUBE_UV
envColor = envMapTexelToLinear( envColor );
#endif
#ifdef ENVMAP_BLENDING_MULTIPLY
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_MIX )
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_ADD )
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
#endif`,j1=`#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform float flipEnvMap;
uniform int maxMipLevel;
#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#else
uniform sampler2D envMap;
#endif
#endif`,W1=`#ifdef USE_ENVMAP
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
uniform float refractionRatio;
#else
varying vec3 vReflect;
#endif
#endif`,J1=`#ifdef USE_ENVMAP
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
#else
varying vec3 vReflect;
uniform float refractionRatio;
#endif
#endif`,X1=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
vec3 cameraToVertex;
if ( isOrthographic ) {
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vReflect = reflect( cameraToVertex, worldNormal );
#else
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
#endif`,q1=`#ifdef USE_FOG
fogDepth = - mvPosition.z;
#endif`,Y1=`#ifdef USE_FOG
varying float fogDepth;
#endif`,K1=`#ifdef USE_FOG
#ifdef FOG_EXP2
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );
#else
float fogFactor = smoothstep( fogNear, fogFar, fogDepth );
#endif
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,Q1=`#ifdef USE_FOG
uniform vec3 fogColor;
varying float fogDepth;
#ifdef FOG_EXP2
uniform float fogDensity;
#else
uniform float fogNear;
uniform float fogFar;
#endif
#endif`,Z1=`#ifdef USE_GRADIENTMAP
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
float dotNL = dot( normal, lightDirection );
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
#ifdef USE_GRADIENTMAP
return texture2D( gradientMap, coord ).rgb;
#else
return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
#endif
}`,$1=`#ifdef USE_LIGHTMAP
vec4 lightMapTexel= texture2D( lightMap, vUv2 );
reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
#endif`,eT=`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
#endif`,tT=`vec3 diffuse = vec3( 1.0 );
GeometricContext geometry;
geometry.position = mvPosition.xyz;
geometry.normal = normalize( transformedNormal );
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
GeometricContext backGeometry;
backGeometry.position = geometry.position;
backGeometry.normal = -geometry.normal;
backGeometry.viewDir = geometry.viewDir;
vLightFront = vec3( 0.0 );
vIndirectFront = vec3( 0.0 );
#ifdef DOUBLE_SIDED
vLightBack = vec3( 0.0 );
vIndirectBack = vec3( 0.0 );
#endif
IncidentLight directLight;
float dotNL;
vec3 directLightColor_Diffuse;
vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
vIndirectFront += getLightProbeIrradiance( lightProbe, geometry );
#ifdef DOUBLE_SIDED
vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );
#endif
#if NUM_POINT_LIGHTS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );
dotNL = dot( geometry.normal, directLight.direction );
directLightColor_Diffuse = PI * directLight.color;
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
#ifdef DOUBLE_SIDED
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
#endif
}
#pragma unroll_loop_end
#endif
#if NUM_SPOT_LIGHTS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );
dotNL = dot( geometry.normal, directLight.direction );
directLightColor_Diffuse = PI * directLight.color;
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
#ifdef DOUBLE_SIDED
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
#endif
}
#pragma unroll_loop_end
#endif
#if NUM_DIR_LIGHTS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );
dotNL = dot( geometry.normal, directLight.direction );
directLightColor_Diffuse = PI * directLight.color;
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
#ifdef DOUBLE_SIDED
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
#endif
}
#pragma unroll_loop_end
#endif
#if NUM_HEMI_LIGHTS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
#ifdef DOUBLE_SIDED
vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );
#endif
}
#pragma unroll_loop_end
#endif`,nT=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
uniform vec3 lightProbe[ 9 ];
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
float x = normal.x, y = normal.y, z = normal.z;
vec3 result = shCoefficients[ 0 ] * 0.886227;
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {
vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
vec3 irradiance = ambientLightColor;
#ifndef PHYSICALLY_CORRECT_LIGHTS
irradiance *= PI;
#endif
return irradiance;
}
#if NUM_DIR_LIGHTS > 0
struct DirectionalLight {
vec3 direction;
vec3 color;
};
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {
directLight.color = directionalLight.color;
directLight.direction = directionalLight.direction;
directLight.visible = true;
}
#endif
#if NUM_POINT_LIGHTS > 0
struct PointLight {
vec3 position;
vec3 color;
float distance;
float decay;
};
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {
vec3 lVector = pointLight.position - geometry.position;
directLight.direction = normalize( lVector );
float lightDistance = length( lVector );
directLight.color = pointLight.color;
directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );
directLight.visible = ( directLight.color != vec3( 0.0 ) );
}
#endif
#if NUM_SPOT_LIGHTS > 0
struct SpotLight {
vec3 position;
vec3 direction;
vec3 color;
float distance;
float decay;
float coneCos;
float penumbraCos;
};
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {
vec3 lVector = spotLight.position - geometry.position;
directLight.direction = normalize( lVector );
float lightDistance = length( lVector );
float angleCos = dot( directLight.direction, spotLight.direction );
if ( angleCos > spotLight.coneCos ) {
float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );
directLight.color = spotLight.color;
directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );
directLight.visible = true;
} else {
directLight.color = vec3( 0.0 );
directLight.visible = false;
}
}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
struct RectAreaLight {
vec3 color;
vec3 position;
vec3 halfWidth;
vec3 halfHeight;
};
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
struct HemisphereLight {
vec3 direction;
vec3 skyColor;
vec3 groundColor;
};
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {
float dotNL = dot( geometry.normal, hemiLight.direction );
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
#ifndef PHYSICALLY_CORRECT_LIGHTS
irradiance *= PI;
#endif
return irradiance;
}
#endif`,iT=`#if defined( USE_ENVMAP )
#ifdef ENVMAP_MODE_REFRACTION
uniform float refractionRatio;
#endif
vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {
vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
#ifdef ENVMAP_TYPE_CUBE
vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );
#ifdef TEXTURE_LOD_EXT
vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );
#else
vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );
#endif
envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
#elif defined( ENVMAP_TYPE_CUBE_UV )
vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
#else
vec4 envMapColor = vec4( 0.0 );
#endif
return PI * envMapColor.rgb * envMapIntensity;
}
float getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {
float maxMIPLevelScalar = float( maxMIPLevel );
float sigma = PI * roughness * roughness / ( 1.0 + roughness );
float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );
return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );
}
vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {
#ifdef ENVMAP_MODE_REFLECTION
vec3 reflectVec = reflect( -viewDir, normal );
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
#else
vec3 reflectVec = refract( -viewDir, normal, refractionRatio );
#endif
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
float specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );
#ifdef ENVMAP_TYPE_CUBE
vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );
#ifdef TEXTURE_LOD_EXT
vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );
#else
vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );
#endif
envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
#elif defined( ENVMAP_TYPE_CUBE_UV )
vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
#endif
return envMapColor.rgb * envMapIntensity;
}
#endif`,rT=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,sT=`varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
struct ToonMaterial {
vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
#ifndef PHYSICALLY_CORRECT_LIGHTS
irradiance *= PI;
#endif
reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon
#define Material_LightProbeLOD( material ) (0)`,oT=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,aT=`varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
float specularShininess;
float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
#ifndef PHYSICALLY_CORRECT_LIGHTS
irradiance *= PI;
#endif
reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong
#define Material_LightProbeLOD( material ) (0)`,lT=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;
material.specularRoughness = min( material.specularRoughness, 1.0 );
#ifdef REFLECTIVITY
#ifdef SPECULAR
vec3 specularIntensityFactor = vec3( specularIntensity );
vec3 specularTintFactor = specularTint;
#ifdef USE_SPECULARINTENSITYMAP
specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;
#endif
#ifdef USE_SPECULARTINTMAP
specularTintFactor *= specularTintMapTexelToLinear( texture2D( specularTintMap, vUv ) ).rgb;
#endif
material.specularColorF90 = mix( specularIntensityFactor, vec3( 1.0 ), metalnessFactor );
#else
vec3 specularIntensityFactor = vec3( 1.0 );
vec3 specularTintFactor = vec3( 1.0 );
material.specularColorF90 = vec3( 1.0 );
#endif
material.specularColor = mix( min( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ) * specularTintFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );
material.specularColorF90 = vec3( 1.0 );
#endif
#ifdef CLEARCOAT
material.clearcoat = clearcoat;
material.clearcoatRoughness = clearcoatRoughness;
#ifdef USE_CLEARCOATMAP
material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
#endif
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
material.clearcoatRoughness += geometryRoughness;
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_SHEEN
material.sheenColor = sheen;
#endif`,cT=`struct PhysicalMaterial {
vec3 diffuseColor;
float specularRoughness;
vec3 specularColor;
vec3 specularColorF90;
#ifdef CLEARCOAT
float clearcoat;
float clearcoatRoughness;
#endif
#ifdef USE_SHEEN
vec3 sheenColor;
#endif
};
#define MAXIMUM_SPECULAR_COEFFICIENT 0.16
#define DEFAULT_SPECULAR_COEFFICIENT 0.04
float clearcoatDHRApprox( const in float roughness, const in float dotNL ) {
return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );
}
#if NUM_RECT_AREA_LIGHTS > 0
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
vec3 normal = geometry.normal;
vec3 viewDir = geometry.viewDir;
vec3 position = geometry.position;
vec3 lightPos = rectAreaLight.position;
vec3 halfWidth = rectAreaLight.halfWidth;
vec3 halfHeight = rectAreaLight.halfHeight;
vec3 lightColor = rectAreaLight.color;
float roughness = material.specularRoughness;
vec3 rectCoords[ 4 ];
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
vec2 uv = LTC_Uv( normal, viewDir, roughness );
vec4 t1 = texture2D( ltc_1, uv );
vec4 t2 = texture2D( ltc_2, uv );
mat3 mInv = mat3(
vec3( t1.x, 0, t1.y ),
vec3( 0, 1, 0 ),
vec3( t1.z, 0, t1.w )
);
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
#ifndef PHYSICALLY_CORRECT_LIGHTS
irradiance *= PI;
#endif
#ifdef CLEARCOAT
float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
vec3 ccIrradiance = ccDotNL * directLight.color;
#ifndef PHYSICALLY_CORRECT_LIGHTS
ccIrradiance *= PI;
#endif
float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );
reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), vec3( 1.0 ), material.clearcoatRoughness );
#else
float clearcoatDHR = 0.0;
#endif
#ifdef USE_SHEEN
reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(
material.specularRoughness,
directLight.direction,
geometry,
material.sheenColor
);
#else
reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularColorF90, material.specularRoughness);
#endif
reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
}
void 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) {
#ifdef CLEARCOAT
float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );
float ccDotNL = ccDotNV;
float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );
#else
float clearcoatDHR = 0.0;
#endif
float clearcoatInv = 1.0 - clearcoatDHR;
vec3 singleScattering = vec3( 0.0 );
vec3 multiScattering = vec3( 0.0 );
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
BRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );
vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );
reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct RE_Direct_Physical
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,uT=`
GeometricContext geometry;
geometry.position = - vViewPosition;
geometry.normal = normal;
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
#ifdef CLEARCOAT
geometry.clearcoatNormal = clearcoatNormal;
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
PointLight pointLight;
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
PointLightShadow pointLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
pointLight = pointLights[ i ];
getPointDirectLightIrradiance( pointLight, geometry, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
pointLightShadow = pointLightShadows[ i ];
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
#endif
RE_Direct( directLight, geometry, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
SpotLight spotLight;
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
spotLight = spotLights[ i ];
getSpotDirectLightIrradiance( spotLight, geometry, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
spotLightShadow = spotLightShadows[ i ];
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometry, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
DirectionalLight directionalLight;
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLightShadow;
#endif
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
directionalLight = directionalLights[ i ];
getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
directionalLightShadow = directionalLightShadows[ i ];
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometry, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
RectAreaLight rectAreaLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
rectAreaLight = rectAreaLights[ i ];
RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
}
#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
vec3 iblIrradiance = vec3( 0.0 );
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
irradiance += getLightProbeIrradiance( lightProbe, geometry );
#if ( NUM_HEMI_LIGHTS > 0 )
#pragma unroll_loop_start
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
}
#pragma unroll_loop_end
#endif
#endif
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,hT=`#if defined( RE_IndirectDiffuse )
#ifdef USE_LIGHTMAP
vec4 lightMapTexel= texture2D( lightMap, vUv2 );
vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
#ifndef PHYSICALLY_CORRECT_LIGHTS
lightMapIrradiance *= PI;
#endif
irradiance += lightMapIrradiance;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
iblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );
#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
radiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );
#ifdef CLEARCOAT
clearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );
#endif
#endif`,dT=`#if defined( RE_IndirectDiffuse )
RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
#endif`,fT=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,pT=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
#endif`,mT=`#ifdef USE_LOGDEPTHBUF
#ifdef USE_LOGDEPTHBUF_EXT
varying float vFragDepth;
varying float vIsPerspective;
#else
uniform float logDepthBufFC;
#endif
#endif`,gT=`#ifdef USE_LOGDEPTHBUF
#ifdef USE_LOGDEPTHBUF_EXT
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#else
if ( isPerspectiveMatrix( projectionMatrix ) ) {
gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
gl_Position.z *= gl_Position.w;
}
#endif
#endif`,yT=`#ifdef USE_MAP
vec4 texelColor = texture2D( map, vUv );
texelColor = mapTexelToLinear( texelColor );
diffuseColor *= texelColor;
#endif`,vT=`#ifdef USE_MAP
uniform sampler2D map;
#endif`,xT=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
#endif
#ifdef USE_MAP
vec4 mapTexel = texture2D( map, uv );
diffuseColor *= mapTexelToLinear( mapTexel );
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,bT=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
uniform mat3 uvTransform;
#endif
#ifdef USE_MAP
uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,wT=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vUv );
metalnessFactor *= texelMetalness.b;
#endif`,ST=`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
#endif`,MT=`#ifdef USE_MORPHNORMALS
objectNormal *= morphTargetBaseInfluence;
objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
#endif`,AT=`#ifdef USE_MORPHTARGETS
uniform float morphTargetBaseInfluence;
#ifndef USE_MORPHNORMALS
uniform float morphTargetInfluences[ 8 ];
#else
uniform float morphTargetInfluences[ 4 ];
#endif
#endif`,_T=`#ifdef USE_MORPHTARGETS
transformed *= morphTargetBaseInfluence;
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
transformed += morphTarget1 * morphTargetInfluences[ 1 ];
transformed += morphTarget2 * morphTargetInfluences[ 2 ];
transformed += morphTarget3 * morphTargetInfluences[ 3 ];
#ifndef USE_MORPHNORMALS
transformed += morphTarget4 * morphTargetInfluences[ 4 ];
transformed += morphTarget5 * morphTargetInfluences[ 5 ];
transformed += morphTarget6 * morphTargetInfluences[ 6 ];
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
#endif
#endif`,TT=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
vec3 normal = normalize( cross( fdx, fdy ) );
#else
vec3 normal = normalize( vNormal );
#ifdef DOUBLE_SIDED
normal = normal * faceDirection;
#endif
#ifdef USE_TANGENT
vec3 tangent = normalize( vTangent );
vec3 bitangent = normalize( vBitangent );
#ifdef DOUBLE_SIDED
tangent = tangent * faceDirection;
bitangent = bitangent * faceDirection;
#endif
#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
mat3 vTBN = mat3( tangent, bitangent, normal );
#endif
#endif
#endif
vec3 geometryNormal = normal;`,ET=`#ifdef OBJECTSPACE_NORMALMAP
normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
#endif
#ifdef DOUBLE_SIDED
normal = normal * faceDirection;
#endif
normal = normalize( normalMatrix * normal );
#elif defined( TANGENTSPACE_NORMALMAP )
vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
mapN.xy *= normalScale;
#ifdef USE_TANGENT
normal = normalize( vTBN * mapN );
#else
normal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );
#endif
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,NT=`#ifdef USE_NORMALMAP
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
#ifdef OBJECTSPACE_NORMALMAP
uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
vec2 st0 = dFdx( vUv.st );
vec2 st1 = dFdy( vUv.st );
vec3 N = surf_norm;
vec3 q1perp = cross( q1, N );
vec3 q0perp = cross( N, q0 );
vec3 T = q1perp * st0.x + q0perp * st1.x;
vec3 B = q1perp * st0.y + q0perp * st1.y;
float det = max( dot( T, T ), dot( B, B ) );
float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
}
#endif`,CT=`#ifdef CLEARCOAT
vec3 clearcoatNormal = geometryNormal;
#endif`,LT=`#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
#ifdef USE_TANGENT
clearcoatNormal = normalize( vTBN * clearcoatMapN );
#else
clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
#endif
#endif`,IT=`#ifdef USE_CLEARCOATMAP
uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
uniform sampler2D clearcoatRoughnessMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
uniform sampler2D clearcoatNormalMap;
uniform vec2 clearcoatNormalScale;
#endif`,PT=`vec3 packNormalToRGB( const in vec3 normal ) {
return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
const float ShiftRight8 = 1. / 256.;
vec4 packDepthToRGBA( const in float v ) {
vec4 r = vec4( fract( v * PackFactors ), v );
r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
}
float unpackRGBAToDepth( const in vec4 v ) {
return dot( v, UnpackFactors );
}
vec4 pack2HalfToRGBA( vec2 v ) {
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);
}
vec2 unpackRGBATo2Half( vec4 v ) {
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
return linearClipZ * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
return (( near + viewZ ) * far ) / (( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
return ( near * far ) / ( ( far - near ) * invClipZ - far );
}`,DT=`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
#endif`,RT=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_INSTANCING
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,BT=`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,OT=`#ifdef DITHERING
vec3 dithering( vec3 color ) {
float grid_position = rand( gl_FragCoord.xy );
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
return color + dither_shift_RGB;
}
#endif`,FT=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vUv );
roughnessFactor *= texelRoughness.g;
#endif`,zT=`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
#endif`,GT=`#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
struct SpotLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
}
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
return unpackRGBATo2Half( texture2D( shadow, uv ) );
}
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
float occlusion = 1.0;
vec2 distribution = texture2DDistribution( shadow, uv );
float hard_shadow = step( compare , distribution.x );
if (hard_shadow != 1.0 ) {
float distance = compare - distribution.x ;
float variance = max( 0.00000, distribution.y * distribution.y );
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 );
}
return occlusion;
}
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
float shadow = 1.0;
shadowCoord.xyz /= shadowCoord.w;
shadowCoord.z += shadowBias;
bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
bool inFrustum = all( inFrustumVec );
bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
bool frustumTest = all( frustumTestVec );
if ( frustumTest ) {
#if defined( SHADOWMAP_TYPE_PCF )
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float dx0 = - texelSize.x * shadowRadius;
float dy0 = - texelSize.y * shadowRadius;
float dx1 = + texelSize.x * shadowRadius;
float dy1 = + texelSize.y * shadowRadius;
float dx2 = dx0 / 2.0;
float dy2 = dy0 / 2.0;
float dx3 = dx1 / 2.0;
float dy3 = dy1 / 2.0;
shadow = (
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
) * ( 1.0 / 17.0 );
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float dx = texelSize.x;
float dy = texelSize.y;
vec2 uv = shadowCoord.xy;
vec2 f = fract( uv * shadowMapSize + 0.5 );
uv -= f * texelSize;
shadow = (
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
f.x ) +
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
f.x ) +
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
f.y ) +
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
f.y ) +
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
f.x ),
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
f.x ),
f.y )
) * ( 1.0 / 9.0 );
#elif defined( SHADOWMAP_TYPE_VSM )
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
#else
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
#endif
}
return shadow;
}
vec2 cubeToUV( vec3 v, float texelSizeY ) {
vec3 absV = abs( v );
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
absV *= scaleToCube;
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
vec2 planar = v.xy;
float almostATexel = 1.5 * texelSizeY;
float almostOne = 1.0 - almostATexel;
if ( absV.z >= almostOne ) {
if ( v.z > 0.0 )
planar.x = 4.0 - v.x;
} else if ( absV.x >= almostOne ) {
float signX = sign( v.x );
planar.x = v.z * signX + 2.0 * signX;
} else if ( absV.y >= almostOne ) {
float signY = sign( v.y );
planar.x = v.x + 2.0 * signY + 2.0;
planar.y = v.z * signY - 2.0;
}
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
}
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
vec3 lightToPosition = shadowCoord.xyz;
float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
vec3 bd3D = normalize( lightToPosition );
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
return (
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
) * ( 1.0 / 9.0 );
#else
return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
#endif
}
#endif`,UT=`#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
struct DirectionalLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
struct SpotLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
struct PointLightShadow {
float shadowBias;
float shadowNormalBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
#endif
#endif`,kT=`#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
vec4 shadowWorldPosition;
#endif
#if NUM_DIR_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );
vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
}
#pragma unroll_loop_end
#endif
#endif`,VT=`float getShadowMask() {
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLightShadow directionalLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
directionalLight = directionalLightShadows[ i ];
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
SpotLightShadow spotLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
spotLight = spotLightShadows[ i ];
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
}
#pragma unroll_loop_end
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
PointLightShadow pointLight;
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
pointLight = pointLightShadows[ i ];
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
}
#pragma unroll_loop_end
#endif
#endif
return shadow;
}`,HT=`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,jT=`#ifdef USE_SKINNING
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
#ifdef BONE_TEXTURE
uniform highp sampler2D boneTexture;
uniform int boneTextureSize;
mat4 getBoneMatrix( const in float i ) {
float j = i * 4.0;
float x = mod( j, float( boneTextureSize ) );
float y = floor( j / float( boneTextureSize ) );
float dx = 1.0 / float( boneTextureSize );
float dy = 1.0 / float( boneTextureSize );
y = dy * ( y + 0.5 );
vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
mat4 bone = mat4( v1, v2, v3, v4 );
return bone;
}
#else
uniform mat4 boneMatrices[ MAX_BONES ];
mat4 getBoneMatrix( const in float i ) {
mat4 bone = boneMatrices[ int(i) ];
return bone;
}
#endif
#endif`,WT=`#ifdef USE_SKINNING
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
skinned += boneMatY * skinVertex * skinWeight.y;
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,JT=`#ifdef USE_SKINNING
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
skinMatrix += skinWeight.z * boneMatZ;
skinMatrix += skinWeight.w * boneMatW;
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
#endif`,XT=`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
#endif`,qT=`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
#endif`,YT=`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,KT=`#ifndef saturate
#define saturate(a) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
return toneMappingExposure * color;
}
vec3 ReinhardToneMapping( vec3 color ) {
color *= toneMappingExposure;
return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 OptimizedCineonToneMapping( vec3 color ) {
color *= toneMappingExposure;
color = max( vec3( 0.0 ), color - 0.004 );
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
const mat3 ACESInputMat = mat3(
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
vec3( 0.04823, 0.01566, 0.83777 )
);
const mat3 ACESOutputMat = mat3(
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
vec3( -0.07367, -0.00605, 1.07602 )
);
color *= toneMappingExposure / 0.6;
color = ACESInputMat * color;
color = RRTAndODTFit( color );
color = ACESOutputMat * color;
return saturate( color );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,QT=`#ifdef USE_TRANSMISSION
float transmissionFactor = transmission;
float thicknessFactor = thickness;
#ifdef USE_TRANSMISSIONMAP
transmissionFactor *= texture2D( transmissionMap, vUv ).r;
#endif
#ifdef USE_THICKNESSMAP
thicknessFactor *= texture2D( thicknessMap, vUv ).g;
#endif
vec3 pos = vWorldPosition.xyz / vWorldPosition.w;
vec3 v = normalize( cameraPosition - pos );
vec3 n = inverseTransformDirection( normal, viewMatrix );
float ior = ( 1.0 + 0.4 * reflectivity ) / ( 1.0 - 0.4 * reflectivity );
vec3 transmission = transmissionFactor * getIBLVolumeRefraction(
n, v, roughnessFactor, material.diffuseColor, material.specularColor,
pos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,
attenuationTint, attenuationDistance );
totalDiffuse = mix( totalDiffuse, transmission, transmissionFactor );
#endif`,ZT=`#ifdef USE_TRANSMISSION
#ifdef USE_TRANSMISSIONMAP
uniform sampler2D transmissionMap;
#endif
#ifdef USE_THICKNESSMAP
uniform sampler2D thicknessMap;
#endif
uniform vec2 transmissionSamplerSize;
uniform sampler2D transmissionSamplerMap;
uniform mat4 modelMatrix;
uniform mat4 projectionMatrix;
varying vec4 vWorldPosition;
vec3 getVolumeTransmissionRay(vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix) {
vec3 refractionVector = refract(-v, normalize(n), 1.0 / ior);
vec3 modelScale;
modelScale.x = length(vec3(modelMatrix[0].xyz));
modelScale.y = length(vec3(modelMatrix[1].xyz));
modelScale.z = length(vec3(modelMatrix[2].xyz));
return normalize(refractionVector) * thickness * modelScale;
}
float applyIorToRoughness(float roughness, float ior) {
return roughness * clamp(ior * 2.0 - 2.0, 0.0, 1.0);
}
vec3 getTransmissionSample(vec2 fragCoord, float roughness, float ior) {
float framebufferLod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness, ior);
return texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod).rgb;
}
vec3 applyVolumeAttenuation(vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance) {
if (attenuationDistance == 0.0) {
return radiance;
} else {
vec3 attenuationCoefficient = -log(attenuationColor) / attenuationDistance;
vec3 transmittance = exp(-attenuationCoefficient * transmissionDistance); return transmittance * radiance;
}
}
vec3 getIBLVolumeRefraction(vec3 n, vec3 v, float perceptualRoughness, vec3 baseColor, vec3 specularColor,
vec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,
vec3 attenuationColor, float attenuationDistance) {
vec3 transmissionRay = getVolumeTransmissionRay(n, v, thickness, ior, modelMatrix);
vec3 refractedRayExit = position + transmissionRay;
vec4 ndcPos = projMatrix * viewMatrix * vec4(refractedRayExit, 1.0);
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
refractionCoords += 1.0;
refractionCoords /= 2.0;
vec3 transmittedLight = getTransmissionSample(refractionCoords, perceptualRoughness, ior);
vec3 attenuatedColor = applyVolumeAttenuation(transmittedLight, length(transmissionRay), attenuationColor, attenuationDistance);
return (1.0 - specularColor) * attenuatedColor * baseColor;
}
#endif`,$T=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
varying vec2 vUv;
#endif`,eE=`#ifdef USE_UV
#ifdef UVS_VERTEX_ONLY
vec2 vUv;
#else
varying vec2 vUv;
#endif
uniform mat3 uvTransform;
#endif`,tE=`#ifdef USE_UV
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
#endif`,nE=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
varying vec2 vUv2;
#endif`,iE=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
attribute vec2 uv2;
varying vec2 vUv2;
uniform mat3 uv2Transform;
#endif`,rE=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
#endif`,sE=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )
vec4 worldPosition = vec4( transformed, 1.0 );
#ifdef USE_INSTANCING
worldPosition = instanceMatrix * worldPosition;
#endif
worldPosition = modelMatrix * worldPosition;
#endif`,oE=`uniform sampler2D t2D;
varying vec2 vUv;
void main() {
vec4 texColor = texture2D( t2D, vUv );
gl_FragColor = mapTexelToLinear( texColor );
#include <tonemapping_fragment>
#include <encodings_fragment>
}`,aE=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,lE=`#include <envmap_common_pars_fragment>
uniform float opacity;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
vec3 vReflect = vWorldDirection;
#include <envmap_fragment>
gl_FragColor = envColor;
gl_FragColor.a *= opacity;
#include <tonemapping_fragment>
#include <encodings_fragment>
}`,cE=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,uE=`#if DEPTH_PACKING == 3200
uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( 1.0 );
#if DEPTH_PACKING == 3200
diffuseColor.a = opacity;
#endif
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <logdepthbuf_fragment>
float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
#if DEPTH_PACKING == 3200
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
#elif DEPTH_PACKING == 3201
gl_FragColor = packDepthToRGBA( fragCoordZ );
#endif
}`,hE=`#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
#include <uv_vertex>
#include <skinbase_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vHighPrecisionZW = gl_Position.zw;
}`,dE=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( 1.0 );
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
float dist = length( vWorldPosition - referencePosition );
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = packDepthToRGBA( dist );
}`,fE=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <skinbase_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <worldpos_vertex>
#include <clipping_planes_vertex>
vWorldPosition = worldPosition.xyz;
}`,pE=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
vec4 texColor = texture2D( tEquirect, sampleUV );
gl_FragColor = mapTexelToLinear( texColor );
#include <tonemapping_fragment>
#include <encodings_fragment>
}`,mE=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}`,gE=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
if ( mod( vLineDistance, totalSize ) > dashSize ) {
discard;
}
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <color_fragment>
outgoingLight = diffuseColor.rgb;
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,yE=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
vLineDistance = scale * lineDistance;
#include <color_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,vE=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <specularmap_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
#ifdef USE_LIGHTMAP
vec4 lightMapTexel= texture2D( lightMap, vUv2 );
reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
#else
reflectedLight.indirectDiffuse += vec3( 1.0 );
#endif
#include <aomap_fragment>
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
vec3 outgoingLight = reflectedLight.indirectDiffuse;
#include <envmap_fragment>
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,xE=`#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <uv2_vertex>
#include <color_vertex>
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <envmap_vertex>
#include <fog_vertex>
}`,bE=`uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
varying vec3 vLightFront;
varying vec3 vIndirectFront;
#ifdef DOUBLE_SIDED
varying vec3 vLightBack;
varying vec3 vIndirectBack;
#endif
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <fog_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <specularmap_fragment>
#include <emissivemap_fragment>
#ifdef DOUBLE_SIDED
reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;
#else
reflectedLight.indirectDiffuse += vIndirectFront;
#endif
#include <lightmap_fragment>
reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );
#ifdef DOUBLE_SIDED
reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
#else
reflectedLight.directDiffuse = vLightFront;
#endif
reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <envmap_fragment>
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,wE=`#define LAMBERT
varying vec3 vLightFront;
varying vec3 vIndirectFront;
#ifdef DOUBLE_SIDED
varying vec3 vLightBack;
varying vec3 vIndirectBack;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <envmap_pars_vertex>
#include <bsdfs>
#include <lights_pars_begin>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <uv2_vertex>
#include <color_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <envmap_vertex>
#include <lights_lambert_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,SE=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <fog_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
vec3 viewDir = normalize( vViewPosition );
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
vec3 y = cross( viewDir, x );
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
#ifdef USE_MATCAP
vec4 matcapColor = texture2D( matcap, uv );
matcapColor = matcapTexelToLinear( matcapColor );
#else
vec4 matcapColor = vec4( 1.0 );
#endif
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,ME=`#define MATCAP
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
vViewPosition = - mvPosition.xyz;
}`,AE=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_toon_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,_E=`#define TOON
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <uv2_vertex>
#include <color_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,TE=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_phong_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
#include <envmap_fragment>
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,EE=`#define PHONG
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <uv2_vertex>
#include <color_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,NE=`#define STANDARD
#ifdef PHYSICAL
#define REFLECTIVITY
#define CLEARCOAT
#define SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef USE_TRANSMISSION
uniform float transmission;
uniform float thickness;
uniform float attenuationDistance;
uniform vec3 attenuationTint;
#endif
#ifdef REFLECTIVITY
uniform float reflectivity;
#endif
#ifdef SPECULAR
uniform float specularIntensity;
uniform vec3 specularTint;
#ifdef USE_SPECULARINTENSITYMAP
uniform sampler2D specularIntensityMap;
#endif
#ifdef USE_SPECULARTINTMAP
uniform sampler2D specularTintMap;
#endif
#endif
#ifdef CLEARCOAT
uniform float clearcoat;
uniform float clearcoatRoughness;
#endif
#ifdef USE_SHEEN
uniform vec3 sheen;
#endif
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <bsdfs>
#include <transmission_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <lights_physical_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <roughnessmap_fragment>
#include <metalnessmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <clearcoat_normal_fragment_begin>
#include <clearcoat_normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_physical_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
#include <transmission_fragment>
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,CE=`#define STANDARD
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif
#ifdef USE_TRANSMISSION
varying vec4 vWorldPosition;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <uv2_vertex>
#include <color_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
#ifdef USE_TRANSMISSION
vWorldPosition = worldPosition;
#endif
}`,LE=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
varying vec3 vViewPosition;
#endif
#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif
#include <packing>
#include <uv_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
}`,IE=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
varying vec3 vViewPosition;
#endif
#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
vViewPosition = - mvPosition.xyz;
#endif
}`,PE=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_particle_fragment>
#include <color_fragment>
#include <alphatest_fragment>
outgoingLight = diffuseColor.rgb;
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,DE=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <color_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
gl_PointSize = size;
#ifdef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
#endif
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <fog_vertex>
}`,RE=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
}`,BE=`#include <common>
#include <fog_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
#include <begin_vertex>
#include <project_vertex>
#include <worldpos_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,OE=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
outgoingLight = diffuseColor.rgb;
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
}`,FE=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
vec2 scale;
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
#ifndef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) scale *= - mvPosition.z;
#endif
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
vec2 rotatedPosition;
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
mvPosition.xy += rotatedPosition;
gl_Position = projectionMatrix * mvPosition;
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,at={alphamap_fragment:y1,alphamap_pars_fragment:v1,alphatest_fragment:x1,aomap_fragment:b1,aomap_pars_fragment:w1,begin_vertex:S1,beginnormal_vertex:M1,bsdfs:A1,bumpmap_pars_fragment:_1,clipping_planes_fragment:T1,clipping_planes_pars_fragment:E1,clipping_planes_pars_vertex:N1,clipping_planes_vertex:C1,color_fragment:L1,color_pars_fragment:I1,color_pars_vertex:P1,color_vertex:D1,common:R1,cube_uv_reflection_fragment:B1,defaultnormal_vertex:O1,displacementmap_pars_vertex:F1,displacementmap_vertex:z1,emissivemap_fragment:G1,emissivemap_pars_fragment:U1,encodings_fragment:k1,encodings_pars_fragment:V1,envmap_fragment:H1,envmap_common_pars_fragment:j1,envmap_pars_fragment:W1,envmap_pars_vertex:J1,envmap_physical_pars_fragment:iT,envmap_vertex:X1,fog_vertex:q1,fog_pars_vertex:Y1,fog_fragment:K1,fog_pars_fragment:Q1,gradientmap_pars_fragment:Z1,lightmap_fragment:$1,lightmap_pars_fragment:eT,lights_lambert_vertex:tT,lights_pars_begin:nT,lights_toon_fragment:rT,lights_toon_pars_fragment:sT,lights_phong_fragment:oT,lights_phong_pars_fragment:aT,lights_physical_fragment:lT,lights_physical_pars_fragment:cT,lights_fragment_begin:uT,lights_fragment_maps:hT,lights_fragment_end:dT,logdepthbuf_fragment:fT,logdepthbuf_pars_fragment:pT,logdepthbuf_pars_vertex:mT,logdepthbuf_vertex:gT,map_fragment:yT,map_pars_fragment:vT,map_particle_fragment:xT,map_particle_pars_fragment:bT,metalnessmap_fragment:wT,metalnessmap_pars_fragment:ST,morphnormal_vertex:MT,morphtarget_pars_vertex:AT,morphtarget_vertex:_T,normal_fragment_begin:TT,normal_fragment_maps:ET,normalmap_pars_fragment:NT,clearcoat_normal_fragment_begin:CT,clearcoat_normal_fragment_maps:LT,clearcoat_pars_fragment:IT,packing:PT,premultiplied_alpha_fragment:DT,project_vertex:RT,dithering_fragment:BT,dithering_pars_fragment:OT,roughnessmap_fragment:FT,roughnessmap_pars_fragment:zT,shadowmap_pars_fragment:GT,shadowmap_pars_vertex:UT,shadowmap_vertex:kT,shadowmask_pars_fragment:VT,skinbase_vertex:HT,skinning_pars_vertex:jT,skinning_vertex:WT,skinnormal_vertex:JT,specularmap_fragment:XT,specularmap_pars_fragment:qT,tonemapping_fragment:YT,tonemapping_pars_fragment:KT,transmission_fragment:QT,transmission_pars_fragment:ZT,uv_pars_fragment:$T,uv_pars_vertex:eE,uv_vertex:tE,uv2_pars_fragment:nE,uv2_pars_vertex:iE,uv2_vertex:rE,worldpos_vertex:sE,background_frag:oE,background_vert:aE,cube_frag:lE,cube_vert:cE,depth_frag:uE,depth_vert:hE,distanceRGBA_frag:dE,distanceRGBA_vert:fE,equirect_frag:pE,equirect_vert:mE,linedashed_frag:gE,linedashed_vert:yE,meshbasic_frag:vE,meshbasic_vert:xE,meshlambert_frag:bE,meshlambert_vert:wE,meshmatcap_frag:SE,meshmatcap_vert:ME,meshtoon_frag:AE,meshtoon_vert:_E,meshphong_frag:TE,meshphong_vert:EE,meshphysical_frag:NE,meshphysical_vert:CE,normal_frag:LE,normal_vert:IE,points_frag:PE,points_vert:DE,shadow_frag:RE,shadow_vert:BE,sprite_frag:OE,sprite_vert:FE},be={common:{diffuse:{value:new fe(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Dt},uv2Transform:{value:new Dt},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 O(1,1)}},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 fe(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 fe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Dt}},sprite:{diffuse:{value:new fe(16777215)},opacity:{value:1},center:{value:new O(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Dt}}},ar={basic:{uniforms:Fn([be.common,be.specularmap,be.envmap,be.aomap,be.lightmap,be.fog]),vertexShader:at.meshbasic_vert,fragmentShader:at.meshbasic_frag},lambert:{uniforms:Fn([be.common,be.specularmap,be.envmap,be.aomap,be.lightmap,be.emissivemap,be.fog,be.lights,{emissive:{value:new fe(0)}}]),vertexShader:at.meshlambert_vert,fragmentShader:at.meshlambert_frag},phong:{uniforms:Fn([be.common,be.specularmap,be.envmap,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.fog,be.lights,{emissive:{value:new fe(0)},specular:{value:new fe(1118481)},shininess:{value:30}}]),vertexShader:at.meshphong_vert,fragmentShader:at.meshphong_frag},standard:{uniforms:Fn([be.common,be.envmap,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.roughnessmap,be.metalnessmap,be.fog,be.lights,{emissive:{value:new fe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:at.meshphysical_vert,fragmentShader:at.meshphysical_frag},toon:{uniforms:Fn([be.common,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.gradientmap,be.fog,be.lights,{emissive:{value:new fe(0)}}]),vertexShader:at.meshtoon_vert,fragmentShader:at.meshtoon_frag},matcap:{uniforms:Fn([be.common,be.bumpmap,be.normalmap,be.displacementmap,be.fog,{matcap:{value:null}}]),vertexShader:at.meshmatcap_vert,fragmentShader:at.meshmatcap_frag},points:{uniforms:Fn([be.points,be.fog]),vertexShader:at.points_vert,fragmentShader:at.points_frag},dashed:{uniforms:Fn([be.common,be.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:at.linedashed_vert,fragmentShader:at.linedashed_frag},depth:{uniforms:Fn([be.common,be.displacementmap]),vertexShader:at.depth_vert,fragmentShader:at.depth_frag},normal:{uniforms:Fn([be.common,be.bumpmap,be.normalmap,be.displacementmap,{opacity:{value:1}}]),vertexShader:at.normal_vert,fragmentShader:at.normal_frag},sprite:{uniforms:Fn([be.sprite,be.fog]),vertexShader:at.sprite_vert,fragmentShader:at.sprite_frag},background:{uniforms:{uvTransform:{value:new Dt},t2D:{value:null}},vertexShader:at.background_vert,fragmentShader:at.background_frag},cube:{uniforms:Fn([be.envmap,{opacity:{value:1}}]),vertexShader:at.cube_vert,fragmentShader:at.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:at.equirect_vert,fragmentShader:at.equirect_frag},distanceRGBA:{uniforms:Fn([be.common,be.displacementmap,{referencePosition:{value:new M},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:at.distanceRGBA_vert,fragmentShader:at.distanceRGBA_frag},shadow:{uniforms:Fn([be.lights,be.fog,{color:{value:new fe(0)},opacity:{value:1}}]),vertexShader:at.shadow_vert,fragmentShader:at.shadow_frag}};ar.physical={uniforms:Fn([ar.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new O(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new fe(0)},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new O},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationTint:{value:new fe(0)},specularIntensity:{value:0},specularIntensityMap:{value:null},specularTint:{value:new fe(1,1,1)},specularTintMap:{value:null}}]),vertexShader:at.meshphysical_vert,fragmentShader:at.meshphysical_frag};function zE(r,e,t,n,i){let s=new fe(0),o=0,a,l,c=null,u=0,h=null;function d(p,m){let v=!1,g=m.isScene===!0?m.background:null;g&&g.isTexture&&(g=e.get(g));let y=r.xr,x=y.getSession&&y.getSession();x&&x.environmentBlendMode==="additive"&&(g=null),g===null?f(s,o):g&&g.isColor&&(f(g,1),v=!0),(r.autoClear||v)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),g&&(g.isCubeTexture||g.mapping===Js)?(l===void 0&&(l=new gt(new jn(1,1,1),new _t({name:"BackgroundCubeMaterial",uniforms:ca(ar.cube.uniforms),vertexShader:ar.cube.vertexShader,fragmentShader:ar.cube.fragmentShader,side:kt,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(b,w,_){this.matrixWorld.copyPosition(_.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=g,l.material.uniforms.flipEnvMap.value=g.isCubeTexture&&g.isRenderTargetTexture===!1?-1:1,(c!==g||u!==g.version||h!==r.toneMapping)&&(l.material.needsUpdate=!0,c=g,u=g.version,h=r.toneMapping),p.unshift(l,l.geometry,l.material,0,0,null)):g&&g.isTexture&&(a===void 0&&(a=new gt(new ls(2,2),new _t({name:"BackgroundMaterial",uniforms:ca(ar.background.uniforms),vertexShader:ar.background.vertexShader,fragmentShader:ar.background.fragmentShader,side:Oi,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(a)),a.material.uniforms.t2D.value=g,g.matrixAutoUpdate===!0&&g.updateMatrix(),a.material.uniforms.uvTransform.value.copy(g.matrix),(c!==g||u!==g.version||h!==r.toneMapping)&&(a.material.needsUpdate=!0,c=g,u=g.version,h=r.toneMapping),p.unshift(a,a.geometry,a.material,0,0,null))}function f(p,m){t.buffers.color.setClear(p.r,p.g,p.b,m,i)}return{getClearColor:function(){return s},setClearColor:function(p,m=1){s.set(p),o=m,f(s,o)},getClearAlpha:function(){return o},setClearAlpha:function(p){o=p,f(s,o)},render:d}}function GE(r,e,t,n){let i=r.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||s!==null,a={},l=m(null),c=l;function u(P,R,G,B,j){let ne=!1;if(o){let le=p(B,G,R);c!==le&&(c=le,d(c.object)),ne=v(B,j),ne&&g(B,j)}else{let le=R.wireframe===!0;(c.geometry!==B.id||c.program!==G.id||c.wireframe!==le)&&(c.geometry=B.id,c.program=G.id,c.wireframe=le,ne=!0)}P.isInstancedMesh===!0&&(ne=!0),j!==null&&t.update(j,34963),ne&&(S(P,R,G,B),j!==null&&r.bindBuffer(34963,t.get(j).buffer))}function h(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function d(P){return n.isWebGL2?r.bindVertexArray(P):s.bindVertexArrayOES(P)}function f(P){return n.isWebGL2?r.deleteVertexArray(P):s.deleteVertexArrayOES(P)}function p(P,R,G){let B=G.wireframe===!0,j=a[P.id];j===void 0&&(j={},a[P.id]=j);let ne=j[R.id];ne===void 0&&(ne={},j[R.id]=ne);let le=ne[B];return le===void 0&&(le=m(h()),ne[B]=le),le}function m(P){let R=[],G=[],B=[];for(let j=0;j<i;j++)R[j]=0,G[j]=0,B[j]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:R,enabledAttributes:G,attributeDivisors:B,object:P,attributes:{},index:null}}function v(P,R){let G=c.attributes,B=P.attributes,j=0;for(let ne in B){let le=G[ne],W=B[ne];if(le===void 0||le.attribute!==W||le.data!==W.data)return!0;j++}return c.attributesNum!==j||c.index!==R}function g(P,R){let G={},B=P.attributes,j=0;for(let ne in B){let le=B[ne],W={};W.attribute=le,le.data&&(W.data=le.data),G[ne]=W,j++}c.attributes=G,c.attributesNum=j,c.index=R}function y(){let P=c.newAttributes;for(let R=0,G=P.length;R<G;R++)P[R]=0}function x(P){b(P,0)}function b(P,R){let G=c.newAttributes,B=c.enabledAttributes,j=c.attributeDivisors;G[P]=1,B[P]===0&&(r.enableVertexAttribArray(P),B[P]=1),j[P]!==R&&((n.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](P,R),j[P]=R)}function w(){let P=c.newAttributes,R=c.enabledAttributes;for(let G=0,B=R.length;G<B;G++)R[G]!==P[G]&&(r.disableVertexAttribArray(G),R[G]=0)}function _(P,R,G,B,j,ne){n.isWebGL2===!0&&(G===5124||G===5125)?r.vertexAttribIPointer(P,R,G,j,ne):r.vertexAttribPointer(P,R,G,B,j,ne)}function S(P,R,G,B){if(n.isWebGL2===!1&&(P.isInstancedMesh||B.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;y();let j=B.attributes,ne=G.getAttributes(),le=R.defaultAttributeValues;for(let W in ne){let z=ne[W];if(z>=0){let D=j[W];if(D!==void 0){let K=D.normalized,q=D.itemSize,ee=t.get(D);if(ee===void 0)continue;let V=ee.buffer,de=ee.type,ae=ee.bytesPerElement;if(D.isInterleavedBufferAttribute){let te=D.data,X=te.stride,se=D.offset;te&&te.isInstancedInterleavedBuffer?(b(z,te.meshPerAttribute),B._maxInstanceCount===void 0&&(B._maxInstanceCount=te.meshPerAttribute*te.count)):x(z),r.bindBuffer(34962,V),_(z,q,de,K,X*ae,se*ae)}else D.isInstancedBufferAttribute?(b(z,D.meshPerAttribute),B._maxInstanceCount===void 0&&(B._maxInstanceCount=D.meshPerAttribute*D.count)):x(z),r.bindBuffer(34962,V),_(z,q,de,K,0,0)}else if(W==="instanceMatrix"){let K=t.get(P.instanceMatrix);if(K===void 0)continue;let q=K.buffer,ee=K.type;b(z+0,1),b(z+1,1),b(z+2,1),b(z+3,1),r.bindBuffer(34962,q),r.vertexAttribPointer(z+0,4,ee,!1,64,0),r.vertexAttribPointer(z+1,4,ee,!1,64,16),r.vertexAttribPointer(z+2,4,ee,!1,64,32),r.vertexAttribPointer(z+3,4,ee,!1,64,48)}else if(W==="instanceColor"){let K=t.get(P.instanceColor);if(K===void 0)continue;let q=K.buffer,ee=K.type;b(z,1),r.bindBuffer(34962,q),r.vertexAttribPointer(z,3,ee,!1,12,0)}else if(le!==void 0){let K=le[W];if(K!==void 0)switch(K.length){case 2:r.vertexAttrib2fv(z,K);break;case 3:r.vertexAttrib3fv(z,K);break;case 4:r.vertexAttrib4fv(z,K);break;default:r.vertexAttrib1fv(z,K)}}}}w()}function A(){C();for(let P in a){let R=a[P];for(let G in R){let B=R[G];for(let j in B)f(B[j].object),delete B[j];delete R[G]}delete a[P]}}function T(P){if(a[P.id]===void 0)return;let R=a[P.id];for(let G in R){let B=R[G];for(let j in B)f(B[j].object),delete B[j];delete R[G]}delete a[P.id]}function L(P){for(let R in a){let G=a[R];if(G[P.id]===void 0)continue;let B=G[P.id];for(let j in B)f(B[j].object),delete B[j];delete G[P.id]}}function C(){U(),c!==l&&(c=l,d(c.object))}function U(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:u,reset:C,resetDefaultState:U,dispose:A,releaseStatesOfGeometry:T,releaseStatesOfProgram:L,initAttributes:y,enableAttribute:x,disableUnusedAttributes:w}}function UE(r,e,t,n){let i=n.isWebGL2,s;function o(c){s=c}function a(c,u){r.drawArrays(s,c,u),t.update(u,s,1)}function l(c,u,h){if(h===0)return;let d,f;if(i)d=r,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](s,c,u,h),t.update(u,s,h)}this.setMode=o,this.render=a,this.renderInstances=l}function kE(r,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){let S=e.get("EXT_texture_filter_anisotropic");n=r.getParameter(S.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(S){if(S==="highp"){if(r.getShaderPrecisionFormat(35633,36338).precision>0&&r.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";S="mediump"}return S==="mediump"&&r.getShaderPrecisionFormat(35633,36337).precision>0&&r.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}let o=typeof WebGL2RenderingContext!="undefined"&&r instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext!="undefined"&&r instanceof WebGL2ComputeRenderingContext,a=t.precision!==void 0?t.precision:"highp",l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);let c=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=r.getParameter(34930),d=r.getParameter(35660),f=r.getParameter(3379),p=r.getParameter(34076),m=r.getParameter(34921),v=r.getParameter(36347),g=r.getParameter(36348),y=r.getParameter(36349),x=d>0,b=o||e.has("OES_texture_float"),w=x&&b,_=o?r.getParameter(36183):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:d,maxTextureSize:f,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:v,maxVaryings:g,maxFragmentUniforms:y,vertexTextures:x,floatFragmentTextures:b,floatVertexTextures:w,maxSamples:_}}function VE(r){let e=this,t=null,n=0,i=!1,s=!1,o=new ni,a=new Dt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d,f){let p=h.length!==0||d||n!==0||i;return i=d,t=u(h,f,0),n=h.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1,c()},this.setState=function(h,d,f){let p=h.clippingPlanes,m=h.clipIntersection,v=h.clipShadows,g=r.get(h);if(!i||p===null||p.length===0||s&&!v)s?u(null):c();else{let y=s?0:n,x=y*4,b=g.clippingState||null;l.value=b,b=u(p,d,x,f);for(let w=0;w!==x;++w)b[w]=t[w];g.clippingState=b,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,d,f,p){let m=h!==null?h.length:0,v=null;if(m!==0){if(v=l.value,p!==!0||v===null){let g=f+m*4,y=d.matrixWorldInverse;a.getNormalMatrix(y),(v===null||v.length<g)&&(v=new Float32Array(g));for(let x=0,b=f;x!==m;++x,b+=4)o.copy(h[x]).applyMatrix4(y,a),o.normal.toArray(v,b),v[b+3]=o.constant}l.value=v,l.needsUpdate=!0}return e.numPlanes=m,e.numIntersection=0,v}}function HE(r){let e=new WeakMap;function t(o,a){return a===vu?o.mapping=js:a===xu&&(o.mapping=Ws),o}function n(o){if(o&&o.isTexture&&o.isRenderTargetTexture===!1){let a=o.mapping;if(a===vu||a===xu)if(e.has(o)){let l=e.get(o).texture;return t(l,o.mapping)}else{let l=o.image;if(l&&l.height>0){let c=r.getRenderTarget(),u=new Lf(l.height/2);return u.fromEquirectangularTexture(r,o),e.set(o,u),r.setRenderTarget(c),o.addEventListener("dispose",i),t(u.texture,o.mapping)}else return null}}return o}function i(o){let a=o.target;a.removeEventListener("dispose",i);let l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}var Rr=class extends Dr{constructor(e=-1,t=1,n=1,i=-1,s=.1,o=2e3){super();this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,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,n,i,s,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=n,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,s=n-e,o=n+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}};Rr.prototype.isOrthographicCamera=!0;var fa=class extends _t{constructor(e){super(e);this.type="RawShaderMaterial"}};fa.prototype.isRawShaderMaterial=!0;var pa=4,cs=8,lr=Math.pow(2,cs),yy=[.125,.215,.35,.446,.526,.582],vy=cs-pa+1+yy.length,ma=20,cr={[ln]:0,[Fi]:1,[Rl]:2,[Mu]:3,[Au]:4,[_u]:5,[Qs]:6},to=new dn({side:kt,depthWrite:!1,depthTest:!1}),jE=new gt(new jn,to),Pf=new Rr,{_lodPlanes:Hl,_sizeLods:xy,_sigmas:Ju}=JE(),by=new fe,Df=null,no=(1+Math.sqrt(5))/2,ga=1/no,wy=[new M(1,1,1),new M(-1,1,1),new M(1,1,-1),new M(-1,1,-1),new M(0,no,ga),new M(0,no,-ga),new M(ga,0,no),new M(-ga,0,no),new M(no,ga,0),new M(-no,ga,0)];function Sy(r){let e=Math.max(r.r,r.g,r.b),t=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);return r.multiplyScalar(Math.pow(2,-t)),(t+128)/255}var My=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=XE(ma),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Df=this._renderer.getRenderTarget();let s=this._allocateTargets();return this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e){return this._fromTexture(e)}fromCubemap(e){return this._fromTexture(e)}compileCubemapShader(){this._cubemapShader===null&&(this._cubemapShader=Ty(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){this._equirectShader===null&&(this._equirectShader=_y(),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<Hl.length;e++)Hl[e].dispose()}_cleanup(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Df),e.scissorTest=!1,Xu(e,0,0,e.width,e.height)}_fromTexture(e){Df=this._renderer.getRenderTarget();let t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t}_allocateTargets(e){let t={magFilter:Pt,minFilter:Pt,generateMipmaps:!1,type:At,format:QA,encoding:WE(e)?e.encoding:Rl,depthBuffer:!1},n=Ay(t);return n.depthBuffer=!e,this._pingPongRenderTarget=Ay(t),n}_compileMaterial(e){let t=new gt(Hl[0],e);this._renderer.compile(t,Pf)}_sceneToCubeUV(e,t,n,i){let s=90,o=1,a=new Vt(s,o,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,d=u.outputEncoding,f=u.toneMapping;u.getClearColor(by),u.toneMapping=Hs,u.outputEncoding=ln,u.autoClear=!1;let p=!1,m=e.background;if(m){if(m.isColor){to.color.copy(m).convertSRGBToLinear(),e.background=null;let v=Sy(to.color);to.opacity=v,p=!0}}else{to.color.copy(by).convertSRGBToLinear();let v=Sy(to.color);to.opacity=v,p=!0}for(let v=0;v<6;v++){let g=v%3;g==0?(a.up.set(0,l[v],0),a.lookAt(c[v],0,0)):g==1?(a.up.set(0,0,l[v]),a.lookAt(0,c[v],0)):(a.up.set(0,l[v],0),a.lookAt(0,0,c[v])),Xu(i,g*lr,v>2?lr:0,lr,lr),u.setRenderTarget(i),p&&u.render(jE,a),u.render(e,a)}u.toneMapping=f,u.outputEncoding=d,u.autoClear=h}_textureToCubeUV(e,t){let n=this._renderer;e.isCubeTexture?this._cubemapShader==null&&(this._cubemapShader=Ty()):this._equirectShader==null&&(this._equirectShader=_y());let i=e.isCubeTexture?this._cubemapShader:this._equirectShader,s=new gt(Hl[0],i),o=i.uniforms;o.envMap.value=e,e.isCubeTexture||o.texelSize.value.set(1/e.image.width,1/e.image.height),o.inputEncoding.value=cr[e.encoding],o.outputEncoding.value=cr[t.texture.encoding],Xu(t,0,0,3*lr,2*lr),n.setRenderTarget(t),n.render(s,Pf)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<vy;i++){let s=Math.sqrt(Ju[i]*Ju[i]-Ju[i-1]*Ju[i-1]),o=wy[(i-1)%wy.length];this._blur(e,i-1,i,s,o)}t.autoClear=n}_blur(e,t,n,i,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,i,"latitudinal",s),this._halfBlur(o,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let u=3,h=new gt(Hl[i],c),d=c.uniforms,f=xy[n]-1,p=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*ma-1),m=s/p,v=isFinite(s)?1+Math.floor(u*m):ma;v>ma&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${v} samples when the maximum is set to ${ma}`);let g=[],y=0;for(let _=0;_<ma;++_){let S=_/m,A=Math.exp(-S*S/2);g.push(A),_==0?y+=A:_<v&&(y+=2*A)}for(let _=0;_<g.length;_++)g[_]=g[_]/y;d.envMap.value=e.texture,d.samples.value=v,d.weights.value=g,d.latitudinal.value=o==="latitudinal",a&&(d.poleAxis.value=a),d.dTheta.value=p,d.mipInt.value=cs-n,d.inputEncoding.value=cr[e.texture.encoding],d.outputEncoding.value=cr[e.texture.encoding];let x=xy[i],b=3*Math.max(0,lr-2*x),w=(i===0?0:2*lr)+2*x*(i>cs-pa?i-cs+pa:0);Xu(t,b,w,3*x,2*x),l.setRenderTarget(t),l.render(h,Pf)}};function WE(r){return r===void 0||r.type!==At?!1:r.encoding===ln||r.encoding===Fi||r.encoding===Qs}function JE(){let r=[],e=[],t=[],n=cs;for(let i=0;i<vy;i++){let s=Math.pow(2,n);e.push(s);let o=1/s;i>cs-pa?o=yy[i-cs+pa-1]:i==0&&(o=0),t.push(o);let a=1/(s-1),l=-a/2,c=1+a/2,u=[l,l,c,l,c,c,l,l,c,c,l,c],h=6,d=6,f=3,p=2,m=1,v=new Float32Array(f*d*h),g=new Float32Array(p*d*h),y=new Float32Array(m*d*h);for(let b=0;b<h;b++){let w=b%3*2/3-1,_=b>2?0:-1,S=[w,_,0,w+2/3,_,0,w+2/3,_+1,0,w,_,0,w+2/3,_+1,0,w,_+1,0];v.set(S,f*d*b),g.set(u,p*d*b);let A=[b,b,b,b,b,b];y.set(A,m*d*b)}let x=new we;x.setAttribute("position",new Re(v,f)),x.setAttribute("uv",new Re(g,p)),x.setAttribute("faceIndex",new Re(y,m)),r.push(x),n>pa&&n--}return{_lodPlanes:r,_sizeLods:e,_sigmas:t}}function Ay(r){let e=new bt(3*lr,3*lr,r);return e.texture.mapping=Js,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Xu(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function XE(r){let e=new Float32Array(r),t=new M(0,1,0);return new fa({name:"SphericalGaussianBlur",defines:{n:r},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:t},inputEncoding:{value:cr[ln]},outputEncoding:{value:cr[ln]}},vertexShader:Rf(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
uniform int samples;
uniform float weights[ n ];
uniform bool latitudinal;
uniform float dTheta;
uniform float mipInt;
uniform vec3 poleAxis;
${Bf()}
#define ENVMAP_TYPE_CUBE_UV
#include <cube_uv_reflection_fragment>
vec3 getSample( float theta, vec3 axis ) {
float cosTheta = cos( theta );
// Rodrigues' axis-angle rotation
vec3 sampleDirection = vOutputDirection * cosTheta
+ cross( axis, vOutputDirection ) * sin( theta )
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
return bilinearCubeUV( envMap, sampleDirection, mipInt );
}
void main() {
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
}
axis = normalize( axis );
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
for ( int i = 1; i < n; i++ ) {
if ( i >= samples ) {
break;
}
float theta = dTheta * float( i );
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
}
gl_FragColor = linearToOutputTexel( gl_FragColor );
}
`,blending:It,depthTest:!1,depthWrite:!1})}function _y(){let r=new O(1,1);return new fa({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:r},inputEncoding:{value:cr[ln]},outputEncoding:{value:cr[ln]}},vertexShader:Rf(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
uniform vec2 texelSize;
${Bf()}
#include <common>
void main() {
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
vec3 outputDirection = normalize( vOutputDirection );
vec2 uv = equirectUv( outputDirection );
vec2 f = fract( uv / texelSize - 0.5 );
uv -= f * texelSize;
vec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
uv.x += texelSize.x;
vec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
uv.y += texelSize.y;
vec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
uv.x -= texelSize.x;
vec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
vec3 tm = mix( tl, tr, f.x );
vec3 bm = mix( bl, br, f.x );
gl_FragColor.rgb = mix( tm, bm, f.y );
gl_FragColor = linearToOutputTexel( gl_FragColor );
}
`,blending:It,depthTest:!1,depthWrite:!1})}function Ty(){return new fa({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:cr[ln]},outputEncoding:{value:cr[ln]}},vertexShader:Rf(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform samplerCube envMap;
${Bf()}
void main() {
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
gl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;
gl_FragColor = linearToOutputTexel( gl_FragColor );
}
`,blending:It,depthTest:!1,depthWrite:!1})}function Rf(){return`
precision mediump float;
precision mediump int;
attribute vec3 position;
attribute vec2 uv;
attribute float faceIndex;
varying vec3 vOutputDirection;
// RH coordinate system; PMREM face-indexing convention
vec3 getDirection( vec2 uv, float face ) {
uv = 2.0 * uv - 1.0;
vec3 direction = vec3( uv, 1.0 );
if ( face == 0.0 ) {
direction = direction.zyx; // ( 1, v, u ) pos x
} else if ( face == 1.0 ) {
direction = direction.xzy;
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
} else if ( face == 2.0 ) {
direction.x *= -1.0; // ( -u, v, 1 ) pos z
} else if ( face == 3.0 ) {
direction = direction.zyx;
direction.xz *= -1.0; // ( -1, v, -u ) neg x
} else if ( face == 4.0 ) {
direction = direction.xzy;
direction.xy *= -1.0; // ( -u, -1, v ) neg y
} else if ( face == 5.0 ) {
direction.z *= -1.0; // ( u, v, -1 ) neg z
}
return direction;
}
void main() {
vOutputDirection = getDirection( uv, faceIndex );
gl_Position = vec4( position, 1.0 );
}
`}function Bf(){return`
uniform int inputEncoding;
uniform int outputEncoding;
#include <encodings_pars_fragment>
vec4 inputTexelToLinear( vec4 value ) {
if ( inputEncoding == 0 ) {
return value;
} else if ( inputEncoding == 1 ) {
return sRGBToLinear( value );
} else if ( inputEncoding == 2 ) {
return RGBEToLinear( value );
} else if ( inputEncoding == 3 ) {
return RGBMToLinear( value, 7.0 );
} else if ( inputEncoding == 4 ) {
return RGBMToLinear( value, 16.0 );
} else if ( inputEncoding == 5 ) {
return RGBDToLinear( value, 256.0 );
} else {
return GammaToLinear( value, 2.2 );
}
}
vec4 linearToOutputTexel( vec4 value ) {
if ( outputEncoding == 0 ) {
return value;
} else if ( outputEncoding == 1 ) {
return LinearTosRGB( value );
} else if ( outputEncoding == 2 ) {
return LinearToRGBE( value );
} else if ( outputEncoding == 3 ) {
return LinearToRGBM( value, 7.0 );
} else if ( outputEncoding == 4 ) {
return LinearToRGBM( value, 16.0 );
} else if ( outputEncoding == 5 ) {
return LinearToRGBD( value, 256.0 );
} else {
return LinearToGamma( value, 2.2 );
}
}
vec4 envMapTexelToLinear( vec4 color ) {
return inputTexelToLinear( color );
}
`}function qE(r){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture&&a.isRenderTargetTexture===!1){let l=a.mapping,c=l===vu||l===xu,u=l===js||l===Ws;if(c||u){if(e.has(a))return e.get(a).texture;{let h=a.image;if(c&&h&&h.height>0||u&&h&&i(h)){let d=r.getRenderTarget();t===null&&(t=new My(r));let f=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),r.setRenderTarget(d),a.addEventListener("dispose",s),f.texture}else return null}}}return a}function i(a){let l=0,c=6;for(let u=0;u<c;u++)a[u]!==void 0&&l++;return l===c}function s(a){let l=a.target;l.removeEventListener("dispose",s);let c=e.get(l);c!==void 0&&(c.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:o}}function YE(r){let e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(n){n.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(n){let i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function KE(r,e,t,n){let i={},s=new WeakMap;function o(h){let d=h.target;d.index!==null&&e.remove(d.index);for(let p in d.attributes)e.remove(d.attributes[p]);d.removeEventListener("dispose",o),delete i[d.id];let f=s.get(d);f&&(e.remove(f),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function a(h,d){return i[d.id]===!0||(d.addEventListener("dispose",o),i[d.id]=!0,t.memory.geometries++),d}function l(h){let d=h.attributes;for(let p in d)e.update(d[p],34962);let f=h.morphAttributes;for(let p in f){let m=f[p];for(let v=0,g=m.length;v<g;v++)e.update(m[v],34962)}}function c(h){let d=[],f=h.index,p=h.attributes.position,m=0;if(f!==null){let y=f.array;m=f.version;for(let x=0,b=y.length;x<b;x+=3){let w=y[x+0],_=y[x+1],S=y[x+2];d.push(w,_,_,S,S,w)}}else{let y=p.array;m=p.version;for(let x=0,b=y.length/3-1;x<b;x+=3){let w=x+0,_=x+1,S=x+2;d.push(w,_,_,S,S,w)}}let v=new(py(d)>65535?is:Mf)(d,1);v.version=m;let g=s.get(h);g&&e.remove(g),s.set(h,v)}function u(h){let d=s.get(h);if(d){let f=h.index;f!==null&&d.version<f.version&&c(h)}else c(h);return s.get(h)}return{get:a,update:l,getWireframeAttribute:u}}function QE(r,e,t,n){let i=n.isWebGL2,s;function o(d){s=d}let a,l;function c(d){a=d.type,l=d.bytesPerElement}function u(d,f){r.drawElements(s,f,a,d*l),t.update(f,s,1)}function h(d,f,p){if(p===0)return;let m,v;if(i)m=r,v="drawElementsInstanced";else if(m=e.get("ANGLE_instanced_arrays"),v="drawElementsInstancedANGLE",m===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[v](s,f,a,d*l,p),t.update(f,s,p)}this.setMode=o,this.setIndex=c,this.render=u,this.renderInstances=h}function ZE(r){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case 4:t.triangles+=a*(s/3);break;case 1:t.lines+=a*(s/2);break;case 3:t.lines+=a*(s-1);break;case 2:t.lines+=a*s;break;case 0:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function i(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function $E(r,e){return r[0]-e[0]}function eN(r,e){return Math.abs(e[1])-Math.abs(r[1])}function tN(r){let e={},t=new Float32Array(8),n=[];for(let s=0;s<8;s++)n[s]=[s,0];function i(s,o,a,l){let c=s.morphTargetInfluences,u=c===void 0?0:c.length,h=e[o.id];if(h===void 0||h.length!==u){h=[];for(let v=0;v<u;v++)h[v]=[v,0];e[o.id]=h}for(let v=0;v<u;v++){let g=h[v];g[0]=v,g[1]=c[v]}h.sort(eN);for(let v=0;v<8;v++)v<u&&h[v][1]?(n[v][0]=h[v][0],n[v][1]=h[v][1]):(n[v][0]=Number.MAX_SAFE_INTEGER,n[v][1]=0);n.sort($E);let d=o.morphAttributes.position,f=o.morphAttributes.normal,p=0;for(let v=0;v<8;v++){let g=n[v],y=g[0],x=g[1];y!==Number.MAX_SAFE_INTEGER&&x?(d&&o.getAttribute("morphTarget"+v)!==d[y]&&o.setAttribute("morphTarget"+v,d[y]),f&&o.getAttribute("morphNormal"+v)!==f[y]&&o.setAttribute("morphNormal"+v,f[y]),t[v]=x,p+=x):(d&&o.hasAttribute("morphTarget"+v)===!0&&o.deleteAttribute("morphTarget"+v),f&&o.hasAttribute("morphNormal"+v)===!0&&o.deleteAttribute("morphNormal"+v),t[v]=0)}let m=o.morphTargetsRelative?1:1-p;l.getUniforms().setValue(r,"morphTargetBaseInfluence",m),l.getUniforms().setValue(r,"morphTargetInfluences",t)}return{update:i}}function nN(r,e,t,n){let i=new WeakMap;function s(l){let c=n.render.frame,u=l.geometry,h=e.get(l,u);return i.get(h)!==c&&(e.update(h),i.set(h,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),t.update(l.instanceMatrix,34962),l.instanceColor!==null&&t.update(l.instanceColor,34962)),h}function o(){i=new WeakMap}function a(l){let c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:o}}var Of=class extends xt{constructor(e=null,t=1,n=1,i=1){super(null);this.image={data:e,width:t,height:n,depth:i},this.magFilter=Pt,this.minFilter=Pt,this.wrapR=Zt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}};Of.prototype.isDataTexture2DArray=!0;var qu=class extends xt{constructor(e=null,t=1,n=1,i=1){super(null);this.image={data:e,width:t,height:n,depth:i},this.magFilter=Pt,this.minFilter=Pt,this.wrapR=Zt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}};qu.prototype.isDataTexture3D=!0;var Ey=new xt,iN=new Of,rN=new qu,Ny=new as,Cy=[],Ly=[],Iy=new Float32Array(16),Py=new Float32Array(9),Dy=new Float32Array(4);function ya(r,e,t){let n=r[0];if(n<=0||n>0)return r;let i=e*t,s=Cy[i];if(s===void 0&&(s=new Float32Array(i),Cy[i]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,r[o].toArray(s,a)}return s}function Wn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function zn(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Ry(r,e){let t=Ly[e];t===void 0&&(t=new Int32Array(e),Ly[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function sN(r,e){let t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function oN(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Wn(t,e))return;r.uniform2fv(this.addr,e),zn(t,e)}}function aN(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Wn(t,e))return;r.uniform3fv(this.addr,e),zn(t,e)}}function lN(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Wn(t,e))return;r.uniform4fv(this.addr,e),zn(t,e)}}function cN(r,e){let t=this.cache,n=e.elements;if(n===void 0){if(Wn(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),zn(t,e)}else{if(Wn(t,n))return;Dy.set(n),r.uniformMatrix2fv(this.addr,!1,Dy),zn(t,n)}}function uN(r,e){let t=this.cache,n=e.elements;if(n===void 0){if(Wn(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),zn(t,e)}else{if(Wn(t,n))return;Py.set(n),r.uniformMatrix3fv(this.addr,!1,Py),zn(t,n)}}function hN(r,e){let t=this.cache,n=e.elements;if(n===void 0){if(Wn(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),zn(t,e)}else{if(Wn(t,n))return;Iy.set(n),r.uniformMatrix4fv(this.addr,!1,Iy),zn(t,n)}}function dN(r,e){let t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function fN(r,e){let t=this.cache;Wn(t,e)||(r.uniform2iv(this.addr,e),zn(t,e))}function pN(r,e){let t=this.cache;Wn(t,e)||(r.uniform3iv(this.addr,e),zn(t,e))}function mN(r,e){let t=this.cache;Wn(t,e)||(r.uniform4iv(this.addr,e),zn(t,e))}function gN(r,e){let t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function yN(r,e){let t=this.cache;Wn(t,e)||(r.uniform2uiv(this.addr,e),zn(t,e))}function vN(r,e){let t=this.cache;Wn(t,e)||(r.uniform3uiv(this.addr,e),zn(t,e))}function xN(r,e){let t=this.cache;Wn(t,e)||(r.uniform4uiv(this.addr,e),zn(t,e))}function bN(r,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.safeSetTexture2D(e||Ey,i)}function wN(r,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||rN,i)}function SN(r,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.safeSetTextureCube(e||Ny,i)}function MN(r,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||iN,i)}function AN(r){switch(r){case 5126:return sN;case 35664:return oN;case 35665:return aN;case 35666:return lN;case 35674:return cN;case 35675:return uN;case 35676:return hN;case 5124:case 35670:return dN;case 35667:case 35671:return fN;case 35668:case 35672:return pN;case 35669:case 35673:return mN;case 5125:return gN;case 36294:return yN;case 36295:return vN;case 36296:return xN;case 35678:case 36198:case 36298:case 36306:case 35682:return bN;case 35679:case 36299:case 36307:return wN;case 35680:case 36300:case 36308:case 36293:return SN;case 36289:case 36303:case 36311:case 36292:return MN}}function _N(r,e){r.uniform1fv(this.addr,e)}function TN(r,e){let t=ya(e,this.size,2);r.uniform2fv(this.addr,t)}function EN(r,e){let t=ya(e,this.size,3);r.uniform3fv(this.addr,t)}function NN(r,e){let t=ya(e,this.size,4);r.uniform4fv(this.addr,t)}function CN(r,e){let t=ya(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function LN(r,e){let t=ya(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function IN(r,e){let t=ya(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function PN(r,e){r.uniform1iv(this.addr,e)}function DN(r,e){r.uniform2iv(this.addr,e)}function RN(r,e){r.uniform3iv(this.addr,e)}function BN(r,e){r.uniform4iv(this.addr,e)}function ON(r,e){r.uniform1uiv(this.addr,e)}function FN(r,e){r.uniform2uiv(this.addr,e)}function zN(r,e){r.uniform3uiv(this.addr,e)}function GN(r,e){r.uniform4uiv(this.addr,e)}function UN(r,e,t){let n=e.length,i=Ry(t,n);r.uniform1iv(this.addr,i);for(let s=0;s!==n;++s)t.safeSetTexture2D(e[s]||Ey,i[s])}function kN(r,e,t){let n=e.length,i=Ry(t,n);r.uniform1iv(this.addr,i);for(let s=0;s!==n;++s)t.safeSetTextureCube(e[s]||Ny,i[s])}function VN(r){switch(r){case 5126:return _N;case 35664:return TN;case 35665:return EN;case 35666:return NN;case 35674:return CN;case 35675:return LN;case 35676:return IN;case 5124:case 35670:return PN;case 35667:case 35671:return DN;case 35668:case 35672:return RN;case 35669:case 35673:return BN;case 5125:return ON;case 36294:return FN;case 36295:return zN;case 36296:return GN;case 35678:case 36198:case 36298:case 36306:case 35682:return UN;case 35680:case 36300:case 36308:case 36293:return kN}}function HN(r,e,t){this.id=r,this.addr=t,this.cache=[],this.setValue=AN(e.type)}function By(r,e,t){this.id=r,this.addr=t,this.cache=[],this.size=e.size,this.setValue=VN(e.type)}By.prototype.updateCache=function(r){let e=this.cache;r instanceof Float32Array&&e.length!==r.length&&(this.cache=new Float32Array(r.length)),zn(e,r)};function Oy(r){this.id=r,this.seq=[],this.map={}}Oy.prototype.setValue=function(r,e,t){let n=this.seq;for(let i=0,s=n.length;i!==s;++i){let o=n[i];o.setValue(r,e[o.id],t)}};var Ff=/(\w+)(\])?(\[|\.)?/g;function Fy(r,e){r.seq.push(e),r.map[e.id]=e}function jN(r,e,t){let n=r.name,i=n.length;for(Ff.lastIndex=0;;){let s=Ff.exec(n),o=Ff.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===i){Fy(t,c===void 0?new HN(a,r,e):new By(a,r,e));break}else{let h=t.map[a];h===void 0&&(h=new Oy(a),Fy(t,h)),t=h}}}function us(r,e){this.seq=[],this.map={};let t=r.getProgramParameter(e,35718);for(let n=0;n<t;++n){let i=r.getActiveUniform(e,n),s=r.getUniformLocation(e,i.name);jN(i,s,this)}}us.prototype.setValue=function(r,e,t,n){let i=this.map[e];i!==void 0&&i.setValue(r,t,n)};us.prototype.setOptional=function(r,e,t){let n=e[t];n!==void 0&&this.setValue(r,t,n)};us.upload=function(r,e,t,n){for(let i=0,s=e.length;i!==s;++i){let o=e[i],a=t[o.id];a.needsUpdate!==!1&&o.setValue(r,a.value,n)}};us.seqWithValue=function(r,e){let t=[];for(let n=0,i=r.length;n!==i;++n){let s=r[n];s.id in e&&t.push(s)}return t};function zy(r,e,t){let n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}var WN=0;function JN(r){let e=r.split(`
`);for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join(`
`)}function Gy(r){switch(r){case ln:return["Linear","( value )"];case Fi:return["sRGB","( value )"];case Rl:return["RGBE","( value )"];case Mu:return["RGBM","( value, 7.0 )"];case Au:return["RGBM","( value, 16.0 )"];case _u:return["RGBD","( value, 256.0 )"];case Qs:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case F_:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",r),["Linear","( value )"]}}function Uy(r,e,t){let n=r.getShaderParameter(e,35713),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";let s=r.getShaderSource(e);return"THREE.WebGLShader: gl.getShaderInfoLog() "+t+`
`+i+JN(s)}function va(r,e){let t=Gy(e);return"vec4 "+r+"( vec4 value ) { return "+t[0]+"ToLinear"+t[1]+"; }"}function XN(r,e){let t=Gy(e);return"vec4 "+r+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function qN(r,e){let t;switch(e){case zA:t="Linear";break;case GA:t="Reinhard";break;case UA:t="OptimizedCineon";break;case kA:t="ACESFilmic";break;case VA:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function YN(r){return[r.extensionDerivatives||r.envMapCubeUV||r.bumpMap||r.tangentSpaceNormalMap||r.clearcoatNormalMap||r.flatShading||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap||r.transmission>0)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(jl).join(`
`)}function KN(r){let e=[];for(let t in r){let n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
`)}function QN(r,e){let t={},n=r.getProgramParameter(e,35721);for(let i=0;i<n;i++){let o=r.getActiveAttrib(e,i).name;t[o]=r.getAttribLocation(e,o)}return t}function jl(r){return r!==""}function ky(r,e){return r.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 Vy(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var ZN=/^[ \t]*#include +<([\w\d./]+)>/gm;function zf(r){return r.replace(ZN,$N)}function $N(r,e){let t=at[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return zf(t)}var eC=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,tC=/#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 Hy(r){return r.replace(tC,jy).replace(eC,nC)}function nC(r,e,t,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),jy(r,e,t,n)}function jy(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function Wy(r){let e="precision "+r.precision+` float;
precision `+r.precision+" int;";return r.precision==="highp"?e+=`
#define HIGH_PRECISION`:r.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}function iC(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===Pg?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===qd?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===Dl&&(e="SHADOWMAP_TYPE_VSM"),e}function rC(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case js:case Ws:e="ENVMAP_TYPE_CUBE";break;case Js:case Ho:e="ENVMAP_TYPE_CUBE_UV";break}return e}function sC(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case Ws:case Ho:e="ENVMAP_MODE_REFRACTION";break}return e}function oC(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case yu:e="ENVMAP_BLENDING_MULTIPLY";break;case OA:e="ENVMAP_BLENDING_MIX";break;case FA:e="ENVMAP_BLENDING_ADD";break}return e}function aC(r,e,t,n){let i=r.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=iC(t),c=rC(t),u=sC(t),h=oC(t),d=r.gammaFactor>0?r.gammaFactor:1,f=t.isWebGL2?"":YN(t),p=KN(s),m=i.createProgram(),v,g,y=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(v=[p].filter(jl).join(`
`),v.length>0&&(v+=`
`),g=[f,p].filter(jl).join(`
`),g.length>0&&(g+=`
`)):(v=[Wy(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.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularTintMap?"#define USE_SPECULARTINTMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",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 "+l:"",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",`
`].filter(jl).join(`
`),g=[f,Wy(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 "+c:"",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.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularTintMap?"#define USE_SPECULARTINTMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.sheen?"#define USE_SHEEN":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",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 "+l:"",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!==Hs?"#define TONE_MAPPING":"",t.toneMapping!==Hs?at.tonemapping_pars_fragment:"",t.toneMapping!==Hs?qN("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",at.encodings_pars_fragment,t.map?va("mapTexelToLinear",t.mapEncoding):"",t.matcap?va("matcapTexelToLinear",t.matcapEncoding):"",t.envMap?va("envMapTexelToLinear",t.envMapEncoding):"",t.emissiveMap?va("emissiveMapTexelToLinear",t.emissiveMapEncoding):"",t.specularTintMap?va("specularTintMapTexelToLinear",t.specularTintMapEncoding):"",t.lightMap?va("lightMapTexelToLinear",t.lightMapEncoding):"",XN("linearToOutputTexel",t.outputEncoding),t.depthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(jl).join(`
`)),o=zf(o),o=ky(o,t),o=Vy(o,t),a=zf(a),a=ky(a,t),a=Vy(a,t),o=Hy(o),a=Hy(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es
`,v=["#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+v,g=["#define varying in",t.glslVersion===Zg?"":"out highp vec4 pc_fragColor;",t.glslVersion===Zg?"":"#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(`
`)+`
`+g);let x=y+v+o,b=y+g+a,w=zy(i,35633,x),_=zy(i,35632,b);if(i.attachShader(m,w),i.attachShader(m,_),t.index0AttributeName!==void 0?i.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(m,0,"position"),i.linkProgram(m),r.debug.checkShaderErrors){let T=i.getProgramInfoLog(m).trim(),L=i.getShaderInfoLog(w).trim(),C=i.getShaderInfoLog(_).trim(),U=!0,P=!0;if(i.getProgramParameter(m,35714)===!1){U=!1;let R=Uy(i,w,"vertex"),G=Uy(i,_,"fragment");console.error("THREE.WebGLProgram: shader error: ",i.getError(),"35715",i.getProgramParameter(m,35715),"gl.getProgramInfoLog",T,R,G)}else T!==""?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",T):(L===""||C==="")&&(P=!1);P&&(this.diagnostics={runnable:U,programLog:T,vertexShader:{log:L,prefix:v},fragmentShader:{log:C,prefix:g}})}i.deleteShader(w),i.deleteShader(_);let S;this.getUniforms=function(){return S===void 0&&(S=new us(i,m)),S};let A;return this.getAttributes=function(){return A===void 0&&(A=QN(i,m)),A},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(m),this.program=void 0},this.name=t.shaderName,this.id=WN++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=w,this.fragmentShader=_,this}function lC(r,e,t,n,i,s,o){let a=[],l=i.isWebGL2,c=i.logarithmicDepthBuffer,u=i.floatVertexTextures,h=i.maxVertexUniforms,d=i.vertexTextures,f=i.precision,p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},m=["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","specularIntensityMap","specularTintMap","specularTintMapEncoding","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","transmission","transmissionMap","thicknessMap"];function v(S){let T=S.skeleton.bones;if(u)return 1024;{let C=Math.floor((h-20)/4),U=Math.min(C,T.length);return U<T.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+T.length+" bones. This GPU supports "+U+"."),0):U}}function g(S){let A;return S&&S.isTexture?A=S.encoding:S&&S.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),A=S.texture.encoding):A=ln,A}function y(S,A,T,L,C){let U=L.fog,P=S.isMeshStandardMaterial?L.environment:null,R=(S.isMeshStandardMaterial?t:e).get(S.envMap||P),G=p[S.type],B=C.isSkinnedMesh?v(C):0;S.precision!==null&&(f=i.getMaxPrecision(S.precision),f!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",f,"instead."));let j,ne;if(G){let z=ar[G];j=z.vertexShader,ne=z.fragmentShader}else j=S.vertexShader,ne=S.fragmentShader;let le=r.getRenderTarget();return{isWebGL2:l,shaderID:G,shaderName:S.type,vertexShader:j,fragmentShader:ne,defines:S.defines,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:f,instancing:C.isInstancedMesh===!0,instancingColor:C.isInstancedMesh===!0&&C.instanceColor!==null,supportsVertexTextures:d,outputEncoding:le!==null?g(le.texture):r.outputEncoding,map:!!S.map,mapEncoding:g(S.map),matcap:!!S.matcap,matcapEncoding:g(S.matcap),envMap:!!R,envMapMode:R&&R.mapping,envMapEncoding:g(R),envMapCubeUV:!!R&&(R.mapping===Js||R.mapping===Ho),lightMap:!!S.lightMap,lightMapEncoding:g(S.lightMap),aoMap:!!S.aoMap,emissiveMap:!!S.emissiveMap,emissiveMapEncoding:g(S.emissiveMap),bumpMap:!!S.bumpMap,normalMap:!!S.normalMap,objectSpaceNormalMap:S.normalMapType===G_,tangentSpaceNormalMap:S.normalMapType===Qr,clearcoatMap:!!S.clearcoatMap,clearcoatRoughnessMap:!!S.clearcoatRoughnessMap,clearcoatNormalMap:!!S.clearcoatNormalMap,displacementMap:!!S.displacementMap,roughnessMap:!!S.roughnessMap,metalnessMap:!!S.metalnessMap,specularMap:!!S.specularMap,specularIntensityMap:!!S.specularIntensityMap,specularTintMap:!!S.specularTintMap,specularTintMapEncoding:g(S.specularTintMap),alphaMap:!!S.alphaMap,gradientMap:!!S.gradientMap,sheen:!!S.sheen,transmission:!!S.transmission,transmissionMap:!!S.transmissionMap,thicknessMap:!!S.thicknessMap,combine:S.combine,vertexTangents:!!S.normalMap&&!!C.geometry&&!!C.geometry.attributes.tangent,vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!C.geometry&&!!C.geometry.attributes.color&&C.geometry.attributes.color.itemSize===4,vertexUvs:!!S.map||!!S.bumpMap||!!S.normalMap||!!S.specularMap||!!S.alphaMap||!!S.emissiveMap||!!S.roughnessMap||!!S.metalnessMap||!!S.clearcoatMap||!!S.clearcoatRoughnessMap||!!S.clearcoatNormalMap||!!S.displacementMap||!!S.transmissionMap||!!S.thicknessMap||!!S.specularIntensityMap||!!S.specularTintMap,uvsVertexOnly:!(!!S.map||!!S.bumpMap||!!S.normalMap||!!S.specularMap||!!S.alphaMap||!!S.emissiveMap||!!S.roughnessMap||!!S.metalnessMap||!!S.clearcoatNormalMap||!!S.transmission||!!S.transmissionMap||!!S.thicknessMap||!!S.specularIntensityMap||!!S.specularTintMap)&&!!S.displacementMap,fog:!!U,useFog:S.fog,fogExp2:U&&U.isFogExp2,flatShading:!!S.flatShading,sizeAttenuation:S.sizeAttenuation,logarithmicDepthBuffer:c,skinning:C.isSkinnedMesh===!0&&B>0,maxBones:B,useVertexTexture:u,morphTargets:!!C.geometry&&!!C.geometry.morphAttributes.position,morphNormals:!!C.geometry&&!!C.geometry.morphAttributes.normal,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:S.dithering,shadowMapEnabled:r.shadowMap.enabled&&T.length>0,shadowMapType:r.shadowMap.type,toneMapping:S.toneMapped?r.toneMapping:Hs,physicallyCorrectLights:r.physicallyCorrectLights,premultipliedAlpha:S.premultipliedAlpha,alphaTest:S.alphaTest,doubleSided:S.side===Xt,flipSided:S.side===kt,depthPacking:S.depthPacking!==void 0?S.depthPacking:!1,index0AttributeName:S.index0AttributeName,extensionDerivatives:S.extensions&&S.extensions.derivatives,extensionFragDepth:S.extensions&&S.extensions.fragDepth,extensionDrawBuffers:S.extensions&&S.extensions.drawBuffers,extensionShaderTextureLOD:S.extensions&&S.extensions.shaderTextureLOD,rendererExtensionFragDepth:l||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:l||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:l||n.has("EXT_shader_texture_lod"),customProgramCacheKey:S.customProgramCacheKey()}}function x(S){let A=[];if(S.shaderID?A.push(S.shaderID):(A.push(S.fragmentShader),A.push(S.vertexShader)),S.defines!==void 0)for(let T in S.defines)A.push(T),A.push(S.defines[T]);if(S.isRawShaderMaterial===!1){for(let T=0;T<m.length;T++)A.push(S[m[T]]);A.push(r.outputEncoding),A.push(r.gammaFactor)}return A.push(S.customProgramCacheKey),A.join()}function b(S){let A=p[S.type],T;if(A){let L=ar[A];T=ki.clone(L.uniforms)}else T=S.uniforms;return T}function w(S,A){let T;for(let L=0,C=a.length;L<C;L++){let U=a[L];if(U.cacheKey===A){T=U,++T.usedTimes;break}}return T===void 0&&(T=new aC(r,A,S,s),a.push(T)),T}function _(S){if(--S.usedTimes==0){let A=a.indexOf(S);a[A]=a[a.length-1],a.pop(),S.destroy()}}return{getParameters:y,getProgramCacheKey:x,getUniforms:b,acquireProgram:w,releaseProgram:_,programs:a}}function cC(){let r=new WeakMap;function e(s){let o=r.get(s);return o===void 0&&(o={},r.set(s,o)),o}function t(s){r.delete(s)}function n(s,o,a){r.get(s)[o]=a}function i(){r=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function uC(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.program!==e.program?r.program.id-e.program.id:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function Jy(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Xy(r){let e=[],t=0,n=[],i=[],s=[],o={id:-1};function a(){t=0,n.length=0,i.length=0,s.length=0}function l(f,p,m,v,g,y){let x=e[t],b=r.get(m);return x===void 0?(x={id:f.id,object:f,geometry:p,material:m,program:b.program||o,groupOrder:v,renderOrder:f.renderOrder,z:g,group:y},e[t]=x):(x.id=f.id,x.object=f,x.geometry=p,x.material=m,x.program=b.program||o,x.groupOrder=v,x.renderOrder=f.renderOrder,x.z=g,x.group=y),t++,x}function c(f,p,m,v,g,y){let x=l(f,p,m,v,g,y);m.transmission>0?i.push(x):m.transparent===!0?s.push(x):n.push(x)}function u(f,p,m,v,g,y){let x=l(f,p,m,v,g,y);m.transmission>0?i.unshift(x):m.transparent===!0?s.unshift(x):n.unshift(x)}function h(f,p){n.length>1&&n.sort(f||uC),i.length>1&&i.sort(p||Jy),s.length>1&&s.sort(p||Jy)}function d(){for(let f=t,p=e.length;f<p;f++){let m=e[f];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.program=null,m.group=null}}return{opaque:n,transmissive:i,transparent:s,init:a,push:c,unshift:u,finish:d,sort:h}}function hC(r){let e=new WeakMap;function t(i,s){let o;return e.has(i)===!1?(o=new Xy(r),e.set(i,[o])):s>=e.get(i).length?(o=new Xy(r),e.get(i).push(o)):o=e.get(i)[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}function dC(){let r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new M,color:new fe};break;case"SpotLight":t={position:new M,direction:new M,color:new fe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new M,color:new fe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new M,skyColor:new fe,groundColor:new fe};break;case"RectAreaLight":t={color:new fe,position:new M,halfWidth:new M,halfHeight:new M};break}return r[e.id]=t,t}}}function fC(){let r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new O};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new O};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new O,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}var pC=0;function mC(r,e){return(e.castShadow?1:0)-(r.castShadow?1:0)}function gC(r,e){let t=new dC,n=fC(),i={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++)i.probe.push(new M);let s=new M,o=new me,a=new me;function l(u){let h=0,d=0,f=0;for(let S=0;S<9;S++)i.probe[S].set(0,0,0);let p=0,m=0,v=0,g=0,y=0,x=0,b=0,w=0;u.sort(mC);for(let S=0,A=u.length;S<A;S++){let T=u[S],L=T.color,C=T.intensity,U=T.distance,P=T.shadow&&T.shadow.map?T.shadow.map.texture:null;if(T.isAmbientLight)h+=L.r*C,d+=L.g*C,f+=L.b*C;else if(T.isLightProbe)for(let R=0;R<9;R++)i.probe[R].addScaledVector(T.sh.coefficients[R],C);else if(T.isDirectionalLight){let R=t.get(T);if(R.color.copy(T.color).multiplyScalar(T.intensity),T.castShadow){let G=T.shadow,B=n.get(T);B.shadowBias=G.bias,B.shadowNormalBias=G.normalBias,B.shadowRadius=G.radius,B.shadowMapSize=G.mapSize,i.directionalShadow[p]=B,i.directionalShadowMap[p]=P,i.directionalShadowMatrix[p]=T.shadow.matrix,x++}i.directional[p]=R,p++}else if(T.isSpotLight){let R=t.get(T);if(R.position.setFromMatrixPosition(T.matrixWorld),R.color.copy(L).multiplyScalar(C),R.distance=U,R.coneCos=Math.cos(T.angle),R.penumbraCos=Math.cos(T.angle*(1-T.penumbra)),R.decay=T.decay,T.castShadow){let G=T.shadow,B=n.get(T);B.shadowBias=G.bias,B.shadowNormalBias=G.normalBias,B.shadowRadius=G.radius,B.shadowMapSize=G.mapSize,i.spotShadow[v]=B,i.spotShadowMap[v]=P,i.spotShadowMatrix[v]=T.shadow.matrix,w++}i.spot[v]=R,v++}else if(T.isRectAreaLight){let R=t.get(T);R.color.copy(L).multiplyScalar(C),R.halfWidth.set(T.width*.5,0,0),R.halfHeight.set(0,T.height*.5,0),i.rectArea[g]=R,g++}else if(T.isPointLight){let R=t.get(T);if(R.color.copy(T.color).multiplyScalar(T.intensity),R.distance=T.distance,R.decay=T.decay,T.castShadow){let G=T.shadow,B=n.get(T);B.shadowBias=G.bias,B.shadowNormalBias=G.normalBias,B.shadowRadius=G.radius,B.shadowMapSize=G.mapSize,B.shadowCameraNear=G.camera.near,B.shadowCameraFar=G.camera.far,i.pointShadow[m]=B,i.pointShadowMap[m]=P,i.pointShadowMatrix[m]=T.shadow.matrix,b++}i.point[m]=R,m++}else if(T.isHemisphereLight){let R=t.get(T);R.skyColor.copy(T.color).multiplyScalar(C),R.groundColor.copy(T.groundColor).multiplyScalar(C),i.hemi[y]=R,y++}}g>0&&(e.isWebGL2||r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=be.LTC_FLOAT_1,i.rectAreaLTC2=be.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=be.LTC_HALF_1,i.rectAreaLTC2=be.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=h,i.ambient[1]=d,i.ambient[2]=f;let _=i.hash;(_.directionalLength!==p||_.pointLength!==m||_.spotLength!==v||_.rectAreaLength!==g||_.hemiLength!==y||_.numDirectionalShadows!==x||_.numPointShadows!==b||_.numSpotShadows!==w)&&(i.directional.length=p,i.spot.length=v,i.rectArea.length=g,i.point.length=m,i.hemi.length=y,i.directionalShadow.length=x,i.directionalShadowMap.length=x,i.pointShadow.length=b,i.pointShadowMap.length=b,i.spotShadow.length=w,i.spotShadowMap.length=w,i.directionalShadowMatrix.length=x,i.pointShadowMatrix.length=b,i.spotShadowMatrix.length=w,_.directionalLength=p,_.pointLength=m,_.spotLength=v,_.rectAreaLength=g,_.hemiLength=y,_.numDirectionalShadows=x,_.numPointShadows=b,_.numSpotShadows=w,i.version=pC++)}function c(u,h){let d=0,f=0,p=0,m=0,v=0,g=h.matrixWorldInverse;for(let y=0,x=u.length;y<x;y++){let b=u[y];if(b.isDirectionalLight){let w=i.directional[d];w.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),w.direction.sub(s),w.direction.transformDirection(g),d++}else if(b.isSpotLight){let w=i.spot[p];w.position.setFromMatrixPosition(b.matrixWorld),w.position.applyMatrix4(g),w.direction.setFromMatrixPosition(b.matrixWorld),s.setFromMatrixPosition(b.target.matrixWorld),w.direction.sub(s),w.direction.transformDirection(g),p++}else if(b.isRectAreaLight){let w=i.rectArea[m];w.position.setFromMatrixPosition(b.matrixWorld),w.position.applyMatrix4(g),a.identity(),o.copy(b.matrixWorld),o.premultiply(g),a.extractRotation(o),w.halfWidth.set(b.width*.5,0,0),w.halfHeight.set(0,b.height*.5,0),w.halfWidth.applyMatrix4(a),w.halfHeight.applyMatrix4(a),m++}else if(b.isPointLight){let w=i.point[f];w.position.setFromMatrixPosition(b.matrixWorld),w.position.applyMatrix4(g),f++}else if(b.isHemisphereLight){let w=i.hemi[v];w.direction.setFromMatrixPosition(b.matrixWorld),w.direction.transformDirection(g),w.direction.normalize(),v++}}}return{setup:l,setupView:c,state:i}}function qy(r,e){let t=new gC(r,e),n=[],i=[];function s(){n.length=0,i.length=0}function o(h){n.push(h)}function a(h){i.push(h)}function l(){t.setup(n)}function c(h){t.setupView(n,h)}return{init:s,state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:l,setupLightsView:c,pushLight:o,pushShadow:a}}function yC(r,e){let t=new WeakMap;function n(s,o=0){let a;return t.has(s)===!1?(a=new qy(r,e),t.set(s,[a])):o>=t.get(s).length?(a=new qy(r,e),t.get(s).push(a)):a=t.get(s)[o],a}function i(){t=new WeakMap}return{get:n,dispose:i}}var Yu=class extends nn{constructor(e){super();this.type="MeshDepthMaterial",this.depthPacking=Kr,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.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}};Yu.prototype.isMeshDepthMaterial=!0;var Ku=class extends nn{constructor(e){super();this.type="MeshDistanceMaterial",this.referencePosition=new M,this.nearDistance=1,this.farDistance=1e3,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.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};Ku.prototype.isMeshDistanceMaterial=!0;var vC=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include <packing>
void main() {
float mean = 0.0;
float squared_mean = 0.0;
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );
for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {
#ifdef HORIZONTAL_PASS
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );
mean += distribution.x;
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
#else
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );
mean += depth;
squared_mean += depth * depth;
#endif
}
mean = mean * HALF_SAMPLE_RATE;
squared_mean = squared_mean * HALF_SAMPLE_RATE;
float std_dev = sqrt( squared_mean - mean * mean );
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`,xC=`void main() {
gl_Position = vec4( position, 1.0 );
}`;function Yy(r,e,t){let n=new Vl,i=new O,s=new O,o=new Qe,a=new Yu({depthPacking:z_}),l=new Ku,c={},u=t.maxTextureSize,h={0:kt,1:Oi,2:Xt},d=new _t({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new O},radius:{value:4}},vertexShader:xC,fragmentShader:vC}),f=d.clone();f.defines.HORIZONTAL_PASS=1;let p=new we;p.setAttribute("position",new Re(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new gt(p,d),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Pg,this.render=function(b,w,_){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||b.length===0)return;let S=r.getRenderTarget(),A=r.getActiveCubeFace(),T=r.getActiveMipmapLevel(),L=r.state;L.setBlending(It),L.buffers.color.setClear(1,1,1,1),L.buffers.depth.setTest(!0),L.setScissorTest(!1);for(let C=0,U=b.length;C<U;C++){let P=b[C],R=P.shadow;if(R===void 0){console.warn("THREE.WebGLShadowMap:",P,"has no shadow.");continue}if(R.autoUpdate===!1&&R.needsUpdate===!1)continue;i.copy(R.mapSize);let G=R.getFrameExtents();if(i.multiply(G),s.copy(R.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/G.x),i.x=s.x*G.x,R.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/G.y),i.y=s.y*G.y,R.mapSize.y=s.y)),R.map===null&&!R.isPointLightShadow&&this.type===Dl){let j={minFilter:$e,magFilter:$e,format:zt};R.map=new bt(i.x,i.y,j),R.map.texture.name=P.name+".shadowMap",R.mapPass=new bt(i.x,i.y,j),R.camera.updateProjectionMatrix()}if(R.map===null){let j={minFilter:Pt,magFilter:Pt,format:zt};R.map=new bt(i.x,i.y,j),R.map.texture.name=P.name+".shadowMap",R.camera.updateProjectionMatrix()}r.setRenderTarget(R.map),r.clear();let B=R.getViewportCount();for(let j=0;j<B;j++){let ne=R.getViewport(j);o.set(s.x*ne.x,s.y*ne.y,s.x*ne.z,s.y*ne.w),L.viewport(o),R.updateMatrices(P,j),n=R.getFrustum(),x(w,_,R.camera,P,this.type)}!R.isPointLightShadow&&this.type===Dl&&g(R,_),R.needsUpdate=!1}v.needsUpdate=!1,r.setRenderTarget(S,A,T)};function g(b,w){let _=e.update(m);d.uniforms.shadow_pass.value=b.map.texture,d.uniforms.resolution.value=b.mapSize,d.uniforms.radius.value=b.radius,r.setRenderTarget(b.mapPass),r.clear(),r.renderBufferDirect(w,null,_,d,m,null),f.uniforms.shadow_pass.value=b.mapPass.texture,f.uniforms.resolution.value=b.mapSize,f.uniforms.radius.value=b.radius,r.setRenderTarget(b.map),r.clear(),r.renderBufferDirect(w,null,_,f,m,null)}function y(b,w,_,S,A,T,L){let C=null,U=S.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(U!==void 0?C=U:C=S.isPointLight===!0?l:a,r.localClippingEnabled&&_.clipShadows===!0&&_.clippingPlanes.length!==0){let P=C.uuid,R=_.uuid,G=c[P];G===void 0&&(G={},c[P]=G);let B=G[R];B===void 0&&(B=C.clone(),G[R]=B),C=B}return C.visible=_.visible,C.wireframe=_.wireframe,L===Dl?C.side=_.shadowSide!==null?_.shadowSide:_.side:C.side=_.shadowSide!==null?_.shadowSide:h[_.side],C.clipShadows=_.clipShadows,C.clippingPlanes=_.clippingPlanes,C.clipIntersection=_.clipIntersection,C.wireframeLinewidth=_.wireframeLinewidth,C.linewidth=_.linewidth,S.isPointLight===!0&&C.isMeshDistanceMaterial===!0&&(C.referencePosition.setFromMatrixPosition(S.matrixWorld),C.nearDistance=A,C.farDistance=T),C}function x(b,w,_,S,A){if(b.visible===!1)return;if(b.layers.test(w.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&A===Dl)&&(!b.frustumCulled||n.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse,b.matrixWorld);let C=e.update(b),U=b.material;if(Array.isArray(U)){let P=C.groups;for(let R=0,G=P.length;R<G;R++){let B=P[R],j=U[B.materialIndex];if(j&&j.visible){let ne=y(b,C,j,S,_.near,_.far,A);r.renderBufferDirect(_,null,C,ne,b,B)}}}else if(U.visible){let P=y(b,C,U,S,_.near,_.far,A);r.renderBufferDirect(_,null,C,P,b,null)}}let L=b.children;for(let C=0,U=L.length;C<U;C++)x(L[C],w,_,S,A)}}function bC(r,e,t){let n=t.isWebGL2;function i(){let J=!1,xe=new Qe,he=null,Ne=new Qe(0,0,0,0);return{setMask:function(Be){he!==Be&&!J&&(r.colorMask(Be,Be,Be,Be),he=Be)},setLocked:function(Be){J=Be},setClear:function(Be,ke,ht,ft,Bn){Bn===!0&&(Be*=ft,ke*=ft,ht*=ft),xe.set(Be,ke,ht,ft),Ne.equals(xe)===!1&&(r.clearColor(Be,ke,ht,ft),Ne.copy(xe))},reset:function(){J=!1,he=null,Ne.set(-1,0,0,0)}}}function s(){let J=!1,xe=null,he=null,Ne=null;return{setTest:function(Be){Be?q(2929):ee(2929)},setMask:function(Be){xe!==Be&&!J&&(r.depthMask(Be),xe=Be)},setFunc:function(Be){if(he!==Be){if(Be)switch(Be){case CA:r.depthFunc(512);break;case LA:r.depthFunc(519);break;case IA:r.depthFunc(513);break;case Yd:r.depthFunc(515);break;case PA:r.depthFunc(514);break;case DA:r.depthFunc(518);break;case RA:r.depthFunc(516);break;case BA:r.depthFunc(517);break;default:r.depthFunc(515)}else r.depthFunc(515);he=Be}},setLocked:function(Be){J=Be},setClear:function(Be){Ne!==Be&&(r.clearDepth(Be),Ne=Be)},reset:function(){J=!1,xe=null,he=null,Ne=null}}}function o(){let J=!1,xe=null,he=null,Ne=null,Be=null,ke=null,ht=null,ft=null,Bn=null;return{setTest:function(Mt){J||(Mt?q(2960):ee(2960))},setMask:function(Mt){xe!==Mt&&!J&&(r.stencilMask(Mt),xe=Mt)},setFunc:function(Mt,Tn,En){(he!==Mt||Ne!==Tn||Be!==En)&&(r.stencilFunc(Mt,Tn,En),he=Mt,Ne=Tn,Be=En)},setOp:function(Mt,Tn,En){(ke!==Mt||ht!==Tn||ft!==En)&&(r.stencilOp(Mt,Tn,En),ke=Mt,ht=Tn,ft=En)},setLocked:function(Mt){J=Mt},setClear:function(Mt){Bn!==Mt&&(r.clearStencil(Mt),Bn=Mt)},reset:function(){J=!1,xe=null,he=null,Ne=null,Be=null,ke=null,ht=null,ft=null,Bn=null}}}let a=new i,l=new s,c=new o,u={},h=null,d={},f=null,p=!1,m=null,v=null,g=null,y=null,x=null,b=null,w=null,_=!1,S=null,A=null,T=null,L=null,C=null,U=r.getParameter(35661),P=!1,R=0,G=r.getParameter(7938);G.indexOf("WebGL")!==-1?(R=parseFloat(/^WebGL (\d)/.exec(G)[1]),P=R>=1):G.indexOf("OpenGL ES")!==-1&&(R=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),P=R>=2);let B=null,j={},ne=r.getParameter(3088),le=r.getParameter(2978),W=new Qe().fromArray(ne),z=new Qe().fromArray(le);function D(J,xe,he){let Ne=new Uint8Array(4),Be=r.createTexture();r.bindTexture(J,Be),r.texParameteri(J,10241,9728),r.texParameteri(J,10240,9728);for(let ke=0;ke<he;ke++)r.texImage2D(xe+ke,0,6408,1,1,0,6408,5121,Ne);return Be}let K={};K[3553]=D(3553,3553,1),K[34067]=D(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),q(2929),l.setFunc(Yd),H(!1),Q(Ig),q(2884),se(It);function q(J){u[J]!==!0&&(r.enable(J),u[J]=!0)}function ee(J){u[J]!==!1&&(r.disable(J),u[J]=!1)}function V(J){J!==h&&(r.bindFramebuffer(36160,J),h=J)}function de(J,xe){return xe===null&&h!==null&&(xe=h),d[J]!==xe?(r.bindFramebuffer(J,xe),d[J]=xe,n&&(J===36009&&(d[36160]=xe),J===36160&&(d[36009]=xe)),!0):!1}function ae(J){return f!==J?(r.useProgram(J),f=J,!0):!1}let te={[Vo]:32774,[vA]:32778,[xA]:32779};if(n)te[Fg]=32775,te[zg]=32776;else{let J=e.get("EXT_blend_minmax");J!==null&&(te[Fg]=J.MIN_EXT,te[zg]=J.MAX_EXT)}let X={[bA]:0,[wA]:1,[SA]:768,[Gg]:770,[NA]:776,[TA]:774,[AA]:772,[MA]:769,[Ug]:771,[EA]:775,[_A]:773};function se(J,xe,he,Ne,Be,ke,ht,ft){if(J===It){p===!0&&(ee(3042),p=!1);return}if(p===!1&&(q(3042),p=!0),J!==yA){if(J!==m||ft!==_){if((v!==Vo||x!==Vo)&&(r.blendEquation(32774),v=Vo,x=Vo),ft)switch(J){case Vs:r.blendFuncSeparate(1,771,1,771);break;case Rg:r.blendFunc(1,1);break;case Bg:r.blendFuncSeparate(0,0,769,771);break;case Og:r.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",J);break}else switch(J){case Vs:r.blendFuncSeparate(770,771,1,771);break;case Rg:r.blendFunc(770,1);break;case Bg:r.blendFunc(0,769);break;case Og:r.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",J);break}g=null,y=null,b=null,w=null,m=J,_=ft}return}Be=Be||xe,ke=ke||he,ht=ht||Ne,(xe!==v||Be!==x)&&(r.blendEquationSeparate(te[xe],te[Be]),v=xe,x=Be),(he!==g||Ne!==y||ke!==b||ht!==w)&&(r.blendFuncSeparate(X[he],X[Ne],X[ke],X[ht]),g=he,y=Ne,b=ke,w=ht),m=J,_=null}function $(J,xe){J.side===Xt?ee(2884):q(2884);let he=J.side===kt;xe&&(he=!he),H(he),J.blending===Vs&&J.transparent===!1?se(It):se(J.blending,J.blendEquation,J.blendSrc,J.blendDst,J.blendEquationAlpha,J.blendSrcAlpha,J.blendDstAlpha,J.premultipliedAlpha),l.setFunc(J.depthFunc),l.setTest(J.depthTest),l.setMask(J.depthWrite),a.setMask(J.colorWrite);let Ne=J.stencilWrite;c.setTest(Ne),Ne&&(c.setMask(J.stencilWriteMask),c.setFunc(J.stencilFunc,J.stencilRef,J.stencilFuncMask),c.setOp(J.stencilFail,J.stencilZFail,J.stencilZPass)),ie(J.polygonOffset,J.polygonOffsetFactor,J.polygonOffsetUnits),J.alphaToCoverage===!0?q(32926):ee(32926)}function H(J){S!==J&&(J?r.frontFace(2304):r.frontFace(2305),S=J)}function Q(J){J!==mA?(q(2884),J!==A&&(J===Ig?r.cullFace(1029):J===gA?r.cullFace(1028):r.cullFace(1032))):ee(2884),A=J}function ce(J){J!==T&&(P&&r.lineWidth(J),T=J)}function ie(J,xe,he){J?(q(32823),(L!==xe||C!==he)&&(r.polygonOffset(xe,he),L=xe,C=he)):ee(32823)}function N(J){J?q(3089):ee(3089)}function E(J){J===void 0&&(J=33984+U-1),B!==J&&(r.activeTexture(J),B=J)}function Y(J,xe){B===null&&E();let he=j[B];he===void 0&&(he={type:void 0,texture:void 0},j[B]=he),(he.type!==J||he.texture!==xe)&&(r.bindTexture(J,xe||K[J]),he.type=J,he.texture=xe)}function re(){let J=j[B];J!==void 0&&J.type!==void 0&&(r.bindTexture(J.type,null),J.type=void 0,J.texture=void 0)}function ye(){try{r.compressedTexImage2D.apply(r,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function pe(){try{r.texImage2D.apply(r,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function Ie(){try{r.texImage3D.apply(r,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function ve(J){W.equals(J)===!1&&(r.scissor(J.x,J.y,J.z,J.w),W.copy(J))}function Fe(J){z.equals(J)===!1&&(r.viewport(J.x,J.y,J.z,J.w),z.copy(J))}function Ce(){r.disable(3042),r.disable(2884),r.disable(2929),r.disable(32823),r.disable(3089),r.disable(2960),r.disable(32926),r.blendEquation(32774),r.blendFunc(1,0),r.blendFuncSeparate(1,0,1,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(513),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(519,0,4294967295),r.stencilOp(7680,7680,7680),r.clearStencil(0),r.cullFace(1029),r.frontFace(2305),r.polygonOffset(0,0),r.activeTexture(33984),r.bindFramebuffer(36160,null),n===!0&&(r.bindFramebuffer(36009,null),r.bindFramebuffer(36008,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),u={},B=null,j={},h=null,d={},f=null,p=!1,m=null,v=null,g=null,y=null,x=null,b=null,w=null,_=!1,S=null,A=null,T=null,L=null,C=null,W.set(0,0,r.canvas.width,r.canvas.height),z.set(0,0,r.canvas.width,r.canvas.height),a.reset(),l.reset(),c.reset()}return{buffers:{color:a,depth:l,stencil:c},enable:q,disable:ee,bindFramebuffer:de,bindXRFramebuffer:V,useProgram:ae,setBlending:se,setMaterial:$,setFlipSided:H,setCullFace:Q,setLineWidth:ce,setPolygonOffset:ie,setScissorTest:N,activeTexture:E,bindTexture:Y,unbindTexture:re,compressedTexImage2D:ye,texImage2D:pe,texImage3D:Ie,scissor:ve,viewport:Fe,reset:Ce}}function wC(r,e,t,n,i,s,o){let a=i.isWebGL2,l=i.maxTextures,c=i.maxCubemapSize,u=i.maxTextureSize,h=i.maxSamples,d=new WeakMap,f,p=!1;try{p=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(N){}function m(N,E){return p?new OffscreenCanvas(N,E):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function v(N,E,Y,re){let ye=1;if((N.width>re||N.height>re)&&(ye=re/Math.max(N.width,N.height)),ye<1||E===!0)if(typeof HTMLImageElement!="undefined"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&N instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&N instanceof ImageBitmap){let pe=E?ey:Math.floor,Ie=pe(ye*N.width),ve=pe(ye*N.height);f===void 0&&(f=m(Ie,ve));let Fe=Y?m(Ie,ve):f;return Fe.width=Ie,Fe.height=ve,Fe.getContext("2d").drawImage(N,0,0,Ie,ve),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+N.width+"x"+N.height+") to ("+Ie+"x"+ve+")."),Fe}else return"data"in N&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+N.width+"x"+N.height+")."),N;return N}function g(N){return rf(N.width)&&rf(N.height)}function y(N){return a?!1:N.wrapS!==Zt||N.wrapT!==Zt||N.minFilter!==Pt&&N.minFilter!==$e}function x(N,E){return N.generateMipmaps&&E&&N.minFilter!==Pt&&N.minFilter!==$e}function b(N,E,Y,re,ye=1){r.generateMipmap(N);let pe=n.get(E);pe.__maxMipLevel=Math.log2(Math.max(Y,re,ye))}function w(N,E,Y){if(a===!1)return E;if(N!==null){if(r[N]!==void 0)return r[N];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let re=E;return E===6403&&(Y===5126&&(re=33326),Y===5131&&(re=33325),Y===5121&&(re=33321)),E===6407&&(Y===5126&&(re=34837),Y===5131&&(re=34843),Y===5121&&(re=32849)),E===6408&&(Y===5126&&(re=34836),Y===5131&&(re=34842),Y===5121&&(re=32856)),(re===33325||re===33326||re===34842||re===34836)&&e.get("EXT_color_buffer_float"),re}function _(N){return N===Pt||N===Xs||N===qs?9728:9729}function S(N){let E=N.target;E.removeEventListener("dispose",S),T(E),E.isVideoTexture&&d.delete(E),o.memory.textures--}function A(N){let E=N.target;E.removeEventListener("dispose",A),L(E)}function T(N){let E=n.get(N);E.__webglInit!==void 0&&(r.deleteTexture(E.__webglTexture),n.remove(N))}function L(N){let E=N.texture,Y=n.get(N),re=n.get(E);if(!!N){if(re.__webglTexture!==void 0&&(r.deleteTexture(re.__webglTexture),o.memory.textures--),N.depthTexture&&N.depthTexture.dispose(),N.isWebGLCubeRenderTarget)for(let ye=0;ye<6;ye++)r.deleteFramebuffer(Y.__webglFramebuffer[ye]),Y.__webglDepthbuffer&&r.deleteRenderbuffer(Y.__webglDepthbuffer[ye]);else r.deleteFramebuffer(Y.__webglFramebuffer),Y.__webglDepthbuffer&&r.deleteRenderbuffer(Y.__webglDepthbuffer),Y.__webglMultisampledFramebuffer&&r.deleteFramebuffer(Y.__webglMultisampledFramebuffer),Y.__webglColorRenderbuffer&&r.deleteRenderbuffer(Y.__webglColorRenderbuffer),Y.__webglDepthRenderbuffer&&r.deleteRenderbuffer(Y.__webglDepthRenderbuffer);if(N.isWebGLMultipleRenderTargets)for(let ye=0,pe=E.length;ye<pe;ye++){let Ie=n.get(E[ye]);Ie.__webglTexture&&(r.deleteTexture(Ie.__webglTexture),o.memory.textures--),n.remove(E[ye])}n.remove(E),n.remove(N)}}let C=0;function U(){C=0}function P(){let N=C;return N>=l&&console.warn("THREE.WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+l),C+=1,N}function R(N,E){let Y=n.get(N);if(N.isVideoTexture&&$(N),N.version>0&&Y.__version!==N.version){let re=N.image;if(re===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(re.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{D(Y,N,E);return}}t.activeTexture(33984+E),t.bindTexture(3553,Y.__webglTexture)}function G(N,E){let Y=n.get(N);if(N.version>0&&Y.__version!==N.version){D(Y,N,E);return}t.activeTexture(33984+E),t.bindTexture(35866,Y.__webglTexture)}function B(N,E){let Y=n.get(N);if(N.version>0&&Y.__version!==N.version){D(Y,N,E);return}t.activeTexture(33984+E),t.bindTexture(32879,Y.__webglTexture)}function j(N,E){let Y=n.get(N);if(N.version>0&&Y.__version!==N.version){K(Y,N,E);return}t.activeTexture(33984+E),t.bindTexture(34067,Y.__webglTexture)}let ne={[di]:10497,[Zt]:33071,[qr]:33648},le={[Pt]:9728,[Xs]:9984,[qs]:9986,[$e]:9729,[jo]:9985,[Ai]:9987};function W(N,E,Y){if(Y?(r.texParameteri(N,10242,ne[E.wrapS]),r.texParameteri(N,10243,ne[E.wrapT]),(N===32879||N===35866)&&r.texParameteri(N,32882,ne[E.wrapR]),r.texParameteri(N,10240,le[E.magFilter]),r.texParameteri(N,10241,le[E.minFilter])):(r.texParameteri(N,10242,33071),r.texParameteri(N,10243,33071),(N===32879||N===35866)&&r.texParameteri(N,32882,33071),(E.wrapS!==Zt||E.wrapT!==Zt)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(N,10240,_(E.magFilter)),r.texParameteri(N,10241,_(E.minFilter)),E.minFilter!==Pt&&E.minFilter!==$e&&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){let re=e.get("EXT_texture_filter_anisotropic");if(E.type===Tr&&e.has("OES_texture_float_linear")===!1||a===!1&&E.type===Jo&&e.has("OES_texture_half_float_linear")===!1)return;(E.anisotropy>1||n.get(E).__currentAnisotropy)&&(r.texParameterf(N,re.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(E.anisotropy,i.getMaxAnisotropy())),n.get(E).__currentAnisotropy=E.anisotropy)}}function z(N,E){N.__webglInit===void 0&&(N.__webglInit=!0,E.addEventListener("dispose",S),N.__webglTexture=r.createTexture(),o.memory.textures++)}function D(N,E,Y){let re=3553;E.isDataTexture2DArray&&(re=35866),E.isDataTexture3D&&(re=32879),z(N,E),t.activeTexture(33984+Y),t.bindTexture(re,N.__webglTexture),r.pixelStorei(37440,E.flipY),r.pixelStorei(37441,E.premultiplyAlpha),r.pixelStorei(3317,E.unpackAlignment),r.pixelStorei(37443,0);let ye=y(E)&&g(E.image)===!1,pe=v(E.image,ye,!1,u),Ie=g(pe)||a,ve=s.convert(E.format),Fe=s.convert(E.type),Ce=w(E.internalFormat,ve,Fe);W(re,E,Ie);let J,xe=E.mipmaps;if(E.isDepthTexture)Ce=6402,a?E.type===Tr?Ce=36012:E.type===Wo?Ce=33190:E.type===Ys?Ce=35056:Ce=33189:E.type===Tr&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),E.format===Xo&&Ce===6402&&E.type!==bu&&E.type!==Wo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),E.type=bu,Fe=s.convert(E.type)),E.format===Ks&&Ce===6402&&(Ce=34041,E.type!==Ys&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),E.type=Ys,Fe=s.convert(E.type))),t.texImage2D(3553,0,Ce,pe.width,pe.height,0,ve,Fe,null);else if(E.isDataTexture)if(xe.length>0&&Ie){for(let he=0,Ne=xe.length;he<Ne;he++)J=xe[he],t.texImage2D(3553,he,Ce,J.width,J.height,0,ve,Fe,J.data);E.generateMipmaps=!1,N.__maxMipLevel=xe.length-1}else t.texImage2D(3553,0,Ce,pe.width,pe.height,0,ve,Fe,pe.data),N.__maxMipLevel=0;else if(E.isCompressedTexture){for(let he=0,Ne=xe.length;he<Ne;he++)J=xe[he],E.format!==zt&&E.format!==Nt?ve!==null?t.compressedTexImage2D(3553,he,Ce,J.width,J.height,0,J.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):t.texImage2D(3553,he,Ce,J.width,J.height,0,ve,Fe,J.data);N.__maxMipLevel=xe.length-1}else if(E.isDataTexture2DArray)t.texImage3D(35866,0,Ce,pe.width,pe.height,pe.depth,0,ve,Fe,pe.data),N.__maxMipLevel=0;else if(E.isDataTexture3D)t.texImage3D(32879,0,Ce,pe.width,pe.height,pe.depth,0,ve,Fe,pe.data),N.__maxMipLevel=0;else if(xe.length>0&&Ie){for(let he=0,Ne=xe.length;he<Ne;he++)J=xe[he],t.texImage2D(3553,he,Ce,ve,Fe,J);E.generateMipmaps=!1,N.__maxMipLevel=xe.length-1}else t.texImage2D(3553,0,Ce,ve,Fe,pe),N.__maxMipLevel=0;x(E,Ie)&&b(re,E,pe.width,pe.height),N.__version=E.version,E.onUpdate&&E.onUpdate(E)}function K(N,E,Y){if(E.image.length!==6)return;z(N,E),t.activeTexture(33984+Y),t.bindTexture(34067,N.__webglTexture),r.pixelStorei(37440,E.flipY),r.pixelStorei(37441,E.premultiplyAlpha),r.pixelStorei(3317,E.unpackAlignment),r.pixelStorei(37443,0);let re=E&&(E.isCompressedTexture||E.image[0].isCompressedTexture),ye=E.image[0]&&E.image[0].isDataTexture,pe=[];for(let he=0;he<6;he++)!re&&!ye?pe[he]=v(E.image[he],!1,!0,c):pe[he]=ye?E.image[he].image:E.image[he];let Ie=pe[0],ve=g(Ie)||a,Fe=s.convert(E.format),Ce=s.convert(E.type),J=w(E.internalFormat,Fe,Ce);W(34067,E,ve);let xe;if(re){for(let he=0;he<6;he++){xe=pe[he].mipmaps;for(let Ne=0;Ne<xe.length;Ne++){let Be=xe[Ne];E.format!==zt&&E.format!==Nt?Fe!==null?t.compressedTexImage2D(34069+he,Ne,J,Be.width,Be.height,0,Be.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):t.texImage2D(34069+he,Ne,J,Be.width,Be.height,0,Fe,Ce,Be.data)}}N.__maxMipLevel=xe.length-1}else{xe=E.mipmaps;for(let he=0;he<6;he++)if(ye){t.texImage2D(34069+he,0,J,pe[he].width,pe[he].height,0,Fe,Ce,pe[he].data);for(let Ne=0;Ne<xe.length;Ne++){let ke=xe[Ne].image[he].image;t.texImage2D(34069+he,Ne+1,J,ke.width,ke.height,0,Fe,Ce,ke.data)}}else{t.texImage2D(34069+he,0,J,Fe,Ce,pe[he]);for(let Ne=0;Ne<xe.length;Ne++){let Be=xe[Ne];t.texImage2D(34069+he,Ne+1,J,Fe,Ce,Be.image[he])}}N.__maxMipLevel=xe.length}x(E,ve)&&b(34067,E,Ie.width,Ie.height),N.__version=E.version,E.onUpdate&&E.onUpdate(E)}function q(N,E,Y,re,ye){let pe=s.convert(Y.format),Ie=s.convert(Y.type),ve=w(Y.internalFormat,pe,Ie);ye===32879||ye===35866?t.texImage3D(ye,0,ve,E.width,E.height,E.depth,0,pe,Ie,null):t.texImage2D(ye,0,ve,E.width,E.height,0,pe,Ie,null),t.bindFramebuffer(36160,N),r.framebufferTexture2D(36160,re,ye,n.get(Y).__webglTexture,0),t.bindFramebuffer(36160,null)}function ee(N,E,Y){if(r.bindRenderbuffer(36161,N),E.depthBuffer&&!E.stencilBuffer){let re=33189;if(Y){let ye=E.depthTexture;ye&&ye.isDepthTexture&&(ye.type===Tr?re=36012:ye.type===Wo&&(re=33190));let pe=se(E);r.renderbufferStorageMultisample(36161,pe,re,E.width,E.height)}else r.renderbufferStorage(36161,re,E.width,E.height);r.framebufferRenderbuffer(36160,36096,36161,N)}else if(E.depthBuffer&&E.stencilBuffer){if(Y){let re=se(E);r.renderbufferStorageMultisample(36161,re,35056,E.width,E.height)}else r.renderbufferStorage(36161,34041,E.width,E.height);r.framebufferRenderbuffer(36160,33306,36161,N)}else{let re=E.isWebGLMultipleRenderTargets===!0?E.texture[0]:E.texture,ye=s.convert(re.format),pe=s.convert(re.type),Ie=w(re.internalFormat,ye,pe);if(Y){let ve=se(E);r.renderbufferStorageMultisample(36161,ve,Ie,E.width,E.height)}else r.renderbufferStorage(36161,Ie,E.width,E.height)}r.bindRenderbuffer(36161,null)}function V(N,E){if(E&&E.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,N),!(E.depthTexture&&E.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(E.depthTexture).__webglTexture||E.depthTexture.image.width!==E.width||E.depthTexture.image.height!==E.height)&&(E.depthTexture.image.width=E.width,E.depthTexture.image.height=E.height,E.depthTexture.needsUpdate=!0),R(E.depthTexture,0);let re=n.get(E.depthTexture).__webglTexture;if(E.depthTexture.format===Xo)r.framebufferTexture2D(36160,36096,3553,re,0);else if(E.depthTexture.format===Ks)r.framebufferTexture2D(36160,33306,3553,re,0);else throw new Error("Unknown depthTexture format")}function de(N){let E=n.get(N),Y=N.isWebGLCubeRenderTarget===!0;if(N.depthTexture){if(Y)throw new Error("target.depthTexture not supported in Cube render targets");V(E.__webglFramebuffer,N)}else if(Y){E.__webglDepthbuffer=[];for(let re=0;re<6;re++)t.bindFramebuffer(36160,E.__webglFramebuffer[re]),E.__webglDepthbuffer[re]=r.createRenderbuffer(),ee(E.__webglDepthbuffer[re],N,!1)}else t.bindFramebuffer(36160,E.__webglFramebuffer),E.__webglDepthbuffer=r.createRenderbuffer(),ee(E.__webglDepthbuffer,N,!1);t.bindFramebuffer(36160,null)}function ae(N){let E=N.texture,Y=n.get(N),re=n.get(E);N.addEventListener("dispose",A),N.isWebGLMultipleRenderTargets!==!0&&(re.__webglTexture=r.createTexture(),re.__version=E.version,o.memory.textures++);let ye=N.isWebGLCubeRenderTarget===!0,pe=N.isWebGLMultipleRenderTargets===!0,Ie=N.isWebGLMultisampleRenderTarget===!0,ve=E.isDataTexture3D||E.isDataTexture2DArray,Fe=g(N)||a;if(a&&E.format===Nt&&(E.type===Tr||E.type===Jo)&&(E.format=zt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),ye){Y.__webglFramebuffer=[];for(let Ce=0;Ce<6;Ce++)Y.__webglFramebuffer[Ce]=r.createFramebuffer()}else if(Y.__webglFramebuffer=r.createFramebuffer(),pe)if(i.drawBuffers){let Ce=N.texture;for(let J=0,xe=Ce.length;J<xe;J++){let he=n.get(Ce[J]);he.__webglTexture===void 0&&(he.__webglTexture=r.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(Ie)if(a){Y.__webglMultisampledFramebuffer=r.createFramebuffer(),Y.__webglColorRenderbuffer=r.createRenderbuffer(),r.bindRenderbuffer(36161,Y.__webglColorRenderbuffer);let Ce=s.convert(E.format),J=s.convert(E.type),xe=w(E.internalFormat,Ce,J),he=se(N);r.renderbufferStorageMultisample(36161,he,xe,N.width,N.height),t.bindFramebuffer(36160,Y.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(36160,36064,36161,Y.__webglColorRenderbuffer),r.bindRenderbuffer(36161,null),N.depthBuffer&&(Y.__webglDepthRenderbuffer=r.createRenderbuffer(),ee(Y.__webglDepthRenderbuffer,N,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(ye){t.bindTexture(34067,re.__webglTexture),W(34067,E,Fe);for(let Ce=0;Ce<6;Ce++)q(Y.__webglFramebuffer[Ce],N,E,36064,34069+Ce);x(E,Fe)&&b(34067,E,N.width,N.height),t.bindTexture(34067,null)}else if(pe){let Ce=N.texture;for(let J=0,xe=Ce.length;J<xe;J++){let he=Ce[J],Ne=n.get(he);t.bindTexture(3553,Ne.__webglTexture),W(3553,he,Fe),q(Y.__webglFramebuffer,N,he,36064+J,3553),x(he,Fe)&&b(3553,he,N.width,N.height)}t.bindTexture(3553,null)}else{let Ce=3553;ve&&(a?Ce=E.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),t.bindTexture(Ce,re.__webglTexture),W(Ce,E,Fe),q(Y.__webglFramebuffer,N,E,36064,Ce),x(E,Fe)&&b(Ce,E,N.width,N.height,N.depth),t.bindTexture(Ce,null)}N.depthBuffer&&de(N)}function te(N){let E=g(N)||a,Y=N.isWebGLMultipleRenderTargets===!0?N.texture:[N.texture];for(let re=0,ye=Y.length;re<ye;re++){let pe=Y[re];if(x(pe,E)){let Ie=N.isWebGLCubeRenderTarget?34067:3553,ve=n.get(pe).__webglTexture;t.bindTexture(Ie,ve),b(Ie,pe,N.width,N.height),t.bindTexture(Ie,null)}}}function X(N){if(N.isWebGLMultisampleRenderTarget)if(a){let E=N.width,Y=N.height,re=16384;N.depthBuffer&&(re|=256),N.stencilBuffer&&(re|=1024);let ye=n.get(N);t.bindFramebuffer(36008,ye.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,ye.__webglFramebuffer),r.blitFramebuffer(0,0,E,Y,0,0,E,Y,re,9728),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,ye.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function se(N){return a&&N.isWebGLMultisampleRenderTarget?Math.min(h,N.samples):0}function $(N){let E=o.render.frame;d.get(N)!==E&&(d.set(N,E),N.update())}let H=!1,Q=!1;function ce(N,E){N&&N.isWebGLRenderTarget&&(H===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),H=!0),N=N.texture),R(N,E)}function ie(N,E){N&&N.isWebGLCubeRenderTarget&&(Q===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),Q=!0),N=N.texture),j(N,E)}this.allocateTextureUnit=P,this.resetTextureUnits=U,this.setTexture2D=R,this.setTexture2DArray=G,this.setTexture3D=B,this.setTextureCube=j,this.setupRenderTarget=ae,this.updateRenderTargetMipmap=te,this.updateMultisampleRenderTarget=X,this.safeSetTexture2D=ce,this.safeSetTextureCube=ie}function SC(r,e,t){let n=t.isWebGL2;function i(s){let o;if(s===At)return 5121;if(s===JA)return 32819;if(s===XA)return 32820;if(s===qA)return 33635;if(s===HA)return 5120;if(s===jA)return 5122;if(s===bu)return 5123;if(s===WA)return 5124;if(s===Wo)return 5125;if(s===Tr)return 5126;if(s===Jo)return n?5131:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===YA)return 6406;if(s===Nt)return 6407;if(s===zt)return 6408;if(s===Qd)return 6409;if(s===KA)return 6410;if(s===Xo)return 6402;if(s===Ks)return 34041;if(s===ZA)return 6403;if(s===$A)return 36244;if(s===e_)return 33319;if(s===t_)return 33320;if(s===n_)return 36248;if(s===i_)return 36249;if(s===kg||s===Vg||s===Hg||s===jg)if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===kg)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Vg)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Hg)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===jg)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Wg||s===Jg||s===Xg||s===qg)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===Wg)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Jg)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Xg)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===qg)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===r_)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if((s===Yg||s===Kg)&&(o=e.get("WEBGL_compressed_texture_etc"),o!==null)){if(s===Yg)return o.COMPRESSED_RGB8_ETC2;if(s===Kg)return o.COMPRESSED_RGBA8_ETC2_EAC}if(s===s_||s===o_||s===a_||s===l_||s===c_||s===u_||s===h_||s===d_||s===f_||s===p_||s===m_||s===g_||s===y_||s===v_||s===b_||s===w_||s===S_||s===M_||s===A_||s===__||s===T_||s===E_||s===N_||s===C_||s===L_||s===I_||s===P_||s===D_)return o=e.get("WEBGL_compressed_texture_astc"),o!==null?s:null;if(s===x_)return o=e.get("EXT_texture_compression_bptc"),o!==null?s:null;if(s===Ys)return n?34042:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:i}}var Gf=class extends Vt{constructor(e=[]){super();this.cameras=e}};Gf.prototype.isArrayCamera=!0;var Jn=class extends Ke{constructor(){super();this.type="Group"}};Jn.prototype.isGroup=!0;var MC={type:"move"},Qu=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Jn,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 Jn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new M,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new M),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Jn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new M,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new M),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,n){let i=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(i=t.getPose(e.targetRaySpace,n),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(MC))),c&&e.hand){o=!0;for(let m of e.hand.values()){let v=t.getJointPose(m,n);if(c.joints[m.jointName]===void 0){let y=new Jn;y.matrixAutoUpdate=!1,y.visible=!1,c.joints[m.jointName]=y,c.add(y)}let g=c.joints[m.jointName];v!==null&&(g.matrix.fromArray(v.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.jointRadius=v.radius),g.visible=v!==null}let u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),f=.02,p=.005;c.inputState.pinching&&d>f+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=f-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}},Ky=class extends cn{constructor(e,t){super();let n=this,i=e.state,s=null,o=1,a=null,l="local-floor",c=null,u=null,h=null,d=null,f=null,p=[],m=new Map,v=new Vt;v.layers.enable(1),v.viewport=new Qe;let g=new Vt;g.layers.enable(2),g.viewport=new Qe;let y=[v,g],x=new Gf;x.layers.enable(1),x.layers.enable(2);let b=null,w=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(B){let j=p[B];return j===void 0&&(j=new Qu,p[B]=j),j.getTargetRaySpace()},this.getControllerGrip=function(B){let j=p[B];return j===void 0&&(j=new Qu,p[B]=j),j.getGripSpace()},this.getHand=function(B){let j=p[B];return j===void 0&&(j=new Qu,p[B]=j),j.getHandSpace()};function _(B){let j=m.get(B.inputSource);j&&j.dispatchEvent({type:B.type,data:B.inputSource})}function S(){m.forEach(function(B,j){B.disconnect(j)}),m.clear(),b=null,w=null,i.bindXRFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),G.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(B){o=B,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(B){l=B,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a},this.getSession=function(){return s},this.setSession=async function(B){if(s=B,s!==null){s.addEventListener("select",_),s.addEventListener("selectstart",_),s.addEventListener("selectend",_),s.addEventListener("squeeze",_),s.addEventListener("squeezestart",_),s.addEventListener("squeezeend",_),s.addEventListener("end",S),s.addEventListener("inputsourceschange",A);let j=t.getContextAttributes();if(j.xrCompatible!==!0&&await t.makeXRCompatible(),s.renderState.layers===void 0){let ne={antialias:j.antialias,alpha:j.alpha,depth:j.depth,stencil:j.stencil,framebufferScaleFactor:o};f=new XRWebGLLayer(s,t,ne),s.updateRenderState({baseLayer:f})}else{let ne=0;if(j.antialias){let le={antialias:!0,alpha:j.alpha,depth:j.depth,stencil:j.stencil,framebufferScaleFactor:o};f=new XRWebGLLayer(s,t,le),s.updateRenderState({layers:[f]})}else{j.depth&&(ne=j.stencil?34041:6402);let le={colorFormat:j.alpha?6408:6407,depthFormat:ne,scaleFactor:o};u=new XRWebGLBinding(s,t),d=u.createProjectionLayer(le),h=t.createFramebuffer(),s.updateRenderState({layers:[d]})}}a=await s.requestReferenceSpace(l),G.setContext(s),G.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};function A(B){let j=s.inputSources;for(let ne=0;ne<p.length;ne++)m.set(j[ne],p[ne]);for(let ne=0;ne<B.removed.length;ne++){let le=B.removed[ne],W=m.get(le);W&&(W.dispatchEvent({type:"disconnected",data:le}),m.delete(le))}for(let ne=0;ne<B.added.length;ne++){let le=B.added[ne],W=m.get(le);W&&W.dispatchEvent({type:"connected",data:le})}}let T=new M,L=new M;function C(B,j,ne){T.setFromMatrixPosition(j.matrixWorld),L.setFromMatrixPosition(ne.matrixWorld);let le=T.distanceTo(L),W=j.projectionMatrix.elements,z=ne.projectionMatrix.elements,D=W[14]/(W[10]-1),K=W[14]/(W[10]+1),q=(W[9]+1)/W[5],ee=(W[9]-1)/W[5],V=(W[8]-1)/W[0],de=(z[8]+1)/z[0],ae=D*V,te=D*de,X=le/(-V+de),se=X*-V;j.matrixWorld.decompose(B.position,B.quaternion,B.scale),B.translateX(se),B.translateZ(X),B.matrixWorld.compose(B.position,B.quaternion,B.scale),B.matrixWorldInverse.copy(B.matrixWorld).invert();let $=D+X,H=K+X,Q=ae-se,ce=te+(le-se),ie=q*K/H*$,N=ee*K/H*$;B.projectionMatrix.makePerspective(Q,ce,ie,N,$,H)}function U(B,j){j===null?B.matrixWorld.copy(B.matrix):B.matrixWorld.multiplyMatrices(j.matrixWorld,B.matrix),B.matrixWorldInverse.copy(B.matrixWorld).invert()}this.updateCamera=function(B){if(s===null)return;x.near=g.near=v.near=B.near,x.far=g.far=v.far=B.far,(b!==x.near||w!==x.far)&&(s.updateRenderState({depthNear:x.near,depthFar:x.far}),b=x.near,w=x.far);let j=B.parent,ne=x.cameras;U(x,j);for(let W=0;W<ne.length;W++)U(ne[W],j);x.matrixWorld.decompose(x.position,x.quaternion,x.scale),B.position.copy(x.position),B.quaternion.copy(x.quaternion),B.scale.copy(x.scale),B.matrix.copy(x.matrix),B.matrixWorld.copy(x.matrixWorld);let le=B.children;for(let W=0,z=le.length;W<z;W++)le[W].updateMatrixWorld(!0);ne.length===2?C(x,v,g):x.projectionMatrix.copy(v.projectionMatrix)},this.getCamera=function(){return x},this.getFoveation=function(){if(d!==null)return d.fixedFoveation;if(f!==null)return f.fixedFoveation},this.setFoveation=function(B){d!==null&&(d.fixedFoveation=B),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=B)};let P=null;function R(B,j){if(c=j.getViewerPose(a),c!==null){let le=c.views;f!==null&&i.bindXRFramebuffer(f.framebuffer);let W=!1;le.length!==x.cameras.length&&(x.cameras.length=0,W=!0);for(let z=0;z<le.length;z++){let D=le[z],K=null;if(f!==null)K=f.getViewport(D);else{let ee=u.getViewSubImage(d,D);i.bindXRFramebuffer(h),ee.depthStencilTexture!==void 0&&t.framebufferTexture2D(36160,36096,3553,ee.depthStencilTexture,0),t.framebufferTexture2D(36160,36064,3553,ee.colorTexture,0),K=ee.viewport}let q=y[z];q.matrix.fromArray(D.transform.matrix),q.projectionMatrix.fromArray(D.projectionMatrix),q.viewport.set(K.x,K.y,K.width,K.height),z===0&&x.matrix.copy(q.matrix),W===!0&&x.cameras.push(q)}}let ne=s.inputSources;for(let le=0;le<p.length;le++){let W=p[le],z=ne[le];W.update(z,j,a)}P&&P(B,j)}let G=new gy;G.setAnimationLoop(R),this.setAnimationLoop=function(B){P=B},this.dispose=function(){}}};function AC(r){function e(g,y){g.fogColor.value.copy(y.color),y.isFog?(g.fogNear.value=y.near,g.fogFar.value=y.far):y.isFogExp2&&(g.fogDensity.value=y.density)}function t(g,y,x,b,w){y.isMeshBasicMaterial?n(g,y):y.isMeshLambertMaterial?(n(g,y),l(g,y)):y.isMeshToonMaterial?(n(g,y),u(g,y)):y.isMeshPhongMaterial?(n(g,y),c(g,y)):y.isMeshStandardMaterial?(n(g,y),y.isMeshPhysicalMaterial?d(g,y,w):h(g,y)):y.isMeshMatcapMaterial?(n(g,y),f(g,y)):y.isMeshDepthMaterial?(n(g,y),p(g,y)):y.isMeshDistanceMaterial?(n(g,y),m(g,y)):y.isMeshNormalMaterial?(n(g,y),v(g,y)):y.isLineBasicMaterial?(i(g,y),y.isLineDashedMaterial&&s(g,y)):y.isPointsMaterial?o(g,y,x,b):y.isSpriteMaterial?a(g,y):y.isShadowMaterial?(g.color.value.copy(y.color),g.opacity.value=y.opacity):y.isShaderMaterial&&(y.uniformsNeedUpdate=!1)}function n(g,y){g.opacity.value=y.opacity,y.color&&g.diffuse.value.copy(y.color),y.emissive&&g.emissive.value.copy(y.emissive).multiplyScalar(y.emissiveIntensity),y.map&&(g.map.value=y.map),y.alphaMap&&(g.alphaMap.value=y.alphaMap),y.specularMap&&(g.specularMap.value=y.specularMap);let x=r.get(y).envMap;if(x){g.envMap.value=x,g.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=y.reflectivity,g.refractionRatio.value=y.refractionRatio;let _=r.get(x).__maxMipLevel;_!==void 0&&(g.maxMipLevel.value=_)}y.lightMap&&(g.lightMap.value=y.lightMap,g.lightMapIntensity.value=y.lightMapIntensity),y.aoMap&&(g.aoMap.value=y.aoMap,g.aoMapIntensity.value=y.aoMapIntensity);let b;y.map?b=y.map:y.specularMap?b=y.specularMap:y.displacementMap?b=y.displacementMap:y.normalMap?b=y.normalMap:y.bumpMap?b=y.bumpMap:y.roughnessMap?b=y.roughnessMap:y.metalnessMap?b=y.metalnessMap:y.alphaMap?b=y.alphaMap:y.emissiveMap?b=y.emissiveMap:y.clearcoatMap?b=y.clearcoatMap:y.clearcoatNormalMap?b=y.clearcoatNormalMap:y.clearcoatRoughnessMap?b=y.clearcoatRoughnessMap:y.specularIntensityMap?b=y.specularIntensityMap:y.specularTintMap&&(b=y.specularTintMap),b!==void 0&&(b.isWebGLRenderTarget&&(b=b.texture),b.matrixAutoUpdate===!0&&b.updateMatrix(),g.uvTransform.value.copy(b.matrix));let w;y.aoMap?w=y.aoMap:y.lightMap&&(w=y.lightMap),w!==void 0&&(w.isWebGLRenderTarget&&(w=w.texture),w.matrixAutoUpdate===!0&&w.updateMatrix(),g.uv2Transform.value.copy(w.matrix))}function i(g,y){g.diffuse.value.copy(y.color),g.opacity.value=y.opacity}function s(g,y){g.dashSize.value=y.dashSize,g.totalSize.value=y.dashSize+y.gapSize,g.scale.value=y.scale}function o(g,y,x,b){g.diffuse.value.copy(y.color),g.opacity.value=y.opacity,g.size.value=y.size*x,g.scale.value=b*.5,y.map&&(g.map.value=y.map),y.alphaMap&&(g.alphaMap.value=y.alphaMap);let w;y.map?w=y.map:y.alphaMap&&(w=y.alphaMap),w!==void 0&&(w.matrixAutoUpdate===!0&&w.updateMatrix(),g.uvTransform.value.copy(w.matrix))}function a(g,y){g.diffuse.value.copy(y.color),g.opacity.value=y.opacity,g.rotation.value=y.rotation,y.map&&(g.map.value=y.map),y.alphaMap&&(g.alphaMap.value=y.alphaMap);let x;y.map?x=y.map:y.alphaMap&&(x=y.alphaMap),x!==void 0&&(x.matrixAutoUpdate===!0&&x.updateMatrix(),g.uvTransform.value.copy(x.matrix))}function l(g,y){y.emissiveMap&&(g.emissiveMap.value=y.emissiveMap)}function c(g,y){g.specular.value.copy(y.specular),g.shininess.value=Math.max(y.shininess,1e-4),y.emissiveMap&&(g.emissiveMap.value=y.emissiveMap),y.bumpMap&&(g.bumpMap.value=y.bumpMap,g.bumpScale.value=y.bumpScale,y.side===kt&&(g.bumpScale.value*=-1)),y.normalMap&&(g.normalMap.value=y.normalMap,g.normalScale.value.copy(y.normalScale),y.side===kt&&g.normalScale.value.negate()),y.displacementMap&&(g.displacementMap.value=y.displacementMap,g.displacementScale.value=y.displacementScale,g.displacementBias.value=y.displacementBias)}function u(g,y){y.gradientMap&&(g.gradientMap.value=y.gradientMap),y.emissiveMap&&(g.emissiveMap.value=y.emissiveMap),y.bumpMap&&(g.bumpMap.value=y.bumpMap,g.bumpScale.value=y.bumpScale,y.side===kt&&(g.bumpScale.value*=-1)),y.normalMap&&(g.normalMap.value=y.normalMap,g.normalScale.value.copy(y.normalScale),y.side===kt&&g.normalScale.value.negate()),y.displacementMap&&(g.displacementMap.value=y.displacementMap,g.displacementScale.value=y.displacementScale,g.displacementBias.value=y.displacementBias)}function h(g,y){g.roughness.value=y.roughness,g.metalness.value=y.metalness,y.roughnessMap&&(g.roughnessMap.value=y.roughnessMap),y.metalnessMap&&(g.metalnessMap.value=y.metalnessMap),y.emissiveMap&&(g.emissiveMap.value=y.emissiveMap),y.bumpMap&&(g.bumpMap.value=y.bumpMap,g.bumpScale.value=y.bumpScale,y.side===kt&&(g.bumpScale.value*=-1)),y.normalMap&&(g.normalMap.value=y.normalMap,g.normalScale.value.copy(y.normalScale),y.side===kt&&g.normalScale.value.negate()),y.displacementMap&&(g.displacementMap.value=y.displacementMap,g.displacementScale.value=y.displacementScale,g.displacementBias.value=y.displacementBias),r.get(y).envMap&&(g.envMapIntensity.value=y.envMapIntensity)}function d(g,y,x){h(g,y),g.reflectivity.value=y.reflectivity,g.clearcoat.value=y.clearcoat,g.clearcoatRoughness.value=y.clearcoatRoughness,y.sheen&&g.sheen.value.copy(y.sheen),y.clearcoatMap&&(g.clearcoatMap.value=y.clearcoatMap),y.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap),y.clearcoatNormalMap&&(g.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),g.clearcoatNormalMap.value=y.clearcoatNormalMap,y.side===kt&&g.clearcoatNormalScale.value.negate()),g.transmission.value=y.transmission,y.transmissionMap&&(g.transmissionMap.value=y.transmissionMap),y.transmission>0&&(g.transmissionSamplerMap.value=x.texture,g.transmissionSamplerSize.value.set(x.width,x.height)),g.thickness.value=y.thickness,y.thicknessMap&&(g.thicknessMap.value=y.thicknessMap),g.attenuationDistance.value=y.attenuationDistance,g.attenuationTint.value.copy(y.attenuationTint),g.specularIntensity.value=y.specularIntensity,g.specularTint.value.copy(y.specularTint),y.specularIntensityMap&&(g.specularIntensityMap.value=y.specularIntensityMap),y.specularTintMap&&(g.specularTintMap.value=y.specularTintMap)}function f(g,y){y.matcap&&(g.matcap.value=y.matcap),y.bumpMap&&(g.bumpMap.value=y.bumpMap,g.bumpScale.value=y.bumpScale,y.side===kt&&(g.bumpScale.value*=-1)),y.normalMap&&(g.normalMap.value=y.normalMap,g.normalScale.value.copy(y.normalScale),y.side===kt&&g.normalScale.value.negate()),y.displacementMap&&(g.displacementMap.value=y.displacementMap,g.displacementScale.value=y.displacementScale,g.displacementBias.value=y.displacementBias)}function p(g,y){y.displacementMap&&(g.displacementMap.value=y.displacementMap,g.displacementScale.value=y.displacementScale,g.displacementBias.value=y.displacementBias)}function m(g,y){y.displacementMap&&(g.displacementMap.value=y.displacementMap,g.displacementScale.value=y.displacementScale,g.displacementBias.value=y.displacementBias),g.referencePosition.value.copy(y.referencePosition),g.nearDistance.value=y.nearDistance,g.farDistance.value=y.farDistance}function v(g,y){y.bumpMap&&(g.bumpMap.value=y.bumpMap,g.bumpScale.value=y.bumpScale,y.side===kt&&(g.bumpScale.value*=-1)),y.normalMap&&(g.normalMap.value=y.normalMap,g.normalScale.value.copy(y.normalScale),y.side===kt&&g.normalScale.value.negate()),y.displacementMap&&(g.displacementMap.value=y.displacementMap,g.displacementScale.value=y.displacementScale,g.displacementBias.value=y.displacementBias)}return{refreshFogUniforms:e,refreshMaterialUniforms:t}}function _C(){let r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return r.style.display="block",r}function wt(r={}){let e=r.canvas!==void 0?r.canvas:_C(),t=r.context!==void 0?r.context:null,n=r.alpha!==void 0?r.alpha:!1,i=r.depth!==void 0?r.depth:!0,s=r.stencil!==void 0?r.stencil:!0,o=r.antialias!==void 0?r.antialias:!1,a=r.premultipliedAlpha!==void 0?r.premultipliedAlpha:!0,l=r.preserveDrawingBuffer!==void 0?r.preserveDrawingBuffer:!1,c=r.powerPreference!==void 0?r.powerPreference:"default",u=r.failIfMajorPerformanceCaveat!==void 0?r.failIfMajorPerformanceCaveat:!1,h=null,d=null,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=ln,this.physicallyCorrectLights=!1,this.toneMapping=Hs,this.toneMappingExposure=1;let m=this,v=!1,g=0,y=0,x=null,b=-1,w=null,_=new Qe,S=new Qe,A=null,T=e.width,L=e.height,C=1,U=null,P=null,R=new Qe(0,0,T,L),G=new Qe(0,0,T,L),B=!1,j=[],ne=new Vl,le=!1,W=!1,z=null,D=new me,K=new M,q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ee(){return x===null?C:1}let V=t;function de(I,oe){for(let k=0;k<I.length;k++){let Z=I[k],ue=e.getContext(Z,oe);if(ue!==null)return ue}return null}try{let I={alpha:n,depth:i,stencil:s,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u};if(e.addEventListener("webglcontextlost",ht,!1),e.addEventListener("webglcontextrestored",ft,!1),V===null){let oe=["webgl2","webgl","experimental-webgl"];if(m.isWebGL1Renderer===!0&&oe.shift(),V=de(oe,I),V===null)throw de(oe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}V.getShaderPrecisionFormat===void 0&&(V.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(I){throw console.error("THREE.WebGLRenderer: "+I.message),I}let ae,te,X,se,$,H,Q,ce,ie,N,E,Y,re,ye,pe,Ie,ve,Fe,Ce,J,xe,he,Ne;function Be(){ae=new YE(V),te=new kE(V,ae,r),ae.init(te),he=new SC(V,ae,te),X=new bC(V,ae,te),j[0]=1029,se=new ZE(V),$=new cC,H=new wC(V,ae,X,$,te,he,se),Q=new HE(m),ce=new qE(m),ie=new g1(V,te),Ne=new GE(V,ae,ie,te),N=new KE(V,ie,se,Ne),E=new nN(V,N,ie,se),Ce=new tN(V),Ie=new VE($),Y=new lC(m,Q,ce,ae,te,Ne,Ie),re=new AC($),ye=new hC($),pe=new yC(ae,te),Fe=new zE(m,Q,X,E,a),ve=new Yy(m,E,te),J=new UE(V,ae,se,te),xe=new QE(V,ae,se,te),se.programs=Y.programs,m.capabilities=te,m.extensions=ae,m.properties=$,m.renderLists=ye,m.shadowMap=ve,m.state=X,m.info=se}Be();let ke=new Ky(m,V);this.xr=ke,this.getContext=function(){return V},this.getContextAttributes=function(){return V.getContextAttributes()},this.forceContextLoss=function(){let I=ae.get("WEBGL_lose_context");I&&I.loseContext()},this.forceContextRestore=function(){let I=ae.get("WEBGL_lose_context");I&&I.restoreContext()},this.getPixelRatio=function(){return C},this.setPixelRatio=function(I){I!==void 0&&(C=I,this.setSize(T,L,!1))},this.getSize=function(I){return I.set(T,L)},this.setSize=function(I,oe,k){if(ke.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}T=I,L=oe,e.width=Math.floor(I*C),e.height=Math.floor(oe*C),k!==!1&&(e.style.width=I+"px",e.style.height=oe+"px"),this.setViewport(0,0,I,oe)},this.getDrawingBufferSize=function(I){return I.set(T*C,L*C).floor()},this.setDrawingBufferSize=function(I,oe,k){T=I,L=oe,C=k,e.width=Math.floor(I*k),e.height=Math.floor(oe*k),this.setViewport(0,0,I,oe)},this.getCurrentViewport=function(I){return I.copy(_)},this.getViewport=function(I){return I.copy(R)},this.setViewport=function(I,oe,k,Z){I.isVector4?R.set(I.x,I.y,I.z,I.w):R.set(I,oe,k,Z),X.viewport(_.copy(R).multiplyScalar(C).floor())},this.getScissor=function(I){return I.copy(G)},this.setScissor=function(I,oe,k,Z){I.isVector4?G.set(I.x,I.y,I.z,I.w):G.set(I,oe,k,Z),X.scissor(S.copy(G).multiplyScalar(C).floor())},this.getScissorTest=function(){return B},this.setScissorTest=function(I){X.setScissorTest(B=I)},this.setOpaqueSort=function(I){U=I},this.setTransparentSort=function(I){P=I},this.getClearColor=function(I){return I.copy(Fe.getClearColor())},this.setClearColor=function(){Fe.setClearColor.apply(Fe,arguments)},this.getClearAlpha=function(){return Fe.getClearAlpha()},this.setClearAlpha=function(){Fe.setClearAlpha.apply(Fe,arguments)},this.clear=function(I,oe,k){let Z=0;(I===void 0||I)&&(Z|=16384),(oe===void 0||oe)&&(Z|=256),(k===void 0||k)&&(Z|=1024),V.clear(Z)},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",ht,!1),e.removeEventListener("webglcontextrestored",ft,!1),ye.dispose(),pe.dispose(),$.dispose(),Q.dispose(),ce.dispose(),E.dispose(),Ne.dispose(),ke.dispose(),ke.removeEventListener("sessionstart",xn),ke.removeEventListener("sessionend",F),z&&(z.dispose(),z=null),Pe.stop()};function ht(I){I.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),v=!0}function ft(){console.log("THREE.WebGLRenderer: Context Restored."),v=!1;let I=se.autoReset,oe=ve.enabled,k=ve.autoUpdate,Z=ve.needsUpdate,ue=ve.type;Be(),se.autoReset=I,ve.enabled=oe,ve.autoUpdate=k,ve.needsUpdate=Z,ve.type=ue}function Bn(I){let oe=I.target;oe.removeEventListener("dispose",Bn),Mt(oe)}function Mt(I){Tn(I),$.remove(I)}function Tn(I){let oe=$.get(I).programs;oe!==void 0&&oe.forEach(function(k){Y.releaseProgram(k)})}function En(I,oe){I.render(function(k){m.renderBufferImmediate(k,oe)})}this.renderBufferImmediate=function(I,oe){Ne.initAttributes();let k=$.get(I);I.hasPositions&&!k.position&&(k.position=V.createBuffer()),I.hasNormals&&!k.normal&&(k.normal=V.createBuffer()),I.hasUvs&&!k.uv&&(k.uv=V.createBuffer()),I.hasColors&&!k.color&&(k.color=V.createBuffer());let Z=oe.getAttributes();I.hasPositions&&(V.bindBuffer(34962,k.position),V.bufferData(34962,I.positionArray,35048),Ne.enableAttribute(Z.position),V.vertexAttribPointer(Z.position,3,5126,!1,0,0)),I.hasNormals&&(V.bindBuffer(34962,k.normal),V.bufferData(34962,I.normalArray,35048),Ne.enableAttribute(Z.normal),V.vertexAttribPointer(Z.normal,3,5126,!1,0,0)),I.hasUvs&&(V.bindBuffer(34962,k.uv),V.bufferData(34962,I.uvArray,35048),Ne.enableAttribute(Z.uv),V.vertexAttribPointer(Z.uv,2,5126,!1,0,0)),I.hasColors&&(V.bindBuffer(34962,k.color),V.bufferData(34962,I.colorArray,35048),Ne.enableAttribute(Z.color),V.vertexAttribPointer(Z.color,3,5126,!1,0,0)),Ne.disableUnusedAttributes(),V.drawArrays(4,0,I.count),I.count=0},this.renderBufferDirect=function(I,oe,k,Z,ue,Me){oe===null&&(oe=q);let _e=ue.isMesh&&ue.matrixWorld.determinant()<0,Se=Il(I,oe,Z,ue);X.setMaterial(Z,_e);let De=k.index,Ve=k.attributes.position;if(De===null){if(Ve===void 0||Ve.count===0)return}else if(De.count===0)return;let Oe=1;Z.wireframe===!0&&(De=N.getWireframeAttribute(k),Oe=2),(k.morphAttributes.position!==void 0||k.morphAttributes.normal!==void 0)&&Ce.update(ue,k,Z,Se),Ne.setup(ue,Z,Se,k,De);let He,Ge=J;De!==null&&(He=ie.get(De),Ge=xe,Ge.setIndex(He));let Kt=De!==null?De.count:Ve.count,vt=k.drawRange.start*Oe,bn=k.drawRange.count*Oe,wn=Me!==null?Me.start*Oe:0,Ri=Me!==null?Me.count*Oe:1/0,Bi=Math.max(vt,wn),Qt=Math.min(Kt,vt+bn,wn+Ri)-1,Mi=Math.max(0,Qt-Bi+1);if(Mi!==0){if(ue.isMesh)Z.wireframe===!0?(X.setLineWidth(Z.wireframeLinewidth*ee()),Ge.setMode(1)):Ge.setMode(4);else if(ue.isLine){let Sn=Z.linewidth;Sn===void 0&&(Sn=1),X.setLineWidth(Sn*ee()),ue.isLineSegments?Ge.setMode(1):ue.isLineLoop?Ge.setMode(2):Ge.setMode(3)}else ue.isPoints?Ge.setMode(0):ue.isSprite&&Ge.setMode(4);if(ue.isInstancedMesh)Ge.renderInstances(Bi,Mi,ue.count);else if(k.isInstancedBufferGeometry){let Sn=Math.min(k.instanceCount,k._maxInstanceCount);Ge.renderInstances(Bi,Mi,Sn)}else Ge.render(Bi,Mi)}},this.compile=function(I,oe){d=pe.get(I),d.init(),p.push(d),I.traverseVisible(function(k){k.isLight&&k.layers.test(oe.layers)&&(d.pushLight(k),k.castShadow&&d.pushShadow(k))}),d.setupLights(),I.traverse(function(k){let Z=k.material;if(Z)if(Array.isArray(Z))for(let ue=0;ue<Z.length;ue++){let Me=Z[ue];sr(Me,I,k)}else sr(Z,I,k)}),p.pop(),d=null};let Di=null;function _r(I){Di&&Di(I)}function xn(){Pe.stop()}function F(){Pe.start()}let Pe=new gy;Pe.setAnimationLoop(_r),typeof window!="undefined"&&Pe.setContext(window),this.setAnimationLoop=function(I){Di=I,ke.setAnimationLoop(I),I===null?Pe.stop():Pe.start()},ke.addEventListener("sessionstart",xn),ke.addEventListener("sessionend",F),this.render=function(I,oe){if(oe!==void 0&&oe.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;I.autoUpdate===!0&&I.updateMatrixWorld(),oe.parent===null&&oe.updateMatrixWorld(),ke.enabled===!0&&ke.isPresenting===!0&&(ke.cameraAutoUpdate===!0&&ke.updateCamera(oe),oe=ke.getCamera()),I.isScene===!0&&I.onBeforeRender(m,I,oe,x),d=pe.get(I,p.length),d.init(),p.push(d),D.multiplyMatrices(oe.projectionMatrix,oe.matrixWorldInverse),ne.setFromProjectionMatrix(D),W=this.localClippingEnabled,le=Ie.init(this.clippingPlanes,W,oe),h=ye.get(I,f.length),h.init(),f.push(h),et(I,oe,0,m.sortObjects),h.finish(),m.sortObjects===!0&&h.sort(U,P),le===!0&&Ie.beginShadows();let k=d.state.shadowsArray;ve.render(k,I,oe),d.setupLights(),d.setupLightsView(oe),le===!0&&Ie.endShadows(),this.info.autoReset===!0&&this.info.reset(),Fe.render(h,I);let Z=h.opaque,ue=h.transmissive,Me=h.transparent;Z.length>0&&Nn(Z,I,oe),ue.length>0&&Ft(Z,ue,I,oe),Me.length>0&&Nn(Me,I,oe),x!==null&&(H.updateMultisampleRenderTarget(x),H.updateRenderTargetMipmap(x)),I.isScene===!0&&I.onAfterRender(m,I,oe),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1),Ne.resetDefaultState(),b=-1,w=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 et(I,oe,k,Z){if(I.visible===!1)return;if(I.layers.test(oe.layers)){if(I.isGroup)k=I.renderOrder;else if(I.isLOD)I.autoUpdate===!0&&I.update(oe);else if(I.isLight)d.pushLight(I),I.castShadow&&d.pushShadow(I);else if(I.isSprite){if(!I.frustumCulled||ne.intersectsSprite(I)){Z&&K.setFromMatrixPosition(I.matrixWorld).applyMatrix4(D);let _e=E.update(I),Se=I.material;Se.visible&&h.push(I,_e,Se,k,K.z,null)}}else if(I.isImmediateRenderObject)Z&&K.setFromMatrixPosition(I.matrixWorld).applyMatrix4(D),h.push(I,null,I.material,k,K.z,null);else if((I.isMesh||I.isLine||I.isPoints)&&(I.isSkinnedMesh&&I.skeleton.frame!==se.render.frame&&(I.skeleton.update(),I.skeleton.frame=se.render.frame),!I.frustumCulled||ne.intersectsObject(I))){Z&&K.setFromMatrixPosition(I.matrixWorld).applyMatrix4(D);let _e=E.update(I),Se=I.material;if(Array.isArray(Se)){let De=_e.groups;for(let Ve=0,Oe=De.length;Ve<Oe;Ve++){let He=De[Ve],Ge=Se[He.materialIndex];Ge&&Ge.visible&&h.push(I,_e,Ge,k,K.z,He)}}else Se.visible&&h.push(I,_e,Se,k,K.z,null)}}let Me=I.children;for(let _e=0,Se=Me.length;_e<Se;_e++)et(Me[_e],oe,k,Z)}function Ft(I,oe,k,Z){if(z===null){let Se=o===!0&&te.isWebGL2===!0?Zr:bt;z=new Se(1024,1024,{generateMipmaps:!0,type:he.convert(Jo)!==null?Jo:At,minFilter:Ai,magFilter:Pt,wrapS:Zt,wrapT:Zt})}let ue=m.getRenderTarget();m.setRenderTarget(z),m.clear();let Me=m.toneMapping;m.toneMapping=Hs,Nn(I,k,Z),m.toneMapping=Me,H.updateMultisampleRenderTarget(z),H.updateRenderTargetMipmap(z),m.setRenderTarget(ue),Nn(oe,k,Z)}function Nn(I,oe,k){let Z=oe.isScene===!0?oe.overrideMaterial:null;if(k.isArrayCamera){let ue=k.cameras;for(let Me=0,_e=ue.length;Me<_e;Me++){let Se=ue[Me];X.viewport(_.copy(Se.viewport)),d.setupLightsView(Se);for(let De=0,Ve=I.length;De<Ve;De++){let Oe=I[De],He=Oe.object,Ge=Oe.geometry,Kt=Z===null?Oe.material:Z,vt=Oe.group;He.layers.test(Se.layers)&&Gs(He,oe,Se,Ge,Kt,vt)}}}else for(let ue=0,Me=I.length;ue<Me;ue++){let _e=I[ue],Se=_e.object,De=_e.geometry,Ve=Z===null?_e.material:Z,Oe=_e.group;Gs(Se,oe,k,De,Ve,Oe)}}function Gs(I,oe,k,Z,ue,Me){if(I.onBeforeRender(m,oe,k,Z,ue,Me),I.modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,I.matrixWorld),I.normalMatrix.getNormalMatrix(I.modelViewMatrix),I.isImmediateRenderObject){let _e=Il(k,oe,ue,I);X.setMaterial(ue),Ne.reset(),En(I,_e)}else ue.transparent===!0&&ue.side===Xt?(ue.side=kt,ue.needsUpdate=!0,m.renderBufferDirect(k,oe,Z,ue,I,Me),ue.side=Oi,ue.needsUpdate=!0,m.renderBufferDirect(k,oe,Z,ue,I,Me),ue.side=Xt):m.renderBufferDirect(k,oe,Z,ue,I,Me);I.onAfterRender(m,oe,k,Z,ue,Me)}function sr(I,oe,k){oe.isScene!==!0&&(oe=q);let Z=$.get(I),ue=d.state.lights,Me=d.state.shadowsArray,_e=ue.state.version,Se=Y.getParameters(I,ue.state,Me,oe,k),De=Y.getProgramCacheKey(Se),Ve=Z.programs;Z.environment=I.isMeshStandardMaterial?oe.environment:null,Z.fog=oe.fog,Z.envMap=(I.isMeshStandardMaterial?ce:Q).get(I.envMap||Z.environment),Ve===void 0&&(I.addEventListener("dispose",Bn),Ve=new Map,Z.programs=Ve);let Oe=Ve.get(De);if(Oe!==void 0){if(Z.currentProgram===Oe&&Z.lightsStateVersion===_e)return Ll(I,Se),Oe}else Se.uniforms=Y.getUniforms(I),I.onBuild(Se,m),I.onBeforeCompile(Se,m),Oe=Y.acquireProgram(Se,De),Ve.set(De,Oe),Z.uniforms=Se.uniforms;let He=Z.uniforms;(!I.isShaderMaterial&&!I.isRawShaderMaterial||I.clipping===!0)&&(He.clippingPlanes=Ie.uniform),Ll(I,Se),Z.needsLights=gu(I),Z.lightsStateVersion=_e,Z.needsLights&&(He.ambientLightColor.value=ue.state.ambient,He.lightProbe.value=ue.state.probe,He.directionalLights.value=ue.state.directional,He.directionalLightShadows.value=ue.state.directionalShadow,He.spotLights.value=ue.state.spot,He.spotLightShadows.value=ue.state.spotShadow,He.rectAreaLights.value=ue.state.rectArea,He.ltc_1.value=ue.state.rectAreaLTC1,He.ltc_2.value=ue.state.rectAreaLTC2,He.pointLights.value=ue.state.point,He.pointLightShadows.value=ue.state.pointShadow,He.hemisphereLights.value=ue.state.hemi,He.directionalShadowMap.value=ue.state.directionalShadowMap,He.directionalShadowMatrix.value=ue.state.directionalShadowMatrix,He.spotShadowMap.value=ue.state.spotShadowMap,He.spotShadowMatrix.value=ue.state.spotShadowMatrix,He.pointShadowMap.value=ue.state.pointShadowMap,He.pointShadowMatrix.value=ue.state.pointShadowMatrix);let Ge=Oe.getUniforms(),Kt=us.seqWithValue(Ge.seq,He);return Z.currentProgram=Oe,Z.uniformsList=Kt,Oe}function Ll(I,oe){let k=$.get(I);k.outputEncoding=oe.outputEncoding,k.instancing=oe.instancing,k.skinning=oe.skinning,k.morphTargets=oe.morphTargets,k.morphNormals=oe.morphNormals,k.numClippingPlanes=oe.numClippingPlanes,k.numIntersection=oe.numClipIntersection,k.vertexAlphas=oe.vertexAlphas,k.vertexTangents=oe.vertexTangents}function Il(I,oe,k,Z){oe.isScene!==!0&&(oe=q),H.resetTextureUnits();let ue=oe.fog,Me=k.isMeshStandardMaterial?oe.environment:null,_e=x===null?m.outputEncoding:x.texture.encoding,Se=(k.isMeshStandardMaterial?ce:Q).get(k.envMap||Me),De=k.vertexColors===!0&&!!Z.geometry&&!!Z.geometry.attributes.color&&Z.geometry.attributes.color.itemSize===4,Ve=!!Z.geometry&&!!Z.geometry.attributes.tangent,Oe=!!Z.geometry&&!!Z.geometry.morphAttributes.position,He=!!Z.geometry&&!!Z.geometry.morphAttributes.normal,Ge=$.get(k),Kt=d.state.lights;if(le===!0&&(W===!0||I!==w)){let Sn=I===w&&k.id===b;Ie.setState(k,I,Sn)}let vt=!1;k.version===Ge.__version?(Ge.needsLights&&Ge.lightsStateVersion!==Kt.state.version||Ge.outputEncoding!==_e||Z.isInstancedMesh&&Ge.instancing===!1||!Z.isInstancedMesh&&Ge.instancing===!0||Z.isSkinnedMesh&&Ge.skinning===!1||!Z.isSkinnedMesh&&Ge.skinning===!0||Ge.envMap!==Se||k.fog&&Ge.fog!==ue||Ge.numClippingPlanes!==void 0&&(Ge.numClippingPlanes!==Ie.numPlanes||Ge.numIntersection!==Ie.numIntersection)||Ge.vertexAlphas!==De||Ge.vertexTangents!==Ve||Ge.morphTargets!==Oe||Ge.morphNormals!==He)&&(vt=!0):(vt=!0,Ge.__version=k.version);let bn=Ge.currentProgram;vt===!0&&(bn=sr(k,oe,Z));let wn=!1,Ri=!1,Bi=!1,Qt=bn.getUniforms(),Mi=Ge.uniforms;if(X.useProgram(bn.program)&&(wn=!0,Ri=!0,Bi=!0),k.id!==b&&(b=k.id,Ri=!0),wn||w!==I){if(Qt.setValue(V,"projectionMatrix",I.projectionMatrix),te.logarithmicDepthBuffer&&Qt.setValue(V,"logDepthBufFC",2/(Math.log(I.far+1)/Math.LN2)),w!==I&&(w=I,Ri=!0,Bi=!0),k.isShaderMaterial||k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshStandardMaterial||k.envMap){let Sn=Qt.map.cameraPosition;Sn!==void 0&&Sn.setValue(V,K.setFromMatrixPosition(I.matrixWorld))}(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial)&&Qt.setValue(V,"isOrthographic",I.isOrthographicCamera===!0),(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial||k.isShadowMaterial||Z.isSkinnedMesh)&&Qt.setValue(V,"viewMatrix",I.matrixWorldInverse)}if(Z.isSkinnedMesh){Qt.setOptional(V,Z,"bindMatrix"),Qt.setOptional(V,Z,"bindMatrixInverse");let Sn=Z.skeleton;Sn&&(te.floatVertexTextures?(Sn.boneTexture===null&&Sn.computeBoneTexture(),Qt.setValue(V,"boneTexture",Sn.boneTexture,H),Qt.setValue(V,"boneTextureSize",Sn.boneTextureSize)):Qt.setOptional(V,Sn,"boneMatrices"))}return(Ri||Ge.receiveShadow!==Z.receiveShadow)&&(Ge.receiveShadow=Z.receiveShadow,Qt.setValue(V,"receiveShadow",Z.receiveShadow)),Ri&&(Qt.setValue(V,"toneMappingExposure",m.toneMappingExposure),Ge.needsLights&&mu(Mi,Bi),ue&&k.fog&&re.refreshFogUniforms(Mi,ue),re.refreshMaterialUniforms(Mi,k,C,L,z),us.upload(V,Ge.uniformsList,Mi,H)),k.isShaderMaterial&&k.uniformsNeedUpdate===!0&&(us.upload(V,Ge.uniformsList,Mi,H),k.uniformsNeedUpdate=!1),k.isSpriteMaterial&&Qt.setValue(V,"center",Z.center),Qt.setValue(V,"modelViewMatrix",Z.modelViewMatrix),Qt.setValue(V,"normalMatrix",Z.normalMatrix),Qt.setValue(V,"modelMatrix",Z.matrixWorld),bn}function mu(I,oe){I.ambientLightColor.needsUpdate=oe,I.lightProbe.needsUpdate=oe,I.directionalLights.needsUpdate=oe,I.directionalLightShadows.needsUpdate=oe,I.pointLights.needsUpdate=oe,I.pointLightShadows.needsUpdate=oe,I.spotLights.needsUpdate=oe,I.spotLightShadows.needsUpdate=oe,I.rectAreaLights.needsUpdate=oe,I.hemisphereLights.needsUpdate=oe}function gu(I){return I.isMeshLambertMaterial||I.isMeshToonMaterial||I.isMeshPhongMaterial||I.isMeshStandardMaterial||I.isShadowMaterial||I.isShaderMaterial&&I.lights===!0}this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return x},this.setRenderTarget=function(I,oe=0,k=0){x=I,g=oe,y=k,I&&$.get(I).__webglFramebuffer===void 0&&H.setupRenderTarget(I);let Z=null,ue=!1,Me=!1;if(I){let Se=I.texture;(Se.isDataTexture3D||Se.isDataTexture2DArray)&&(Me=!0);let De=$.get(I).__webglFramebuffer;I.isWebGLCubeRenderTarget?(Z=De[oe],ue=!0):I.isWebGLMultisampleRenderTarget?Z=$.get(I).__webglMultisampledFramebuffer:Z=De,_.copy(I.viewport),S.copy(I.scissor),A=I.scissorTest}else _.copy(R).multiplyScalar(C).floor(),S.copy(G).multiplyScalar(C).floor(),A=B;if(X.bindFramebuffer(36160,Z)&&te.drawBuffers){let Se=!1;if(I)if(I.isWebGLMultipleRenderTargets){let De=I.texture;if(j.length!==De.length||j[0]!==36064){for(let Ve=0,Oe=De.length;Ve<Oe;Ve++)j[Ve]=36064+Ve;j.length=De.length,Se=!0}}else(j.length!==1||j[0]!==36064)&&(j[0]=36064,j.length=1,Se=!0);else(j.length!==1||j[0]!==1029)&&(j[0]=1029,j.length=1,Se=!0);Se&&(te.isWebGL2?V.drawBuffers(j):ae.get("WEBGL_draw_buffers").drawBuffersWEBGL(j))}if(X.viewport(_),X.scissor(S),X.setScissorTest(A),ue){let Se=$.get(I.texture);V.framebufferTexture2D(36160,36064,34069+oe,Se.__webglTexture,k)}else if(Me){let Se=$.get(I.texture),De=oe||0;V.framebufferTextureLayer(36160,36064,Se.__webglTexture,k||0,De)}},this.readRenderTargetPixels=function(I,oe,k,Z,ue,Me,_e){if(!(I&&I.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Se=$.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&_e!==void 0&&(Se=Se[_e]),Se){X.bindFramebuffer(36160,Se);try{let De=I.texture,Ve=De.format,Oe=De.type;if(Ve!==zt&&he.convert(Ve)!==V.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let He=Oe===Jo&&(ae.has("EXT_color_buffer_half_float")||te.isWebGL2&&ae.has("EXT_color_buffer_float"));if(Oe!==At&&he.convert(Oe)!==V.getParameter(35738)&&!(Oe===Tr&&(te.isWebGL2||ae.has("OES_texture_float")||ae.has("WEBGL_color_buffer_float")))&&!He){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}V.checkFramebufferStatus(36160)===36053?oe>=0&&oe<=I.width-Z&&k>=0&&k<=I.height-ue&&V.readPixels(oe,k,Z,ue,he.convert(Ve),he.convert(Oe),Me):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{let De=x!==null?$.get(x).__webglFramebuffer:null;X.bindFramebuffer(36160,De)}}},this.copyFramebufferToTexture=function(I,oe,k=0){let Z=Math.pow(2,-k),ue=Math.floor(oe.image.width*Z),Me=Math.floor(oe.image.height*Z),_e=he.convert(oe.format);te.isWebGL2&&(_e===6407&&(_e=32849),_e===6408&&(_e=32856)),H.setTexture2D(oe,0),V.copyTexImage2D(3553,k,_e,I.x,I.y,ue,Me,0),X.unbindTexture()},this.copyTextureToTexture=function(I,oe,k,Z=0){let ue=oe.image.width,Me=oe.image.height,_e=he.convert(k.format),Se=he.convert(k.type);H.setTexture2D(k,0),V.pixelStorei(37440,k.flipY),V.pixelStorei(37441,k.premultiplyAlpha),V.pixelStorei(3317,k.unpackAlignment),oe.isDataTexture?V.texSubImage2D(3553,Z,I.x,I.y,ue,Me,_e,Se,oe.image.data):oe.isCompressedTexture?V.compressedTexSubImage2D(3553,Z,I.x,I.y,oe.mipmaps[0].width,oe.mipmaps[0].height,_e,oe.mipmaps[0].data):V.texSubImage2D(3553,Z,I.x,I.y,_e,Se,oe.image),Z===0&&k.generateMipmaps&&V.generateMipmap(3553),X.unbindTexture()},this.copyTextureToTexture3D=function(I,oe,k,Z,ue=0){if(m.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Me=I.max.x-I.min.x+1,_e=I.max.y-I.min.y+1,Se=I.max.z-I.min.z+1,De=he.convert(Z.format),Ve=he.convert(Z.type),Oe;if(Z.isDataTexture3D)H.setTexture3D(Z,0),Oe=32879;else if(Z.isDataTexture2DArray)H.setTexture2DArray(Z,0),Oe=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}V.pixelStorei(37440,Z.flipY),V.pixelStorei(37441,Z.premultiplyAlpha),V.pixelStorei(3317,Z.unpackAlignment);let He=V.getParameter(3314),Ge=V.getParameter(32878),Kt=V.getParameter(3316),vt=V.getParameter(3315),bn=V.getParameter(32877),wn=k.isCompressedTexture?k.mipmaps[0]:k.image;V.pixelStorei(3314,wn.width),V.pixelStorei(32878,wn.height),V.pixelStorei(3316,I.min.x),V.pixelStorei(3315,I.min.y),V.pixelStorei(32877,I.min.z),k.isDataTexture||k.isDataTexture3D?V.texSubImage3D(Oe,ue,oe.x,oe.y,oe.z,Me,_e,Se,De,Ve,wn.data):k.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),V.compressedTexSubImage3D(Oe,ue,oe.x,oe.y,oe.z,Me,_e,Se,De,wn.data)):V.texSubImage3D(Oe,ue,oe.x,oe.y,oe.z,Me,_e,Se,De,Ve,wn),V.pixelStorei(3314,He),V.pixelStorei(32878,Ge),V.pixelStorei(3316,Kt),V.pixelStorei(3315,vt),V.pixelStorei(32877,bn),ue===0&&Z.generateMipmaps&&V.generateMipmap(Oe),X.unbindTexture()},this.initTexture=function(I){H.setTexture2D(I,0),X.unbindTexture()},this.resetState=function(){g=0,y=0,x=null,X.reset(),Ne.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}var Qy=class extends wt{};Qy.prototype.isWebGL1Renderer=!0;var io=class{constructor(e,t=25e-5){this.name="",this.color=new fe(e),this.density=t}clone(){return new io(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}};io.prototype.isFogExp2=!0;var hs=class{constructor(e,t=1,n=1e3){this.name="",this.color=new fe(e),this.near=t,this.far=n}clone(){return new hs(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}};hs.prototype.isFog=!0;var An=class extends Ke{constructor(){super();this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__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){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}};An.prototype.isScene=!0;var Vi=class{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Bl,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=fi()}onUploadCallback(){}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,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];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=fi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}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=fi()),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;var rn=new M,Ti=class{constructor(e,t,n,i=!1){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i===!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,n=this.data.count;t<n;t++)rn.x=this.getX(t),rn.y=this.getY(t),rn.z=this.getZ(t),rn.applyMatrix4(e),this.setXYZ(t,rn.x,rn.y,rn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)rn.x=this.getX(t),rn.y=this.getY(t),rn.z=this.getZ(t),rn.applyNormalMatrix(e),this.setXYZ(t,rn.x,rn.y,rn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)rn.x=this.getX(t),rn.y=this.getY(t),rn.z=this.getZ(t),rn.transformDirection(e),this.setXYZ(t,rn.x,rn.y,rn.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,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new Re(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 Ti(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.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}};Ti.prototype.isInterleavedBufferAttribute=!0;var Zu=class extends nn{constructor(e){super();this.type="SpriteMaterial",this.color=new fe(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}};Zu.prototype.isSpriteMaterial=!0;var xa,Wl=new M,ba=new M,wa=new M,Sa=new O,Jl=new O,Zy=new me,$u=new M,Xl=new M,eh=new M,$y=new O,Uf=new O,ev=new O,kf=class extends Ke{constructor(e){super();if(this.type="Sprite",xa===void 0){xa=new we;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Vi(t,5);xa.setIndex([0,1,2,0,2,3]),xa.setAttribute("position",new Ti(n,3,0,!1)),xa.setAttribute("uv",new Ti(n,2,3,!1))}this.geometry=xa,this.material=e!==void 0?e:new Zu,this.center=new O(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ba.setFromMatrixScale(this.matrixWorld),Zy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),wa.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&ba.multiplyScalar(-wa.z);let n=this.material.rotation,i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));let o=this.center;th($u.set(-.5,-.5,0),wa,o,ba,i,s),th(Xl.set(.5,-.5,0),wa,o,ba,i,s),th(eh.set(.5,.5,0),wa,o,ba,i,s),$y.set(0,0),Uf.set(1,0),ev.set(1,1);let a=e.ray.intersectTriangle($u,Xl,eh,!1,Wl);if(a===null&&(th(Xl.set(-.5,.5,0),wa,o,ba,i,s),Uf.set(0,1),a=e.ray.intersectTriangle($u,eh,Xl,!1,Wl),a===null))return;let l=e.ray.origin.distanceTo(Wl);l<e.near||l>e.far||t.push({distance:l,point:Wl.clone(),uv:qt.getUV(Wl,$u,Xl,eh,$y,Uf,ev,new O),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};kf.prototype.isSprite=!0;function th(r,e,t,n,i,s){Sa.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(Jl.x=s*Sa.x-i*Sa.y,Jl.y=i*Sa.x+s*Sa.y):Jl.copy(Sa),r.copy(e),r.x+=Jl.x,r.y+=Jl.y,r.applyMatrix4(Zy)}var nh=new M,tv=new M,nv=class extends Ke{constructor(){super();this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);let t=e.levels;for(let n=0,i=t.length;n<i;n++){let s=t[n];this.addLevel(s.object.clone(),s.distance)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0){t=Math.abs(t);let n=this.levels,i;for(i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){let t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){nh.setFromMatrixPosition(this.matrixWorld);let i=e.ray.origin.distanceTo(nh);this.getObjectForDistance(i).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){nh.setFromMatrixPosition(e.matrixWorld),tv.setFromMatrixPosition(this.matrixWorld);let n=nh.distanceTo(tv)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){let t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];let n=this.levels;for(let i=0,s=n.length;i<s;i++){let o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance})}return t}},iv=new M,rv=new Qe,sv=new Qe,TC=new M,ov=new me,Ma=class extends gt{constructor(e,t){super(e,t);this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new me,this.bindMatrixInverse=new me}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(){let e=new Qe,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);let s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,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){let n=this.skeleton,i=this.geometry;rv.fromBufferAttribute(i.attributes.skinIndex,e),sv.fromBufferAttribute(i.attributes.skinWeight,e),iv.fromBufferAttribute(i.attributes.position,e).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){let o=sv.getComponent(s);if(o!==0){let a=rv.getComponent(s);ov.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(TC.copy(iv).applyMatrix4(ov),o)}}return t.applyMatrix4(this.bindMatrixInverse)}};Ma.prototype.isSkinnedMesh=!0;var Aa=class extends Ke{constructor(){super();this.type="Bone"}};Aa.prototype.isBone=!0;var ro=class extends xt{constructor(e=null,t=1,n=1,i,s,o,a,l,c=Pt,u=Pt,h,d){super(null,o,a,l,c,u,i,s,h,d);this.image={data:e,width:t,height:n},this.magFilter=c,this.minFilter=u,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}};ro.prototype.isDataTexture=!0;var av=new me,EC=new me,_a=class{constructor(e=[],t=[]){this.uuid=fi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){let 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 n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new me)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let n=new me;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,o=e.length;s<o;s++){let a=e[s]?e[s].matrixWorld:EC;av.multiplyMatrices(a,t[s]),av.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new _a(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=$g(e),e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new ro(t,e,e,zt,Tr);return this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){let s=e.bones[n],o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new Aa),this.bones.push(o),this.boneInverses.push(new me().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){let o=t[i];e.bones.push(o.uuid);let a=n[i];e.boneInverses.push(a.toArray())}return e}},lv=new me,cv=new me,ih=[],ql=new gt,Vf=class extends gt{constructor(e,t,n){super(e,t);this.instanceMatrix=new Re(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,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){let n=this.matrixWorld,i=this.count;if(ql.geometry=this.geometry,ql.material=this.material,ql.material!==void 0)for(let s=0;s<i;s++){this.getMatrixAt(s,lv),cv.multiplyMatrices(n,lv),ql.matrixWorld=cv,ql.raycast(e,ih);for(let o=0,a=ih.length;o<a;o++){let l=ih[o];l.instanceId=s,l.object=this,t.push(l)}ih.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Re(new Float32Array(this.instanceMatrix.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"})}};Vf.prototype.isInstancedMesh=!0;var Gn=class extends nn{constructor(e){super();this.type="LineBasicMaterial",this.color=new fe(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",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}};Gn.prototype.isLineBasicMaterial=!0;var uv=new M,hv=new M,dv=new me,Hf=new or,rh=new ti,Hi=class extends Ke{constructor(e=new we,t=new Gn){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(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)uv.fromBufferAttribute(t,i-1),hv.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=uv.distanceTo(hv);e.setAttribute("lineDistance",new ge(n,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){let n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),rh.copy(n.boundingSphere),rh.applyMatrix4(i),rh.radius+=s,e.ray.intersectsSphere(rh)===!1)return;dv.copy(i).invert(),Hf.copy(e.ray).applyMatrix4(dv);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new M,u=new M,h=new M,d=new M,f=this.isLineSegments?2:1;if(n.isBufferGeometry){let p=n.index,v=n.attributes.position;if(p!==null){let g=Math.max(0,o.start),y=Math.min(p.count,o.start+o.count);for(let x=g,b=y-1;x<b;x+=f){let w=p.getX(x),_=p.getX(x+1);if(c.fromBufferAttribute(v,w),u.fromBufferAttribute(v,_),Hf.distanceSqToSegment(c,u,d,h)>l)continue;d.applyMatrix4(this.matrixWorld);let A=e.ray.origin.distanceTo(d);A<e.near||A>e.far||t.push({distance:A,point:h.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else{let g=Math.max(0,o.start),y=Math.min(v.count,o.start+o.count);for(let x=g,b=y-1;x<b;x+=f){if(c.fromBufferAttribute(v,x),u.fromBufferAttribute(v,x+1),Hf.distanceSqToSegment(c,u,d,h)>l)continue;d.applyMatrix4(this.matrixWorld);let _=e.ray.origin.distanceTo(d);_<e.near||_>e.far||t.push({distance:_,point:h.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){let a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};Hi.prototype.isLine=!0;var fv=new M,pv=new M,ji=class extends Hi{constructor(e,t){super(e,t);this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)fv.fromBufferAttribute(t,i),pv.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+fv.distanceTo(pv);e.setAttribute("lineDistance",new ge(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}};ji.prototype.isLineSegments=!0;var Yl=class extends Hi{constructor(e,t){super(e,t);this.type="LineLoop"}};Yl.prototype.isLineLoop=!0;var Ta=class extends nn{constructor(e){super();this.type="PointsMaterial",this.color=new fe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this}};Ta.prototype.isPointsMaterial=!0;var mv=new me,jf=new or,sh=new ti,oh=new M,Kl=class extends Ke{constructor(e=new we,t=new Ta){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){let n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),sh.copy(n.boundingSphere),sh.applyMatrix4(i),sh.radius+=s,e.ray.intersectsSphere(sh)===!1)return;mv.copy(i).invert(),jf.copy(e.ray).applyMatrix4(mv);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a;if(n.isBufferGeometry){let c=n.index,h=n.attributes.position;if(c!==null){let d=Math.max(0,o.start),f=Math.min(c.count,o.start+o.count);for(let p=d,m=f;p<m;p++){let v=c.getX(p);oh.fromBufferAttribute(h,v),gv(oh,v,l,i,e,t,this)}}else{let d=Math.max(0,o.start),f=Math.min(h.count,o.start+o.count);for(let p=d,m=f;p<m;p++)oh.fromBufferAttribute(h,p),gv(oh,p,l,i,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){let a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};Kl.prototype.isPoints=!0;function gv(r,e,t,n,i,s,o){let a=jf.distanceSqToPoint(r);if(a<t){let l=new M;jf.closestPointToPoint(r,l),l.applyMatrix4(n);let c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}var ah=class extends xt{constructor(e,t,n,i,s,o,a,l,c){super(e,t,n,i,s,o,a,l,c);this.format=a!==void 0?a:Nt,this.minFilter=o!==void 0?o:$e,this.magFilter=s!==void 0?s:$e,this.generateMipmaps=!1;let 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(){let e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}};ah.prototype.isVideoTexture=!0;var yv=class extends xt{constructor(e,t,n,i,s,o,a,l,c,u,h,d){super(null,o,a,l,c,u,i,s,h,d);this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};yv.prototype.isCompressedTexture=!0;var vv=class extends xt{constructor(e,t,n,i,s,o,a,l,c){super(e,t,n,i,s,o,a,l,c);this.needsUpdate=!0}};vv.prototype.isCanvasTexture=!0;var so=class extends xt{constructor(e,t,n,i,s,o,a,l,c,u){if(u=u!==void 0?u:Xo,u!==Xo&&u!==Ks)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===Xo&&(n=bu),n===void 0&&u===Ks&&(n=Ys);super(null,i,s,o,a,l,u,n,c);this.image={width:e,height:t},this.magFilter=a!==void 0?a:Pt,this.minFilter=l!==void 0?l:Pt,this.flipY=!1,this.generateMipmaps=!1}};so.prototype.isDepthTexture=!0;var Ql=class extends we{constructor(e=1,t=8,n=0,i=Math.PI*2){super();this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);let s=[],o=[],a=[],l=[],c=new M,u=new O;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let h=0,d=3;h<=t;h++,d+=3){let f=n+h/t*i;c.x=e*Math.cos(f),c.y=e*Math.sin(f),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[d]/e+1)/2,u.y=(o[d+1]/e+1)/2,l.push(u.x,u.y)}for(let h=1;h<=t;h++)s.push(h,h+1,0);this.setIndex(s),this.setAttribute("position",new ge(o,3)),this.setAttribute("normal",new ge(a,3)),this.setAttribute("uv",new ge(l,2))}static fromJSON(e){return new Ql(e.radius,e.segments,e.thetaStart,e.thetaLength)}},ds=class extends we{constructor(e=1,t=1,n=1,i=8,s=1,o=!1,a=0,l=Math.PI*2){super();this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;i=Math.floor(i),s=Math.floor(s);let u=[],h=[],d=[],f=[],p=0,m=[],v=n/2,g=0;y(),o===!1&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new ge(h,3)),this.setAttribute("normal",new ge(d,3)),this.setAttribute("uv",new ge(f,2));function y(){let b=new M,w=new M,_=0,S=(t-e)/n;for(let A=0;A<=s;A++){let T=[],L=A/s,C=L*(t-e)+e;for(let U=0;U<=i;U++){let P=U/i,R=P*l+a,G=Math.sin(R),B=Math.cos(R);w.x=C*G,w.y=-L*n+v,w.z=C*B,h.push(w.x,w.y,w.z),b.set(G,S,B).normalize(),d.push(b.x,b.y,b.z),f.push(P,1-L),T.push(p++)}m.push(T)}for(let A=0;A<i;A++)for(let T=0;T<s;T++){let L=m[T][A],C=m[T+1][A],U=m[T+1][A+1],P=m[T][A+1];u.push(L,C,P),u.push(C,U,P),_+=6}c.addGroup(g,_,0),g+=_}function x(b){let w=p,_=new O,S=new M,A=0,T=b===!0?e:t,L=b===!0?1:-1;for(let U=1;U<=i;U++)h.push(0,v*L,0),d.push(0,L,0),f.push(.5,.5),p++;let C=p;for(let U=0;U<=i;U++){let R=U/i*l+a,G=Math.cos(R),B=Math.sin(R);S.x=T*B,S.y=v*L,S.z=T*G,h.push(S.x,S.y,S.z),d.push(0,L,0),_.x=G*.5+.5,_.y=B*.5*L+.5,f.push(_.x,_.y),p++}for(let U=0;U<i;U++){let P=w+U,R=C+U;b===!0?u.push(R,R+1,P):u.push(R+1,R,P),A+=3}c.addGroup(g,A,b===!0?1:2),g+=A}}static fromJSON(e){return new ds(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},oo=class extends ds{constructor(e=1,t=1,n=8,i=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,n,i,s,o,a);this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new oo(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Br=class extends we{constructor(e,t,n=1,i=0){super();this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};let s=[],o=[];a(i),c(n),u(),this.setAttribute("position",new ge(s,3)),this.setAttribute("normal",new ge(s.slice(),3)),this.setAttribute("uv",new ge(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(y){let x=new M,b=new M,w=new M;for(let _=0;_<t.length;_+=3)f(t[_+0],x),f(t[_+1],b),f(t[_+2],w),l(x,b,w,y)}function l(y,x,b,w){let _=w+1,S=[];for(let A=0;A<=_;A++){S[A]=[];let T=y.clone().lerp(b,A/_),L=x.clone().lerp(b,A/_),C=_-A;for(let U=0;U<=C;U++)U===0&&A===_?S[A][U]=T:S[A][U]=T.clone().lerp(L,U/C)}for(let A=0;A<_;A++)for(let T=0;T<2*(_-A)-1;T++){let L=Math.floor(T/2);T%2==0?(d(S[A][L+1]),d(S[A+1][L]),d(S[A][L])):(d(S[A][L+1]),d(S[A+1][L+1]),d(S[A+1][L]))}}function c(y){let x=new M;for(let b=0;b<s.length;b+=3)x.x=s[b+0],x.y=s[b+1],x.z=s[b+2],x.normalize().multiplyScalar(y),s[b+0]=x.x,s[b+1]=x.y,s[b+2]=x.z}function u(){let y=new M;for(let x=0;x<s.length;x+=3){y.x=s[x+0],y.y=s[x+1],y.z=s[x+2];let b=v(y)/2/Math.PI+.5,w=g(y)/Math.PI+.5;o.push(b,1-w)}p(),h()}function h(){for(let y=0;y<o.length;y+=6){let x=o[y+0],b=o[y+2],w=o[y+4],_=Math.max(x,b,w),S=Math.min(x,b,w);_>.9&&S<.1&&(x<.2&&(o[y+0]+=1),b<.2&&(o[y+2]+=1),w<.2&&(o[y+4]+=1))}}function d(y){s.push(y.x,y.y,y.z)}function f(y,x){let b=y*3;x.x=e[b+0],x.y=e[b+1],x.z=e[b+2]}function p(){let y=new M,x=new M,b=new M,w=new M,_=new O,S=new O,A=new O;for(let T=0,L=0;T<s.length;T+=9,L+=6){y.set(s[T+0],s[T+1],s[T+2]),x.set(s[T+3],s[T+4],s[T+5]),b.set(s[T+6],s[T+7],s[T+8]),_.set(o[L+0],o[L+1]),S.set(o[L+2],o[L+3]),A.set(o[L+4],o[L+5]),w.copy(y).add(x).add(b).divideScalar(3);let C=v(w);m(_,L+0,y,C),m(S,L+2,x,C),m(A,L+4,b,C)}}function m(y,x,b,w){w<0&&y.x===1&&(o[x]=y.x-1),b.x===0&&b.z===0&&(o[x]=w/2/Math.PI+.5)}function v(y){return Math.atan2(y.z,-y.x)}function g(y){return Math.atan2(-y.y,Math.sqrt(y.x*y.x+y.z*y.z))}}static fromJSON(e){return new Br(e.vertices,e.indices,e.radius,e.details)}},ao=class extends Br{constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,i=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,o,e,t);this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ao(e.radius,e.detail)}},lh=new M,ch=new M,Wf=new M,uh=new qt,xv=class extends we{constructor(e,t){super();if(this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=t!==void 0?t:1,e.isGeometry===!0){console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return}let n=Math.cos(Qo*t),i=e.getIndex(),s=e.getAttribute("position"),o=i?i.count:s.count,a=[0,0,0],l=["a","b","c"],c=new Array(3),u={},h=[];for(let d=0;d<o;d+=3){i?(a[0]=i.getX(d),a[1]=i.getX(d+1),a[2]=i.getX(d+2)):(a[0]=d,a[1]=d+1,a[2]=d+2);let{a:f,b:p,c:m}=uh;if(f.fromBufferAttribute(s,a[0]),p.fromBufferAttribute(s,a[1]),m.fromBufferAttribute(s,a[2]),uh.getNormal(Wf),c[0]=`${f.x},${f.y},${f.z}`,c[1]=`${p.x},${p.y},${p.z}`,c[2]=`${m.x},${m.y},${m.z}`,!(c[0]===c[1]||c[1]===c[2]||c[2]===c[0]))for(let v=0;v<3;v++){let g=(v+1)%3,y=c[v],x=c[g],b=uh[l[v]],w=uh[l[g]],_=`${y}_${x}`,S=`${x}_${y}`;S in u&&u[S]?(Wf.dot(u[S].normal)<=n&&(h.push(b.x,b.y,b.z),h.push(w.x,w.y,w.z)),u[S]=null):_ in u||(u[_]={index0:a[v],index1:a[g],normal:Wf.clone()})}}for(let d in u)if(u[d]){let{index0:f,index1:p}=u[d];lh.fromBufferAttribute(s,f),ch.fromBufferAttribute(s,p),h.push(lh.x,lh.y,lh.z),h.push(ch.x,ch.y,ch.z)}this.setAttribute("position",new ge(h,3))}},gi=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let 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;let t=[],n,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let n=this.getLengths(),i=0,s=n.length,o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=n[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===o)return i/(s-1);let u=n[i],d=n[i+1]-u,f=(o-u)/d;return(i+f)/(s-1)}getTangent(e,t){let n=1e-4,i=e-n,s=e+n;i<0&&(i=0),s>1&&(s=1);let o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new O:new M);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){let n=new M,i=[],s=[],o=[],a=new M,l=new me;for(let f=0;f<=e;f++){let p=f/e;i[f]=this.getTangentAt(p,new M),i[f].normalize()}s[0]=new M,o[0]=new M;let c=Number.MAX_VALUE,u=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);u<=c&&(c=u,n.set(1,0,0)),h<=c&&(c=h,n.set(0,1,0)),d<=c&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let f=1;f<=e;f++){if(s[f]=s[f-1].clone(),o[f]=o[f-1].clone(),a.crossVectors(i[f-1],i[f]),a.length()>Number.EPSILON){a.normalize();let p=Math.acos(Ln(i[f-1].dot(i[f]),-1,1));s[f].applyMatrix4(l.makeRotationAxis(a,p))}o[f].crossVectors(i[f],s[f])}if(t===!0){let f=Math.acos(Ln(s[0].dot(s[e]),-1,1));f/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(f=-f);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(i[p],f*p)),o[p].crossVectors(i[p],s[p])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},lo=class extends gi{constructor(e=0,t=0,n=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super();this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){let n=t||new O,i=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);let a=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=l-this.aX,f=c-this.aY;l=d*u-f*h+this.aX,c=d*h+f*u+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}};lo.prototype.isEllipseCurve=!0;var Jf=class extends lo{constructor(e,t,n,i,s,o){super(e,t,n,n,i,s,o);this.type="ArcCurve"}};Jf.prototype.isArcCurve=!0;function Xf(){let r=0,e=0,t=0,n=0;function i(s,o,a,l){r=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){i(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,h){let d=(o-s)/c-(a-s)/(c+u)+(a-o)/u,f=(a-o)/u-(l-o)/(u+h)+(l-a)/h;d*=u,f*=u,i(o,a,d,f)},calc:function(s){let o=s*s,a=o*s;return r+e*s+t*o+n*a}}}var hh=new M,qf=new Xf,Yf=new Xf,Kf=new Xf,Qf=class extends gi{constructor(e=[],t=!1,n="centripetal",i=.5){super();this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new M){let n=t,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=i[(a-1)%s]:(hh.subVectors(i[0],i[1]).add(i[0]),c=hh);let h=i[a%s],d=i[(a+1)%s];if(this.closed||a+2<s?u=i[(a+2)%s]:(hh.subVectors(i[s-1],i[s-2]).add(i[s-1]),u=hh),this.curveType==="centripetal"||this.curveType==="chordal"){let f=this.curveType==="chordal"?.5:.25,p=Math.pow(c.distanceToSquared(h),f),m=Math.pow(h.distanceToSquared(d),f),v=Math.pow(d.distanceToSquared(u),f);m<1e-4&&(m=1),p<1e-4&&(p=m),v<1e-4&&(v=m),qf.initNonuniformCatmullRom(c.x,h.x,d.x,u.x,p,m,v),Yf.initNonuniformCatmullRom(c.y,h.y,d.y,u.y,p,m,v),Kf.initNonuniformCatmullRom(c.z,h.z,d.z,u.z,p,m,v)}else this.curveType==="catmullrom"&&(qf.initCatmullRom(c.x,h.x,d.x,u.x,this.tension),Yf.initCatmullRom(c.y,h.y,d.y,u.y,this.tension),Kf.initCatmullRom(c.z,h.z,d.z,u.z,this.tension));return n.set(qf.calc(l),Yf.calc(l),Kf.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let i=this.points[t];e.points.push(i.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,n=e.points.length;t<n;t++){let i=e.points[t];this.points.push(new M().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};Qf.prototype.isCatmullRomCurve3=!0;function bv(r,e,t,n,i){let s=(n-e)*.5,o=(i-t)*.5,a=r*r,l=r*a;return(2*t-2*n+s+o)*l+(-3*t+3*n-2*s-o)*a+s*r+t}function NC(r,e){let t=1-r;return t*t*e}function CC(r,e){return 2*(1-r)*r*e}function LC(r,e){return r*r*e}function Zl(r,e,t,n){return NC(r,e)+CC(r,t)+LC(r,n)}function IC(r,e){let t=1-r;return t*t*t*e}function PC(r,e){let t=1-r;return 3*t*t*r*e}function DC(r,e){return 3*(1-r)*r*r*e}function RC(r,e){return r*r*r*e}function $l(r,e,t,n,i){return IC(r,e)+PC(r,t)+DC(r,n)+RC(r,i)}var ii=class extends gi{constructor(e=new O,t=new O,n=new O,i=new O){super();this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new O){let n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set($l(e,i.x,s.x,o.x,a.x),$l(e,i.y,s.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}};ii.prototype.isCubicBezierCurve=!0;var Zf=class extends gi{constructor(e=new M,t=new M,n=new M,i=new M){super();this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new M){let n=t,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set($l(e,i.x,s.x,o.x,a.x),$l(e,i.y,s.y,o.y,a.y),$l(e,i.z,s.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}};Zf.prototype.isCubicBezierCurve3=!0;var ri=class extends gi{constructor(e=new O,t=new O){super();this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new O){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){let n=t||new O;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};ri.prototype.isLineCurve=!0;var dh=class extends gi{constructor(e=new M,t=new M){super();this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new M){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}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(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Wi=class extends gi{constructor(e=new O,t=new O,n=new O){super();this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new O){let n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(Zl(e,i.x,s.x,o.x),Zl(e,i.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};Wi.prototype.isQuadraticBezierCurve=!0;var $f=class extends gi{constructor(e=new M,t=new M,n=new M){super();this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new M){let n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(Zl(e,i.x,s.x,o.x),Zl(e,i.y,s.y,o.y),Zl(e,i.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};$f.prototype.isQuadraticBezierCurve3=!0;var Ea=class extends gi{constructor(e=[]){super();this.type="SplineCurve",this.points=e}getPoint(e,t=new O){let n=t,i=this.points,s=(i.length-1)*e,o=Math.floor(s),a=s-o,l=i[o===0?o:o-1],c=i[o],u=i[o>i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(bv(a,l.x,c.x,u.x,h.x),bv(a,l.y,c.y,u.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let i=e.points[t];this.points.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let i=e.points[t];this.points.push(new O().fromArray(i))}return this}};Ea.prototype.isSplineCurve=!0;var ep=Object.freeze({__proto__:null,ArcCurve:Jf,CatmullRomCurve3:Qf,CubicBezierCurve:ii,CubicBezierCurve3:Zf,EllipseCurve:lo,LineCurve:ri,LineCurve3:dh,QuadraticBezierCurve:Wi,QuadraticBezierCurve3:$f,SplineCurve:Ea}),BC={triangulate:function(r,e,t=2){let n=e&&e.length,i=n?e[0]*t:r.length,s=wv(r,0,i,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,h,d,f;if(n&&(s=UC(r,e,s,t)),r.length>80*t){a=c=r[0],l=u=r[1];for(let p=t;p<i;p+=t)h=r[p],d=r[p+1],h<a&&(a=h),d<l&&(l=d),h>c&&(c=h),d>u&&(u=d);f=Math.max(c-a,u-l),f=f!==0?1/f:0}return ec(s,o,t,a,l,f),o}};function wv(r,e,t,n,i){let s,o;if(i===QC(r,e,t,n)>0)for(s=e;s<t;s+=n)o=Av(s,r[s],r[s+1],o);else for(s=t-n;s>=e;s-=n)o=Av(s,r[s],r[s+1],o);return o&&fh(o,o.next)&&(nc(o),o=o.next),o}function fs(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(fh(t,t.next)||Yt(t.prev,t,t.next)===0)){if(nc(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function ec(r,e,t,n,i,s,o){if(!r)return;!o&&s&&WC(r,n,i,s);let a=r,l,c;for(;r.prev!==r.next;){if(l=r.prev,c=r.next,s?FC(r,n,i,s):OC(r)){e.push(l.i/t),e.push(r.i/t),e.push(c.i/t),nc(r),r=c.next,a=c.next;continue}if(r=c,r===a){o?o===1?(r=zC(fs(r),e,t),ec(r,e,t,n,i,s,2)):o===2&&GC(r,e,t,n,i,s):ec(fs(r),e,t,n,i,s,1);break}}}function OC(r){let e=r.prev,t=r,n=r.next;if(Yt(e,t,n)>=0)return!1;let i=r.next.next;for(;i!==r.prev;){if(Na(e.x,e.y,t.x,t.y,n.x,n.y,i.x,i.y)&&Yt(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function FC(r,e,t,n){let i=r.prev,s=r,o=r.next;if(Yt(i,s,o)>=0)return!1;let a=i.x<s.x?i.x<o.x?i.x:o.x:s.x<o.x?s.x:o.x,l=i.y<s.y?i.y<o.y?i.y:o.y:s.y<o.y?s.y:o.y,c=i.x>s.x?i.x>o.x?i.x:o.x:s.x>o.x?s.x:o.x,u=i.y>s.y?i.y>o.y?i.y:o.y:s.y>o.y?s.y:o.y,h=tp(a,l,e,t,n),d=tp(c,u,e,t,n),f=r.prevZ,p=r.nextZ;for(;f&&f.z>=h&&p&&p.z<=d;){if(f!==r.prev&&f!==r.next&&Na(i.x,i.y,s.x,s.y,o.x,o.y,f.x,f.y)&&Yt(f.prev,f,f.next)>=0||(f=f.prevZ,p!==r.prev&&p!==r.next&&Na(i.x,i.y,s.x,s.y,o.x,o.y,p.x,p.y)&&Yt(p.prev,p,p.next)>=0))return!1;p=p.nextZ}for(;f&&f.z>=h;){if(f!==r.prev&&f!==r.next&&Na(i.x,i.y,s.x,s.y,o.x,o.y,f.x,f.y)&&Yt(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;p&&p.z<=d;){if(p!==r.prev&&p!==r.next&&Na(i.x,i.y,s.x,s.y,o.x,o.y,p.x,p.y)&&Yt(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function zC(r,e,t){let n=r;do{let i=n.prev,s=n.next.next;!fh(i,s)&&Sv(i,n,n.next,s)&&tc(i,s)&&tc(s,i)&&(e.push(i.i/t),e.push(n.i/t),e.push(s.i/t),nc(n),nc(n.next),n=r=s),n=n.next}while(n!==r);return fs(n)}function GC(r,e,t,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&qC(o,a)){let l=Mv(o,a);o=fs(o,o.next),l=fs(l,l.next),ec(o,e,t,n,i,s),ec(l,e,t,n,i,s);return}a=a.next}o=o.next}while(o!==r)}function UC(r,e,t,n){let i=[],s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*n,l=s<o-1?e[s+1]*n:r.length,c=wv(r,a,l,n,!1),c===c.next&&(c.steiner=!0),i.push(XC(c));for(i.sort(kC),s=0;s<i.length;s++)VC(i[s],t),t=fs(t,t.next);return t}function kC(r,e){return r.x-e.x}function VC(r,e){if(e=HC(r,e),e){let t=Mv(e,r);fs(e,e.next),fs(t,t.next)}}function HC(r,e){let t=e,n=r.x,i=r.y,s=-1/0,o;do{if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){let d=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=n&&d>s){if(s=d,d===n){if(i===t.y)return t;if(i===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(n===s)return o;let a=o,l=o.x,c=o.y,u=1/0,h;t=o;do n>=t.x&&t.x>=l&&n!==t.x&&Na(i<c?n:s,i,l,c,i<c?s:n,i,t.x,t.y)&&(h=Math.abs(i-t.y)/(n-t.x),tc(t,r)&&(h<u||h===u&&(t.x>o.x||t.x===o.x&&jC(o,t)))&&(o=t,u=h)),t=t.next;while(t!==a);return o}function jC(r,e){return Yt(r.prev,r,e.prev)<0&&Yt(e.next,r,r.next)<0}function WC(r,e,t,n){let i=r;do i.z===null&&(i.z=tp(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,JC(i)}function JC(r){let e,t,n,i,s,o,a,l,c=1;do{for(t=r,r=null,s=null,o=0;t;){for(o++,n=t,a=0,e=0;e<c&&(a++,n=n.nextZ,!!n);e++);for(l=c;a>0||l>0&&n;)a!==0&&(l===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,c*=2}while(o>1);return r}function tp(r,e,t,n,i){return r=32767*(r-t)*i,e=32767*(e-n)*i,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function XC(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Na(r,e,t,n,i,s,o,a){return(i-o)*(e-a)-(r-o)*(s-a)>=0&&(r-o)*(n-a)-(t-o)*(e-a)>=0&&(t-o)*(s-a)-(i-o)*(n-a)>=0}function qC(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!YC(r,e)&&(tc(r,e)&&tc(e,r)&&KC(r,e)&&(Yt(r.prev,r,e.prev)||Yt(r,e.prev,e))||fh(r,e)&&Yt(r.prev,r,r.next)>0&&Yt(e.prev,e,e.next)>0)}function Yt(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function fh(r,e){return r.x===e.x&&r.y===e.y}function Sv(r,e,t,n){let i=mh(Yt(r,e,t)),s=mh(Yt(r,e,n)),o=mh(Yt(t,n,r)),a=mh(Yt(t,n,e));return!!(i!==s&&o!==a||i===0&&ph(r,t,e)||s===0&&ph(r,n,e)||o===0&&ph(t,r,n)||a===0&&ph(t,e,n))}function ph(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function mh(r){return r>0?1:r<0?-1:0}function YC(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&Sv(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function tc(r,e){return Yt(r.prev,r,r.next)<0?Yt(r,e,r.next)>=0&&Yt(r,r.prev,e)>=0:Yt(r,e,r.prev)<0||Yt(r,r.next,e)<0}function KC(r,e){let t=r,n=!1,i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function Mv(r,e){let t=new np(r.i,r.x,r.y),n=new np(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function Av(r,e,t,n){let i=new np(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function nc(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function np(r,e,t){this.i=r,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 QC(r,e,t,n){let i=0;for(let s=e,o=t-n;s<t;s+=n)i+=(r[o]-r[s])*(r[s+1]+r[o+1]),o=s;return i}var ur=class{static area(e){let t=e.length,n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return ur.area(e)<0}static triangulateShape(e,t){let n=[],i=[],s=[];_v(e),Tv(n,e);let o=e.length;t.forEach(_v);for(let l=0;l<t.length;l++)i.push(o),o+=t[l].length,Tv(n,t[l]);let a=BC.triangulate(n,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function _v(r){let e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function Tv(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}var hr=class extends we{constructor(e,t){super();this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,i=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new ge(i,3)),this.setAttribute("uv",new ge(s,2)),this.computeVertexNormals();function o(a){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,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,m=t.bevelOffset!==void 0?t.bevelOffset:0,v=t.bevelSegments!==void 0?t.bevelSegments:3,g=t.extrudePath,y=t.UVGenerator!==void 0?t.UVGenerator:ZC;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),h=t.amount);let x,b=!1,w,_,S,A;g&&(x=g.getSpacedPoints(u),b=!0,d=!1,w=g.computeFrenetFrames(u,!1),_=new M,S=new M,A=new M),d||(v=0,f=0,p=0,m=0);let T=a.extractPoints(c),L=T.shape,C=T.holes;if(!ur.isClockWise(L)){L=L.reverse();for(let $=0,H=C.length;$<H;$++){let Q=C[$];ur.isClockWise(Q)&&(C[$]=Q.reverse())}}let P=ur.triangulateShape(L,C),R=L;for(let $=0,H=C.length;$<H;$++){let Q=C[$];L=L.concat(Q)}function G($,H,Q){return H||console.error("THREE.ExtrudeGeometry: vec does not exist"),H.clone().multiplyScalar(Q).add($)}let B=L.length,j=P.length;function ne($,H,Q){let ce,ie,N,E=$.x-H.x,Y=$.y-H.y,re=Q.x-$.x,ye=Q.y-$.y,pe=E*E+Y*Y,Ie=E*ye-Y*re;if(Math.abs(Ie)>Number.EPSILON){let ve=Math.sqrt(pe),Fe=Math.sqrt(re*re+ye*ye),Ce=H.x-Y/ve,J=H.y+E/ve,xe=Q.x-ye/Fe,he=Q.y+re/Fe,Ne=((xe-Ce)*ye-(he-J)*re)/(E*ye-Y*re);ce=Ce+E*Ne-$.x,ie=J+Y*Ne-$.y;let Be=ce*ce+ie*ie;if(Be<=2)return new O(ce,ie);N=Math.sqrt(Be/2)}else{let ve=!1;E>Number.EPSILON?re>Number.EPSILON&&(ve=!0):E<-Number.EPSILON?re<-Number.EPSILON&&(ve=!0):Math.sign(Y)===Math.sign(ye)&&(ve=!0),ve?(ce=-Y,ie=E,N=Math.sqrt(pe)):(ce=E,ie=Y,N=Math.sqrt(pe/2))}return new O(ce/N,ie/N)}let le=[];for(let $=0,H=R.length,Q=H-1,ce=$+1;$<H;$++,Q++,ce++)Q===H&&(Q=0),ce===H&&(ce=0),le[$]=ne(R[$],R[Q],R[ce]);let W=[],z,D=le.concat();for(let $=0,H=C.length;$<H;$++){let Q=C[$];z=[];for(let ce=0,ie=Q.length,N=ie-1,E=ce+1;ce<ie;ce++,N++,E++)N===ie&&(N=0),E===ie&&(E=0),z[ce]=ne(Q[ce],Q[N],Q[E]);W.push(z),D=D.concat(z)}for(let $=0;$<v;$++){let H=$/v,Q=f*Math.cos(H*Math.PI/2),ce=p*Math.sin(H*Math.PI/2)+m;for(let ie=0,N=R.length;ie<N;ie++){let E=G(R[ie],le[ie],ce);de(E.x,E.y,-Q)}for(let ie=0,N=C.length;ie<N;ie++){let E=C[ie];z=W[ie];for(let Y=0,re=E.length;Y<re;Y++){let ye=G(E[Y],z[Y],ce);de(ye.x,ye.y,-Q)}}}let K=p+m;for(let $=0;$<B;$++){let H=d?G(L[$],D[$],K):L[$];b?(S.copy(w.normals[0]).multiplyScalar(H.x),_.copy(w.binormals[0]).multiplyScalar(H.y),A.copy(x[0]).add(S).add(_),de(A.x,A.y,A.z)):de(H.x,H.y,0)}for(let $=1;$<=u;$++)for(let H=0;H<B;H++){let Q=d?G(L[H],D[H],K):L[H];b?(S.copy(w.normals[$]).multiplyScalar(Q.x),_.copy(w.binormals[$]).multiplyScalar(Q.y),A.copy(x[$]).add(S).add(_),de(A.x,A.y,A.z)):de(Q.x,Q.y,h/u*$)}for(let $=v-1;$>=0;$--){let H=$/v,Q=f*Math.cos(H*Math.PI/2),ce=p*Math.sin(H*Math.PI/2)+m;for(let ie=0,N=R.length;ie<N;ie++){let E=G(R[ie],le[ie],ce);de(E.x,E.y,h+Q)}for(let ie=0,N=C.length;ie<N;ie++){let E=C[ie];z=W[ie];for(let Y=0,re=E.length;Y<re;Y++){let ye=G(E[Y],z[Y],ce);b?de(ye.x,ye.y+x[u-1].y,x[u-1].x+Q):de(ye.x,ye.y,h+Q)}}}q(),ee();function q(){let $=i.length/3;if(d){let H=0,Q=B*H;for(let ce=0;ce<j;ce++){let ie=P[ce];ae(ie[2]+Q,ie[1]+Q,ie[0]+Q)}H=u+v*2,Q=B*H;for(let ce=0;ce<j;ce++){let ie=P[ce];ae(ie[0]+Q,ie[1]+Q,ie[2]+Q)}}else{for(let H=0;H<j;H++){let Q=P[H];ae(Q[2],Q[1],Q[0])}for(let H=0;H<j;H++){let Q=P[H];ae(Q[0]+B*u,Q[1]+B*u,Q[2]+B*u)}}n.addGroup($,i.length/3-$,0)}function ee(){let $=i.length/3,H=0;V(R,H),H+=R.length;for(let Q=0,ce=C.length;Q<ce;Q++){let ie=C[Q];V(ie,H),H+=ie.length}n.addGroup($,i.length/3-$,1)}function V($,H){let Q=$.length;for(;--Q>=0;){let ce=Q,ie=Q-1;ie<0&&(ie=$.length-1);for(let N=0,E=u+v*2;N<E;N++){let Y=B*N,re=B*(N+1),ye=H+ce+Y,pe=H+ie+Y,Ie=H+ie+re,ve=H+ce+re;te(ye,pe,Ie,ve)}}}function de($,H,Q){l.push($),l.push(H),l.push(Q)}function ae($,H,Q){X($),X(H),X(Q);let ce=i.length/3,ie=y.generateTopUV(n,i,ce-3,ce-2,ce-1);se(ie[0]),se(ie[1]),se(ie[2])}function te($,H,Q,ce){X($),X(H),X(ce),X(H),X(Q),X(ce);let ie=i.length/3,N=y.generateSideWallUV(n,i,ie-6,ie-3,ie-2,ie-1);se(N[0]),se(N[1]),se(N[3]),se(N[1]),se(N[2]),se(N[3])}function X($){i.push(l[$*3+0]),i.push(l[$*3+1]),i.push(l[$*3+2])}function se($){s.push($.x),s.push($.y)}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return $C(t,n,e)}static fromJSON(e,t){let n=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];n.push(a)}let i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new ep[i.type]().fromJSON(i)),new hr(n,e.options)}},ZC={generateTopUV:function(r,e,t,n,i){let s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[i*3],u=e[i*3+1];return[new O(s,o),new O(a,l),new O(c,u)]},generateSideWallUV:function(r,e,t,n,i,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],h=e[n*3+2],d=e[i*3],f=e[i*3+1],p=e[i*3+2],m=e[s*3],v=e[s*3+1],g=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new O(o,1-l),new O(c,1-h),new O(d,1-p),new O(m,1-g)]:[new O(a,1-l),new O(u,1-h),new O(f,1-p),new O(v,1-g)]}};function $C(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){let s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var co=class extends Br{constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,t);this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new co(e.radius,e.detail)}},uo=class extends we{constructor(e,t=12,n=0,i=Math.PI*2){super();this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Ln(i,0,Math.PI*2);let s=[],o=[],a=[],l=1/t,c=new M,u=new O;for(let h=0;h<=t;h++){let d=n+h*l*i,f=Math.sin(d),p=Math.cos(d);for(let m=0;m<=e.length-1;m++)c.x=e[m].x*f,c.y=e[m].y,c.z=e[m].x*p,o.push(c.x,c.y,c.z),u.x=h/t,u.y=m/(e.length-1),a.push(u.x,u.y)}for(let h=0;h<t;h++)for(let d=0;d<e.length-1;d++){let f=d+h*e.length,p=f,m=f+e.length,v=f+e.length+1,g=f+1;s.push(p,m,g),s.push(m,v,g)}if(this.setIndex(s),this.setAttribute("position",new ge(o,3)),this.setAttribute("uv",new ge(a,2)),this.computeVertexNormals(),i===Math.PI*2){let h=this.attributes.normal.array,d=new M,f=new M,p=new M,m=t*e.length*3;for(let v=0,g=0;v<e.length;v++,g+=3)d.x=h[g+0],d.y=h[g+1],d.z=h[g+2],f.x=h[m+g+0],f.y=h[m+g+1],f.z=h[m+g+2],p.addVectors(d,f).normalize(),h[g+0]=h[m+g+0]=p.x,h[g+1]=h[m+g+1]=p.y,h[g+2]=h[m+g+2]=p.z}}static fromJSON(e){return new uo(e.points,e.segments,e.phiStart,e.phiLength)}},ic=class extends Br{constructor(e=1,t=0){let n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[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(n,i,e,t);this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ic(e.radius,e.detail)}},ip=class extends we{constructor(e,t,n){super();this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n};let i=[],s=[],o=[],a=[],l=1e-5,c=new M,u=new M,h=new M,d=new M,f=new M;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");let p=t+1;for(let m=0;m<=n;m++){let v=m/n;for(let g=0;g<=t;g++){let y=g/t;e(y,v,u),s.push(u.x,u.y,u.z),y-l>=0?(e(y-l,v,h),d.subVectors(u,h)):(e(y+l,v,h),d.subVectors(h,u)),v-l>=0?(e(y,v-l,h),f.subVectors(u,h)):(e(y,v+l,h),f.subVectors(h,u)),c.crossVectors(d,f).normalize(),o.push(c.x,c.y,c.z),a.push(y,v)}}for(let m=0;m<n;m++)for(let v=0;v<t;v++){let g=m*p+v,y=m*p+v+1,x=(m+1)*p+v+1,b=(m+1)*p+v;i.push(g,y,b),i.push(y,x,b)}this.setIndex(i),this.setAttribute("position",new ge(s,3)),this.setAttribute("normal",new ge(o,3)),this.setAttribute("uv",new ge(a,2))}},rc=class extends we{constructor(e=.5,t=1,n=8,i=1,s=0,o=Math.PI*2){super();this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);let a=[],l=[],c=[],u=[],h=e,d=(t-e)/i,f=new M,p=new O;for(let m=0;m<=i;m++){for(let v=0;v<=n;v++){let g=s+v/n*o;f.x=h*Math.cos(g),f.y=h*Math.sin(g),l.push(f.x,f.y,f.z),c.push(0,0,1),p.x=(f.x/t+1)/2,p.y=(f.y/t+1)/2,u.push(p.x,p.y)}h+=d}for(let m=0;m<i;m++){let v=m*(n+1);for(let g=0;g<n;g++){let y=g+v,x=y,b=y+n+1,w=y+n+2,_=y+1;a.push(x,b,_),a.push(b,w,_)}}this.setIndex(a),this.setAttribute("position",new ge(l,3)),this.setAttribute("normal",new ge(c,3)),this.setAttribute("uv",new ge(u,2))}static fromJSON(e){return new rc(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}},ps=class extends we{constructor(e,t=12){super();this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let n=[],i=[],s=[],o=[],a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(n),this.setAttribute("position",new ge(i,3)),this.setAttribute("normal",new ge(s,3)),this.setAttribute("uv",new ge(o,2));function c(u){let h=i.length/3,d=u.extractPoints(t),f=d.shape,p=d.holes;ur.isClockWise(f)===!1&&(f=f.reverse());for(let v=0,g=p.length;v<g;v++){let y=p[v];ur.isClockWise(y)===!0&&(p[v]=y.reverse())}let m=ur.triangulateShape(f,p);for(let v=0,g=p.length;v<g;v++){let y=p[v];f=f.concat(y)}for(let v=0,g=f.length;v<g;v++){let y=f[v];i.push(y.x,y.y,0),s.push(0,0,1),o.push(y.x,y.y)}for(let v=0,g=m.length;v<g;v++){let y=m[v],x=y[0]+h,b=y[1]+h,w=y[2]+h;n.push(x,b,w),l+=3}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return eL(t,e)}static fromJSON(e,t){let n=[];for(let i=0,s=e.shapes.length;i<s;i++){let o=t[e.shapes[i]];n.push(o)}return new ps(n,e.curveSegments)}};function eL(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){let i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}var Ji=class extends we{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,o=0,a=Math.PI){super();this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let l=Math.min(o+a,Math.PI),c=0,u=[],h=new M,d=new M,f=[],p=[],m=[],v=[];for(let g=0;g<=n;g++){let y=[],x=g/n,b=0;g==0&&o==0?b=.5/t:g==n&&l==Math.PI&&(b=-.5/t);for(let w=0;w<=t;w++){let _=w/t;h.x=-e*Math.cos(i+_*s)*Math.sin(o+x*a),h.y=e*Math.cos(o+x*a),h.z=e*Math.sin(i+_*s)*Math.sin(o+x*a),p.push(h.x,h.y,h.z),d.copy(h).normalize(),m.push(d.x,d.y,d.z),v.push(_+b,1-x),y.push(c++)}u.push(y)}for(let g=0;g<n;g++)for(let y=0;y<t;y++){let x=u[g][y+1],b=u[g][y],w=u[g+1][y],_=u[g+1][y+1];(g!==0||o>0)&&f.push(x,b,_),(g!==n-1||l<Math.PI)&&f.push(b,w,_)}this.setIndex(f),this.setAttribute("position",new ge(p,3)),this.setAttribute("normal",new ge(m,3)),this.setAttribute("uv",new ge(v,2))}static fromJSON(e){return new Ji(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}},sc=class extends Br{constructor(e=1,t=0){let n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t);this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new sc(e.radius,e.detail)}},rp=class extends hr{constructor(e,t={}){let n=t.font;if(!(n&&n.isFont))return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new we;let i=n.generateShapes(e,t.size);t.depth=t.height!==void 0?t.height:50,t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1);super(i,t);this.type="TextGeometry"}},oc=class extends we{constructor(e=1,t=.4,n=8,i=6,s=Math.PI*2){super();this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);let o=[],a=[],l=[],c=[],u=new M,h=new M,d=new M;for(let f=0;f<=n;f++)for(let p=0;p<=i;p++){let m=p/i*s,v=f/n*Math.PI*2;h.x=(e+t*Math.cos(v))*Math.cos(m),h.y=(e+t*Math.cos(v))*Math.sin(m),h.z=t*Math.sin(v),a.push(h.x,h.y,h.z),u.x=e*Math.cos(m),u.y=e*Math.sin(m),d.subVectors(h,u).normalize(),l.push(d.x,d.y,d.z),c.push(p/i),c.push(f/n)}for(let f=1;f<=n;f++)for(let p=1;p<=i;p++){let m=(i+1)*f+p-1,v=(i+1)*(f-1)+p-1,g=(i+1)*(f-1)+p,y=(i+1)*f+p;o.push(m,v,y),o.push(v,g,y)}this.setIndex(o),this.setAttribute("position",new ge(a,3)),this.setAttribute("normal",new ge(l,3)),this.setAttribute("uv",new ge(c,2))}static fromJSON(e){return new oc(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}},ho=class extends we{constructor(e=1,t=.4,n=64,i=8,s=2,o=3){super();this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:o},n=Math.floor(n),i=Math.floor(i);let a=[],l=[],c=[],u=[],h=new M,d=new M,f=new M,p=new M,m=new M,v=new M,g=new M;for(let x=0;x<=n;++x){let b=x/n*s*Math.PI*2;y(b,s,o,e,f),y(b+.01,s,o,e,p),v.subVectors(p,f),g.addVectors(p,f),m.crossVectors(v,g),g.crossVectors(m,v),m.normalize(),g.normalize();for(let w=0;w<=i;++w){let _=w/i*Math.PI*2,S=-t*Math.cos(_),A=t*Math.sin(_);h.x=f.x+(S*g.x+A*m.x),h.y=f.y+(S*g.y+A*m.y),h.z=f.z+(S*g.z+A*m.z),l.push(h.x,h.y,h.z),d.subVectors(h,f).normalize(),c.push(d.x,d.y,d.z),u.push(x/n),u.push(w/i)}}for(let x=1;x<=n;x++)for(let b=1;b<=i;b++){let w=(i+1)*(x-1)+(b-1),_=(i+1)*x+(b-1),S=(i+1)*x+b,A=(i+1)*(x-1)+b;a.push(w,_,A),a.push(_,S,A)}this.setIndex(a),this.setAttribute("position",new ge(l,3)),this.setAttribute("normal",new ge(c,3)),this.setAttribute("uv",new ge(u,2));function y(x,b,w,_,S){let A=Math.cos(x),T=Math.sin(x),L=w/b*x,C=Math.cos(L);S.x=_*(2+C)*.5*A,S.y=_*(2+C)*T*.5,S.z=_*Math.sin(L)*.5}}static fromJSON(e){return new ho(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}},ac=class extends we{constructor(e,t=64,n=1,i=8,s=!1){super();this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};let o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;let a=new M,l=new M,c=new O,u=new M,h=[],d=[],f=[],p=[];m(),this.setIndex(p),this.setAttribute("position",new ge(h,3)),this.setAttribute("normal",new ge(d,3)),this.setAttribute("uv",new ge(f,2));function m(){for(let x=0;x<t;x++)v(x);v(s===!1?t:0),y(),g()}function v(x){u=e.getPointAt(x/t,u);let b=o.normals[x],w=o.binormals[x];for(let _=0;_<=i;_++){let S=_/i*Math.PI*2,A=Math.sin(S),T=-Math.cos(S);l.x=T*b.x+A*w.x,l.y=T*b.y+A*w.y,l.z=T*b.z+A*w.z,l.normalize(),d.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,h.push(a.x,a.y,a.z)}}function g(){for(let x=1;x<=t;x++)for(let b=1;b<=i;b++){let w=(i+1)*(x-1)+(b-1),_=(i+1)*x+(b-1),S=(i+1)*x+b,A=(i+1)*(x-1)+b;p.push(w,_,A),p.push(_,S,A)}}function y(){for(let x=0;x<=t;x++)for(let b=0;b<=i;b++)c.x=x/t,c.y=b/i,f.push(c.x,c.y)}}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new ac(new ep[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},Ev=class extends we{constructor(e){super();if(this.type="WireframeGeometry",e.isGeometry===!0){console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return}let t=[],n=new Set,i=new M,s=new M;if(e.index!==null){let o=e.attributes.position,a=e.index,l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){let h=l[c],d=h.start,f=h.count;for(let p=d,m=d+f;p<m;p+=3)for(let v=0;v<3;v++){let g=a.getX(p+v),y=a.getX(p+(v+1)%3);i.fromBufferAttribute(o,g),s.fromBufferAttribute(o,y),Nv(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{let o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){let u=3*a+c,h=3*a+(c+1)%3;i.fromBufferAttribute(o,u),s.fromBufferAttribute(o,h),Nv(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new ge(t,3))}};function Nv(r,e,t){let n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n,i),!0)}var Cv=Object.freeze({__proto__:null,BoxGeometry:jn,BoxBufferGeometry:jn,CircleGeometry:Ql,CircleBufferGeometry:Ql,ConeGeometry:oo,ConeBufferGeometry:oo,CylinderGeometry:ds,CylinderBufferGeometry:ds,DodecahedronGeometry:ao,DodecahedronBufferGeometry:ao,EdgesGeometry:xv,ExtrudeGeometry:hr,ExtrudeBufferGeometry:hr,IcosahedronGeometry:co,IcosahedronBufferGeometry:co,LatheGeometry:uo,LatheBufferGeometry:uo,OctahedronGeometry:ic,OctahedronBufferGeometry:ic,ParametricGeometry:ip,ParametricBufferGeometry:ip,PlaneGeometry:ls,PlaneBufferGeometry:ls,PolyhedronGeometry:Br,PolyhedronBufferGeometry:Br,RingGeometry:rc,RingBufferGeometry:rc,ShapeGeometry:ps,ShapeBufferGeometry:ps,SphereGeometry:Ji,SphereBufferGeometry:Ji,TetrahedronGeometry:sc,TetrahedronBufferGeometry:sc,TextGeometry:rp,TextBufferGeometry:rp,TorusGeometry:oc,TorusBufferGeometry:oc,TorusKnotGeometry:ho,TorusKnotBufferGeometry:ho,TubeGeometry:ac,TubeBufferGeometry:ac,WireframeGeometry:Ev}),sp=class extends nn{constructor(e){super();this.type="ShadowMaterial",this.color=new fe(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}};sp.prototype.isShadowMaterial=!0;var Xi=class extends nn{constructor(e){super();this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new fe(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 fe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qr,this.normalScale=new O(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.flatShading=!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.flatShading=e.flatShading,this}};Xi.prototype.isMeshStandardMaterial=!0;var Or=class extends Xi{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 O(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=Ln(2.5*(t-1)/(t+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationTint=new fe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularTint=new fe(1,1,1),this.specularTintMap=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 fe).copy(e.sheen):this.sheen=null,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationTint.copy(e.attenuationTint),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularTint.copy(e.specularTint),this.specularTintMap=e.specularTintMap,this}};Or.prototype.isMeshPhysicalMaterial=!0;var op=class extends nn{constructor(e){super();this.type="MeshPhongMaterial",this.color=new fe(16777215),this.specular=new fe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new fe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qr,this.normalScale=new O(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=yu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",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.flatShading=e.flatShading,this}};op.prototype.isMeshPhongMaterial=!0;var ap=class extends nn{constructor(e){super();this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new fe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new fe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qr,this.normalScale=new O(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.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}};ap.prototype.isMeshToonMaterial=!0;var lp=class extends nn{constructor(e){super();this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qr,this.normalScale=new O(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}};lp.prototype.isMeshNormalMaterial=!0;var cp=class extends nn{constructor(e){super();this.type="MeshLambertMaterial",this.color=new fe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new fe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=yu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",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}};cp.prototype.isMeshLambertMaterial=!0;var up=class extends nn{constructor(e){super();this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new fe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qr,this.normalScale=new O(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,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.flatShading=e.flatShading,this}};up.prototype.isMeshMatcapMaterial=!0;var hp=class extends Gn{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}};hp.prototype.isLineDashedMaterial=!0;var tL=Object.freeze({__proto__:null,ShadowMaterial:sp,SpriteMaterial:Zu,RawShaderMaterial:fa,ShaderMaterial:_t,PointsMaterial:Ta,MeshPhysicalMaterial:Or,MeshStandardMaterial:Xi,MeshPhongMaterial:op,MeshToonMaterial:ap,MeshNormalMaterial:lp,MeshLambertMaterial:cp,MeshDepthMaterial:Yu,MeshDistanceMaterial:Ku,MeshBasicMaterial:dn,MeshMatcapMaterial:up,LineDashedMaterial:hp,LineBasicMaterial:Gn,Material:nn}),Ht={arraySlice:function(r,e,t){return Ht.isTypedArray(r)?new r.constructor(r.subarray(e,t!==void 0?t:r.length)):r.slice(e,t)},convertArray:function(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)},isTypedArray:function(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)},getKeyframeOrder:function(r){function e(i,s){return r[i]-r[s]}let t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n},sortedArray:function(r,e,t){let n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){let a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=r[a+l]}return i},flattenJSON:function(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)},subclip:function(r,e,t,n,i=30){let s=r.clone();s.name=e;let o=[];for(let l=0;l<s.tracks.length;++l){let c=s.tracks[l],u=c.getValueSize(),h=[],d=[];for(let f=0;f<c.times.length;++f){let p=c.times[f]*i;if(!(p<t||p>=n)){h.push(c.times[f]);for(let m=0;m<u;++m)d.push(c.values[f*u+m])}}h.length!==0&&(c.times=Ht.convertArray(h,c.times.constructor),c.values=Ht.convertArray(d,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(r,e=0,t=r,n=30){n<=0&&(n=30);let i=t.tracks.length,s=e/n;for(let o=0;o<i;++o){let a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;let c=r.tracks.find(function(g){return g.name===a.name&&g.ValueTypeName===l});if(c===void 0)continue;let u=0,h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let d=0,f=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=f/3);let p=a.times.length-1,m;if(s<=a.times[0]){let g=u,y=h-u;m=Ht.arraySlice(a.values,g,y)}else if(s>=a.times[p]){let g=p*h+u,y=g+h-u;m=Ht.arraySlice(a.values,g,y)}else{let g=a.createInterpolant(),y=u,x=h-u;g.evaluate(s),m=Ht.arraySlice(g.resultBuffer,y,x)}l==="quaternion"&&new Tt().fromArray(m).normalize().conjugate().toArray(m);let v=c.times.length;for(let g=0;g<v;++g){let y=g*f+d;if(l==="quaternion")Tt.multiplyQuaternionsFlat(c.values,y,m,0,c.values,y);else{let x=f-d*2;for(let b=0;b<x;++b)c.values[y+b]-=m[b]}}}return r.blendMode=Qg,r}},qi=class{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,s)}if(n===a)break;if(s=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=s)){let a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===l)break;if(i=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){let a=n+o>>>1;e<t[a]?o=a:n=a+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(i===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,s,e)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let o=0;o!==i;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}};qi.prototype.beforeStart_=qi.prototype.copySampleValue_;qi.prototype.afterEnd_=qi.prototype.copySampleValue_;var Lv=class extends qi{constructor(e,t,n,i){super(e,t,n,i);this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:qo,endingEnd:qo}}intervalChanged_(e,t,n){let i=this.parameterPositions,s=e-2,o=e+1,a=i[s],l=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case Yo:s=e,a=2*t-n;break;case wu:s=i.length-2,a=t+i[s]-i[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case Yo:o=e,l=2*n-t;break;case wu:o=1,l=n+i[1]-i[0];break;default:o=e-1,l=t}let c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,i){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(n-t)/(i-t),m=p*p,v=m*p,g=-d*v+2*d*m-d*p,y=(1+d)*v+(-1.5-2*d)*m+(-.5+d)*p+1,x=(-1-f)*v+(1.5+f)*m+.5*p,b=f*v-f*m;for(let w=0;w!==a;++w)s[w]=g*o[u+w]+y*o[c+w]+x*o[l+w]+b*o[h+w];return s}},dp=class extends qi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(i-t),h=1-u;for(let d=0;d!==a;++d)s[d]=o[c+d]*h+o[l+d]*u;return s}},Iv=class extends qi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}},Yi=class{constructor(e,t,n,i){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=Ht.convertArray(t,this.TimeBufferType),this.values=Ht.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Ht.convertArray(e.times,Array),values:Ht.convertArray(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Iv(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new dp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Lv(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Yr:t=this.InterpolantFactoryMethodDiscrete;break;case Er:t=this.InterpolantFactoryMethodLinear;break;case Zd:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let n="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(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Yr;case this.InterpolantFactoryMethodLinear:return Er;case this.InterpolantFactoryMethodSmooth:return Zd}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){let n=this.times,i=n.length,s=0,o=i-1;for(;s!==i&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=Ht.arraySlice(n,s,o),this.values=Ht.arraySlice(this.values,s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&Ht.isTypedArray(i))for(let a=0,l=i.length;a!==l;++a){let c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=Ht.arraySlice(this.times),t=Ht.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Zd,s=e.length-1,o=1;for(let a=1;a<s;++a){let l=!1,c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(i)l=!0;else{let h=a*n,d=h-n,f=h+n;for(let p=0;p!==n;++p){let m=t[h+p];if(m!==t[d+p]||m!==t[f+p]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let h=a*n,d=o*n;for(let f=0;f!==n;++f)t[d+f]=t[h+f]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=Ht.arraySlice(e,0,o),this.values=Ht.arraySlice(t,0,o*n)):(this.times=e,this.values=t),this}clone(){let e=Ht.arraySlice(this.times,0),t=Ht.arraySlice(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}};Yi.prototype.TimeBufferType=Float32Array;Yi.prototype.ValueBufferType=Float32Array;Yi.prototype.DefaultInterpolation=Er;var fo=class extends Yi{};fo.prototype.ValueTypeName="bool";fo.prototype.ValueBufferType=Array;fo.prototype.DefaultInterpolation=Yr;fo.prototype.InterpolantFactoryMethodLinear=void 0;fo.prototype.InterpolantFactoryMethodSmooth=void 0;var fp=class extends Yi{};fp.prototype.ValueTypeName="color";var po=class extends Yi{};po.prototype.ValueTypeName="number";var Pv=class extends qi{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t),c=e*a;for(let u=c+a;c!==u;c+=4)Tt.slerpFlat(s,0,o,c-a,o,c,l);return s}},ms=class extends Yi{InterpolantFactoryMethodLinear(e){return new Pv(this.times,this.values,this.getValueSize(),e)}};ms.prototype.ValueTypeName="quaternion";ms.prototype.DefaultInterpolation=Er;ms.prototype.InterpolantFactoryMethodSmooth=void 0;var mo=class extends Yi{};mo.prototype.ValueTypeName="string";mo.prototype.ValueBufferType=Array;mo.prototype.DefaultInterpolation=Yr;mo.prototype.InterpolantFactoryMethodLinear=void 0;mo.prototype.InterpolantFactoryMethodSmooth=void 0;var go=class extends Yi{};go.prototype.ValueTypeName="vector";var Ca=class{constructor(e,t=-1,n,i=$d){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=fi(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(iL(n[o]).scale(i));let s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=n.length;s!==o;++s)t.push(Yi.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let s=t.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);let u=Ht.getKeyframeOrder(l);l=Ht.sortedArray(l,1,u),c=Ht.sortedArray(c,1,u),!i&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new po(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let i={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){let c=e[a],u=c.name.match(s);if(u&&u.length>1){let h=u[1],d=i[h];d||(i[h]=d=[]),d.push(c)}}let o=[];for(let a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let n=function(h,d,f,p,m){if(f.length!==0){let v=[],g=[];Ht.flattenJSON(f,v,g,p),v.length!==0&&m.push(new h(d,v,g))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode,l=e.length||-1,c=e.hierarchy||[];for(let h=0;h<c.length;h++){let d=c[h].keys;if(!(!d||d.length===0))if(d[0].morphTargets){let f={},p;for(p=0;p<d.length;p++)if(d[p].morphTargets)for(let m=0;m<d[p].morphTargets.length;m++)f[d[p].morphTargets[m]]=-1;for(let m in f){let v=[],g=[];for(let y=0;y!==d[p].morphTargets.length;++y){let x=d[p];v.push(x.time),g.push(x.morphTarget===m?1:0)}i.push(new po(".morphTargetInfluence["+m+"]",v,g))}l=f.length*(o||1)}else{let f=".bones["+t[h].name+"]";n(go,f+".position",d,"pos",i),n(ms,f+".quaternion",d,"rot",i),n(go,f+".scale",d,"scl",i)}}return i.length===0?null:new this(s,l,i,a)}resetDuration(){let e=this.tracks,t=0;for(let n=0,i=e.length;n!==i;++n){let s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}};function nL(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return po;case"vector":case"vector2":case"vector3":case"vector4":return go;case"color":return fp;case"quaternion":return ms;case"bool":case"boolean":return fo;case"string":return mo}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function iL(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=nL(r.type);if(r.times===void 0){let t=[],n=[];Ht.flattenJSON(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}var La={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}},yo=class{constructor(e,t,n){let i=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){a++,s===!1&&i.onStart!==void 0&&i.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,i.onProgress!==void 0&&i.onProgress(u,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){let h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=c.length;h<d;h+=2){let f=c[h],p=c[h+1];if(f.global&&(f.lastIndex=0),f.test(u))return p}return null}}},pp=new yo,fn=class{constructor(e){this.manager=e!==void 0?e:pp,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}},Ki={},Xn=class extends fn{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=La.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;if(Ki[e]!==void 0){Ki[e].push({onLoad:t,onProgress:n,onError:i});return}let a=/^data:(.*?)(;base64)?,(.*)$/,l=e.match(a),c;if(l){let u=l[1],h=!!l[2],d=l[3];d=decodeURIComponent(d),h&&(d=atob(d));try{let f,p=(this.responseType||"").toLowerCase();switch(p){case"arraybuffer":case"blob":let m=new Uint8Array(d.length);for(let g=0;g<d.length;g++)m[g]=d.charCodeAt(g);p==="blob"?f=new Blob([m.buffer],{type:u}):f=m.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),s.manager.itemEnd(e)},0)}catch(f){setTimeout(function(){i&&i(f),s.manager.itemError(e),s.manager.itemEnd(e)},0)}}else{Ki[e]=[],Ki[e].push({onLoad:t,onProgress:n,onError:i}),c=new XMLHttpRequest,c.open("GET",e,!0),c.addEventListener("load",function(u){let h=this.response,d=Ki[e];if(delete Ki[e],this.status===200||this.status===0){this.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),La.add(e,h);for(let f=0,p=d.length;f<p;f++){let m=d[f];m.onLoad&&m.onLoad(h)}s.manager.itemEnd(e)}else{for(let f=0,p=d.length;f<p;f++){let m=d[f];m.onError&&m.onError(u)}s.manager.itemError(e),s.manager.itemEnd(e)}},!1),c.addEventListener("progress",function(u){let h=Ki[e];for(let d=0,f=h.length;d<f;d++){let p=h[d];p.onProgress&&p.onProgress(u)}},!1),c.addEventListener("error",function(u){let h=Ki[e];delete Ki[e];for(let d=0,f=h.length;d<f;d++){let p=h[d];p.onError&&p.onError(u)}s.manager.itemError(e),s.manager.itemEnd(e)},!1),c.addEventListener("abort",function(u){let h=Ki[e];delete Ki[e];for(let d=0,f=h.length;d<f;d++){let p=h[d];p.onError&&p.onError(u)}s.manager.itemError(e),s.manager.itemEnd(e)},!1),this.responseType!==void 0&&(c.responseType=this.responseType),this.withCredentials!==void 0&&(c.withCredentials=this.withCredentials),c.overrideMimeType&&c.overrideMimeType(this.mimeType!==void 0?this.mimeType:"text/plain");for(let u in this.requestHeader)c.setRequestHeader(u,this.requestHeader[u]);c.send(null)}return s.manager.itemStart(e),c}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}};var lc=class extends fn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=La.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;let a=document.createElementNS("http://www.w3.org/1999/xhtml","img");function l(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1),La.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(u){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1),i&&i(u),s.manager.itemError(e),s.manager.itemEnd(e)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}},Dv=class extends fn{constructor(e){super(e)}load(e,t,n,i){let s=new as,o=new lc(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(u){s.images[c]=u,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}};var gh=class extends fn{constructor(e){super(e)}load(e,t,n,i){let s=new xt,o=new lc(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a;let l=e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0;s.format=l?Nt:zt,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}},Rv=class extends gi{constructor(){super();this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new ri(t,e))}getPoint(e){let t=e*this.getLength(),n=this.getCurveLengths(),i=0;for(;i<n.length;){if(n[i]>=t){let s=n[i]-t,o=this.curves[i],a=o.getLength(),l=a===0?0:1-s/a;return o.getPointAt(l)}i++}return null}getLength(){let 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;let e=[],t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let i=0,s=this.curves;i<s.length;i++){let o=s[i],a=o&&o.isEllipseCurve?e*2:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){let u=l[c];n&&n.equals(u)||(t.push(u),n=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,n=e.curves.length;t<n;t++){let i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let i=e.curves[t];this.curves.push(new ep[i.type]().fromJSON(i))}return this}},cc=class extends Rv{constructor(e){super();this.type="Path",this.currentPoint=new O,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new ri(this.currentPoint.clone(),new O(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){let s=new Wi(this.currentPoint.clone(),new O(e,t),new O(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,o){let a=new ii(this.currentPoint.clone(),new O(e,t),new O(n,i),new O(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new Ea(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,i,s,o),this}absarc(e,t,n,i,s,o){return this.absellipse(e,t,n,n,i,s,o),this}ellipse(e,t,n,i,s,o,a,l){let c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,i,s,o,a,l),this}absellipse(e,t,n,i,s,o,a,l){let c=new lo(e,t,n,i,s,o,a,l);if(this.curves.length>0){let h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);let u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},yi=class extends cc{constructor(e){super(e);this.uuid=fi(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].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,n=e.holes.length;t<n;t++){let i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let i=e.holes[t];this.holes.push(new cc().fromJSON(i))}return this}},vi=class extends Ke{constructor(e,t=1){super();this.type="Light",this.color=new fe(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,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}};vi.prototype.isLight=!0;var uc=class extends vi{constructor(e,t,n){super(e,n);this.type="HemisphereLight",this.position.copy(Ke.DefaultUp),this.updateMatrix(),this.groundColor=new fe(t)}copy(e){return vi.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}};uc.prototype.isHemisphereLight=!0;var Bv=new me,Ov=new M,Fv=new M,yh=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new O(512,512),this.map=null,this.mapPass=null,this.matrix=new me,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Vl,this._frameExtents=new O(1,1),this._viewportCount=1,this._viewports=[new Qe(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;Ov.setFromMatrixPosition(e.matrixWorld),t.position.copy(Ov),Fv.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Fv),t.updateMatrixWorld(),Bv.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Bv),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.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(){let 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}},mp=class extends yh{constructor(){super(new Vt(50,1,.5,500));this.focus=1}updateMatrices(e){let t=this.camera,n=Ol*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}};mp.prototype.isSpotLightShadow=!0;var vo=class extends vi{constructor(e,t,n=0,i=Math.PI/3,s=0,o=1){super(e,t);this.type="SpotLight",this.position.copy(Ke.DefaultUp),this.updateMatrix(),this.target=new Ke,this.distance=n,this.angle=i,this.penumbra=s,this.decay=o,this.shadow=new mp}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}};vo.prototype.isSpotLight=!0;var zv=new me,hc=new M,gp=new M,yp=class extends yh{constructor(){super(new Vt(90,1,.5,500));this._frameExtents=new O(4,2),this._viewportCount=6,this._viewports=[new Qe(2,1,1,1),new Qe(0,1,1,1),new Qe(3,1,1,1),new Qe(1,1,1,1),new Qe(3,0,1,1),new Qe(1,0,1,1)],this._cubeDirections=[new M(1,0,0),new M(-1,0,0),new M(0,0,1),new M(0,0,-1),new M(0,1,0),new M(0,-1,0)],this._cubeUps=[new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,0,1),new M(0,0,-1)]}updateMatrices(e,t=0){let n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),hc.setFromMatrixPosition(e.matrixWorld),n.position.copy(hc),gp.copy(n.position),gp.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(gp),n.updateMatrixWorld(),i.makeTranslation(-hc.x,-hc.y,-hc.z),zv.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(zv)}};yp.prototype.isPointLightShadow=!0;var xo=class extends vi{constructor(e,t,n=0,i=1){super(e,t);this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new yp}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}};xo.prototype.isPointLight=!0;var vp=class extends yh{constructor(){super(new Rr(-5,5,5,-5,.5,500))}};vp.prototype.isDirectionalLightShadow=!0;var Fr=class extends vi{constructor(e,t){super(e,t);this.type="DirectionalLight",this.position.copy(Ke.DefaultUp),this.updateMatrix(),this.target=new Ke,this.shadow=new vp}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};Fr.prototype.isDirectionalLight=!0;var xp=class extends vi{constructor(e,t){super(e,t);this.type="AmbientLight"}};xp.prototype.isAmbientLight=!0;var bp=class extends vi{constructor(e,t,n=10,i=10){super(e,t);this.type="RectAreaLight",this.width=n,this.height=i}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}};bp.prototype.isRectAreaLight=!0;var wp=class{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new M)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){let n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],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){let n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){let n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){let n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}};wp.prototype.isSphericalHarmonics3=!0;var dc=class extends vi{constructor(e=new wp,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){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};dc.prototype.isLightProbe=!0;var Gv=class extends fn{constructor(e){super(e);this.textures={}}load(e,t,n,i){let s=this,o=new Xn(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){let t=this.textures;function n(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}let i=new tL[e.type];if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=new fe().setHex(e.sheen)),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularTint!==void 0&&i.specularTint!==void 0&&i.specularTint.setHex(e.specularTint),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationTint!==void 0&&i.attenuationTint!==void 0&&i.attenuationTint.setHex(e.attenuationTint),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==1&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(let s in e.uniforms){let o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=n(o.value);break;case"c":i.uniforms[s].value=new fe().setHex(o.value);break;case"v2":i.uniforms[s].value=new O().fromArray(o.value);break;case"v3":i.uniforms[s].value=new M().fromArray(o.value);break;case"v4":i.uniforms[s].value=new Qe().fromArray(o.value);break;case"m3":i.uniforms[s].value=new Dt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new me().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.extensions!==void 0)for(let s in e.extensions)i.extensions[s]=e.extensions[s];if(e.shading!==void 0&&(i.flatShading=e.shading===1),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new O().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularTintMap!==void 0&&(i.specularTintMap=n(e.specularTintMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new O().fromArray(e.clearcoatNormalScale)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),i}setTextures(e){return this.textures=e,this}},Ei=class{static decodeText(e){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(n){return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.substr(0,t+1)}},Sp=class extends we{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(){let e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};Sp.prototype.isInstancedBufferGeometry=!0;var Mp=class extends Re{constructor(e,t,n,i=1){typeof n=="number"&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument."));super(e,t,n);this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};Mp.prototype.isInstancedBufferAttribute=!0;var Ia=class extends fn{constructor(e){super(e)}load(e,t,n,i){let s=this,o=new Xn(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}parse(e){let t={},n={};function i(f,p){if(t[p]!==void 0)return t[p];let v=f.interleavedBuffers[p],g=s(f,v.buffer),y=oa(v.type,g),x=new Vi(y,v.stride);return x.uuid=v.uuid,t[p]=x,x}function s(f,p){if(n[p]!==void 0)return n[p];let v=f.arrayBuffers[p],g=new Uint32Array(v).buffer;return n[p]=g,g}let o=e.isInstancedBufferGeometry?new Sp:new we,a=e.data.index;if(a!==void 0){let f=oa(a.type,a.array);o.setIndex(new Re(f,1))}let l=e.data.attributes;for(let f in l){let p=l[f],m;if(p.isInterleavedBufferAttribute){let v=i(e.data,p.data);m=new Ti(v,p.itemSize,p.offset,p.normalized)}else{let v=oa(p.type,p.array),g=p.isInstancedBufferAttribute?Mp:Re;m=new g(v,p.itemSize,p.normalized)}p.name!==void 0&&(m.name=p.name),p.usage!==void 0&&m.setUsage(p.usage),p.updateRange!==void 0&&(m.updateRange.offset=p.updateRange.offset,m.updateRange.count=p.updateRange.count),o.setAttribute(f,m)}let c=e.data.morphAttributes;if(c)for(let f in c){let p=c[f],m=[];for(let v=0,g=p.length;v<g;v++){let y=p[v],x;if(y.isInterleavedBufferAttribute){let b=i(e.data,y.data);x=new Ti(b,y.itemSize,y.offset,y.normalized)}else{let b=oa(y.type,y.array);x=new Re(b,y.itemSize,y.normalized)}y.name!==void 0&&(x.name=y.name),m.push(x)}o.morphAttributes[f]=m}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);let h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let f=0,p=h.length;f!==p;++f){let m=h[f];o.addGroup(m.start,m.count,m.materialIndex)}let d=e.data.boundingSphere;if(d!==void 0){let f=new M;d.center!==void 0&&f.fromArray(d.center),o.boundingSphere=new ti(f,d.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}},Ap=class extends fn{constructor(e){super(e)}load(e,t,n,i){let s=this,o=this.path===""?Ei.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;let a=new Xn(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(h){i!==void 0&&i(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}let u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},n,i)}async loadAsync(e,t){let n=this,i=this.path===""?Ei.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;let s=new Xn(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);let o=await s.loadAsync(e,t),a=JSON.parse(o),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(a)}parse(e,t){let n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,n),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),t!==void 0){let h=!1;for(let d in o)if(o[d]instanceof HTMLImageElement){h=!0;break}h===!1&&t(c)}return c}async parseAsync(e){let t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,i,a,o,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),l}parseShapes(e){let t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){let s=new yi().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){let n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){let a=new _a().fromJSON(e[s],i);n[a.uuid]=a}return n}parseGeometries(e,t){let n={};if(e!==void 0){let i=new Ia;for(let s=0,o=e.length;s<o;s++){let a,l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(l);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:l.type in Cv?a=Cv[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),a.isBufferGeometry===!0&&l.userData!==void 0&&(a.userData=l.userData),n[l.uuid]=a}}return n}parseMaterials(e,t){let n={},i={};if(e!==void 0){let s=new Gv;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){let l=e[o];if(l.type==="MultiMaterial"){let c=[];for(let u=0;u<l.materials.length;u++){let h=l.materials[u];n[h.uuid]===void 0&&(n[h.uuid]=s.parse(h)),c.push(n[h.uuid])}i[l.uuid]=c}else n[l.uuid]===void 0&&(n[l.uuid]=s.parse(l)),i[l.uuid]=n[l.uuid]}}return i}parseAnimations(e){let t={};if(e!==void 0)for(let n=0;n<e.length;n++){let i=e[n],s=Ca.parse(i);t[s.uuid]=s}return t}parseImages(e,t){let n=this,i={},s;function o(l){return n.manager.itemStart(l),s.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){let c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:n.resourcePath+c;return o(u)}else return l.data?{data:oa(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){let l=new yo(t);s=new lc(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){let h=e[c],d=h.url;if(Array.isArray(d)){i[h.uuid]=[];for(let f=0,p=d.length;f<p;f++){let m=d[f],v=a(m);v!==null&&(v instanceof HTMLImageElement?i[h.uuid].push(v):i[h.uuid].push(new ro(v.data,v.width,v.height)))}}else{let f=a(h.url);f!==null&&(i[h.uuid]=f)}}}return i}async parseImagesAsync(e){let t=this,n={},i;async function s(o){if(typeof o=="string"){let a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await i.loadAsync(l)}else return o.data?{data:oa(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new lc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){let l=e[o],c=l.url;if(Array.isArray(c)){n[l.uuid]=[];for(let u=0,h=c.length;u<h;u++){let d=c[u],f=await s(d);f!==null&&(f instanceof HTMLImageElement?n[l.uuid].push(f):n[l.uuid].push(new ro(f.data,f.width,f.height)))}}else{let u=await s(l.url);u!==null&&(n[l.uuid]=u)}}}return n}parseTextures(e,t){function n(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}let i={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){let a=e[s];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);let l,c=t[a.image];Array.isArray(c)?(l=new as(c),c.length===6&&(l.needsUpdate=!0)):(c&&c.data?l=new ro(c.data,c.width,c.height):l=new xt(c),c&&(l.needsUpdate=!0)),l.uuid=a.uuid,a.name!==void 0&&(l.name=a.name),a.mapping!==void 0&&(l.mapping=n(a.mapping,rL)),a.offset!==void 0&&l.offset.fromArray(a.offset),a.repeat!==void 0&&l.repeat.fromArray(a.repeat),a.center!==void 0&&l.center.fromArray(a.center),a.rotation!==void 0&&(l.rotation=a.rotation),a.wrap!==void 0&&(l.wrapS=n(a.wrap[0],Uv),l.wrapT=n(a.wrap[1],Uv)),a.format!==void 0&&(l.format=a.format),a.type!==void 0&&(l.type=a.type),a.encoding!==void 0&&(l.encoding=a.encoding),a.minFilter!==void 0&&(l.minFilter=n(a.minFilter,kv)),a.magFilter!==void 0&&(l.magFilter=n(a.magFilter,kv)),a.anisotropy!==void 0&&(l.anisotropy=a.anisotropy),a.flipY!==void 0&&(l.flipY=a.flipY),a.premultiplyAlpha!==void 0&&(l.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(l.unpackAlignment=a.unpackAlignment),i[a.uuid]=l}return i}parseObject(e,t,n,i,s){let o;function a(d){return t[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",d),t[d]}function l(d){if(d!==void 0){if(Array.isArray(d)){let f=[];for(let p=0,m=d.length;p<m;p++){let v=d[p];n[v]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",v),f.push(n[v])}return f}return n[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),n[d]}}function c(d){return i[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",d),i[d]}let u,h;switch(e.type){case"Scene":o=new An,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new fe(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new hs(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new io(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":o=new Vt(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new Rr(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new xp(e.color,e.intensity);break;case"DirectionalLight":o=new Fr(e.color,e.intensity);break;case"PointLight":o=new xo(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new bp(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new vo(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new uc(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new dc().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),h=l(e.material),o=new Ma(u,h),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":u=a(e.geometry),h=l(e.material),o=new gt(u,h);break;case"InstancedMesh":u=a(e.geometry),h=l(e.material);let d=e.count,f=e.instanceMatrix,p=e.instanceColor;o=new Vf(u,h,d),o.instanceMatrix=new Re(new Float32Array(f.array),16),p!==void 0&&(o.instanceColor=new Re(new Float32Array(p.array),p.itemSize));break;case"LOD":o=new nv;break;case"Line":o=new Hi(a(e.geometry),l(e.material));break;case"LineLoop":o=new Yl(a(e.geometry),l(e.material));break;case"LineSegments":o=new ji(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new Kl(a(e.geometry),l(e.material));break;case"Sprite":o=new kf(l(e.material));break;case"Group":o=new Jn;break;case"Bone":o=new Aa;break;default:o=new Ke}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){let d=e.children;for(let f=0;f<d.length;f++)o.add(this.parseObject(d[f],t,n,i,s))}if(e.animations!==void 0){let d=e.animations;for(let f=0;f<d.length;f++){let p=d[f];o.animations.push(s[p])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);let d=e.levels;for(let f=0;f<d.length;f++){let p=d[f],m=o.getObjectByProperty("uuid",p.object);m!==void 0&&o.addLevel(m,p.distance)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){let i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}setTexturePath(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}},rL={UVMapping:Kd,CubeReflectionMapping:js,CubeRefractionMapping:Ws,EquirectangularReflectionMapping:vu,EquirectangularRefractionMapping:xu,CubeUVReflectionMapping:Js,CubeUVRefractionMapping:Ho},Uv={RepeatWrapping:di,ClampToEdgeWrapping:Zt,MirroredRepeatWrapping:qr},kv={NearestFilter:Pt,NearestMipmapNearestFilter:Xs,NearestMipmapLinearFilter:qs,LinearFilter:$e,LinearMipmapNearestFilter:jo,LinearMipmapLinearFilter:Ai},vh=class extends fn{constructor(e){super(e);typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=La.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;let a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){La.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}};vh.prototype.isImageBitmapLoader=!0;var Vv=class{constructor(){this.type="ShapePath",this.color=new fe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new cc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,o){return this.currentPath.bezierCurveTo(e,t,n,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function n(y){let x=[];for(let b=0,w=y.length;b<w;b++){let _=y[b],S=new yi;S.curves=_.curves,x.push(S)}return x}function i(y,x){let b=x.length,w=!1;for(let _=b-1,S=0;S<b;_=S++){let A=x[_],T=x[S],L=T.x-A.x,C=T.y-A.y;if(Math.abs(C)>Number.EPSILON){if(C<0&&(A=x[S],L=-L,T=x[_],C=-C),y.y<A.y||y.y>T.y)continue;if(y.y===A.y){if(y.x===A.x)return!0}else{let U=C*(y.x-A.x)-L*(y.y-A.y);if(U===0)return!0;if(U<0)continue;w=!w}}else{if(y.y!==A.y)continue;if(T.x<=y.x&&y.x<=A.x||A.x<=y.x&&y.x<=T.x)return!0}}return w}let s=ur.isClockWise,o=this.subPaths;if(o.length===0)return[];if(t===!0)return n(o);let a,l,c,u=[];if(o.length===1)return l=o[0],c=new yi,c.curves=l.curves,u.push(c),u;let h=!s(o[0].getPoints());h=e?!h:h;let d=[],f=[],p=[],m=0,v;f[m]=void 0,p[m]=[];for(let y=0,x=o.length;y<x;y++)l=o[y],v=l.getPoints(),a=s(v),a=e?!a:a,a?(!h&&f[m]&&m++,f[m]={s:new yi,p:v},f[m].s.curves=l.curves,h&&m++,p[m]=[]):p[m].push({h:l,p:v[0]});if(!f[0])return n(o);if(f.length>1){let y=!1,x=[];for(let b=0,w=f.length;b<w;b++)d[b]=[];for(let b=0,w=f.length;b<w;b++){let _=p[b];for(let S=0;S<_.length;S++){let A=_[S],T=!0;for(let L=0;L<f.length;L++)i(A.p,f[L].p)&&(b!==L&&x.push({froms:b,tos:L,hole:S}),T?(T=!1,d[L].push(A)):y=!0);T&&d[b].push(A)}}x.length>0&&(y||(p=d))}let g;for(let y=0,x=f.length;y<x;y++){c=f[y].s,u.push(c),g=p[y];for(let b=0,w=g.length;b<w;b++)c.holes.push(g[b].h)}return u}},_p=class{constructor(e){this.type="Font",this.data=e}generateShapes(e,t=100){let n=[],i=sL(e,t,this.data);for(let s=0,o=i.length;s<o;s++)Array.prototype.push.apply(n,i[s].toShapes());return n}};function sL(r,e,t){let n=Array.from(r),i=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*i,o=[],a=0,l=0;for(let c=0;c<n.length;c++){let u=n[c];if(u===`
`)a=0,l-=s;else{let h=oL(u,i,a,l,t);a+=h.offsetX,o.push(h.path)}}return o}function oL(r,e,t,n,i){let s=i.glyphs[r]||i.glyphs["?"];if(!s){console.error('THREE.Font: character "'+r+'" does not exists in font family '+i.familyName+".");return}let o=new Vv,a,l,c,u,h,d,f,p;if(s.o){let m=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let v=0,g=m.length;v<g;)switch(m[v++]){case"m":a=m[v++]*e+t,l=m[v++]*e+n,o.moveTo(a,l);break;case"l":a=m[v++]*e+t,l=m[v++]*e+n,o.lineTo(a,l);break;case"q":c=m[v++]*e+t,u=m[v++]*e+n,h=m[v++]*e+t,d=m[v++]*e+n,o.quadraticCurveTo(h,d,c,u);break;case"b":c=m[v++]*e+t,u=m[v++]*e+n,h=m[v++]*e+t,d=m[v++]*e+n,f=m[v++]*e+t,p=m[v++]*e+n,o.bezierCurveTo(h,d,f,p,c,u);break}}return{offsetX:s.ha*e,path:o}}_p.prototype.isFont=!0;var Tp=class extends fn{constructor(e){super(e)}load(e,t,n,i){let s=this,o=new Xn(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){let l;try{l=JSON.parse(a)}catch(u){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),l=JSON.parse(a.substring(65,a.length-2))}let c=s.parse(l);t&&t(c)},n,i)}parse(e){return new _p(e)}},xh,aL={getContext:function(){return xh===void 0&&(xh=new(window.AudioContext||window.webkitAudioContext)),xh},setContext:function(r){xh=r}},Hv=class extends fn{constructor(e){super(e)}load(e,t,n,i){let s=this,o=new Xn(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{let l=a.slice(0);aL.getContext().decodeAudioData(l,function(u){t(u)})}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}},jv=class extends dc{constructor(e,t,n=1){super(void 0,n);let i=new fe().set(e),s=new fe().set(t),o=new M(i.r,i.g,i.b),a=new M(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}};jv.prototype.isHemisphereLightProbe=!0;var Wv=class extends dc{constructor(e,t=1){super(void 0,t);let n=new fe().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}};Wv.prototype.isAmbientLightProbe=!0;var Ep=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Jv(),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){let t=Jv();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function Jv(){return(typeof performance=="undefined"?Date:performance).now()}var Xv=class extends Ke{constructor(e){super();this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){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;let 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}};var qv=class{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0,t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}},Yv=class{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let n=this.buffer,i=this.valueSize,s=e*i+i,o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)n[s+a]=n[a];o=t}else{o+=t;let a=t/o;this._mixBufferRegion(n,s,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){let t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){let l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){a.setValue(n,i);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,o=i;s!==o;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let o=0;o!==s;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){Tt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){let o=this._workIndex*s;Tt.multiplyQuaternionsFlat(e,o,e,t,e,n),Tt.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,s){let o=1-i;for(let a=0;a!==s;++a){let l=t+a;e[l]=e[l]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,s){for(let o=0;o!==s;++o){let a=t+o;e[a]=e[a]+e[n+o]*i}}},Np="\\[\\]\\.:\\/",lL=new RegExp("["+Np+"]","g"),Cp="[^"+Np+"]",cL="[^"+Np.replace("\\.","")+"]",uL=/((?:WC+[\/:])*)/.source.replace("WC",Cp),hL=/(WCOD+)?/.source.replace("WCOD",cL),dL=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Cp),fL=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Cp),pL=new RegExp("^"+uL+hL+dL+fL+"$"),mL=["material","materials","bones"],Kv=class{constructor(e,t,n){let i=n||nt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},nt=class{constructor(e,t,n){this.path=t,this.parsedPath=n||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,n){return e&&e.isAnimationObjectGroup?new nt.Composite(e,t,n):new nt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(lL,"")}static parseTrackName(e){let t=pL.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let s=n.nodeName.substring(i+1);mL.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(!t||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.node[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,s=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(n){let c=t.objectIndex;switch(n){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===c){c=u;break}break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let o=e[i];if(o===void 0){let c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" 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 l=this.BindingType.Direct;if(s!==void 0){if(i==="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[s]!==void 0&&(s=e.morphTargetDictionary[s])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};nt.Composite=Kv;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]];var Qv=class{constructor(){this.uuid=fi(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){let e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length,a,l=e.length,c=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){let d=arguments[u],f=d.uuid,p=t[f];if(p===void 0){p=l++,t[f]=p,e.push(d);for(let m=0,v=o;m!==v;++m)s[m].push(new nt(d,n[m],i[m]))}else if(p<c){a=e[p];let m=--c,v=e[m];t[v.uuid]=p,e[p]=v,t[f]=m,e[m]=d;for(let g=0,y=o;g!==y;++g){let x=s[g],b=x[m],w=x[p];x[p]=b,w===void 0&&(w=new nt(d,n[g],i[g])),x[m]=w}}else e[p]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length,s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){let l=arguments[o],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){let h=s++,d=e[h];t[d.uuid]=u,e[u]=d,t[c]=h,e[h]=l;for(let f=0,p=i;f!==p;++f){let m=n[f],v=m[h],g=m[u];m[u]=v,m[h]=g}}}this.nCachedObjects_=s}uncache(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length,s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){let c=arguments[a],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<s){let d=--s,f=e[d],p=--o,m=e[p];t[f.uuid]=h,e[h]=f,t[m.uuid]=d,e[d]=m,e.pop();for(let v=0,g=i;v!==g;++v){let y=n[v],x=y[d],b=y[p];y[h]=x,y[d]=b,y.pop()}}else{let d=--o,f=e[d];d>0&&(t[f.uuid]=h),e[h]=f,e.pop();for(let p=0,m=i;p!==m;++p){let v=n[p];v[h]=v[d],v.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){let n=this._bindingsIndicesByPath,i=n[e],s=this._bindings;if(i!==void 0)return s[i];let o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);i=s.length,n[e]=i,o.push(e),a.push(t),s.push(h);for(let d=u,f=l.length;d!==f;++d){let p=l[d];h[d]=new nt(p,e,t)}return h}unsubscribe_(e){let t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){let i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=n,o[n]=l,o.pop(),s[n]=s[a],s.pop(),i[n]=i[a],i.pop()}}};Qv.prototype.isAnimationObjectGroup=!0;var Zv=class{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;let s=t.tracks,o=s.length,a=new Array(o),l={endingStart:qo,endingEnd:qo};for(let c=0;c!==o;++c){let u=s[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=B_,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,n){if(e.fadeOut(t),this.fadeIn(t),n){let i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){let 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,n){let i=this._mixer,s=i.time,o=this.timeScale,a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);let l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+n,c[0]=e/o,c[1]=t/o,this}stopWarping(){let 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,n,i){if(!this.enabled){this._updateWeight(e);return}let s=this._startTime;if(s!==null){let l=(e-s)*n;if(l<0||n===0)return;this._startTime=null,t=n*l}t*=this._updateTimeScale(e);let o=this._updateTime(t),a=this._updateWeight(e);if(a>0){let l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Qg:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case $d:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(n!==null){let i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;n!==null&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,i=this.time+e,s=this._loopCount,o=n===O_;if(e===0)return s===-1?i:o&&(s&1)==1?t-i:i;if(n===R_){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){let a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);let l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){let c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)==1)return t-i}return i}_setEndings(e,t,n){let i=this._interpolantSettings;n?(i.endingStart=Yo,i.endingEnd=Yo):(e?i.endingStart=this.zeroSlopeAtStart?Yo:qo:i.endingStart=wu,t?i.endingEnd=this.zeroSlopeAtEnd?Yo:qo:i.endingEnd=wu)}_scheduleFading(e,t,n){let i=this._mixer,s=i.time,o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);let a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=n,this}},$v=class extends cn{constructor(e){super();this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName,u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){let d=i[h],f=d.name,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,l,f));continue}let m=t&&t._propertyBindings[h].binding.parsedPath;p=new Yv(nt.create(n,f,m),d.ValueTypeName,d.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,f),o[h]=p}a[h].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let s=t[n];s.useCount++==0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let s=t[n];--s.useCount==0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){let i=this._actions,s=this._actionsByClip,o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{let a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){let t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;let s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;let h=a.actionByRoot,d=(e._localRoot||this._root).uuid;delete h[d],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let s=t[n];--s.referenceCount==0&&this._removeInactiveBinding(s)}}_lendAction(e){let t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){let t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){let i=this._bindingsByRootAndName,s=this._bindings,o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){let t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,o=this._bindingsByRootAndName,a=o[i],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[i]}_lendBinding(e){let t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){let t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return n===void 0&&(n=new dp(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){let t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){let i=t||this._root,s=i.uuid,o=typeof e=="string"?Ca.findByName(i,e):e,a=o!==null?o.uuid:e,l=this._actionsByClip[a],c=null;if(n===void 0&&(o!==null?n=o.blendMode:n=$d),l!==void 0){let h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===n)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;let u=new Zv(this,o,t,n);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){let n=t||this._root,i=n.uuid,s=typeof e=="string"?Ca.findByName(n,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,s,o);let a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].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){let t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){let o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){let c=o[a];this._deactivateAction(c);let u=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(e){let t=e.uuid,n=this._actionsByClip;for(let o in n){let a=n[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}let i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(let o in s){let a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){let n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}};$v.prototype._controlInterpolantsResultBuffer=new Float32Array(1);var Ae=class{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new Ae(this.value.clone===void 0?this.value:this.value.clone())}},ex=class extends Vi{constructor(e,t,n=1){super(e,t);this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};ex.prototype.isInstancedInterleavedBuffer=!0;var tx=class{constructor(e,t,n,i,s){this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}};tx.prototype.isGLBufferAttribute=!0;var Lp=class{constructor(e,t,n=0,i=1/0){this.ray=new or(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new pf,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: Unsupported camera type: "+t.type)}intersectObject(e,t=!1,n=[]){return Ip(e,this,n,t),n.sort(nx),n}intersectObjects(e,t=!1,n=[]){for(let i=0,s=e.length;i<s;i++)Ip(e[i],this,n,t);return n.sort(nx),n}};function nx(r,e){return r.distance-e.distance}function Ip(r,e,t,n){if(r.layers.test(e.layers)&&r.raycast(e,t),n===!0){let i=r.children;for(let s=0,o=i.length;s<o;s++)Ip(i[s],e,t,!0)}}var bh=class{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){let e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Ln(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var ix=new O,Pa=class{constructor(e=new O(1/0,1/0),t=new O(-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=ix.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return ix.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};Pa.prototype.isBox2=!0;var rx=new M,wh=new M,qn=class{constructor(e=new M,t=new M){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){rx.subVectors(e,this.start),wh.subVectors(this.end,this.start);let n=wh.dot(wh),s=wh.dot(rx)/n;return t&&(s=Ln(s,0,1)),s}closestPointToPoint(e,t,n){let i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}},sx=class extends Ke{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}};sx.prototype.isImmediateRenderObject=!0;var ox=new M,Pp=class extends Ke{constructor(e,t){super();this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;let n=new we,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){let c=o/l*Math.PI*2,u=a/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}n.setAttribute("position",new ge(i,3));let s=new Gn({fog:!1,toneMapped:!1});this.cone=new ji(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),ox.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(ox),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},gs=new M,Sh=new me,Dp=new me,ax=class extends ji{constructor(e){let t=lx(e),n=new we,i=[],s=[],o=new fe(0,0,1),a=new fe(0,1,0);for(let c=0;c<t.length;c++){let u=t[c];u.parent&&u.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}n.setAttribute("position",new ge(i,3)),n.setAttribute("color",new ge(s,3));let l=new Gn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l);this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){let t=this.bones,n=this.geometry,i=n.getAttribute("position");Dp.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){let a=t[s];a.parent&&a.parent.isBone&&(Sh.multiplyMatrices(Dp,a.matrixWorld),gs.setFromMatrixPosition(Sh),i.setXYZ(o,gs.x,gs.y,gs.z),Sh.multiplyMatrices(Dp,a.parent.matrixWorld),gs.setFromMatrixPosition(Sh),i.setXYZ(o+1,gs.x,gs.y,gs.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}};function lx(r){let e=[];r&&r.isBone&&e.push(r);for(let t=0;t<r.children.length;t++)e.push.apply(e,lx(r.children[t]));return e}var Rp=class extends gt{constructor(e,t,n){let i=new Ji(t,4,2),s=new dn({wireframe:!0,fog:!1,toneMapped:!1});super(i,s);this.light=e,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}};var cx=class extends ji{constructor(e=10,t=10,n=4473924,i=8947848){n=new fe(n),i=new fe(i);let s=t/2,o=e/t,a=e/2,l=[],c=[];for(let d=0,f=0,p=-a;d<=t;d++,p+=o){l.push(-a,0,p,a,0,p),l.push(p,0,-a,p,0,a);let m=d===s?n:i;m.toArray(c,f),f+=3,m.toArray(c,f),f+=3,m.toArray(c,f),f+=3,m.toArray(c,f),f+=3}let u=new we;u.setAttribute("position",new ge(l,3)),u.setAttribute("color",new ge(c,3));let h=new Gn({vertexColors:!0,toneMapped:!1});super(u,h);this.type="GridHelper"}};var ux=new M,Mh=new M,hx=new M,Bp=class extends Ke{constructor(e,t,n){super();this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);let i=new we;i.setAttribute("position",new ge([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let s=new Gn({fog:!1,toneMapped:!1});this.lightPlane=new Hi(i,s),this.add(this.lightPlane),i=new we,i.setAttribute("position",new ge([0,0,0,0,0,1],3)),this.targetLine=new Hi(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){ux.setFromMatrixPosition(this.light.matrixWorld),Mh.setFromMatrixPosition(this.light.target.matrixWorld),hx.subVectors(Mh,ux),this.lightPlane.lookAt(Mh),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Mh),this.targetLine.scale.z=hx.length()}},Ah=new M,$t=new Dr,xi=class extends ji{constructor(e){let t=new we,n=new Gn({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],o={},a=new fe(16755200),l=new fe(16711680),c=new fe(43775),u=new fe(16777215),h=new fe(3355443);d("n1","n2",a),d("n2","n4",a),d("n4","n3",a),d("n3","n1",a),d("f1","f2",a),d("f2","f4",a),d("f4","f3",a),d("f3","f1",a),d("n1","f1",a),d("n2","f2",a),d("n3","f3",a),d("n4","f4",a),d("p","n1",l),d("p","n2",l),d("p","n3",l),d("p","n4",l),d("u1","u2",c),d("u2","u3",c),d("u3","u1",c),d("c","t",u),d("p","c",h),d("cn1","cn2",h),d("cn3","cn4",h),d("cf1","cf2",h),d("cf3","cf4",h);function d(p,m,v){f(p,v),f(m,v)}function f(p,m){i.push(0,0,0),s.push(m.r,m.g,m.b),o[p]===void 0&&(o[p]=[]),o[p].push(i.length/3-1)}t.setAttribute("position",new ge(i,3)),t.setAttribute("color",new ge(s,3));super(t,n);this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){let e=this.geometry,t=this.pointMap,n=1,i=1;$t.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),sn("c",t,e,$t,0,0,-1),sn("t",t,e,$t,0,0,1),sn("n1",t,e,$t,-n,-i,-1),sn("n2",t,e,$t,n,-i,-1),sn("n3",t,e,$t,-n,i,-1),sn("n4",t,e,$t,n,i,-1),sn("f1",t,e,$t,-n,-i,1),sn("f2",t,e,$t,n,-i,1),sn("f3",t,e,$t,-n,i,1),sn("f4",t,e,$t,n,i,1),sn("u1",t,e,$t,n*.7,i*1.1,-1),sn("u2",t,e,$t,-n*.7,i*1.1,-1),sn("u3",t,e,$t,0,i*2,-1),sn("cf1",t,e,$t,-n,0,1),sn("cf2",t,e,$t,n,0,1),sn("cf3",t,e,$t,0,-i,1),sn("cf4",t,e,$t,0,i,1),sn("cn1",t,e,$t,-n,0,-1),sn("cn2",t,e,$t,n,0,-1),sn("cn3",t,e,$t,0,-i,-1),sn("cn4",t,e,$t,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function sn(r,e,t,n,i,s,o){Ah.set(i,s,o).unproject(n);let a=e[r];if(a!==void 0){let l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],Ah.x,Ah.y,Ah.z)}}var Da=class extends ji{constructor(e,t=16776960){let n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new we;s.setIndex(new Re(n,1)),s.setAttribute("position",new ge(i,3));super(s,new Gn({color:t,toneMapped:!1}));this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){let t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}};var Op=class extends ji{constructor(e=1){let t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new we;i.setAttribute("position",new ge(t,3)),i.setAttribute("color",new ge(n,3));let s=new Gn({vertexColors:!0,toneMapped:!1});super(i,s);this.type="AxesHelper"}setColors(e,t,n){let i=new fe,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},gL=new Float32Array(1),kF=new Int32Array(gL.buffer);gi.create=function(r,e){return console.log("THREE.Curve.create() has been deprecated"),r.prototype=Object.create(gi.prototype),r.prototype.constructor=r,r.prototype.getPoint=e,r};cc.prototype.fromPoints=function(r){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(r)};cx.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};ax.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};fn.prototype.extractUrlBase=function(r){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Ei.extractUrlBase(r)};fn.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.")}};Pa.prototype.center=function(r){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(r)};Pa.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Pa.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)};Pa.prototype.size=function(r){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(r)};tn.prototype.center=function(r){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(r)};tn.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};tn.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)};tn.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)};tn.prototype.size=function(r){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(r)};ti.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Vl.prototype.setFromMatrix=function(r){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(r)};qn.prototype.center=function(r){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(r)};Dt.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)};Dt.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)};Dt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};Dt.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)};Dt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};Dt.prototype.getInverse=function(r){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()};me.prototype.extractPosition=function(r){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(r)};me.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)};me.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new M().setFromMatrixColumn(this,3)};me.prototype.setRotationFromQuaternion=function(r){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(r)};me.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};me.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};me.prototype.multiplyVector4=function(r){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};me.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};me.prototype.rotateAxis=function(r){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),r.transformDirection(this)};me.prototype.crossVector=function(r){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};me.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};me.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};me.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};me.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};me.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};me.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};me.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};me.prototype.makeFrustum=function(r,e,t,n,i,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(r,e,n,t,i,s)};me.prototype.getInverse=function(r){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()};ni.prototype.isIntersectionLine=function(r){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(r)};Tt.prototype.multiplyVector3=function(r){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),r.applyQuaternion(this)};Tt.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};or.prototype.isIntersectionBox=function(r){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)};or.prototype.isIntersectionPlane=function(r){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(r)};or.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)};qt.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};qt.prototype.barycoordFromPoint=function(r,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(r,e)};qt.prototype.midpoint=function(r){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(r)};qt.prototypenormal=function(r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(r)};qt.prototype.plane=function(r){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(r)};qt.barycoordFromPoint=function(r,e,t,n,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),qt.getBarycoord(r,e,t,n,i)};qt.normal=function(r,e,t,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),qt.getNormal(r,e,t,n)};yi.prototype.extractAllPoints=function(r){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(r)};yi.prototype.extrude=function(r){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new hr(this,r)};yi.prototype.makeGeometry=function(r){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new ps(this,r)};O.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)};O.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)};O.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};M.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};M.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};M.prototype.getPositionFromMatrix=function(r){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(r)};M.prototype.getScaleFromMatrix=function(r){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(r)};M.prototype.getColumnFromMatrix=function(r,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,r)};M.prototype.applyProjection=function(r){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(r)};M.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)};M.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)};M.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Qe.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)};Qe.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Ke.prototype.getChildByName=function(r){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(r)};Ke.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};Ke.prototype.translate=function(r,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,r)};Ke.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};Ke.prototype.applyMatrix=function(r){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)};Object.defineProperties(Ke.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(r){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=r}},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.")}}});gt.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(gt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),ef},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.")}}});Ma.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};Vt.prototype.setLens=function(r,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(r)};Object.defineProperties(vi.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(r){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=r}},shadowCameraLeft:{set:function(r){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=r}},shadowCameraRight:{set:function(r){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=r}},shadowCameraTop:{set:function(r){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=r}},shadowCameraBottom:{set:function(r){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=r}},shadowCameraNear:{set:function(r){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=r}},shadowCameraFar:{set:function(r){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=r}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(r){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=r}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(r){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=r}},shadowMapHeight:{set:function(r){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=r}}});Object.defineProperties(Re.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===Tu},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Tu)}}});Re.prototype.setDynamic=function(r){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?Tu:Bl),this};Re.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Re.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};we.prototype.addIndex=function(r){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(r)};we.prototype.addAttribute=function(r,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(r,new Re(arguments[1],arguments[2]))):r==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(r,e)};we.prototype.addDrawCall=function(r,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(r,e)};we.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};we.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};we.prototype.removeAttribute=function(r){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(r)};we.prototype.applyMatrix=function(r){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)};Object.defineProperties(we.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(r){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?Tu:Bl),this};Vi.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};hr.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};hr.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};hr.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};An.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};Ae.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this};Object.defineProperties(nn.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},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 fe}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(r){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=r===Dg}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(r){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=r}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}});Object.defineProperties(_t.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(r){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=r}}});wt.prototype.clearTarget=function(r,e,t,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(r),this.clear(e,t,n)};wt.prototype.animate=function(r){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(r)};wt.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};wt.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};wt.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};wt.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};wt.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};wt.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};wt.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};wt.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};wt.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};wt.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};wt.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};wt.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};wt.prototype.enableScissorTest=function(r){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(r)};wt.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};wt.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};wt.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};wt.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};wt.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};wt.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};wt.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};wt.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};wt.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};wt.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(wt.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=r}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=r}},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(r){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=r===!0?Fi:ln}},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(Yy.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(bt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=r}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=r}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=r}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=r}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(r){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=r}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(r){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=r}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(r){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=r}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(r){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=r}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(r){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=r}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(r){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=r}}});Xv.prototype.load=function(r){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");let e=this;return new Hv().load(r,function(n){e.setBuffer(n)}),this};qv.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};ju.prototype.updateCubeMap=function(r,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(r,e)};ju.prototype.clear=function(r,e,t,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(r,e,t,n)};Zs.crossOrigin=void 0;Zs.loadTexture=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");let i=new gh;i.setCrossOrigin(this.crossOrigin);let s=i.load(r,t,void 0,n);return e&&(s.mapping=e),s};Zs.loadTextureCube=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");let i=new Dv;i.setCrossOrigin(this.crossOrigin);let s=i.load(r,t,void 0,n);return e&&(s.mapping=e),s};Zs.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};Zs.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Lg}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Lg);var Fp={type:"change"},yL={type:"changeZoom"},_h={type:"start"},zp={type:"end"},dx=navigator.platform.toUpperCase().indexOf("MAC")>=0,fc=new M,fx=new M,vL=new O,px=new M,mx=new Tt,pc=2*Math.PI,Gp=class extends cn{constructor(e,t){super();t===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.enabled=!0,this.useKeyEvents=!0,this.target=new M,this.object.getTarget(this.target),this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0+1*Ee.DEG2RAD,this.maxPolarAngle=Math.PI-1*Ee.DEG2RAD,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.125,this.enableZoom=!0,this.zoomSpeed=2,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.autoRotateClockwise=!0,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Us.ROTATE,MIDDLE:Us.DOLLY,RIGHT:Us.PAN},this.touches={ONE:ks.ROTATE,TWO:ks.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return f.phi},this.getAzimuthalAngle=function(){return f.theta},this.saveState=function(){l.target0.copy(l.target),l.position0.copy(l.object.position),l.zoom0=l.object.zoom},this.reset=function(){l.target.copy(l.target0),l.object.position.copy(l.position0),l.object.zoom=l.zoom0,n=0,l.object.updateProjectionMatrix(),l.dispatchEvent(Fp),l.update(),u=c.NONE},this.update=function(){let F=l.object.position;fc.copy(F).sub(l.target),f.setFromVector3(fc),l.object.isUpVectorFlipped&&(f.phi*=-1,f.theta-=Math.PI),l.autoRotate&&u===c.NONE&&(l.autoRotateClockwise===!0?R(U()):G(U())),l.rotationLimitsMode!==l.rotationLimitsOptions.HORIZONTAL&&(f.phi+=p.phi),(l.rotationLimitsMode!==l.rotationLimitsOptions.VERTICAL||l.autoRotate===!0)&&(f.theta+=p.theta),(l.rotationLimitsMode===l.rotationLimitsOptions.VERTICAL||l.rotationLimitsMode===l.rotationLimitsOptions.BOTH)&&(f.phi=Math.max(i,Math.min(s,f.phi))),(l.rotationLimitsMode===l.rotationLimitsOptions.HORIZONTAL||l.rotationLimitsMode===l.rotationLimitsOptions.BOTH)&&(n+=p.theta,n>l.rotationHorizontalOffset.max?(f.theta=a,n=l.rotationHorizontalOffset.max):n<-l.rotationHorizontalOffset.min&&(f.theta=o,n=-l.rotationHorizontalOffset.min));let Pe=l.minAzimuthAngle,et=l.maxAzimuthAngle;isFinite(Pe)&&isFinite(et)&&(Pe<-Math.PI?Pe+=pc:Pe>Math.PI&&(Pe-=pc),et<-Math.PI?et+=pc:et>Math.PI&&(et-=pc),Pe<=et?f.theta=Math.max(Pe,Math.min(et,f.theta)):f.theta=f.theta>(Pe+et)/2?Math.max(Pe,f.theta):Math.min(et,f.theta)),f.radius*=m,f.radius=Math.max(l.minDistance,Math.min(l.maxDistance,f.radius)),l.target.add(v),fc.setFromSpherical(f),F.copy(l.target).add(fc);let Ft=f.phi%pc;return fx.copy(fc).normalize(),l.object.up.copy(Ke.DefaultUp).applyAxisAngle(fx,l.object.angleOffsetFromUp),Ft>0&&Ft>Math.PI||Ft<0&&Ft>-Math.PI?(l.object.up.negate(),l.object.lookAt(l.target),l.object.isUpVectorFlipped=!0):(l.object.lookAt(l.target),l.object.isUpVectorFlipped=!1),l.enableDamping===!0?(p.theta*=1-l.dampingFactor,p.phi*=1-l.dampingFactor):p.set(0,0,0),v.set(0,0,0),m=1,g||px.distanceToSquared(l.object.position)>d||8*(1-mx.dot(l.object.quaternion))>h?(l.dispatchEvent(Fp),g&&l.dispatchEvent(yL),px.copy(l.object.position),mx.copy(l.object.quaternion),g=!1,!0):(p.set(0,0,0),!1)},this.dispose=function(){l.domElement.removeEventListener("contextmenu",xn),l.domElement.removeEventListener("pointerdown",xe),l.domElement.removeEventListener("wheel",Bn),l.domElement.removeEventListener("touchstart",En),l.domElement.removeEventListener("touchend",_r),l.domElement.removeEventListener("touchmove",Di),l.domElement.ownerDocument.removeEventListener("pointermove",he),l.domElement.ownerDocument.removeEventListener("pointerup",Ne),l.domElement.removeEventListener("gesturestart",X),l.domElement.removeEventListener("gesturechange",X),l.domElement.removeEventListener("gestureend",X),window.removeEventListener("keydown",Mt,!1),window.removeEventListener("keyup",Tn,!1)},this.zoomOut=function(){W(P())},this.zoomIn=function(){z(P())},this.setEnableDampingSpeed=function(F){this.enableDamping=F,this.rotateSpeed=F===!0?.2:1},this.resetTo=function(F,Pe,et){l.target.copy(F),l.object.position.copy(Pe),l.object.zoom=et,l.object.updateProjectionMatrix(),l.dispatchEvent(Fp),l.update(),u=c.NONE},this.stopDamping=function(){p.theta=0,p.phi=0};let n,i,s,o,a;this.rotationVerticalOffset={min:Math.PI*.5,max:Math.PI*.5},this.rotationHorizontalOffset={min:Math.PI*.5,max:Math.PI*.5},this.rotationLimitsOptions={DEFAULT:0,VERTICAL:1,HORIZONTAL:2,BOTH:3},this.rotationLimitsMode=this.rotationLimitsOptions.DEFAULT,this.updateRotationOffetLimits=function(){n=0,i=Th(f.phi-l.rotationVerticalOffset.min),s=Th(f.phi+l.rotationVerticalOffset.max),i<0&&(i=l.minPolarAngle),s<0&&(s=l.maxPolarAngle),o=Th(f.theta-l.rotationHorizontalOffset.min),a=Th(f.theta+l.rotationHorizontalOffset.max)},this.toJSON=function(){let F={};return l.useKeyEvents&&(F.useKeyEvents=!0),l.enableDamping&&(F.enableDamping=!0),l.enablePan&&(F.enablePan=!0),l.enableZoom&&(F.enableZoom=!0),l.enableRotate&&(F.enableRotate=!0),F.rotationLimitsMode=l.rotationLimitsMode,(l.rotationLimitsMode===l.rotationLimitsOptions.VERTICAL||l.rotationLimitsMode===l.rotationLimitsOptions.BOTH)&&(F.rotationVerticalOffset={min:l.rotationVerticalOffset.min,max:l.rotationVerticalOffset.max}),(l.rotationLimitsMode===l.rotationLimitsOptions.HORIZONTAL||l.rotationLimitsMode===l.rotationLimitsOptions.BOTH)&&(F.rotationHorizontalOffset={min:l.rotationHorizontalOffset.min,max:l.rotationHorizontalOffset.max}),l.autoRotate&&(F.autoRotate=!0,F.autoRotateSpeed=l.autoRotateSpeed,l.autoRotateClockwise&&(F.autoRotateClockwise=!0)),F},this.fromJSON=function(F){l.useKeyEvents=F.useKeyEvents===!0,l.setEnableDampingSpeed(F.enableDamping===!0),l.enablePan=F.enablePan===!0,l.enableZoom=F.enableZoom===!0,l.enableRotate=F.enableRotate===!0,F.rotationLimitsMode!==void 0&&(l.rotationLimitsMode=F.rotationLimitsMode),F.rotationVerticalOffset&&(l.rotationVerticalOffset={min:F.rotationVerticalOffset.min,max:F.rotationVerticalOffset.max}),F.rotationHorizontalOffset&&(l.rotationHorizontalOffset={min:F.rotationHorizontalOffset.min,max:F.rotationHorizontalOffset.max}),l.autoRotate=F.autoRotate===!0,F.autoRotateSpeed&&(l.autoRotateSpeed=F.autoRotateSpeed),l.autoRotateClockwise=F.autoRotateClockwise===!0,l.updateRotationOffetLimits()};let l=this,c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},u=c.NONE,h=1e-8,d=.01,f=new bh,p=new bh,m=1,v=new M,g=!1,y=new O,x=new O,b=new O,w=new O,_=new O,S=new O,A=new O,T=new O,L=new O,C={};function U(){return 2*Math.PI/60/60*l.autoRotateSpeed}function P(){return Math.pow(.95,l.zoomSpeed)}function R(F){p.theta-=F*(l.object.isUpVectorFlipped?-1:1)}function G(F){p.theta+=F}function B(F){p.phi-=F}let j=function(){let F=new M;return function(et,Ft){F.setFromMatrixColumn(Ft,0),F.multiplyScalar(-et),v.add(F)}}(),ne=function(){let F=new M;return function(et,Ft){l.screenSpacePanning===!0?F.setFromMatrixColumn(Ft,1):(F.setFromMatrixColumn(Ft,0),F.crossVectors(l.object.up,F)),F.multiplyScalar(et),v.add(F)}}(),le=function(){let F=new M;return function(et,Ft){let Nn=l.domElement;if(l.object.isPerspectiveCamera){let Gs=l.object.position;F.copy(Gs).sub(l.target);let sr=F.length();sr*=Math.tan(l.object.fov/2*Math.PI/180),j(2*et*sr/Nn.clientHeight,l.object.matrix),ne(2*Ft*sr/Nn.clientHeight,l.object.matrix)}else l.object.isOrthographicCamera?(j(et*(l.object.right-l.object.left)/l.object.zoom/Nn.clientWidth,l.object.matrix),ne(Ft*(l.object.top-l.object.bottom)/l.object.zoom/Nn.clientHeight,l.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),l.enablePan=!1)}}();function W(F){l.object.isPerspectiveCamera?m/=F:l.object.isOrthographicCamera?(l.object.zoom=Math.max(l.minZoom,Math.min(l.maxZoom,l.object.zoom*F)),l.object.updateProjectionMatrix(),g=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),l.enableZoom=!1)}function z(F){l.object.isPerspectiveCamera?m*=F:l.object.isOrthographicCamera?(l.object.zoom=Math.max(l.minZoom,Math.min(l.maxZoom,l.object.zoom/F)),l.object.updateProjectionMatrix(),g=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),l.enableZoom=!1)}function D(F){y.set(F.clientX,F.clientY)}function K(F){A.set(F.clientX,F.clientY)}function q(F){w.set(F.clientX,F.clientY)}function ee(F){x.set(F.clientX,F.clientY),b.subVectors(x,y).multiplyScalar(l.rotateSpeed).rotateAround(vL,-l.object.angleOffsetFromUp);let Pe=l.domElement;R(2*Math.PI*b.x/Pe.clientHeight),B(2*Math.PI*b.y/Pe.clientHeight),y.copy(x),l.update()}function V(F){T.set(F.clientX,F.clientY),L.subVectors(T,A),L.y>0?W(P()):L.y<0&&z(P()),A.copy(T),l.update()}function de(F){_.set(F.clientX,F.clientY),S.subVectors(_,w).multiplyScalar(l.panSpeed),le(S.x,S.y),w.copy(_),l.update()}function ae(){}let te=0;function X(F){if(F.preventDefault(),F.type==="gesturechange"){if(l.enableZoom===!1)return;F.scale>te?z(P()):F.scale<te&&W(P()),te=F.scale}}let se=!1,$,H;function Q(F){return F.wheelDeltaY?F.wheelDeltaY===-3*F.deltaY:F.deltaMode===0}function ce(F){if(!se)se=!0,H=Q(F);else{if(H===!1||(dx?F.metaKey:F.ctrlKey)){if(l.enableZoom===!1)return;F.deltaY<0?z(P()):F.deltaY>0&&W(P())}else{if(l.enablePan===!1)return;S.set(-F.deltaX,-F.deltaY).multiplyScalar(l.panSpeed),F.altKey?le(0,S.y):F.shiftKey?le(S.x,0):le(S.x,S.y)}l.update()}$&&window.clearTimeout($),$=window.setTimeout(()=>{se=!1,H=void 0},200)}function ie(F){let Pe=!1;switch(F.code){case l.keys.UP:le(0,l.keyPanSpeed),Pe=!0;break;case l.keys.BOTTOM:le(0,-l.keyPanSpeed),Pe=!0;break;case l.keys.LEFT:le(l.keyPanSpeed,0),Pe=!0;break;case l.keys.RIGHT:le(-l.keyPanSpeed,0),Pe=!0;break;default:break}Pe&&(F.preventDefault(),l.update())}function N(F){if(F.touches.length===1)y.set(F.touches[0].pageX,F.touches[0].pageY);else{let Pe=.5*(F.touches[0].pageX+F.touches[1].pageX),et=.5*(F.touches[0].pageY+F.touches[1].pageY);y.set(Pe,et)}}function E(F){if(F.touches.length===1)w.set(F.touches[0].pageX,F.touches[0].pageY);else{let Pe=.5*(F.touches[0].pageX+F.touches[1].pageX),et=.5*(F.touches[0].pageY+F.touches[1].pageY);w.set(Pe,et)}}function Y(F){let Pe=F.touches[0].pageX-F.touches[1].pageX,et=F.touches[0].pageY-F.touches[1].pageY,Ft=Math.sqrt(Pe*Pe+et*et);A.set(0,Ft)}function re(F){l.enableZoom&&Y(F),l.enablePan&&E(F)}function ye(F){l.enableZoom&&Y(F),l.enableRotate&&N(F)}function pe(F){if(F.touches.length===1)x.set(F.touches[0].pageX,F.touches[0].pageY);else{let et=.5*(F.touches[0].pageX+F.touches[1].pageX),Ft=.5*(F.touches[0].pageY+F.touches[1].pageY);x.set(et,Ft)}b.subVectors(x,y).multiplyScalar(l.rotateSpeed);let Pe=l.domElement;R(2*Math.PI*b.x/Pe.clientHeight),B(2*Math.PI*b.y/Pe.clientHeight),y.copy(x)}function Ie(F){if(F.touches.length===1)_.set(F.touches[0].pageX,F.touches[0].pageY);else{let Pe=.5*(F.touches[0].pageX+F.touches[1].pageX),et=.5*(F.touches[0].pageY+F.touches[1].pageY);_.set(Pe,et)}S.subVectors(_,w).multiplyScalar(l.panSpeed),le(S.x,S.y),w.copy(_)}function ve(F){let Pe=F.touches[0].pageX-F.touches[1].pageX,et=F.touches[0].pageY-F.touches[1].pageY,Ft=Math.sqrt(Pe*Pe+et*et);T.set(0,Ft),L.set(0,Math.pow(T.y/A.y,l.zoomSpeed)),W(L.y),A.copy(T)}function Fe(F){l.enableZoom&&ve(F),l.enablePan&&Ie(F)}function Ce(F){l.enableZoom&&ve(F),l.enableRotate&&pe(F)}function J(){}function xe(F){if(l.enabled!==!1)switch(F.pointerType){case"mouse":case"pen":l.useKeyEvents===!1?Be(F):ke(F);break;default:break}}function he(F){if(l.enabled!==!1)switch(F.pointerType){case"mouse":case"pen":ht(F);break;default:break}}function Ne(F){switch(F.pointerType){case"mouse":case"pen":ft(F);break;default:break}l.domElement.ownerDocument.removeEventListener("pointermove",he),l.domElement.ownerDocument.removeEventListener("pointerup",Ne)}function Be(F){F.preventDefault(),l.domElement.focus?l.domElement.focus():window.focus();let Pe;switch(F.button){case 0:Pe=l.mouseButtons.LEFT;break;case 1:Pe=l.mouseButtons.MIDDLE;break;case 2:Pe=l.mouseButtons.RIGHT;break;default:Pe=-1}switch(Pe){case Us.DOLLY:if(l.enablePan===!1)return;q(F),u=c.PAN;break;case Us.ROTATE:if(F.ctrlKey||F.metaKey||F.shiftKey){if(l.enablePan===!1)return;q(F),u=c.PAN}else{if(l.enableRotate===!1)return;D(F),u=c.ROTATE}break;case Us.PAN:if(F.ctrlKey||F.metaKey||F.shiftKey){if(l.enableRotate===!1)return;D(F),u=c.ROTATE}else{if(l.enablePan===!1)return;q(F),u=c.PAN}break;default:u=c.NONE}u!==c.NONE&&(l.domElement.ownerDocument.addEventListener("pointermove",he),l.domElement.ownerDocument.addEventListener("pointerup",Ne),l.dispatchEvent(_h))}function ke(F){if(l.enabled!==!1){switch(F.preventDefault(),l.domElement.focus?l.domElement.focus():window.focus(),F.button){case l.mouseButtons.MIDDLE:if(l.enablePan===!1)return;q(F),u=c.PAN;break;case l.mouseButtons.LEFT:if(F.altKey===!0&&!F.shiftKey&&!(dx?F.metaKey:F.ctrlKey)){if(l.enableRotate===!1)return;D(F),u=c.ROTATE}else if(C.code==="Space"){if(l.enablePan===!1)return;q(F),u=c.PAN}break;default:u=c.NONE}u!==c.NONE&&(l.domElement.ownerDocument.addEventListener("pointermove",he),l.domElement.ownerDocument.addEventListener("pointerup",Ne),l.dispatchEvent(_h))}}function ht(F){if(l.enabled!==!1)switch(F.preventDefault(),u){case c.ROTATE:if(l.enableRotate===!1)return;ee(F);break;case c.DOLLY:if(l.enableZoom===!1)return;V(F);break;case c.PAN:if(l.enablePan===!1)return;de(F);break;default:break}}function ft(F){l.enabled!==!1&&(ae(F),l.dispatchEvent(zp),u=c.NONE)}function Bn(F){l.enabled===!1||l.enableZoom===!1||u!==c.NONE&&u!==c.ROTATE||(F.preventDefault(),l.dispatchEvent(_h),ce(F),l.dispatchEvent(zp))}function Mt(F){l.enabled!==!1&&(C=F)}function Tn(){l.enabled!==!1&&(C={},u!==c.NONE&&ft(new PointerEvent("pointerover")))}function En(F){if(l.enabled!==!1){switch(F.preventDefault(),F.touches.length){case 1:switch(l.touches.ONE){case ks.ROTATE:if(l.enableRotate===!1)return;N(F),u=c.TOUCH_ROTATE;break;case ks.PAN:if(l.enablePan===!1)return;E(F),u=c.TOUCH_PAN;break;default:u=c.NONE}break;case 2:switch(l.touches.TWO){case ks.DOLLY_PAN:if(l.enableZoom===!1&&l.enablePan===!1)return;re(F),u=c.TOUCH_DOLLY_PAN;break;case ks.DOLLY_ROTATE:if(l.enableZoom===!1&&l.enableRotate===!1)return;ye(F),u=c.TOUCH_DOLLY_ROTATE;break;default:u=c.NONE}break;default:u=c.NONE}u!==c.NONE&&l.dispatchEvent(_h)}}function Di(F){if(l.enabled!==!1)switch(F.preventDefault(),u){case c.TOUCH_ROTATE:if(l.enableRotate===!1)return;pe(F),l.update();break;case c.TOUCH_PAN:if(l.enablePan===!1)return;Ie(F),l.update();break;case c.TOUCH_DOLLY_PAN:if(l.enableZoom===!1&&l.enablePan===!1)return;Fe(F),l.update();break;case c.TOUCH_DOLLY_ROTATE:if(l.enableZoom===!1&&l.enableRotate===!1)return;Ce(F),l.update();break;default:u=c.NONE}}function _r(F){l.enabled!==!1&&(J(F),l.dispatchEvent(zp),u=c.NONE)}function xn(F){l.enabled!==!1&&F.preventDefault()}l.domElement.addEventListener("contextmenu",xn),l.domElement.addEventListener("pointerdown",xe),l.domElement.addEventListener("wheel",Bn,{passive:!1}),l.domElement.addEventListener("touchstart",En,{passive:!1}),l.domElement.addEventListener("touchend",_r),l.domElement.addEventListener("touchmove",Di,{passive:!1}),l.domElement.addEventListener("gesturestart",X),l.domElement.addEventListener("gesturechange",X),l.domElement.addEventListener("gestureend",X),window.addEventListener("keydown",Mt,!1),window.addEventListener("keyup",Tn,!1),this.update(),this.updateRotationOffetLimits(),this.setEnableDampingSpeed(!0)}};function Th(r){let e=Math.PI*2;for(;r<=-Math.PI;)r+=e;for(;r>Math.PI;)r-=e;return r}var xL=3,Up=class extends Lp{constructor(){super();this.layers.enable(xL)}setFromCamera(e,t){t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):t.isPerspectiveCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):console.error("Raycaster: Unsupported camera type.")}intersectVisibleObjects(e,t=!0,n=[]){return e.forEach(i=>{i.visible&&this.intersectObject(i,t,n)}),n}createRaycastLineHelper(){let e=new Gn({color:65280,linewidth:10}),t=new M(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),n=new M(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),i=this.camera.far-this.camera.near,s=new M().addVectors(t,n.multiplyScalar(i)),o=new we;return o.setFromPoints([t,s]),new Hi(o,e)}};var gx=r=>class{constructor(t=pp){this.manager=t;this.loader=new r(t)}};var ze=class{constructor(e){this.hashProperties=void 0;this.isNode=!0;this.shortcuts={};this.uuid=Ee.generateUUID(),this.type=e,this.name="",this.userData={}}analyze(e,t){t=t!=null?t:{},e.analyzing=!0,this.build(e.addFlow(t.slot,t.cache,t.context),"v4"),e.clearVertexNodeCode(),e.clearFragmentNodeCode(),e.removeFlow(),e.analyzing=!1}analyzeAndFlow(e,t,n){return n=n!=null?n:{},this.analyze(e,n),this.flow(e,t,n)}flow(e,t,n){n=n!=null?n:{},e.addFlow(n.slot,n.cache,n.context);let i={result:this.build(e,t),code:e.clearNodeCode(),extra:e.context.extra};return e.removeFlow(),i}build(e,t,n){t=t!=null?t:this.getType(e,t);let i=e.getNodeData(n!=null?n:this);return e.analyzing&&this.appendDepsNode(e,i,t),e.nodes.indexOf(this)===-1&&e.nodes.push(this),this.updateFrame!==void 0&&e.updaters.indexOf(this)===-1&&e.updaters.push(this),this.generate(e,t,n)}updateFrame(e){}generateReadonly(e,t,n,i,s,o){return""}generate(e,t,n,i,s){return""}parse(e,t,n,i){}appendDepsNode(e,t,n){t.deps=(t.deps||0)+1;let i=e.getTypeLength(n);(i>(t.outputMax||0)||this.getType(e,n))&&(t.outputMax=i,t.output=n)}setName(e){this.name=e}getName(){return this.name}getType(e,t){return t==="sampler2D"||t==="samplerCube"?t:this.type}getJSONNode(e){if((e==null?void 0:e.materials)&&(e==null?void 0:e.materials[this.uuid])!==void 0)return e.materials[this.uuid]}getHash(){let e="{",t,n;for(t in this)n=this[t],n instanceof ze&&(e+='"'+t+'":'+n.getHash()+",");if(this.hashProperties)for(let i=0;i<this.hashProperties.length;i++)t=this.hashProperties[i],n=this[t],e+='"'+t+'":"'+String(n)+'",';return e+='"id":"'+this.uuid+'"}',e}copy(e){return this.name=e.name,e.type&&(this.type=e.type),e.frameId&&(this.frameId=e.frameId),e.hashProperties&&(this.hashProperties=e.hashProperties.map(t=>t)),this.userData=JSON.parse(JSON.stringify(e.userData)),this.shortcuts=JSON.parse(JSON.stringify(e.shortcuts)),this}clone(){return new this.constructor().copy(this)}createJSONNode(e){let t=e===void 0||typeof e=="string";if(typeof this.type!="string")throw new Error("Node does not allow serialization.");let n={};return n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData),!t&&e&&(e.nodes[this.uuid]=n),n}toJSON(e){var t;return(t=this.getJSONNode(e))!=null?t:this.createJSONNode(e)}fromJSON(e,t){return this.uuid=e.uuid,this.type=e.type,e.name&&(this.name=e.name),e.userData&&(this.userData=e.userData),this}};var je=class extends ze{constructor(e,t){super(e);this.scope="";t=t!=null?t:{},this.shared=t.shared!==void 0?t.shared:!0,this.unique=t.unique!==void 0?t.unique:!1}build(e,t,n,i){if(t=t!=null?t:this.getType(e),this.getShared(e,t)){let s=this.getUnique(e,t);s&&this.uuid===void 0&&(this.uuid=Ee.generateUUID()),n=e.getUUID(n!=null?n:this.getUUID(),!s);let o=e.getNodeData(n),a=o.output||this.getType(e);if(e.analyzing)return(o.deps||0)>0||this.getLabel()?(this.appendDepsNode(e,o,t),this.generate(e,t,n)):super.build(e,t,n);if(s)return o.name=o.name||super.build(e,t,n),o.name;if(!this.getLabel()&&(!this.getShared(e,a)||e.context.ignoreCache||o.deps===1))return super.build(e,t,n);n=this.getUUID(!1);let l=this.getTemp(e,n);if(l)return e.format(l,a,t);{l=super.generate(e,t,n,o.output,i);let c=this.generate(e,a,n);return e.addNodeCode(l+" = "+c+";"),e.format(l,a,t)}}return super.build(e,t,n)}getShared(e,t){return t!=="sampler2D"&&t!=="samplerCube"&&this.shared}getUnique(e,t){return this.unique}setLabel(e){return this.label=e,this}getLabel(){return this.label}getUUID(e){let t=this.uuid;return typeof this.scope=="string"&&(t=this.scope+"-"+t),t}getTemp(e,t){t=t||this.uuid;let n=e.getVars()[t];return n?n.name:void 0}generate(e,t,n,i,s){return this.getShared(e,t)||console.error("TempNode is not shared"),n=n!=null?n:this.uuid,e.getTempVar(n,i!=null?i:this.getType(e),s,this.getLabel()).name}};var Ct=class extends je{constructor(e,t){t=t!=null?t:{},t.shared=t.shared!==void 0?t.shared:!1;super(e,t);this.readonly=!1}setReadonly(e){return this.readonly=e,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}createJSONNode(e){let t=super.createJSONNode(e);return this.readonly===!0&&(t.readonly=this.readonly),t}fromJSON(e,t){return super.fromJSON(e,t),e.readonly!==void 0&&this.setReadonly(e.readonly),this}generate(e,t,n,i,s,o){n=e.getUUID(n!=null?n:this.getUUID()),i=i!=null?i:this.getType(e);let a=e.getNodeData(n);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(e,t,n,i,s,o):e.isShader("vertex")?(a.vertex||(a.vertex=e.createVertexUniform(i,this,s,o,this.getLabel())),e.format(a.vertex.name,i,t)):(a.fragment||(a.fragment=e.createFragmentUniform(i,this,s,o,this.getLabel())),e.format(a.fragment.name,i,t))}copy(e){return super.copy(e),this.readonly=e.readonly,this}};var Un=class extends Ct{constructor(e=0,t,n){super("v3");this.nodeType="Vector3";this.value=e instanceof M?e:new M(e,t,n)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}get z(){return this.value.z}set z(e){this.value.z=e}generateReadonly(e,t,n,i,s,o){return e.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",i,t)}copy(e){return super.copy(e),this.value.copy(e.value),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.x=this.value.x,t.y=this.value.y,t.z=this.value.z,this.getReadonly()===!0&&(t.readonly=!0)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.x&&(this.value.x=e.x),e.y&&(this.value.y=e.y),e.z&&(this.value.z=e.z),this}};var In=class extends Ct{constructor(e=0,t){super("v2");this.nodeType="Vector2";this.value=e instanceof O?e:new O(e,t)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}generateReadonly(e,t,n,i,s,o){return e.format("vec2("+this.value.x+", "+this.value.y+")",i,t)}copy(e){return super.copy(e),this.value.copy(e.value),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.x=this.value.x,t.y=this.value.y,this.getReadonly()===!0&&(t.readonly=!0)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.x&&(this.value.x=e.x),e.y&&(this.value.y=e.y),this}};var it=class extends Ct{constructor(e){super("i");this.nodeType="Int";this.value=Math.floor(e!=null?e:0)}generateReadonly(e,t,n,i,s,o){return e.format(this.value.toString(),i,t)}copy(e){return super.copy(e),this.value=e.value,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.value=this.value,this.getReadonly()===!0&&(t.readonly=!0)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=e.value),this}};var Te=class extends Ct{constructor(e){super("f");this.nodeType="Float";this.value=e!=null?e:0}generateReadonly(e,t,n,i,s,o){return e.format(this.value+(this.value%1?"":".0"),i,t)}copy(e){return super.copy(e),this.value=e.value,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.value=this.value,this.getReadonly()===!0&&(t.readonly=!0)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=e.value),this}};var lt;(function(m){m.POSITION="position",m.LIGHTING="light",m.COLOR="color",m.GRADIENT="gradient",m.NORMAL="normal",m.DEPTH="depth",m.TEXTURE="texture",m.NOISE="noise",m.FRESNEL="fresnel",m.RAINBOW="rainbow",m.TRANSMISSION="transmission",m.POINTS="points",m.MATCAP="matcap",m.LINES="lines",m.DISPLACE="displace"})(lt||(lt={}));var Gt;(function(n){n.POSITION="position",n.LIGHTING="light",n.COLOR="color"})(Gt||(Gt={}));var jt=class{constructor(e,t,n){this.next=void 0;this.uniforms={};this.textures={};this.defines={};this.backLayer=void 0;this.isBack=!1;if(this.id=e,t){this.type=t.type;for(let i in t)i!=="type"&&i!=="calpha"&&(this.uniforms[`f${this.id}_${i}`]=t[i]);for(let i in n)this.defines[i]=n[i]}}copy(e){this.id=e.id,this.type=e.type,this.defines=Ue({},e.defines);for(let t in e.uniforms)this.getName(t)==="transmissionSamplerMap"||this.getName(t)==="transmissionDepthMap"||(this.uniforms[t]?this.uniforms[t].copy(e.uniforms[t]):this.uniforms[t]=e.uniforms[t].clone());return this}clone(){return new jt(this.id).copy(this)}fromJSON(e,t){this.id=e.id,this.defines=Ue({},e.defines);for(let n in e.uniforms)this.uniforms[n]=t.getNode(e.uniforms[n]);if(e.type===lt.TEXTURE){if(!(`f${this.id}_textureSize`in this.uniforms)){let n=this.uniforms[`f${this.id}_texture`].value.image;this.uniforms[`f${e.id}_textureSize`]=new Un(n.width,n.height)}`f${this.id}_size`in this.uniforms||(this.uniforms[`f${e.id}_size`]=new In(200,200)),`f${e.id}_axis`in this.uniforms||(this.uniforms[`f${e.id}_axis`]=new it(0)),`f${e.id}_projection`in this.uniforms||(this.uniforms[`f${e.id}_projection`]=new it(0))}else e.type===lt.NOISE?(`f${e.id}_noiseType`in this.uniforms||(this.uniforms[`f${e.id}_noiseType`]=new it(0)),`f${e.id}_size`in this.uniforms||(this.uniforms[`f${e.id}_size`]=new Un(-1,-1,-1))):e.type===lt.DEPTH&&(`f${e.id}_isWorldSpace`in this.uniforms||(this.uniforms[`f${e.id}_isWorldSpace`]=new Te(1)));return this}toJSON(e){let t={};for(let i in this.uniforms)t[i]=this.uniforms[i].toJSON(e).uuid;return{id:this.id,type:this.type,defines:JSON.parse(JSON.stringify(this.defines)),uniforms:t,next:this.next==null?void 0:this.next.toJSON(e)}}copyUniforms(e){for(let t in this.uniforms){let n=this.getName(t);n!==void 0&&e.uniforms[`f${e.id}_${n}`]&&n!=="transmissionDepthMap"&&n!=="transmissionSamplerMap"&&this.uniforms[t].copy(e.uniforms[`f${e.id}_${n}`])}return this}hasValueByKey(e){return this.uniforms[e]!==void 0}hasValue(e){return this.hasValueByKey(`f${this.id}_${e}`)}setValue(e,t){let n=`f${this.id}_${e}`;this.hasValueByKey(n)&&t!==void 0&&(this.uniforms[n].value=t)}getValue(e){let t=`f${this.id}_${e}`;if(this.hasValueByKey(t))return this.uniforms[t].value}getValues(){let e={type:this.type};for(let t in this.uniforms){let n=this.getName(t);if(n===void 0)continue;let s=this.uniforms[`f${this.id}_${n}`].value;s!==void 0&&(Array.isArray(s)?e[n]=s.map(o=>o.clone?o.clone():o):e[n]=s.clone?s.clone():s)}return e}getName(e){let n=/f\d+_(.*)/.exec(e);if(n&&n.length>1)return n[1];console.log(`Layer.getName: error ${e}`)}getNames(){let e=[];for(let t in this.uniforms){let n=this.getName(t);n&&e.push(n)}return e}isEqual(e){for(let t in e.uniforms){let n=e.getName(t);if(!n)return!1;let i=this.getValue(n),s=e.uniforms[t].value;if(s.value instanceof xt){if(i.image!==s.image)return!1}else if(Array.isArray(s)){let o=i;for(let a=0,l=o.length;a<l;++a)if(o[a]!==s[a])return!1}else{let o=i;if(o.equals){if(!o.equals(s))return!1}else if(i!==s)return!1}}return!0}dispose(){}},kp=function(r,e){let t=r.id,n=r.type;return new jt(t,{type:n}).fromJSON(r,e)};function Eh(r){let e=r instanceof jt?r.type:r;return e==="texture"||e==="displace_map"||e==="matcap"}var ct=class extends Ct{constructor(e=0,t,n){super("c");this.nodeType="Color";this.value=e instanceof fe?e:new fe(e||0,t,n)}get r(){return this.value.r}set r(e){this.value.r=e}get g(){return this.value.g}set g(e){this.value.g=e}get b(){return this.value.b}set b(e){this.value.b=e}generate(e,t,n,i,s,o){n=e.getUUID(n!=null?n:this.getUUID()),i=i!=null?i:this.getType(e);let a=e.getNodeData(n),l=this.getReadonly()&&this.generateReadonly!==void 0;if(this.alpha){let c=this.alpha.build(e,"f");e.addFragmentNodeCode(`accumAlpha += ( 1.0 - accumAlpha ) * ${c};`)}return l?this.generateReadonly(e,t,n,i,s,o):e.isShader("vertex")?(a.vertex||(a.vertex=e.createVertexUniform(i,this,s,o,this.getLabel())),e.format(a.vertex.name,i,t)):(a.fragment||(a.fragment=e.createFragmentUniform(i,this,s,o,this.getLabel())),e.format(a.fragment.name,i,t))}generateReadonly(e,t,n,i,s,o){return e.format("vec3("+this.value.r+", "+this.value.g+", "+this.value.b+")",i,t)}copy(e){return super.copy(e),this.value.copy(e.value),e.alpha?this.alpha?this.alpha.copy(e.alpha):this.alpha=e.alpha.clone():this.alpha=void 0,this}toJSON(e){var n;let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.r=this.value.r,t.g=this.value.g,t.b=this.value.b,t.value=this.value.getHex(),t.alpha=(n=this.alpha)==null?void 0:n.toJSON(e),this.readonly===!0&&(t.readonly=!0)),t.nodeType=this.nodeType,this.alpha&&(t.alpha=this.alpha.uuid),t}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=new fe(e.value)),e.alpha&&(this.alpha=t.getNode(e.alpha)),this}};var mc=class extends Ct{constructor(e){super("b");this.nodeType="Bool";this.value=e!=null?e:!1}generateReadonly(e,t,n,i){return e.format(this.value?"true":"false",i,t)}copy(e){return super.copy(e),this.value=e.value,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.value=this.value,this.getReadonly()===!0&&(t.readonly=!0)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=e.value),this}};var Ra=class extends Ct{constructor(e=1,t){super("v4[]");this.nodeType="Vector4Array";this.size=e,this.value=Array.isArray(t)?t:t instanceof Qe?new Array(e).fill(t):new Array(e).fill(new Qe(0))}copy(e){return super.copy(e),this.value=e.value.map(t=>t.clone()),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.value=this.value.map(n=>({x:n.x,y:n.y,z:n.z,w:n.w}))),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=e.value.map(n=>new Qe(n.x,n.y,n.z,n.w)),this.size=this.value.length),this}};var Ba=class extends Ct{constructor(e=1,t){super("f[]");this.nodeType="FloatArray";this.size=e,this.value=Array.isArray(t)?t:typeof t=="number"?new Array(e).fill(t):new Array(e).fill(0)}copy(e){return super.copy(e),this.size=e.size,this.value=[...e.value],this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.size=this.size,t.value=[...this.value]),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=[...e.value]),e.size?this.size=e.size:e.value&&(this.size=this.value.length),this}};var yx=class{constructor(){this.nodes={};this.keywords={}}add(e){this.nodes[e.name]=e}addKeyword(e,t,n){n=n!==void 0?n:!0,this.keywords[e]={callback:t,cache:n}}remove(e){delete this.nodes[e.name]}removeKeyword(e){delete this.keywords[e]}get(e){return this.nodes[e]}getKeyword(e,t){return this.keywords[e].callback(t)}getKeywordData(e){return this.keywords[e]}contains(e){return this.nodes[e]!==void 0}containsKeyword(e){return this.keywords[e]!==void 0}},pn=new yx;var bo=class extends je{constructor(e){super("v2",{shared:!1});this.nodeType="UV";this.index=e!=null?e:0}generate(e,t){e.requires.uv[this.index]=!0;let n=this.index>0?this.index+1:"",i=e.isShader("vertex")?"uv"+n:"vUv"+n;return e.format(i,this.getType(e),t)}copy(e){return super.copy(e),this.index=e.index,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.index=this.index),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.index&&(this.index=e.index),this}};pn.addKeyword("uv",function(){return new bo});pn.addKeyword("uv2",function(){return new bo(1)});var bL=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,vx=/[a-z_0-9]+/gi,Le=class extends je{constructor(e,t,n,i,s){super(s);this.src="";this.nodeType="Function";this.useKeywords=!0;this.includes=[];this.extensions={};this.keywords={};this.isMethod=s===void 0,this.isInterface=!1,this.parse(e,t,n,i)}getShared(e,t){return!this.isMethod}getType(e){return e.getTypeByFormat(this.type)}getInputByName(e){if(this.inputs){let t=this.inputs.length;for(;t--;)if(this.inputs[t].name===e)return this.inputs[t]}}getIncludeByName(e){if(this.includes){let t=this.includes.length;for(;t--;)if(this.includes[t].name===e)return this.includes[t]}}generate(e,t,n,i,s){let o,a=0,l=this.src;if(this.includes)for(let u=0;u<this.includes.length;u++)e.include(this.includes[u],this);for(let u in this.extensions)e.extensions[u]=!0;let c=[];for(;o=vx.exec(this.src);)c.push(o);for(let u=0;u<c.length;u++){let h=c[u],d=h[0],f=this.isMethod?!this.getInputByName(d):!0,p=d;if(this.keywords[d]||this.useKeywords&&f&&pn.containsKeyword(d)){let m=this.keywords[d];if(!m){let v=pn.getKeywordData(d);v.cache&&(m=e.keywords[d]),m=m||pn.getKeyword(d,e),v.cache&&(e.keywords[d]=m)}p=m.build(e)}d!==p&&(l=l.substring(0,h.index+a)+p+l.substring(h.index+d.length+a),a+=p.length-d.length),this.getIncludeByName(p)===void 0&&pn.contains(p)&&e.include(pn.get(p))}return t==="source"?l:this.isMethod?(this.isInterface||e.include(this,void 0,l),this.name):e.format("( "+l+" )",this.getType(e),t)}parse(e,t,n,i){if(this.src=e||"",this.includes=t!=null?t:[],this.extensions=n!=null?n:{},this.keywords=i!=null?i:{},this.isMethod){let s=bL.exec(this.src);if(this.inputs=[],s&&s.length==4){this.type=s[1],this.name=s[2];let o=s[3].match(vx);if(o){let a=0;for(;a<o.length;){let l=o[a++],c;l==="in"||l==="out"||l==="inout"?c=o[a++]:(c=l,l="");let u=o[a++];this.inputs.push({name:u,type:c,qualifier:l})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}copy(e){return super.copy(e),this.isMethod=e.isMethod,this.useKeywords=e.useKeywords,e.type!==void 0&&(this.type=e.type),this.parse(e.src,e.includes,e.extensions,e.keywords),this}toJSON(e){var n;let t=this.getJSONNode(e);if(!t){t=this.createJSONNode(e),t.src=this.src,t.isMethod=this.isMethod,t.useKeywords=this.useKeywords,this.isMethod||(t.type=this.type),t.extensions=JSON.parse(JSON.stringify(this.extensions));let i={};for(let s in this.keywords)i[s]=this.keywords[s].toJSON(e).uuid;if(t.keywords=i,(n=this.includes)==null?void 0:n.length){let s=[];for(let o=0;o<this.includes.length;o++)s.push(this.includes[o].toJSON(e).uuid);t.includes=s}t.isMethod=this.isMethod,t.inputs=this.inputs}return t.nodeType=this.nodeType,t}fromJSON(e,t){if(super.fromJSON(e,t),e.inputs!==void 0&&(this.inputs=e.inputs),e.isMethod!==void 0&&(this.isMethod=e.isMethod),e.src&&(this.src=e.src),e.isMethod&&(this.isMethod=e.isMethod),e.useKeywords&&(this.useKeywords=e.useKeywords),e.type&&(this.type=e.type),e.extensions&&(this.extensions=e.extensions),e.keywords&&t){this.keywords={};for(let n in e.keywords)this.keywords[n]=t.getNode(e.keywords[n])}return e.includes&&t&&(this.includes=e.includes.map(n=>t.getNode(n))),this}};var wL=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,Vp=class extends je{constructor(e="",t){super();this.src="";this.useDefine=!1;this.nodeType="Const";this.parse(e||Vp.PI,void 0,void 0,void 0,t)}getType(e){return e.getTypeByFormat(this.type)}parse(e,t,n,i,s){this.src=e||"";let o,a,l="",c=wL.exec(e);this.useDefine=s!=null?s:this.src.charAt(0)==="#",c&&c.length>1?(a=c[1],o=c[2],l=c[3]):(o=this.src,a="f"),this.name=o,this.type=a,this.value=l}build(e,t){if(t==="source"){if(this.value)return this.useDefine?"#define "+this.name+" "+this.value:"const "+this.type+" "+this.name+" = "+this.value+";";if(this.useDefine)return this.src}return e.include(this),e.format(this.name,this.getType(e),t)}generate(e,t,n,i,s){return e.format(this.name,this.getType(e),t)}copy(e){return super.copy(e),this.parse(e.src,void 0,void 0,void 0,e.useDefine),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.src=this.src,t.useDefine=this.useDefine,t.value=this.value,t.name=this.name),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.src&&(this.src=e.src),e.value&&(this.value=e.value),e.name&&(this.name=e.name),e.useDefine!==void 0&&(this.useDefine=e.useDefine),this}},rt=Vp;rt.PI="PI",rt.PI2="PI2",rt.RECIPROCAL_PI="RECIPROCAL_PI",rt.RECIPROCAL_PI2="RECIPROCAL_PI2",rt.LOG2="LOG2",rt.EPSILON="EPSILON";var yt=class extends Le{constructor(e="",t,n,i,s){super(e,s,i,n,t);this.nodeType="Expression"}};var wo=class extends je{constructor(e=new ze,t){super("v4");this.nodeType="ColorSpace";this.factor=new ze;this.input=e,this.method=t!=null?t:wo.LINEAR_TO_LINEAR,this.hashProperties=["method"]}static getEncodingComponents(e){switch(e){case ln:return["Linear"];case Fi:return["sRGB"];case Rl:return["RGBE"];case Mu:return["RGBM",new Te(7).setReadonly(!0)];case Au:return["RGBM",new Te(16).setReadonly(!0)];case _u:return["RGBD",new Te(256).setReadonly(!0)];case Qs:return["Gamma",new yt("float( GAMMA_FACTOR )","f")];default:return[]}}generate(e,t){let n=this.input.build(e,"v4"),i=this.getType(e),s=wo.Nodes[this.method],o=e.include(s);if(o===wo.LINEAR_TO_LINEAR)return e.format(n,i,t);if(s.inputs.length===2){let a=this.factor.build(e,"f");return e.format(o+"( "+n+", "+a+" )",i,t)}else return e.format(o+"( "+n+" )",i,t)}fromEncoding(e){let t=wo.getEncodingComponents(e);this.method="LinearTo"+t[0],this.factor=t[1]}fromDecoding(e){let t=wo.getEncodingComponents(e);this.method=t[0]+"ToLinear",this.factor=t[1]}copy(e){return super.copy(e),this.input.copy(e.input),this.method=e.method,this.factor.copy(e.factor),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.input=this.input.toJSON(e).uuid,t.factor=this.factor.toJSON(e).uuid,t.method=this.method),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.input&&(this.input=t.getNode(e.input)),e.factor&&(this.factor=t.getNode(e.factor)),e.method&&(this.method=e.method),this}},Bt=wo;Bt.Nodes={LinearToLinear:new Le(["vec4 LinearToLinear( in vec4 value ) {"," return value;","}"].join(`
`)),GammaToLinear:new Le(["vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {"," return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );","}"].join(`
`)),LinearToGamma:new Le(["vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {"," return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );","}"].join(`
`)),sRGBToLinear:new Le(["vec4 sRGBToLinear( in vec4 value ) {"," 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.w );","}"].join(`
`)),LinearTosRGB:new Le(["vec4 LinearTosRGB( in vec4 value ) {"," 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.w );","}"].join(`
`)),RGBEToLinear:new Le(["vec4 RGBEToLinear( in vec4 value ) {"," return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );","}"].join(`
`)),LinearToRGBE:new Le(["vec4 LinearToRGBE( in vec4 value ) {"," float maxComponent = max( max( value.r, value.g ), value.b );"," float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );"," return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );","}"].join(`
`)),RGBMToLinear:new Le(["vec3 RGBMToLinear( in vec4 value, in float maxRange ) {"," return vec4( value.xyz * value.w * maxRange, 1.0 );","}"].join(`
`)),LinearToRGBM:new Le(["vec3 LinearToRGBM( in vec4 value, in float maxRange ) {"," float maxRGB = max( value.x, max( value.g, value.b ) );"," float M = clamp( maxRGB / maxRange, 0.0, 1.0 );"," M = ceil( M * 255.0 ) / 255.0;"," return vec4( value.rgb / ( M * maxRange ), M );","}"].join(`
`)),RGBDToLinear:new Le(["vec3 RGBDToLinear( in vec4 value, in float maxRange ) {"," return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );","}"].join(`
`)),LinearToRGBD:new Le(["vec3 LinearToRGBD( in vec4 value, in float maxRange ) {"," float maxRGB = max( value.x, max( value.g, value.b ) );"," float D = max( maxRange / maxRGB, 1.0 );"," D = clamp( floor( D ) / 255.0, 0.0, 1.0 );"," return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );","}"].join(`
`)),cLogLuvM:new rt("const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );"),LinearToLogLuv:new Le(["vec4 LinearToLogLuv( in vec4 value ) {"," vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;"," Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));"," vec4 vResult;"," vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;"," float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;"," vResult.w = fract(Le);"," vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;"," return vResult;","}"].join(`
`),[new rt("const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );")]),cLogLuvInverseM:new rt("const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );"),LogLuvToLinear:new Le(["vec4 LogLuvToLinear( in vec4 value ) {"," float Le = value.z * 255.0 + value.w;"," vec3 Xp_Y_XYZp;"," Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);"," Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;"," Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;"," vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;"," return vec4( max(vRGB, 0.0), 1.0 );","}"].join(`
`),[new rt("const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );")])},Bt.LINEAR_TO_LINEAR="LinearToLinear",Bt.GAMMA_TO_LINEAR="GammaToLinear",Bt.LINEAR_TO_GAMMA="LinearToGamma",Bt.SRGB_TO_LINEAR="sRGBToLinear",Bt.LINEAR_TO_SRGB="LinearTosRGB",Bt.RGBE_TO_LINEAR="RGBEToLinear",Bt.LINEAR_TO_RGBE="LinearToRGBE",Bt.RGBM_TO_LINEAR="RGBMToLinear",Bt.LINEAR_TO_RGBM="LinearToRGBM",Bt.RGBD_TO_LINEAR="RGBDToLinear",Bt.LINEAR_TO_RGBD="LinearToRGBD",Bt.LINEAR_TO_LOG_LUV="LinearToLogLuv",Bt.LOG_LUV_TO_LINEAR="LogLuvToLinear";var bi=class extends xt{toJSON(e){let t=super.toJSON(e),n=e===void 0||typeof e=="string";if(this.image!==void 0&&!n){let i=this.image;if(Array.isArray(i)){e.images[i.uuid].url=[];for(let s=0;s<i.length;s++)e.images[i.uuid].url[s]=xx(i[s])}else e.images[i.uuid].url=xx(i)}return t}};function xx(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?SL(r):(console.warn("THREE.Texture: Unable to serialize Texture."),"")}var Oa;function SL(r){if(/^data:/i.test(r.src))return r.src;let e;if(r instanceof HTMLCanvasElement)e=r;else{Oa===void 0&&(Oa=document.createElement("canvas")),Oa.width=r.width,Oa.height=r.height;let n=Oa.getContext("2d");r instanceof ImageData?n.putImageData(r,0,0):n.drawImage(r,0,0,r.width,r.height),e=Oa}let t=r.src.startsWith("blob:")?r.fileName:r.src;return/\.jpe?g$/i.test(t)?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}var kn=class extends Ct{constructor(e=new bi,t,n,i){super("v4",{shared:!0});this.nodeType="Texture";this.value=e,this.uv=t!=null?t:new bo,this.bias=n,this.project=i!==void 0?i:!1}getTexture(e,t){return super.generate(e,t,this.value.uuid,"t")}generate(e,t){var u;if(t==="sampler2D")return this.getTexture(e,t);let n=this.getTexture(e,t),i=this.uv.build(e,this.project?"v4":"v2"),s=this.bias?this.bias.build(e,"f"):void 0;s===void 0&&e.context.bias&&(s=e.context.bias.setTexture(this).build(e,"f"));let o,a;this.project?o="texture2DProj":o=s?"tex2DBias":"tex2D",s?a=o+"( "+n+", "+i+", "+s+" )":a=o+"( "+n+", "+i+" )";let l={include:e.isShader("vertex"),ignoreCache:!0},c=this.getType(e);return e.addContext(l),this.colorSpace=(u=this.colorSpace)!=null?u:new Bt(new yt("",c)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(a),a=this.colorSpace.build(e,c),e.removeContext(),e.format(a,c,t)}copy(e){return super.copy(e),e.value.isRenderTargetTexture?this.value=e.value:this.value.copy(e.value),this.uv.copy(e.uv),e.bias?this.bias?this.bias.copy(e.bias):this.bias=e.bias.clone():this.bias=void 0,e.colorSpace?this.colorSpace?this.colorSpace.copy(e.colorSpace):this.colorSpace=e.colorSpace.clone():this.colorSpace=void 0,this.project=e.project,e.value.isRenderTargetTexture||(this.value.updateMatrix(),this.value.needsUpdate=!0),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.value&&(t.value=this.value.toJSON(e).uuid),t.uv=this.uv.toJSON(e).uuid,t.project=this.project,this.bias&&(t.bias=this.bias.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),this.project=e.project,e.value&&(this.value=t.getTexture(e.value),this.value.updateMatrix()),e.uv&&(this.uv=t.getNode(e.uv)),e.bias&&(this.bias=t.getNode(e.bias)),this}};var zr=class extends Ct{constructor(e){super("m3");this.nodeType="Matrix3";this.value=e!=null?e:new Dt}generateReadonly(e,t,n,i,s,o){return e.format("mat3("+this.value.elements.join(", ")+")",i,t)}copy(e){return super.copy(e),this.elements=e.elements,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.elements=this.value.elements.concat()),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.elements&&(this.elements=e.elements),this}get elements(){return this.value.elements}set elements(e){this.value.fromArray(e)}};var Fa;(function(i){i[i.UV=0]="UV",i[i.PLANAR=1]="PLANAR",i[i.SPHERICAL=2]="SPHERICAL",i[i.CYLINDRICAL=3]="CYLINDRICAL"})(Fa||(Fa={}));var gc=class extends je{constructor(e=new kn,t,n,i,s,o,a,l){super("v3");this.nodeType="CustomTexture";this.firstTime=!0,this.texture=e,this.textureSize=t,this.crop=n,this.projection=i,this.axis=s,this.size=o,this.mat=new zr(this.texture.value.matrix),this.alpha=a,this.mode=l,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){e.require("position"),e.require("uv"),e.requires.uv=[!0],e.extensions.shaderTextureLOD=!0,e.extensions.derivatives=!0;let n;switch(this.projection.value){case 3:n=e.include(gc.Nodes.cylindrical);break;case 2:n=e.include(gc.Nodes.spherical);break;case 1:let s=new Le(`
vec3 g${this.uuid.toString().replace(/-/g,"")}_planarTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float alpha, int mode, out float calpha) {
vec2 uvs = ( mat * vec3( (g${this.uuid.toString().replace(/-/g,"")}_vCustomUv * 2. - 1.) / (size * .5), 1. ) / 2. + 0.5 ).xy;
vec4 tmp = texture2D( tex, uvs );
vec3 col = tmp.rgb;
float lalpha = alpha * tmp.a;
if ( crop > 0.5 ) {
if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {
lalpha = 0.0;
}
}
calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
return col;
}`);n=e.include(s);break;default:n=e.include(gc.Nodes.uv);break}if(this.projection.value===1&&this.firstTime){let s=`g${this.uuid.toString().replace(/-/g,"")}`;e.addVertexParsCode(`varying vec2 ${s}_vCustomUv;`),e.addFragmentParsCode(`varying vec2 ${s}_vCustomUv;`),e.addVertexFinalCode(`
vec3 ${s}_posN = transformed;
${this.axis.value===0?`
float ${s}_u = (1. + (${s}_posN.z)) / 2.;
float ${s}_v = (1. + (${s}_posN.y)) / 2.;
`:""}
${this.axis.value===1?`
float ${s}_u = (1. + (${s}_posN.x)) / 2.;
float ${s}_v = (1. - (${s}_posN.z)) / 2.;
`:""}
${this.axis.value===2?`
float ${s}_u = (1. + (${s}_posN.x)) / 2.;
float ${s}_v = (1. + (${s}_posN.y)) / 2.;
`:""}
${s}_vCustomUv = vec2(${s}_u, ${s}_v);
`)}e.addFragmentVariable(this.calpha,"float");let i=[];return i.push(this.texture.getTexture(e,"t")),i.push(this.textureSize.build(e,"v2")),i.push(this.crop.build(e,"f")),i.push(this.mat.build(e,"mat3")),i.push(this.size.build(e,"v2")),i.push(this.alpha.build(e,"f")),i.push(this.mode.build(e,"i")),i.push(this.calpha),this.firstTime=!this.firstTime,e.format(n+"("+i.join(",")+")",this.getType(e),t)}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.texture=this.texture.toJSON(e).uuid,t.textureSize=this.textureSize.toJSON(e).uuid,t.crop=this.crop.toJSON(e).uuid,t.projection=this.projection.toJSON(e).uuid,t.axis=this.axis.toJSON(e).uuid,t.size=this.size.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid,t.mode=this.mode.toJSON(e).uuid,t.calpha=this.calpha),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.texture&&(this.texture=t.getNode(e.texture),this.texture.value.updateMatrix(),this.mat=new zr(this.texture.value.matrix)),e.textureSize&&(this.textureSize=t.getNode(e.textureSize)),e.crop&&(this.crop=t.getNode(e.crop)),e.projection&&(this.projection=t.getNode(e.projection)),e.axis&&(this.axis=t.getNode(e.axis)),e.size&&(this.size=t.getNode(e.size)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.mode&&(this.mode=t.getNode(e.mode)),e.calpha&&(this.calpha=e.calpha),this}copy(e){return super.copy(e),this.texture.copy(e.texture),this.textureSize=e.textureSize.clone(),this.crop=e.crop.clone(),this.projection=e.projection.clone(),this.axis=e.axis.clone(),this.size=e.size.clone(),this.alpha=e.alpha.clone(),this.mode=e.mode.clone(),this}},za=gc;za.Nodes=function(){let e=new Le(`
vec3 cylindricalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float alpha, int mode, out float calpha) {
vec3 posN = normalize(position);
float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);
float scaledHeight = position.y / (size.y * 0.5);
float v = (scaledHeight / 2.) + .5;
vec2 calculatedUv = vec2(u,v);
vec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;
vec2 df = fwidth(uvs);
if(df.x > 0.5) df.x = 0.;
#ifdef GL_EXT_shader_texture_lod
vec4 tmp = texture2DLodEXT(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));
#else
vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));
#endif
vec3 col = tmp.rgb;
float lalpha = alpha * tmp.a;
if ( crop > 0.5 ) {
if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {
lalpha = 0.0;
}
}
calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
return col;
}
`),t=new Le(`
vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float alpha, int mode, out float calpha) {
vec3 posN = normalize(vPosition);
float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);
float v = 0.5 + asin(posN.y) / 3.1415;
vec2 calculatedUv = vec2(u,v);
vec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;
vec2 df = fwidth(uvs);
if(df.x > 0.5) df.x = 0.;
#ifdef GL_EXT_shader_texture_lod
vec4 tmp = texture2DLodEXT(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));
#else
vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));
#endif
vec3 col = tmp.rgb;
float lalpha = alpha * tmp.a;
if ( crop > 0.5 ) {
if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {
lalpha = 0.0;
}
}
calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
return col;
}
`),n=new Le(`vec3 uvTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float alpha, int mode, out float calpha) {
vec2 uvs = ( mat * vec3( vUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;
vec4 tmp = texture2D( tex, uvs );
vec3 col = tmp.rgb;
float lalpha = alpha * tmp.a;
if ( crop > 0.5 ) {
if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {
lalpha = 0.0;
}
}
calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
return col;
}`);return{cylindrical:e,spherical:t,uv:n}}();var Hp=class extends je{constructor(e,t,n,i,s,o,a){super("v3");this.nodeType="Fresnel";this.color=e,this.bias=t,this.scale=n,this.intensity=i,this.factor=s,this.alpha=o,this.mode=a,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.require("vWorldViewDir"),e.require("vWorldNormal"),e.isShader("fragment")){e.addFragmentVariable(this.calpha,"float");let n=e.include(Hp.Nodes.fresnel),i=[];return i.push(this.color.build(e,"c")),i.push(this.bias.build(e,"f")),i.push(this.scale.build(e,"f")),i.push(this.intensity.build(e,"f")),i.push(this.factor.build(e,"f")),i.push(this.alpha.build(e,"f")),i.push(this.mode.build(e,"i")),i.push(this.calpha),e.format(n+"("+i.join(",")+")",this.getType(e),t)}else return console.warn("FresnelNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.color=this.color.toJSON(e).uuid,t.bias=this.bias.toJSON(e).uuid,t.scale=this.scale.toJSON(e).uuid,t.intensity=this.intensity.toJSON(e).uuid,t.factor=this.factor.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid,t.mode=this.mode.toJSON(e).uuid,t.calpha=this.calpha),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.color&&(this.color=t.getNode(e.color)),e.bias&&(this.bias=t.getNode(e.bias)),e.scale&&(this.scale=t.getNode(e.scale)),e.intensity&&(this.intensity=t.getNode(e.intensity)),e.factor&&(this.factor=t.getNode(e.factor)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.mode&&(this.mode=t.getNode(e.mode)),e.calpha&&(this.calpha=e.calpha),this}copy(e){return super.copy(e),this.color=e.color.clone(),this.bias=e.bias.clone(),this.scale=e.scale.clone(),this.intensity=e.intensity.clone(),this.factor=e.factor.clone(),this.alpha=e.alpha.clone(),this.mode=e.mode.clone(),this.calpha=e.calpha,this}},Ga=Hp;Ga.Nodes=function(){return{fresnel:new Le(`vec3 fresnel(vec3 color, float bias, float scale, float intensity, float factor, float alpha, int mode, out float calpha) {
float fresnel = bias + scale * pow( abs( factor + dot( normalize( vWorldViewDir ), normalize( vWorldNormal ) ) ), intensity );
float lalpha = clamp( fresnel, 0.0, 1.0 ) * alpha;
calpha = lalpha / clamp(lalpha + accumAlpha, 0.001, 1.0);
accumAlpha += (1.0 - accumAlpha) * lalpha;
return color;
}`)}}();var Ua;(function(s){s.SIMPLEX="simplex3d",s.SIMPLEX_FRACTAL="simplex3dFractal",s.ASHIMA="simplexAshima",s.FBM="fbm",s.PERLIN="perlin"})(Ua||(Ua={}));var si=function(){let r=5,e=new Le(`vec3 random3(vec3 c) {
float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0)));
vec3 r;
r.z = fract(512.0*j);
j *= .125;
r.x = fract(512.0*j);
j *= .125;
r.y = fract(512.0*j);
return r-0.5;
}`),t=new Le(`float simplex3d(vec3 p) {
vec3 s = floor(p + dot(p, vec3(F3)));
vec3 x = p - s + dot(s, vec3(G3));
vec3 e = step(vec3(0.0), x - x.yzx);
vec3 i1 = e*(1.0 - e.zxy);
vec3 i2 = 1.0 - e.zxy*(1.0 - e);
vec3 x1 = x - i1 + G3;
vec3 x2 = x - i2 + 2.0*G3;
vec3 x3 = x - 1.0 + 3.0*G3;
vec4 w, d;
w.x = dot(x, x);
w.y = dot(x1, x1);
w.z = dot(x2, x2);
w.w = dot(x3, x3);
w = max(0.6 - w, 0.0);
d.x = dot(random3(s), x);
d.y = dot(random3(s + i1), x1);
d.z = dot(random3(s + i2), x2);
d.w = dot(random3(s + 1.0), x3);
w *= w;
w *= w;
d *= w;
return dot(d, vec4(52.0));
}`,[e]);t.keywords.F3=new rt("float F3 0.3333333"),t.keywords.G3=new rt("float G3 0.1666667");let n=new Le(`float simplex3dFractal(vec3 m) {
mat3 rot1 = mat3(-0.37, 0.36, 0.85,-0.14,-0.93, 0.34,0.92, 0.01,0.4);
mat3 rot2 = mat3(-0.55,-0.39, 0.74, 0.33,-0.91,-0.24,0.77, 0.12,0.63);
mat3 rot3 = mat3(-0.71, 0.52,-0.47,-0.08,-0.72,-0.68,-0.7,-0.45,0.56);
return 0.5333333 * simplex3d(m * rot1)
+ 0.2666667 * simplex3d(2.0 * m * rot2)
+ 0.1333333 * simplex3d(4.0 * m * rot3)
+ 0.0666667 * simplex3d(8.0 * m);
}`,[t]),i=new Le("vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}"),s=new Le("vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}"),o=new Le(`float simplexAshima(vec3 v) {
const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
vec3 i = floor(v + dot(v, C.yyy) );
vec3 x0 = v - i + dot(i, C.xxx) ;
vec3 g = step(x0.yzx, x0.xyz);
vec3 l = 1.0 - g;
vec3 i1 = min( g.xyz, l.zxy );
vec3 i2 = max( g.xyz, l.zxy );
vec3 x1 = x0 - i1 + 1.0 * C.xxx;
vec3 x2 = x0 - i2 + 2.0 * C.xxx;
vec3 x3 = x0 - 1. + 3.0 * C.xxx;
i = mod(i, 289.0 );
vec4 p = permute( permute( permute(
i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
+ i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
+ i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
float n_ = 1.0/7.0; // N=7
vec3 ns = n_ * D.wyz - D.xzx;
vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N)
vec4 x_ = floor(j * ns.z);
vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)
vec4 x = x_ *ns.x + ns.yyyy;
vec4 y = y_ *ns.x + ns.yyyy;
vec4 h = 1.0 - abs(x) - abs(y);
vec4 b0 = vec4( x.xy, y.xy );
vec4 b1 = vec4( x.zw, y.zw );
vec4 s0 = floor(b0)*2.0 + 1.0;
vec4 s1 = floor(b1)*2.0 + 1.0;
vec4 sh = -step(h, vec4(0.0));
vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
vec3 p0 = vec3(a0.xy,h.x);
vec3 p1 = vec3(a0.zw,h.y);
vec3 p2 = vec3(a1.xy,h.z);
vec3 p3 = vec3(a1.zw,h.w);
vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
p3 *= norm.w;
vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
m = m * m;
return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
dot(p2,x2), dot(p3,x3) ) );
}`,[i,s]),a=new Le("vec4 mod289(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;}"),l=new Le("vec4 perm(vec4 x){return mod289(((x * 34.0) + 1.0) * x);}",[a]),c=new Le(`float noise(vec3 p){
vec3 a = floor(p);
vec3 d = p - a;
d = d * d * (3.0 - 2.0 * d);
vec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0);
vec4 k1 = perm(b.xyxy);
vec4 k2 = perm(k1.xyxy + b.zzww);
vec4 c = k2 + a.zzzz;
vec4 k3 = perm(c);
vec4 k4 = perm(c + 1.0);
vec4 o1 = fract(k3 * (1.0 / 41.0));
vec4 o2 = fract(k4 * (1.0 / 41.0));
vec4 o3 = o2 * d.z + o1 * (1.0 - d.z);
vec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x);
return o4.y * d.y + o4.x * (1.0 - d.y);
}`,[l]),u=new Le(`float fbm(vec3 x) {
float v = 0.0;
float a = 0.5;
vec3 shift = vec3(100);
for (int i = 0; i < NUM_OCTAVES; ++i) {
v += a * noise(x);
x = x * 2.0 + shift;
a *= 0.5;
}
return v;
}`,[c]);u.keywords.NUM_OCTAVES=new rt(`int NUM_OCTAVES ${r}`);let h=new Le("vec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}"),d=new Le(`float perlin(vec3 P){
vec3 Pi0 = floor(P);
vec3 Pi1 = Pi0 + vec3(1.0);
Pi0 = mod(Pi0, 289.0);
Pi1 = mod(Pi1, 289.0);
vec3 Pf0 = fract(P);
vec3 Pf1 = Pf0 - vec3(1.0);
vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
vec4 iy = vec4(Pi0.yy, Pi1.yy);
vec4 iz0 = Pi0.zzzz;
vec4 iz1 = Pi1.zzzz;
vec4 ixy = permute(permute(ix) + iy);
vec4 ixy0 = permute(ixy + iz0);
vec4 ixy1 = permute(ixy + iz1);
vec4 gx0 = ixy0 / 7.0;
vec4 gy0 = fract(floor(gx0) / 7.0) - 0.5;
gx0 = fract(gx0);
vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);
vec4 sz0 = step(gz0, vec4(0.0));
gx0 -= sz0 * (step(0.0, gx0) - 0.5);
gy0 -= sz0 * (step(0.0, gy0) - 0.5);
vec4 gx1 = ixy1 / 7.0;
vec4 gy1 = fract(floor(gx1) / 7.0) - 0.5;
gx1 = fract(gx1);
vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);
vec4 sz1 = step(gz1, vec4(0.0));
gx1 -= sz1 * (step(0.0, gx1) - 0.5);
gy1 -= sz1 * (step(0.0, gy1) - 0.5);
vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);
vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);
vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);
vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);
vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);
vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);
vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);
vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);
vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
g000 *= norm0.x;
g010 *= norm0.y;
g100 *= norm0.z;
g110 *= norm0.w;
vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
g001 *= norm1.x;
g011 *= norm1.y;
g101 *= norm1.z;
g111 *= norm1.w;
float n000 = dot(g000, Pf0);
float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));
float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));
float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));
float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));
float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));
float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));
float n111 = dot(g111, Pf1);
vec3 fade_xyz = fade(Pf0);
vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);
vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
return 2.2 * n_xyz;
}`,[i,s,h]);return{simplex:t,simplexFractal:n,simplexAshima:o,fbm:u,perlin:d}}();var jp=class extends je{constructor(e,t,n,i,s,o,a){super("v3");this.nodeType="Rainbow";this.filmThickness=e,this.movement=t,this.wavelengths=n,this.noiseStrength=i,this.noiseScale=s,this.offset=o,this.alpha=a,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.isShader("fragment")){e.require("normal"),e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let n=e.include(jp.Nodes.rainbow),i=[];return i.push(this.filmThickness.build(e,"f")),i.push(this.movement.build(e,"f")),i.push(this.wavelengths.build(e,"v3")),i.push(this.noiseStrength.build(e,"f")),i.push(this.noiseScale.build(e,"f")),i.push(this.offset.build(e,"v3")),i.push(this.alpha.build(e,"f")),i.push(this.calpha),e.format(n+"("+i.join(",")+")",this.getType(e),t)}else return console.warn("RainbowNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.filmThickness=this.filmThickness.toJSON(e).uuid,t.movement=this.movement.toJSON(e).uuid,t.wavelengths=this.wavelengths.toJSON(e).uuid,t.noiseStrength=this.noiseStrength.toJSON(e).uuid,t.noiseScale=this.noiseScale.toJSON(e).uuid,t.offset=this.offset.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid,t.calpha=this.calpha),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.filmThickness&&(this.filmThickness=t.getNode(e.filmThickness)),e.movement&&(this.movement=t.getNode(e.movement)),e.wavelengths&&(this.wavelengths=t.getNode(e.wavelengths)),e.noiseStrength&&(this.noiseStrength=t.getNode(e.noiseStrength)),e.noiseScale&&(this.noiseScale=t.getNode(e.noiseScale)),e.offset&&(this.offset=t.getNode(e.offset)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.calpha&&(this.calpha=e.calpha),this}copy(e){return super.copy(e),this.filmThickness=e.filmThickness.clone(),this.movement=e.movement.clone(),this.wavelengths=e.wavelengths.clone(),this.noiseStrength=e.noiseStrength.clone(),this.noiseScale=e.noiseScale.clone(),this.offset=e.offset.clone(),this.alpha=e.alpha.clone(),this.calpha=e.calpha,this}},ka=jp;ka.Nodes=function(){let e=new Le(`vec3 attenuation(vec3 wavelengths, float filmThickness, float movement, float noiseStrength, float noiseScale, vec3 offset) {
vec3 viewDir = normalize(-(cameraPosition + offset));
vec3 st = position / noiseScale;
vec3 q = vec3(simplex3d(st),
simplex3d(st + vec3(1.0)),
simplex3d(st + vec3(1.0)));
vec3 r = vec3(simplex3d(st + vec3(1.4, 1.3, 1.0) * q + vec3(1.7, 9.2, 1.0)),
simplex3d(st + vec3(2.0, 1.2, 1.0) * q + vec3(8.3, 2.8, 1.0)),
simplex3d(st * q));
float noise = simplex3d(st + r);
return .5 + .5 * cos((((filmThickness + (noise * noiseStrength)) / (vec3(wavelengths.r * 1.0, wavelengths.g * 0.8, wavelengths.b * 0.6) + 1.0)) * dot(normalize(vObjectNormal), viewDir)) + movement);
}`,[si.simplex]);return{rainbow:new Le(`vec3 rainbow(float filmThickness, float movement, vec3 wavelengths, float noiseStrength, float noiseScale, vec3 offset, float alpha, out float calpha) {
vec3 res = clamp(attenuation(wavelengths, filmThickness, movement, noiseStrength, noiseScale, offset), 0.0, 2.0);
float rainbowContribution = clamp(res.r + res.g + res.b, 0.0, 1.0);
float lalpha = alpha * rainbowContribution;
calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
return res;
}`,[e])}}();var Wp=class extends je{constructor(e,t,n,i,s,o,a,l){super("v3");this.nodeType="Transmission";this.thickness=e,this.ior=t,this.roughness=n,this.transmissionSamplerSize=i,this.transmissionSamplerMap=s,this.transmissionDepthMap=o,this.aspectRatio=a,this.alpha=l,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.extensions.shaderTextureLOD=!0,e.extensions.derivatives=!0,e.isShader("fragment")){e.define("NUM_SAMPLES",30),e.require("worldPosition"),e.requires.worldNormal=!0,e.requires.modelMatrix=!0,e.requires.projectionMatrix=!0,e.addFragmentVariable(this.calpha,"float");let n=e.include(Wp.Nodes.transmission),i=[];return i.push(this.thickness.build(e,"f")),i.push(this.ior.build(e,"f")),i.push(this.roughness.build(e,"f")),i.push(this.transmissionSamplerSize.build(e,"v2")),i.push(this.transmissionSamplerMap.getTexture(e,"t")),i.push(this.transmissionDepthMap.getTexture(e,"t")),i.push(this.aspectRatio.build(e,"v2")),i.push("normal"),i.push(this.alpha.build(e,"f")),i.push(this.calpha),e.format(n+"("+i.join(",")+")",this.getType(e),t)}else return console.warn("TransmissionNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.thickness=this.thickness.toJSON(e).uuid,t.ior=this.ior.toJSON(e).uuid,t.roughness=this.roughness.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid,t.calpha=this.calpha),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.thickness&&(this.thickness=t.getNode(e.thickness)),e.ior&&(this.ior=t.getNode(e.ior)),e.roughness&&(this.roughness=t.getNode(e.roughness)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.calpha&&(this.calpha=e.calpha),this}copy(e){return super.copy(this),this.thickness=e.thickness.clone(),this.ior=e.ior.clone(),this.roughness=e.roughness.clone(),this.transmissionSamplerSize=e.transmissionSamplerSize.clone(),this.transmissionSamplerMap=e.transmissionSamplerMap,this.transmissionDepthMap=e.transmissionDepthMap,this.alpha=e.alpha.clone(),this.calpha=e.calpha,this}},Va=Wp;Va.Nodes=function(){let e=new Le(`
float gaussian(vec2 i) {
const float sigma = float(NUM_SAMPLES) * .25;
return exp( -.5* dot(i/=sigma,i) ) / ( 6.28 * sigma*sigma );
}`),t=new Le(`
vec4 blur(sampler2D sp, vec2 U, vec2 scale, float lod, sampler2D dm, vec2 unrefractedU, vec2 aspectRatio) {
// Slightly modified version of this:
// https://www.shadertoy.com/view/ltScRG
const int LOD = 2;
const int sLOD = 4; // tile size = 2^LOD
vec4 O = vec4(0);
const int s = NUM_SAMPLES/sLOD;
for ( int i = 0; i < s*s; i++ ) {
int modulo = (i)-((i)/(s))*(s);
vec2 d = vec2(float(modulo), float(i/s))*float(sLOD) - float(NUM_SAMPLES)/2.;
vec2 uv = U + (scale * aspectRatio) * d;
// What is the depth of the opaque object we're trying to sample
float opaqueDepth = texture2D(dm, uv).r;
if (opaqueDepth < gl_FragCoord.z) {
uv = unrefractedU + ((scale * min(lod / 2., 1.)) * aspectRatio) * d;
lod = lod > 4.0 ? lod : lod / 2.0;
}
#ifdef TEXTURE_LOD_EXT
O += gaussian(d) * texture2DLodEXT( sp, uv, lod);
#else
O += gaussian(d) * textureLod( sp, uv, lod);
#endif
}
return O / O.a;
}`,[e]),n=new Le(`
vec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {
// Direction of refracted light.
vec3 refractionVector = refract( -v, n, 1.0 / ior );
// Compute rotation-independant scaling of the model matrix.
vec3 modelScale;
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
// The thickness is specified in local space.
return normalize( refractionVector ) * thickness * modelScale;
}`),i=new Le(`
float applyIorToRoughness( float roughness, float ior ) {
// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and
// an IOR of 1.5 results in the default amount of microfacet refraction.
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
} `),s=new Le(`
vec4 getTransmissionSample( vec2 fragCoord, float roughness, float ior, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 unrefractedCoords, vec2 aspectRatio) {
float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
float lod = applyIorToRoughness(roughness, ior);
return blur(transmissionSamplerMap, fragCoord, vec2(lod / (transmissionSamplerSize.x / 2.)), min(framebufferLod / 5.5, 8.5), transmissionDepthMap, unrefractedCoords, aspectRatio);
}`,[i,t]),o=new Le(`
vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 aspectRatio ) {
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
vec3 refractedRayExit = position + transmissionRay;
// Project refracted vector on the framebuffer, while mapping to normalized device coordinates.
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
refractionCoords += 1.0;
refractionCoords /= 2.0;
vec4 ndcPosUnrefracted = projMatrix * viewMatrix * vec4(position, 1.0 );
vec2 unrefractedCoords = ndcPosUnrefracted.xy / ndcPosUnrefracted.w;
unrefractedCoords += 1.0;
unrefractedCoords /= 2.0;
// Sample framebuffer to get pixel the refracted ray hits.
vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, unrefractedCoords, aspectRatio );
// Get the specular component.
return vec4( ( 1.0 ) * transmittedLight.rgb, transmittedLight.a );
}`,[s,n]);return{transmission:new Le(`
vec3 transmission(float thickness, float ior, float roughness, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 aspectRatio, vec3 normal, float alpha, out float calpha) {
vec3 v = vec3(0.);
if (isOrthographic) {
v = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
v = normalize(vWPosition - cameraPosition);
}
vec4 transmission = getIBLVolumeRefraction(vWNormal, -v, roughness, vWPosition, modelMatrix, viewMatrix, projectionMatrix, ior, thickness, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, aspectRatio );
float lalpha = alpha;
calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
return transmission.rgb;
}`,[o])}}();var Jp=class extends je{constructor(e,t){super("v3");this.nodeType="CustomNormal";this.cnormal=e,this.alpha=t}generate(e,t){if(e.isShader("fragment")){let n=e.include(Jp.Nodes.customNormal),i=[];return i.push(this.cnormal.build(e,"v3")),i.push("normal"),i.push(this.alpha.build(e,"f")),e.format(n+"("+i.join(",")+")",this.getType(e),t)}else return console.warn("CustomNormalNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.cnormal=this.cnormal.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.cnormal&&(this.cnormal=t.getNode(e.cnormal)),e.alpha&&(this.alpha=t.getNode(e.alpha)),this}copy(e){return super.copy(e),this.cnormal.copy(e.cnormal),this.alpha.copy(e.alpha),this}},Ha=Jp;Ha.Nodes=function(){return{customNormal:new Le(`vec3 customNormal(vec3 cnormal, vec3 norm, float alpha) {
vec3 normal = packNormalToRGB( norm ).rgb;
normal *= step( vec3(0.5), cnormal );
accumAlpha += ( 1.0 - accumAlpha ) * alpha;
return normal;
}`)}}();var Xp=class extends je{constructor(e,t,n,i,s,o,a,l,c){super("v3");this.nodeType="Gradient";this.glType=e,this.num=t,this.smooth=n,this.colors=i,this.steps=s,this.offset=o,this.morph=a,this.angle=l,this.alpha=c,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.isShader("fragment")){e.define("GRAD_MAX",10),e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let n=e.include(Xp.Nodes.gradient),i=[];return i.push(this.glType.build(e,"i")),i.push(this.num.build(e,"i")),i.push(this.smooth.build(e,"b")),i.push(this.colors.build(e,"v4[]")),i.push(this.steps.build(e,"f[]")),i.push(this.offset.build(e,"v2")),i.push(this.morph.build(e,"v2")),i.push(this.angle.build(e,"f")),i.push(this.alpha.build(e,"f")),i.push(this.calpha),e.format(n+"("+i.join(",")+")",this.getType(e),t)}else return console.warn("GradientNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.glType=this.glType.toJSON(e).uuid,t.num=this.num.toJSON(e).uuid,t.smooth=this.smooth.toJSON(e).uuid,t.colors=this.colors.toJSON(e).uuid,t.steps=this.steps.toJSON(e).uuid,t.offset=this.offset.toJSON(e).uuid,t.morph=this.morph.toJSON(e).uuid,t.angle=this.angle.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid,t.calpha=this.calpha),t.nodeType=this.nodeType,t}copy(e){return super.copy(e),this.glType=e.glType.clone(),this.num=e.num.clone(),this.smooth=e.smooth.clone(),this.colors=e.colors.clone(),this.steps=e.steps.clone(),this.offset=e.offset.clone(),this.morph=e.morph.clone(),this.angle=e.angle.clone(),this.alpha=e.alpha.clone(),this.calpha=e.calpha,this}fromJSON(e,t){return super.fromJSON(e,t),e.calpha&&(this.calpha=e.calpha),e.glType&&(this.glType=t.getNode(e.glType)),e.num&&(this.num=t.getNode(e.num)),e.smooth&&(this.smooth=t.getNode(e.smooth)),e.colors&&(this.colors=t.getNode(e.colors)),e.steps&&(this.steps=t.getNode(e.steps)),e.offset&&(this.offset=t.getNode(e.offset)),e.morph&&(this.morph=t.getNode(e.morph)),e.angle&&(this.angle=t.getNode(e.angle)),e.alpha&&(this.alpha=t.getNode(e.alpha)),this}},ja=Xp;ja.Nodes=function(){return{gradient:new Le(`vec3 gradient(int glType, int num, bool smoothed, vec4 colors[GRAD_MAX], float steps[GRAD_MAX], vec2 offset, vec2 morph, float angle, float alpha, out float calpha) {
vec4 color = colors[0];
vec2 m = morph / vUv.xy;
vec2 rot = vec2( 0.5 + m.x, m.y );
vec2 dt = vec2(
cos( angle ) * rot.x - sin( angle ) * rot.y,
sin( angle ) * rot.x + cos( angle ) * rot.y
);
vec2 pt = ( vUv - 0.5 + offset ) / 2.0 + dt / 2.0;
float t = dot( pt, dt ) / dot( dt, dt );
if ( glType == 1 ) {
t = distance (
( vUv + morph ) * 3.0,
( vUv + offset ) + 1.0
) + angle;
} else if ( glType == 2 ) {
float polar = atan(
vUv.x + morph.x - 0.5 + offset.x,
vUv.y + morph.y - 0.5 + offset.y
) * -1.0;
t = fract( ( angle / PI / -2.0 ) + 0.5 * ( polar / PI ) );
}
float p;
if (smoothed) {
for ( int i = 1; i < GRAD_MAX; i++ ) {
p = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );
color = mix(color, colors[i], smoothstep(0.0, 1.0, p));
}
} else {
for ( int i = 1; i < GRAD_MAX; i++ ) {
p = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );
color = mix(color, colors[i], p);
}
}
float lalpha = alpha * color.a;
calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
return color.xyz;
}`)}}();var So;(function(t){t.NOISE="noise",t.MAP="map"})(So||(So={}));var qp=class extends je{constructor(e=new it(0),t,n,i,s,o){super("v3");this.nodeType="VertexDisplacement";this.displacementTypeIndex=e,this.intensity=t,this.movementOrTexture=n,Object.values(So)[this.displacementTypeIndex.value]===So.MAP&&(this.mat=new zr(this.movementOrTexture.value.matrix)),this.cropOrOffset=i,this.scale=s,this.noiseFunctionIndex=o}generate(e,t){if(e.isShader("vertex")){e.define("USE_LAYER_DISPLACE");let n,i=[];switch(i.push("displaced_position"),i.push("displaced_normal"),Object.values(So)[this.displacementTypeIndex.value]){case So.MAP:{n=e.include(qp.Nodes.map),i.push(this.movementOrTexture.getTexture(e,"t")),i.push("uv"),i.push(this.cropOrOffset.build(e,"f")),this.mat&&i.push(this.mat.build(e,"mat3"));break}case So.NOISE:{let o=Object.values(Ua)[this.noiseFunctionIndex.value],a=new Le(`vec3 orthogonal(vec3 v) {
return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));
}`),l=new Le(`vec3 distorted(vec3 p, vec3 n, float scale, float intensity, vec3 offset, float neighbour_offset, float movement) {
return p + n * ${o}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1)) * intensity;
}`,[si.simplex,si.simplexFractal,si.simplexAshima,si.fbm,si.perlin]),c=new Le(`vec3 vertexDisplacementNoise(vec3 position, vec3 normal, float scale, vec3 offset, float movement, float intensity, out vec3 displaced_normal) {
vec3 displaced_position = distorted(position, normal, scale, intensity, offset, neighbor_offset, movement);
vec3 tangent1 = orthogonal(normal);
vec3 tangent2 = normalize(cross(normal, tangent1));
// TODO(Max): The distance to the neighbors was originally scaled by 0.1.
// This caused some small oval/circular visual artifacts in the lighting.
// For now, simply using neighbors further away betters the problem,
// but we should figure out the underlying cause when we have some time.
// Maybe its related to how we calculate the tangent and bitangent?
vec3 nearby1 = position + tangent1;
vec3 nearby2 = position + tangent2;
vec3 distorted1 = distorted(nearby1, normal, scale, intensity, offset, neighbor_offset, movement);
vec3 distorted2 = distorted(nearby2, normal, scale, intensity, offset, neighbor_offset, movement);
displaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));
return displaced_position;
}`,[l,a]);n=e.include(c),i.push(this.scale.build(e,"f")),i.push(this.cropOrOffset.build(e,"v3")),i.push(this.movementOrTexture.build(e,"f"));break}}return i.push(this.intensity.build(e,"f")),i.push("displaced_normal"),e.format(n+"("+i.join(",")+")",this.getType(e),t)}else return console.warn("VertexDisplacementNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}toJSON(e){var n;let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.intensity=this.intensity.toJSON(e).uuid,t.scale=(n=this.scale)==null?void 0:n.toJSON(e).uuid,t.movementOrTexture=this.movementOrTexture.toJSON(e).uuid,t.cropOrOffset=this.cropOrOffset.toJSON(e).uuid),t.displacementTypeIndex=this.displacementTypeIndex,t.noiseFunctionIndex=this.noiseFunctionIndex,t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),this.displacementTypeIndex=e.displacementTypeIndex,this.noiseFunctionIndex=e.noiseFunctionIndex,e.cropOrOffset&&(this.cropOrOffset=t.getNode(e.cropOrOffset)),e.intensity&&(this.intensity=t.getNode(e.intensity)),e.movementOrTexture&&(this.displacementTypeIndex.value===1?(this.movementOrTexture=t.getNode(e.movementOrTexture),this.movementOrTexture.value.updateMatrix(),this.mat=new zr(this.movementOrTexture.value.matrix)):this.displacementTypeIndex.value===0&&(this.movementOrTexture=t.getNode(e.movementOrTexture))),e.scale&&(this.scale=t.getNode(e.scale)),this}copy(e){var t,n;return super.copy(e),this.noiseFunctionIndex=(t=e.noiseFunctionIndex)==null?void 0:t.clone(),this.scale=(n=e.scale)==null?void 0:n.clone(),this.cropOrOffset=e.cropOrOffset.clone(),this.intensity=e.intensity.clone(),this.movementOrTexture=e.movementOrTexture.clone(),this}},Mo=qp;Mo.Nodes=function(){let e=new Le(`vec3 orthogonal(vec3 v) {
return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));
}`),t=new Le(`float displacementMapTexture(sampler2D tex, float crop, vec2 uv, mat3 mat, vec2 offset) {
vec2 uvs = (mat * vec3(uv * 2.0 - 1.0, 1.0) / 2.0 + 0.5).xy + offset;
vec4 tmp = texture2D(tex, uvs);
vec3 col = tmp.rgb;
if (crop > 0.5) {
if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {
return 0.0;
}
}
return col.r;
}`);return{map:new Le(`vec3 vertexDisplacementMap(vec3 position, vec3 normal, sampler2D tex, vec2 uv, float crop, mat3 mat, float intensity, out vec3 displaced_normal) {
vec3 displaced_position = position + normal * displacementMapTexture(tex, crop, uv, mat, vec2(0.0)) * intensity;
vec3 tangent1 = normalize(orthogonal(normal));
vec3 tangent2 = normalize(cross(normal, tangent1));
vec3 nearby1 = position + tangent1 * 0.1;
vec3 nearby2 = position + tangent2 * 0.1;
vec3 distorted1 = nearby1 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;
vec3 distorted2 = nearby2 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;
displaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));
return displaced_position;
}`,[e,t])}}();var Wa=class extends je{constructor(e=new ze,t=new ze,n=new ze,i=new ze,s=new ze,o=new ze,a=new ze,l=new ze,c=new ze,u=new ze,h=new ze,d=new ze,f=new ze,p=new ze,m=new ze,v=new ze){super("v3");this.nodeType="Noise";this.scale=e,this.size=t,this.move=n,this.fA=i,this.fB=s,this.distortion=o,this.colorA=a,this.colorB=l,this.colorC=c,this.colorD=u,this.intA=h,this.intB=d,this.intC=f,this.intD=p,this.alpha=m,this.noiseFunctionIndex=v}generate(e,t,n,i,s){e.require("uv"),e.requires.uv=[!0];let o=Object.values(Ua)[this.noiseFunctionIndex.value],a=new Le(`vec3 ${o}customNoise(float scale, vec3 size, float move, vec2 fA, vec2 fB, vec2 distortion, vec3 colorA, vec3 colorB, vec3 colorC, vec3 colorD, float intA, float intB, float intC, float intD, float alpha) {
vec3 st = position / size;
st /= scale;
vec3 q = vec3(${o}(st),
${o}(st + vec3(1.0)),
${o}(st + vec3(1.0)));
vec3 r = vec3(${o}(st + vec3(distortion, 1.0) * q + vec3(fA, 1.0) + move),
${o}(st + vec3(distortion, 1.0) * q + vec3(fB, 1.0) + move),
${o}(st * q));
float f = ${o}(st + r);
vec3 color;
color = mix(colorA * intA, colorB * intB, clamp((f * f) * 4.0, 0.0, 1.0));
color = mix(color, colorC * intC, clamp(length(q), 0.0, 1.0));
color = mix(color, colorD * intD, clamp(length(r.x), 0.0, 1.0));
accumAlpha += (1.0 - accumAlpha) * alpha;
return clamp(color, 0.0, 1.0);
}`,[si.simplex,si.simplexFractal,si.simplexAshima,si.fbm,si.perlin]),l=e.include(a),c=[];return c.push(this.scale.build(e,"f")),c.push(this.size.build(e,"v3")),c.push(this.move.build(e,"f")),c.push(this.fA.build(e,"v2")),c.push(this.fB.build(e,"v2")),c.push(this.distortion.build(e,"v2")),c.push(this.colorA.build(e,"c")),c.push(this.colorB.build(e,"c")),c.push(this.colorC.build(e,"c")),c.push(this.colorD.build(e,"c")),c.push(this.intA.build(e,"f")),c.push(this.intB.build(e,"f")),c.push(this.intC.build(e,"f")),c.push(this.intD.build(e,"f")),c.push(this.alpha.build(e,"f")),e.format(l+"("+c.join(",")+")",this.getType(e),t)}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.scale=this.scale.toJSON(e).uuid,t.size=this.size.toJSON(e).uuid,t.move=this.move.toJSON(e).uuid,t.fA=this.fA.toJSON(e).uuid,t.fB=this.fB.toJSON(e).uuid,t.distortion=this.distortion.toJSON(e).uuid,t.colorA=this.colorA.toJSON(e).uuid,t.colorB=this.colorB.toJSON(e).uuid,t.colorC=this.colorC.toJSON(e).uuid,t.colorD=this.colorD.toJSON(e).uuid,t.intA=this.intA.toJSON(e).uuid,t.intB=this.intB.toJSON(e).uuid,t.intC=this.intC.toJSON(e).uuid,t.intD=this.intD.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid),t.noiseFunction=this.noiseFunctionIndex,t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.scale&&(this.scale=t.getNode(e.scale)),e.size&&(this.size=t.getNode(e.size)),e.move&&(this.move=t.getNode(e.move)),e.fA&&(this.fA=t.getNode(e.fA)),e.fB&&(this.fB=t.getNode(e.fB)),e.distortion&&(this.distortion=t.getNode(e.distortion)),e.colorA&&(this.colorA=t.getNode(e.colorA)),e.colorB&&(this.colorB=t.getNode(e.colorB)),e.colorC&&(this.colorC=t.getNode(e.colorC)),e.colorD&&(this.colorD=t.getNode(e.colorD)),e.intA&&(this.intA=t.getNode(e.intA)),e.intB&&(this.intB=t.getNode(e.intB)),e.intC&&(this.intC=t.getNode(e.intC)),e.intD&&(this.intD=t.getNode(e.intD)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.noiseFunctionIndex&&(this.noiseFunctionIndex=t.getNode(e.noiseFunctionIndex)),this}copy(e){return super.copy(e),this.scale.copy(e.scale),this.size.copy(e.size),this.move.copy(e.move),this.fA.copy(e.fA),this.fB.copy(e.fB),this.distortion.copy(e.distortion),this.colorA.copy(e.colorA),this.colorB.copy(e.colorB),this.colorC.copy(e.colorC),this.colorD.copy(e.colorD),this.intA.copy(e.intA),this.intB.copy(e.intB),this.intC.copy(e.intC),this.intD.copy(e.intD),this.alpha.copy(e.alpha),this.noiseFunctionIndex.copy(e.noiseFunctionIndex),this}};Wa.numOctaves=5;var Ja;(function(i){i.ADD="+",i.SUB="-",i.MUL="*",i.DIV="/"})(Ja||(Ja={}));var Yp=class extends je{constructor(e=new ze,t=new ze,n=Yp.ADD){super();this.nodeType="Operator";this.type=e.type,this.a=e,this.b=t,this.op=n}getType(e){let t=this.a.getType(e),n=this.b.getType(e);return e.isTypeMatrix(t)?"v4":e.getTypeLength(n)>e.getTypeLength(t)?n:t}generate(e,t){let n=this.getType(e);this.type=n;let i=this.a.build(e,n),s=this.b.build(e,n);return e.format("( "+i+" "+this.op+" "+s+" )",n,t)}copy(e){return super.copy(e),this.a.copy(e.a),this.b.copy(e.b),this.op=e.op,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.a=this.a.toJSON(e).uuid,t.b=this.b.toJSON(e).uuid,t.op=this.op),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.a&&(this.a=t.getNode(e.a)),e.b&&(this.b=t.getNode(e.b)),e.op&&(this.op=e.op),this}},Yn=Yp;Yn.ADD=Ja.ADD,Yn.SUB=Ja.SUB,Yn.MUL=Ja.MUL,Yn.DIV=Ja.DIV;var Xa=class extends je{constructor(e=new ze,t=new ze,n=new ze,i=new ze){super("v3");this.nodeType="Blend";this.a=e,this.b=t,this.alpha=n,this.mode=i}generate(e,t){if(e.isShader("fragment")){let n=[];return n.push(this.a.build(e,"c")),n.push(this.b.build(e,"c")),n.push(this.alpha.build(e,"f")),n.push(this.mode.build(e,"i")),e.format("spe_blend("+n.join(",")+")",this.getType(e),t)}else return console.warn("BlendNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}copy(e){return super.copy(e),this.a.copy(e.a),this.b.copy(e.b),this.alpha.copy(e.alpha),this.mode.copy(e.mode),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.a=this.a.toJSON(e).uuid,t.b=this.b.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid,t.mode=this.mode.toJSON(e).uuid),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.a&&(this.a=t.getNode(e.a)),e.b&&(this.b=t.getNode(e.b)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.mode&&(this.mode=t.getNode(e.mode)),this}};var Kp=class extends je{constructor(e,t,n,i,s,o,a,l){super("v3");this.nodeType="Depth";this.near=e,this.far=t,this.isVector=n,this.isWorldSpace=i,this.origin=s,this.colorA=o,this.colorB=a,this.alpha=l}generate(e,t){if(e.isShader("fragment")){e.require("worldPosition");let n=e.include(Kp.Nodes.sdepth),i=[];return i.push(this.near.build(e,"f")),i.push(this.far.build(e,"f")),i.push(this.isVector.build(e,"f")),i.push(this.isWorldSpace.build(e,"f")),i.push(this.origin.build(e,"v3")),i.push(this.colorA.build(e,"v3")),i.push(this.colorB.build(e,"v3")),i.push(this.alpha.build(e,"f")),e.format(n+"("+i.join(",")+")",this.getType(e),t)}else return console.warn("DepthNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.near=this.near.toJSON(e).uuid,t.far=this.far.toJSON(e).uuid,t.isVector=this.isVector.toJSON(e).uuid,t.isWorldSpace=this.isWorldSpace.toJSON(e).uuid,t.origin=this.origin.toJSON(e).uuid,t.colorA=this.colorA.toJSON(e).uuid,t.colorB=this.colorB.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.near&&(this.near=t.getNode(e.near)),e.far&&(this.far=t.getNode(e.far)),e.isVector&&(this.isVector=t.getNode(e.isVector)),e.isWorldSpace&&(this.isWorldSpace=t.getNode(e.isWorldSpace)),e.origin&&(this.origin=t.getNode(e.origin)),e.colorA&&(this.colorA=t.getNode(e.colorA)),e.colorB&&(this.colorB=t.getNode(e.colorB)),e.alpha&&(this.alpha=t.getNode(e.alpha)),this}copy(e){return super.copy(e),this.near=e.near.clone(),this.far=e.far.clone(),this.isVector=e.isVector.clone(),this.isWorldSpace=e.isWorldSpace.clone(),this.origin=e.origin.clone(),this.colorA=e.colorA.clone(),this.colorB=e.colorB.clone(),this.alpha=e.alpha.clone(),this}},qa=Kp;qa.Nodes=function(){return{sdepth:new Le(`vec3 sdepth(float near, float far, float isVector, float isWorldSpace, vec3 origin, vec3 colorA, vec3 colorB, float alpha) {
float dist;
if (isVector > 0.5) {
dist = (isWorldSpace > 0.5) ? length(vWPosition - origin) : length(position - origin);
} else {
dist = length (vWPosition - cameraPosition);
}
float dep = ( dist - near ) / ( far - near );
vec3 depth = mix( colorB, colorA, 1.0 - clamp( dep, 0., 1. ) );
accumAlpha += ( 1.0 - accumAlpha ) * alpha;
return depth;
}`)}}();var Qp=class extends je{constructor(e,t,n,i){super("v3");this.nodeType="Matcap";this.color=e,this.texture=t,this.alpha=n,this.mode=i,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.isShader("fragment")){e.addFragmentVariable(this.calpha,"float");let n=e.include(Qp.Nodes.matcap);e.require("normal"),e.requires.normal=!0;let i=[];return i.push(this.color.build(e,"v3")),i.push(this.texture.getTexture(e,"t")),i.push("normal"),i.push(this.alpha.build(e,"f")),i.push(this.mode.build(e,"i")),i.push(this.calpha),e.format(n+"("+i.join(",")+")",this.getType(e),t)}else return console.warn("MatcapNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}copy(e){return super.copy(e),this.texture=e.texture.clone(),this.color=e.color.clone(),this.alpha=e.alpha.clone(),this.mode=e.mode.clone(),this.calpha=e.calpha,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.texture=this.texture.toJSON(e).uuid,t.color=this.color.toJSON(e).uuid,t.alpha=this.alpha.toJSON(e).uuid,t.mode=this.mode.toJSON(e).uuid,t.calpha=this.calpha),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.calpha&&(this.calpha=e.calpha),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.texture&&(this.texture=t.getNode(e.texture)),e.color&&(this.color=t.getNode(e.color)),e.mode&&(this.mode=t.getNode(e.mode)),this}},Ya=Qp;Ya.Nodes=function(){return{matcap:new Le(`vec3 matcap(vec3 color, sampler2D matcapTex, vec3 normal, float alpha, int mode, out float calpha) {
vec3 viewDir = normalize( vViewPosition );
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
vec3 y = cross( viewDir, x );
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks
vec4 matcapColor = texture2D( matcapTex, uv );
// matcapColor = matcapTexelToLinear( matcapColor );
matcapColor.rgb *= color;
calpha = alpha / clamp( alpha + accumAlpha, 0.00001, 1.0 );
accumAlpha += ( 1.0 - accumAlpha ) * alpha;
return matcapColor.rgb;
}
`)}}();var Kn=class{constructor(e){this.id=2,this.layerCount=2,this.uuid=Ee.generateUUID(),this.needsUpdate=!1,this._material=e,this._layerNodes=[];let t=this._createLayer({id:0,type:lt.COLOR});this._material.color=t.color,this._material.alpha===void 0&&(this._material.alpha=new Te(1));let n=new Te(1),i=new it(0);"shadingAlpha"in this._material&&"shadingBlend"in this._material&&(this._material.shadingAlpha=n,this._material.shadingBlend=i),this._layerNodes.push({id:0,type:Gt.COLOR,color:t.color,alpha:t.alpha,mode:t.mode}),this._layerNodes.push({id:1,type:Gt.LIGHTING,alpha:n,mode:i}),this.head=t.layer,this.head.next=new jt(1,{type:lt.LIGHTING,alpha:n,mode:i}),this.attachLightNodes()}get material(){return this._material}set material(e){this._material=e;let t,n,i=this.head;for(;i!==void 0;){if(i.type===lt.LIGHTING){t=i.uniforms[`f${i.id}_alpha`],n=i.uniforms[`f${i.id}_mode`];break}i=i.next}"shadingAlpha"in this._material&&"shadingBlend"in this._material&&(this._material.shadingAlpha=t,this._material.shadingBlend=n),this.attachLightNodes(),this.blendColors(),this.blendAfterColors(),this.blendPositions()}getLayersOfType(e){let t=[],n=this.head;for(;n;)n.type===e&&t.push(n),n=n.next;return t}addLayer(e){var i;if(e.id=(i=e.id)!=null?i:++this.id,this.layerCount++,e.type===lt.LIGHTING){let s=this.createLightLayer(e);return this.uuid=Ee.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),s}let t=this._createLayer(e),n=t.layer;if(this.head===void 0)this.head=n;else{let s=this.head;for(;s.next!=null;)s=s.next;s.next=n}return t.color&&this._layerNodes.push({id:n.id,type:Gt.COLOR,color:t.color,alpha:t.alpha,mode:t.mode}),t.position&&this._layerNodes.push({id:n.id,type:Gt.POSITION,position:t.position}),this.uuid=Ee.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),n}addLayerBeforeAt(e,t){var a;let n=this.head;e.id=(a=e.id)!=null?a:++this.id,this.layerCount++;let i=this._createLayer(e),s=i.layer;s.next=t;let o=0;if(n===t)this.head=s,i.color&&this._layerNodes.splice(0,0,{id:s.id,type:Gt.COLOR,color:i.color,alpha:i.alpha,mode:i.mode}),i.position&&this._layerNodes.splice(0,0,{id:s.id,type:Gt.POSITION,position:i.position});else{for(o=1;(n==null?void 0:n.next)!==t;)n=n==null?void 0:n.next,o++;n.next=s,i.color&&this._layerNodes.splice(o,0,{id:s.id,type:Gt.COLOR,color:i.color,alpha:i.alpha,mode:i.mode}),i.position&&this._layerNodes.splice(o,0,{id:s.id,type:Gt.POSITION,position:i.position})}return this.uuid=Ee.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),s}addLayerAt(e,t){var s;t.id=(s=t.id)!=null?s:++this.id,this.layerCount++;let n=this._createLayer(t),i=n.layer;if(n.color&&this._layerNodes.splice(e,0,{id:i.id,type:Gt.COLOR,color:n.color,alpha:n.alpha,mode:n.mode}),n.position&&this._layerNodes.splice(e,0,{id:i.id,type:Gt.POSITION,position:n.position}),e==0)i.next=this.head,this.head=i;else{let o=this.head,a=this.head.next;for(let l=0;l<e-1;l++)o=a,a=a.next;i.next=a,o.next=i}return this.uuid=Ee.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),i}removeLayer(e){let t=this.head,n,i=0;if((t==null?void 0:t.id)==e)this.head=t.next;else for(i=1,n=t,t=t==null?void 0:t.next;t!=null;){if(t.id==e){n.next=t.next;break}i++,n=t,t=t.next}return this.cleanupChangedLayer(t),this.blendColors(),this.blendAfterColors(),this.blendPositions(),this.uuid=Ee.generateUUID(),this.layerCount--,i}changeLayer(e,t){let n,i=this.head,s;if((i==null?void 0:i.id)==e){let o=this._createLayer(Ue({id:e},t));s=o.layer,s.next=i.next,this.head=s,o.color&&(this._layerNodes[0]={id:s.id,type:Gt.COLOR,color:o.color,alpha:o.alpha,mode:o.mode}),o.position&&(this._layerNodes[0]={id:s.id,type:Gt.POSITION,position:o.position}),s.uniforms[`f${e}_mode`].value=i.uniforms[`f${e}_mode`].value,s.uniforms[`f${e}_alpha`].value=i.uniforms[`f${e}_alpha`].value}else{n=i,i=i.next;let o=1;for(;i!=null;){if(i.id==e){let a=this._createLayer(Ue({id:e},t));s=a.layer,n.next=s,s.next=i.next,a.color&&(this._layerNodes[o]={id:s.id,type:Gt.COLOR,color:a.color,alpha:a.alpha,mode:a.mode}),a.position&&(this._layerNodes[o]={id:s.id,type:Gt.POSITION,position:a.position}),s.uniforms[`f${e}_mode`].value=i.uniforms[`f${e}_mode`].value,s.uniforms[`f${e}_alpha`].value=i.uniforms[`f${e}_alpha`].value;break}n=i,i=i.next,o++}}return this.uuid=Ee.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),s}getLayer(e){let t=this.head;for(;t!=null&&t.id!=e;)t=t.next;return t}getLayers(){let e=[],t=this.head;for(;t!=null;)e.push(t),t=t.next;return e}getLayerPosition(e){let t=this.head,n=0;for(;t!==void 0&&t.id!=e;)n++,t=t.next;return n}getDefines(){}getBeforeProgram(){}getLightingProgram(){}getAfterProgram(){}getVarPrograms(){}getUniforms(){}moveLayer(e,t){let n,i=this.head,s;if(e==0)n=this.head,this.head=n.next;else{for(let a=0;a<e;a++)s=i,i=i.next;s.next=i.next,n=i}if(i=this.head,s=void 0,t==0)n.next=this.head,this.head=n;else{for(let a=0;a<t-1;a++)i=i.next;n.next=i==null?void 0:i.next,i.next=n}let o=this._layerNodes.splice(e,1)[0];this._layerNodes.splice(t,0,o),this.uuid=Ee.generateUUID(),this.blendColors(),this.blendAfterColors()}updateLayerUniform(){this.uuid=Ee.generateUUID(),this.blendColors(),this.blendAfterColors()}copy(e){this.needsUpdate=!1,this.layerCount=e.layerCount,this._layerNodes=[],this.layerCount=0,this.head=void 0,this.rebuildLayerNodes(this.head,e.head);let t=e.head,n=this.head;for(;t.next!=null;)this.rebuildLayerNodes(n,t.next),n=n.next,t=t.next;return this.id=e.id,this.uuid=e.uuid,this.blendColors(),this.blendAfterColors(),this.blendPositions(),this}createLightLayer(e){let t=new Te(e.alpha),n=new it(e.mode);this._material.shadingAlpha=t,this._material.shadingBlend=n,this._layerNodes.push({id:e.id,type:Gt.LIGHTING,alpha:t,mode:n});let i=new jt(e.id,{type:lt.LIGHTING,alpha:t,mode:n});if(this.head===void 0)this.head=i;else{let s=this.head;for(;s.next!=null;)s=s.next;s.next=i}return this.attachLightNodes(),i}rebuildLayerNodes(e,t,n=!1){if(t.type===lt.LIGHTING){let i=n?t.uniforms[`f${t.id}_alpha`]:new Te(t.uniforms[`f${t.id}_alpha`].value),s=n?t.uniforms[`f${t.id}_mode`]:new it(t.uniforms[`f${t.id}_mode`].value);this._material.shadingAlpha=i,this._material.shadingBlend=s,this._layerNodes.push({id:t.id,type:Gt.LIGHTING,alpha:i,mode:s}),this.head===void 0?this.head=new jt(t.id,{type:lt.LIGHTING,alpha:i,mode:s}):e&&(e.next=new jt(t.id,{type:lt.LIGHTING,alpha:i,mode:s})),this.attachLightNodes(t)}else{let i={type:t.type,id:t.id};for(let s in t.uniforms){let o=t.getName(s);if(!o)continue;let a=`f${t.id}_${o}`;if(Array.isArray(t.uniforms[a].value))i[o]=t.uniforms[a].value.map(l=>l.clone&&!n?l.clone():l);else{let l=t.uniforms[a].value;if(o==="transmissionDepthMap"){i[o]=l;continue}l!=null&&(i[o]=l.clone&&!n&&!l.isRenderTargetTexture?l.clone():l)}}this.addLayer(i)}}attachLightNodes(e){var i,s,o,a,l,c,u,h,d,f,p;let t={},n=this.getLightLayer();switch(this._material.userData.category){case"Lambert":t.emissive=new ct((s=(i=e==null?void 0:e.getValue("emissive"))==null?void 0:i.clone())!=null?s:0);break;case"Phong":t.shininess=new Te((o=e==null?void 0:e.getValue("shininess"))!=null?o:30),t.specular=new ct((l=(a=e==null?void 0:e.getValue("specular"))==null?void 0:a.clone())!=null?l:1118481);break;case"Toon":t.shininess=new Te((c=e==null?void 0:e.getValue("shininess"))!=null?c:30),t.specular=new ct((h=(u=e==null?void 0:e.getValue("specular"))==null?void 0:u.clone())!=null?h:1118481);break;case"Physical":t.roughness=new Te((d=e==null?void 0:e.getValue("roughness"))!=null?d:.3),t.metalness=new Te((f=e==null?void 0:e.getValue("metalness"))!=null?f:0),t.reflectivity=new Te((p=e==null?void 0:e.getValue("reflectivity"))!=null?p:.5);break;default:break}Object.keys(t).forEach(m=>{this._material[m]=t[m],n.uniforms[`f${n.id}_${m}`]=t[m]})}clone(e){return new Kn(e).copy(this)}toJSON(e){return{id:this.id,uuid:this.uuid,head:this.head.toJSON(e)}}fromJSON(e,t,n){let i=new jt(e.head.id,{type:e.head.type}).fromJSON(e.head,t),s=e.head.next,o=i;for(;s!=null;)o.next=new jt(s.id,{type:s.type}).fromJSON(s,t),s=s.next,o=o.next;this._layerNodes=[],this.head=void 0,this.rebuildLayerNodes(this.head,i,!0);let a=i;for(o=this.head;a.next!=null;)this.rebuildLayerNodes(o,a.next,!0),o=o.next,a=a.next;return this._material=n,this.id=e.id,this.uuid=e.uuid,this.blendColors(),this.blendAfterColors(),this.blendPositions(),this}getLightLayer(){var t;let e=this.head;for(;e!==void 0&&e.type!=="light";)e=(t=e.next)!=null?t:e;return e}dispose(){let e=this.head;for(this._layerNodes=[],this.layerCount=0;e!==void 0;)e.hasOwnProperty("dispose")===!0&&e.dispose(),e=e.next;this.head=void 0}_createLayer(e){var n,i,s,o,a,l,c,u,h,d,f,p,m,v,g,y,x,b,w,_,S,A,T,L,C,U,P,R,G,B,j,ne,le,W,z,D,K,q,ee,V,de,ae,te,X,se,$,H,Q,ce,ie,N,E,Y,re,ye,pe,Ie,ve,Fe,Ce,J,xe,he,Ne,Be,ke,ht,ft,Bn,Mt,Tn,En,Di,_r,xn,F,Pe,et,Ft,Nn,Gs,sr,Ll,Il,mu,gu,I,oe;let t=e.type;switch(t){case lt.COLOR:{let k=new ct((n=e.color)!=null?n:5855577),Z=new Te((i=e.alpha)!=null?i:1),ue=new yt("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");ue.keywords.alpha=Z;let Me=new it((s=e.mode)!=null?s:0);return k.alpha=Z,{layer:new jt(e.id,{type:t,color:k,alpha:Z,calpha:ue,mode:Me}),color:k,alpha:ue,mode:Me}}case lt.TEXTURE:{let k=(o=e.texture)!=null?o:new bi,Z=k.matrix;e.mat&&Z.copy(e.mat),k.needsUpdate=!0;let ue=new Te((a=e.crop)!=null?a:0),Me=new it((l=e.projection)!=null?l:0),_e=new it((c=e.axis)!=null?c:0),Se=new In((u=e.size)!=null?u:new O(100,100)),De=new Te((h=e.alpha)!=null?h:1),Ve=new it((d=e.mode)!=null?d:0),Oe=new kn(k),He=new Un((f=e.textureSize)!=null?f:new M(k.image?k.image.width:0,k.image?k.image.height:0)),Ge=new za(Oe,He,ue,Me,_e,Se,De,Ve),Kt=new yt(Ge.calpha,"f");return{layer:new jt(e.id,{type:t,texture:Oe,textureSize:He,crop:ue,projection:Me,axis:_e,size:Se,mat:Ge.mat,alpha:De,calpha:Kt,mode:Ve}),color:Ge,alpha:Kt,mode:Ve}}case lt.MATCAP:{let k=new ct((p=e.color)!=null?p:16777215),Z=(m=e.texture)!=null?m:new bi;Z.needsUpdate=!0;let ue=new Te((v=e.alpha)!=null?v:1),Me=new kn(Z),_e=new it((g=e.mode)!=null?g:0),Se=new Ya(k,Me,ue,_e),De=new yt(Se.calpha,"f");return{layer:new jt(e.id,{type:t,texture:Me,color:k,alpha:ue,calpha:De,mode:_e}),color:Se,alpha:De,mode:_e}}case lt.FRESNEL:{let k=new ct((y=e.color)!=null?y:16777215),Z=new Te((x=e.bias)!=null?x:.1),ue=new Te((b=e.scale)!=null?b:1),Me=new Te((w=e.intensity)!=null?w:2),_e=new Te((_=e.factor)!=null?_:1),Se=new Te((S=e.alpha)!=null?S:1),De=new it((A=e.mode)!=null?A:0),Ve=new Ga(k,Z,ue,Me,_e,Se,De),Oe=new yt(Ve.calpha,"f");return{layer:new jt(e.id,{type:t,color:k,bias:Z,scale:ue,intensity:Me,factor:_e,alpha:Se,calpha:Oe,mode:De}),color:Ve,alpha:Oe,mode:De}}case lt.RAINBOW:{let k=new Te((T=e.filmThickness)!=null?T:30),Z=new Te((L=e.movement)!=null?L:0),ue=new Un((C=e.wavelengths)!=null?C:new M(0,0,0)),Me=new Te((U=e.noiseStrength)!=null?U:0),_e=new Te((P=e.noiseScale)!=null?P:1),Se=new Un((R=e.offset)!=null?R:new M(0,0,0)),De=new Te((G=e.alpha)!=null?G:1),Ve=new ka(k,Z,ue,Me,_e,Se,De),Oe=new yt(Ve.calpha,"f"),He=new it((B=e.mode)!=null?B:0);return{layer:new jt(e.id,{type:t,filmThickness:k,movement:Z,wavelengths:ue,noiseStrength:Me,noiseScale:_e,offset:Se,alpha:De,calpha:Oe,mode:He}),color:Ve,alpha:Oe,mode:He}}case lt.TRANSMISSION:{let k=new Te((j=e.thickness)!=null?j:10),Z=new Te((ne=e.ior)!=null?ne:1.5),ue=new Te((le=e.roughness)!=null?le:.5),Me=new In((W=e.transmissionSamplerSize)!=null?W:new O(2048,2048)),_e=(z=e.transmissionSamplerMap)!=null?z:new bi,Se=(D=e.transmissionDepthMap)!=null?D:new bi,De=new kn(_e),Ve=new kn(Se),Oe=window.innerWidth,He=window.innerHeight,Ge=Oe>=He?new In(He/Oe,1):new In(1,Oe/He),Kt=new Te((K=e.alpha)!=null?K:1),vt=new Va(k,Z,ue,Me,De,Ve,Ge,Kt),bn=new yt(vt.calpha,"f"),wn=new it((q=e.mode)!=null?q:0);return{layer:new jt(e.id,{type:t,thickness:k,ior:Z,roughness:ue,transmissionSamplerSize:Me,transmissionSamplerMap:De,transmissionDepthMap:Ve,aspectRatio:Ge,alpha:Kt,calpha:bn,mode:wn}),color:vt,alpha:bn,mode:wn}}case lt.DEPTH:{let k=new Te((ee=e.near)!=null?ee:50),Z=new Te((V=e.far)!=null?V:200),ue=new Te((de=e.isVector)!=null?de:1),Me=new Te((ae=e.isWorldSpace)!=null?ae:0),_e=new Un((te=e.origin)!=null?te:new M),Se=new ct((X=e.colorA)!=null?X:new fe),De=new ct((se=e.colorB)!=null?se:new fe(0,0,0)),Ve=new Te(($=e.alpha)!=null?$:1),Oe=new it((H=e.mode)!=null?H:0),He=new yt("alpha / clamp(alpha + accumAlpha, 0.001, 1.0 )","f");He.keywords.alpha=Ve;let Ge=new qa(k,Z,ue,Me,_e,Se,De,Ve);return{layer:new jt(e.id,{type:t,near:k,far:Z,isVector:ue,isWorldSpace:Me,origin:_e,colorA:Se,colorB:De,alpha:Ve,calpha:He,mode:Oe}),color:Ge,alpha:He,mode:Oe}}case lt.NOISE:{let k=new Te((Q=e.scale)!=null?Q:1),Z=new Un((ce=e.size)!=null?ce:new M(100,100,100)),ue=new Te((ie=e.move)!=null?ie:1),Me=new In((N=e.fA)!=null?N:new O(1.7,9.2)),_e=new In((E=e.fB)!=null?E:new O(8.3,2.8)),Se=new In((Y=e.distortion)!=null?Y:new O(1,1)),De=new ct((re=e.colorA)!=null?re:new fe(.4,.4,.4)),Ve=new ct((ye=e.colorB)!=null?ye:new fe(.4,.4,.4)),Oe=new ct((pe=e.colorC)!=null?pe:new fe(1,1,1)),He=new ct((Ie=e.colorD)!=null?Ie:new fe(1,1,1)),Ge=new Te((ve=e.intA)!=null?ve:1),Kt=new Te((Fe=e.intB)!=null?Fe:1),vt=new Te((Ce=e.intC)!=null?Ce:1),bn=new Te((J=e.intD)!=null?J:1),wn=new Te((xe=e.alpha)!=null?xe:1),Ri=new it((he=e.mode)!=null?he:0),Bi=new it((Ne=e.noiseType)!=null?Ne:0),Qt=new yt("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");Qt.keywords.alpha=wn;let Mi=new Wa(k,Z,ue,Me,_e,Se,De,Ve,Oe,He,Ge,Kt,vt,bn,wn,Bi);return{layer:new jt(e.id,{type:t,scale:k,size:Z,move:ue,fA:Me,fB:_e,distortion:Se,colorA:De,colorB:Ve,colorC:Oe,colorD:He,intA:Ge,intB:Kt,intC:vt,intD:bn,alpha:wn,calpha:Qt,mode:Ri,noiseType:Bi}),color:Mi,alpha:Qt,mode:Ri}}case lt.NORMAL:{let k=new Un((Be=e.cnormal)!=null?Be:new M(1,1,1)),Z=new Te((ke=e.alpha)!=null?ke:1),ue=new it((ht=e.mode)!=null?ht:0),Me=new Ha(k,Z),_e=new yt("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");return _e.keywords.alpha=Z,{layer:new jt(e.id,{type:t,cnormal:k,alpha:Z,calpha:_e,mode:ue}),color:Me,alpha:_e,mode:ue}}case lt.GRADIENT:{let k=new it((ft=e.gl_type)!=null?ft:0),Z=new it((Bn=e.num)!=null?Bn:2),ue=new mc((Mt=e.smooth)!=null?Mt:!1),Me;e.colors?Me=new Ra(e.colors.length,e.colors):(Me=new Ra(10,new Qe(0,0,0,1)),Me.value[1]=new Qe(1,1,1,1));for(let bn=Z.value;bn<10;bn++)Me.value[bn]=Me.value[Z.value-1];let _e;e.steps?_e=new Ba(e.steps.length,e.steps):(_e=new Ba(10,1),_e.value[0]=0);let Se=new In((Tn=e.offset)!=null?Tn:new O(0,0)),De=new In((En=e.morph)!=null?En:new O(0,0)),Ve=new Te((Di=e.angle)!=null?Di:0),Oe=new Te((_r=e.alpha)!=null?_r:1),He=new it((xn=e.mode)!=null?xn:0),Ge=new ja(k,Z,ue,Me,_e,Se,De,Ve,Oe),Kt=new yt(Ge.calpha,"f");return{layer:new jt(e.id,{type:t,gl_type:k,num:Z,smooth:ue,colors:Me,steps:_e,offset:Se,morph:De,angle:Ve,alpha:Oe,calpha:Kt,mode:He}),color:Ge,alpha:Kt,mode:He}}case lt.DISPLACE:{let k=new it((F=e.displacementType)!=null?F:0);if(k.value===0){let Z=new Un((Pe=e.offset)!=null?Pe:new M(0,0,0)),ue=new Te((et=e.scale)!=null?et:10),Me=new Te((Ft=e.intensity)!=null?Ft:8),_e=new Te((Nn=e.movement)!=null?Nn:1),Se=new Te((Gs=e.alpha)!=null?Gs:1),De=new it((sr=e.mode)!=null?sr:0),Ve=new it((Ll=e.noiseType)!=null?Ll:0),Oe=new Mo(k,Me,_e,Z,ue,Ve);return{layer:new jt(e.id,{displacementType:k,type:t,offset:Z,scale:ue,intensity:Me,movement:_e,alpha:Se,mode:De,noiseType:Ve}),position:Oe}}else if(k.value===1){let Z=(Il=e.texture)!=null?Il:new bi,ue=Z.matrix;e.mat&&ue.copy(e.mat),Z.needsUpdate=!0;let Me=new Te((mu=e.intensity)!=null?mu:8),_e=new kn(Z),Se=new Te((gu=e.crop)!=null?gu:0),De=new Te((I=e.alpha)!=null?I:1),Ve=new it((oe=e.mode)!=null?oe:0),Oe=new Mo(k,Me,_e,Se);return{layer:new jt(e.id,{displacementType:k,type:t,intensity:Me,texture:_e,crop:Se,mat:Oe.mat,alpha:De,mode:Ve}),position:Oe}}return{}}}return{}}blendColors(){let e=this._layerNodes.findIndex(n=>n.type===Gt.COLOR),t=this._layerNodes.findIndex(n=>n.type===Gt.LIGHTING);if(e!==-1&&e<t){let n=this._layerNodes[e].color;for(let i=e+1;i<t;++i){let s=this._layerNodes[i];s.type===Gt.COLOR&&(n=new Xa(n,s.color,s.alpha,s.mode))}this._material.color=n}else this._material.color=void 0}blendAfterColors(){let e=new yt("outgoingLight","f"),t=this._layerNodes.findIndex(n=>n.type===Gt.LIGHTING);if(this._layerNodes.length>t+1){for(let n=t+1;n<this._layerNodes.length;++n){let i=this._layerNodes[n];i.type===Gt.COLOR&&(e=new Xa(e,i.color,i.alpha,i.mode))}"afterColor"in this._material&&(this._material.afterColor=e)}else"afterColor"in this._material&&(this._material.afterColor=void 0)}blendPositions(){let e=this._layerNodes.filter(t=>t.type===Gt.POSITION);if(e.length>0){let t=e[0].position;for(let n=1;n<e.length;++n)e[n]&&(t=new Yn(t,e[n].position,Yn.ADD),t=new Yn(t,new Te(.5).setReadonly(!0),Yn.MUL));this._material.position=t}else this._material.position=void 0}cleanupChangedLayer(e){switch(this._layerNodes=this._layerNodes.filter(t=>t.id!==e.id),e.type){case lt.DISPLACE:{this.blendPositions();break}default:{this.blendColors(),this.blendAfterColors();break}}}};var Nh=class{constructor(e){e=e!=null?e:{},this.name=e.name,this.type=e.type,this.node=e.node,this.size=e.size,this.needsUpdate=e.needsUpdate}get value(){return this.node.value}set value(e){this.node.value=e}};var yc=class extends Ct{constructor(e=0,t,n,i){super("v4");this.nodeType="Vector4";this.value=e instanceof Qe?e:new Qe(e,t,n,i)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}get z(){return this.value.z}set z(e){this.value.z=e}get w(){return this.value.w}set w(e){this.value.w=e}generateReadonly(e,t,n,i,s,o){return e.format("vec4("+this.value.x+", "+this.value.y+", "+this.value.z+", "+this.value.w+")",i,t)}copy(e){return super.copy(e),this.value.copy(e.value),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.x=this.value.x,t.y=this.value.y,t.z=this.value.z,t.w=this.value.w,this.getReadonly()===!0&&(t.readonly=!0)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.x&&(this.value.x=e.x),e.y&&(this.value.y=e.y),e.z&&(this.value.z=e.z),e.w&&(this.value.w=e.w),e.readonly!==void 0&&(this.readonly=e.readonly),this}};var ML=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
)*?)}`,"gim"),AL=new RegExp("s*(w*?)s*(w*?)(=|;)","gim"),Ao=class extends je{constructor(e=""){super();this.inputs=[];this.src="";this.nodeType="Struct";this.parse(e)}getType(e){return e.getTypeByFormat(this.name)}getInputByName(e){let t=this.inputs.length;for(;t--;)if(this.inputs[t].name===e)return this.inputs[t]}generate(e,t,n,i,s){return t==="source"?this.src+";":e.format("( "+this.src+" )",this.getType(e),t)}parse(e=""){this.src=e,this.inputs=[];let t=ML.exec(e);if(t){let n=t[2],i;for(;i=AL.exec(n);)this.inputs.push({type:i[1],name:i[2]});this.name=t[1]}else this.name="";this.type=this.name}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.src=this.src),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.src&&(this.src=e.src,this.parse(this.src)),this}};var Ch=class extends je{constructor(e,t){super();this.inputs=[];this.nodeType="FunctionCall";this.value=e,this.inputs=t!=null?t:[]}getFunction(){return this.value}getType(e){return this.value.getType(e)}generate(e,t,n,i,s){i=this.getType(e);let o=this.value,a=o.build(e,t)+"( ",l=[];if(o.inputs){for(let c=0;c<o.inputs.length;c++){let u=o.inputs[c],h=this.inputs[c]||this.inputs[u.name];l.push(h.build(e,e.getTypeByFormat(u.type)))}a+=l.join(", ")+" )"}return e.format(a,i,t)}copy(e){return super.copy(e),this.value.copy(e.value),this.inputs=e.inputs.map(t=>t.clone()),this}toJSON(e){var n;let t=this.getJSONNode(e);if(!t){let i=this.value;if(t=this.createJSONNode(e),t.value=this.value.toJSON(e).uuid,(n=i.inputs)==null?void 0:n.length){t.inputs={};for(let s=0;s<i.inputs.length;s++){let o=i.inputs[s],a=this.inputs[s];t.inputs[o.name]=a.toJSON(e).uuid}}}return t}};var st;(function(D){D.RAD="radians",D.DEG="degrees",D.EXP="exp",D.EXP2="exp2",D.LOG="log",D.LOG2="log2",D.SQRT="sqrt",D.INV_SQRT="inversesqrt",D.FLOOR="floor",D.CEIL="ceil",D.NORMALIZE="normalize",D.FRACT="fract",D.SATURATE="saturate",D.SIN="sin",D.COS="cos",D.TAN="tan",D.ASIN="asin",D.ACOS="acos",D.ARCTAN="atan",D.ABS="abs",D.SIGN="sign",D.LENGTH="length",D.NEGATE="negate",D.INVERT="invert",D.MIN="min",D.MAX="max",D.MOD="mod",D.STEP="step",D.REFLECT="reflect",D.DISTANCE="distance",D.DOT="dot",D.CROSS="cross",D.POW="pow",D.MIX="mix",D.CLAMP="clamp",D.REFRACT="refract",D.SMOOTHSTEP="smoothstep",D.FACEFORWARD="faceforward"})(st||(st={}));var St=class extends je{constructor(e=new ze,t=St.ABS,n,i){super();this.nodeType="Math";this.a=e,typeof t!="string"?this.b=t:i=t,typeof n!="string"?this.c=n:i=n,this.method=i,this.hashProperties=["method"]}getNumInputs(e){switch(this.method){case St.MIX:case St.CLAMP:case St.REFRACT:case St.SMOOTHSTEP:case St.FACEFORWARD:return 3;case St.MIN:case St.MAX:case St.MOD:case St.STEP:case St.REFLECT:case St.DISTANCE:case St.DOT:case St.CROSS:case St.POW:return 2;default:return 1}}getInputType(e){let t=e.getTypeLength(this.a.getType(e)),n=this.b?e.getTypeLength(this.b.getType(e)):0,i=this.c?e.getTypeLength(this.c.getType(e)):0;return t>n&&t>i?this.a.getType(e):n>i?this.b.getType(e):this.c.getType(e)}getType(e){switch(this.method){case St.LENGTH:case St.DISTANCE:case St.DOT:return"f";case St.CROSS:return"v3"}return this.getInputType(e)}generate(e,t){let n,i,s,o=this.a?e.getTypeLength(this.a.getType(e)):0,a=this.b?e.getTypeLength(this.b.getType(e)):0,l=this.c?e.getTypeLength(this.c.getType(e)):0,c=this.getInputType(e),u=this.getType(e);switch(this.type=u,this.method){case St.NEGATE:return e.format("( -"+this.a.build(e,c)+" )",c,t);case St.INVERT:return e.format("( 1.0 - "+this.a.build(e,c)+" )",c,t);case St.CROSS:n=this.a.build(e,"v3"),i=this.b.build(e,"v3");break;case St.STEP:n=this.a.build(e,o===1?"f":c),i=this.b.build(e,c);break;case St.MIN:case St.MAX:case St.MOD:n=this.a.build(e,c),i=this.b.build(e,a===1?"f":c);break;case St.REFRACT:n=this.a.build(e,c),i=this.b.build(e,c),s=this.c.build(e,"f");break;case St.MIX:n=this.a.build(e,c),i=this.b.build(e,c),s=this.c.build(e,l===1?"f":c);break;default:n=this.a.build(e,c),this.b&&(i=this.b.build(e,c)),this.c&&(s=this.c.build(e,c));break}let h=[];h.push(n),i&&h.push(i),s&&h.push(s);let d=this.getNumInputs(e);if(h.length!==d)throw Error(`Arguments not match used in "${this.method}". Require ${d}, currently ${h.length}.`);return e.format(this.method+"( "+h.join(", ")+" )",u,t)}copy(e){return super.copy(e),this.a.copy(e.a),this.b=e.b instanceof ze?e.b.clone():e.b,this.c=e.c instanceof ze?e.c.clone():e.c,this.method=e.method,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.a=this.a.toJSON(e).uuid,this.b&&(t.b=this.b.toJSON(e).uuid),this.c&&(t.c=this.c.toJSON(e).uuid),t.method=this.method),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.a&&(this.a=t.getNode(e.a)),e.b&&(this.b=t.getNode(e.b)),e.c&&(this.c=t.getNode(e.c)),e.method&&(this.method=e.method),this}},Ye=St;Ye.RAD=st.RAD,Ye.DEG=st.DEG,Ye.EXP=st.EXP,Ye.EXP2=st.EXP2,Ye.LOG=st.LOG,Ye.LOG2=st.LOG2,Ye.SQRT=st.SQRT,Ye.INV_SQRT=st.INV_SQRT,Ye.FLOOR=st.FLOOR,Ye.CEIL=st.CEIL,Ye.NORMALIZE=st.NORMALIZE,Ye.FRACT=st.FRACT,Ye.SATURATE=st.SATURATE,Ye.SIN=st.SIN,Ye.COS=st.COS,Ye.TAN=st.TAN,Ye.ASIN=st.ASIN,Ye.ACOS=st.ACOS,Ye.ARCTAN=st.ARCTAN,Ye.ABS=st.ABS,Ye.SIGN=st.SIGN,Ye.LENGTH=st.LENGTH,Ye.NEGATE=st.NEGATE,Ye.INVERT=st.INVERT,Ye.MIN=st.MIN,Ye.MAX=st.MAX,Ye.MOD=st.MOD,Ye.STEP=st.STEP,Ye.REFLECT=st.REFLECT,Ye.DISTANCE=st.DISTANCE,Ye.DOT=st.DOT,Ye.CROSS=st.CROSS,Ye.POW=st.POW,Ye.MIX=st.MIX,Ye.CLAMP=st.CLAMP,Ye.REFRACT=st.REFRACT,Ye.SMOOTHSTEP=st.SMOOTHSTEP,Ye.FACEFORWARD=st.FACEFORWARD;var Ka=class extends je{constructor(e=new ze,t=new ze,n=new ze){super("v4");this.nodeType="TextureCubeUV";this.value=e,this.uv=t,this.bias=n}bilinearCubeUV(e,t,n,i){var l,c,u,h;let s=new Ch(Ka.Nodes.bilinearCubeUV,[t,n,i]);this.colorSpaceTL=(l=this.colorSpaceTL)!=null?l:new Bt(new yt("","v4")),this.colorSpaceTL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTL.input.parse(s.build(e)+".tl"),this.colorSpaceTR=(c=this.colorSpaceTR)!=null?c:new Bt(new yt("","v4")),this.colorSpaceTR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTR.input.parse(s.build(e)+".tr"),this.colorSpaceBL=(u=this.colorSpaceBL)!=null?u:new Bt(new yt("","v4")),this.colorSpaceBL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBL.input.parse(s.build(e)+".bl"),this.colorSpaceBR=(h=this.colorSpaceBR)!=null?h:new Bt(new yt("","v4")),this.colorSpaceBR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBR.input.parse(s.build(e)+".br");let o={include:e.isShader("vertex"),ignoreCache:!0};e.addContext(o),this.colorSpaceTLExp=new yt(this.colorSpaceTL.build(e,"v4"),"v4"),this.colorSpaceTRExp=new yt(this.colorSpaceTR.build(e,"v4"),"v4"),this.colorSpaceBLExp=new yt(this.colorSpaceBL.build(e,"v4"),"v4"),this.colorSpaceBRExp=new yt(this.colorSpaceBR.build(e,"v4"),"v4"),e.removeContext();let a=new yt("mix( mix( cubeUV_TL, cubeUV_TR, cubeUV.f.x ), mix( cubeUV_BL, cubeUV_BR, cubeUV.f.x ), cubeUV.f.y )","v4");return a.keywords.cubeUV_TL=this.colorSpaceTLExp,a.keywords.cubeUV_TR=this.colorSpaceTRExp,a.keywords.cubeUV_BL=this.colorSpaceBLExp,a.keywords.cubeUV_BR=this.colorSpaceBRExp,a.keywords.cubeUV=s,a}generate(e,t){if(e.isShader("fragment")){let n=this.uv,i=this.bias||e.context.roughness,s=new Ch(Ka.Nodes.roughnessToMip,[i]),o=new Ye(s,Ka.Nodes.m0,Ka.Nodes.cubeUV_maxMipLevel,Ye.CLAMP),a=new Ye(o,Ye.FLOOR),l=new Ye(o,Ye.FRACT),c=this.bilinearCubeUV(e,this.value,n,a),u=this.bilinearCubeUV(e,this.value,n,new Yn(a,new Te(1).setReadonly(!0),Yn.ADD)),h=new Ye(c,u,l,Ye.MIX);return e.format(h.build(e),"v4",t)}else return console.warn("TextureCubeUVNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t)}copy(e){return super.copy(e),this.uv.copy(e.uv),this.bias.copy(e.bias),this.value.copy(e.value),e.colorSpaceTL?this.colorSpaceTL?this.colorSpaceTL.copy(e.colorSpaceTL):this.colorSpaceTL=e.colorSpaceTL.clone():this.colorSpaceTL=void 0,e.colorSpaceTR?this.colorSpaceTR?this.colorSpaceTR.copy(e.colorSpaceTR):this.colorSpaceTR=e.colorSpaceTR.clone():this.colorSpaceTR=void 0,e.colorSpaceBL?this.colorSpaceBL?this.colorSpaceBL.copy(e.colorSpaceBL):this.colorSpaceBL=e.colorSpaceBL.clone():this.colorSpaceBL=void 0,e.colorSpaceBR?this.colorSpaceBR?this.colorSpaceBR.copy(e.colorSpaceBR):this.colorSpaceBR=e.colorSpaceBR.clone():this.colorSpaceBR=void 0,e.colorSpaceTLExp?this.colorSpaceTLExp?this.colorSpaceTLExp.copy(e.colorSpaceTLExp):this.colorSpaceTLExp=e.colorSpaceTLExp.clone():this.colorSpaceTLExp=void 0,e.colorSpaceTRExp?this.colorSpaceTRExp?this.colorSpaceTRExp.copy(e.colorSpaceTRExp):this.colorSpaceTRExp=e.colorSpaceTRExp.clone():this.colorSpaceTRExp=void 0,e.colorSpaceBLExp?this.colorSpaceBLExp?this.colorSpaceBLExp.copy(e.colorSpaceBLExp):this.colorSpaceBLExp=e.colorSpaceBLExp.clone():this.colorSpaceBLExp=void 0,e.colorSpaceBRExp?this.colorSpaceBRExp?this.colorSpaceBRExp.copy(e.colorSpaceBRExp):this.colorSpaceBRExp=e.colorSpaceBRExp.clone():this.colorSpaceBRExp=void 0,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.value=this.value.toJSON(e).uuid,t.uv=this.uv.toJSON(e).uuid,t.bias=this.bias.toJSON(e).uuid,this.colorSpaceTL&&this.colorSpaceTL.toJSON(e).uuid,this.colorSpaceTR&&this.colorSpaceTR.toJSON(e).uuid,this.colorSpaceBL&&this.colorSpaceBL.toJSON(e).uuid,this.colorSpaceBR&&this.colorSpaceBR.toJSON(e).uuid,this.colorSpaceTLExp&&this.colorSpaceTLExp.toJSON(e).uuid,this.colorSpaceTRExp&&this.colorSpaceTRExp.toJSON(e).uuid,this.colorSpaceBLExp&&this.colorSpaceBLExp.toJSON(e).uuid,this.colorSpaceBRExp&&this.colorSpaceBRExp.toJSON(e).uuid),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=t.getNode(e.value)),e.uv&&(this.uv=t.getNode(e.uv)),e.bias&&(this.bias=t.getNode(e.bias)),e.colorSpaceTL&&(this.colorSpaceTL=t.getNode(e.colorSpaceTL)),e.colorSpaceTR&&(this.colorSpaceTR=t.getNode(e.colorSpaceTR)),e.colorSpaceBL&&(this.colorSpaceBL=t.getNode(e.colorSpaceBL)),e.colorSpaceBR&&(this.colorSpaceBR=t.getNode(e.colorSpaceBR)),e.colorSpaceTLExp&&(this.colorSpaceTLExp=t.getNode(e.colorSpaceTLExp)),e.colorSpaceTRExp&&(this.colorSpaceTRExp=t.getNode(e.colorSpaceTRExp)),e.colorSpaceBLExp&&(this.colorSpaceBLExp=t.getNode(e.colorSpaceBLExp)),e.colorSpaceBRExp&&(this.colorSpaceBRExp=t.getNode(e.colorSpaceBRExp)),this}},_o=Ka;_o.Nodes=function(){let e=new Ao(`struct TextureCubeUVData {
vec4 tl;
vec4 tr;
vec4 br;
vec4 bl;
vec2 f;
}`),t=new rt("float cubeUV_maxMipLevel 8.0",!0),n=new rt("float cubeUV_minMipLevel 4.0",!0),i=new rt("float cubeUV_maxTileSize 256.0",!0),s=new rt("float cubeUV_minTileSize 16.0",!0),o=new Le(`float getFace(vec3 direction) {
vec3 absDirection = abs(direction);
float face = -1.0;
if (absDirection.x > absDirection.z) {
if (absDirection.x > absDirection.y)
face = direction.x > 0.0 ? 0.0 : 3.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
} else {
if (absDirection.z > absDirection.y)
face = direction.z > 0.0 ? 2.0 : 5.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
}
return face;
}`);o.useKeywords=!1;let a=new Le(`vec2 getUV(vec3 direction, float face) {
vec2 uv;
if (face == 0.0) {
uv = vec2(direction.z, direction.y) / abs(direction.x); // pos x
} else if (face == 1.0) {
uv = vec2(-direction.x, -direction.z) / abs(direction.y); // pos y
} else if (face == 2.0) {
uv = vec2(-direction.x, direction.y) / abs(direction.z); // pos z
} else if (face == 3.0) {
uv = vec2(-direction.z, direction.y) / abs(direction.x); // neg x
} else if (face == 4.0) {
uv = vec2(-direction.x, direction.z) / abs(direction.y); // neg y
} else {
uv = vec2(direction.x, direction.y) / abs(direction.z); // neg z
}
return 0.5 * (uv + 1.0);
}`);a.useKeywords=!1;let l=new Le(`TextureCubeUVData bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {
float face = getFace(direction);
float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);
mipInt = max(mipInt, cubeUV_minMipLevel);
float faceSize = exp2(mipInt);
float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);
vec2 uv = getUV(direction, face) * (faceSize - 1.0);
vec2 f = fract(uv);
uv += 0.5 - f;
if (face > 2.0) {
uv.y += faceSize;
face -= 3.0;
}
uv.x += face * faceSize;
if(mipInt < cubeUV_maxMipLevel){
uv.y += 2.0 * cubeUV_maxTileSize;
}
uv.y += filterInt * 2.0 * cubeUV_minTileSize;
uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);
uv *= texelSize;
vec4 tl = texture2D(envMap, uv);
uv.x += texelSize;
vec4 tr = texture2D(envMap, uv);
uv.y += texelSize;
vec4 br = texture2D(envMap, uv);
uv.x -= texelSize;
vec4 bl = texture2D(envMap, uv);
return TextureCubeUVData( tl, tr, br, bl, f );
}`,[e,o,a,t,n,i,s]);l.useKeywords=!1;let c=new rt("float r0 1.0",!0),u=new rt("float v0 0.339",!0),h=new rt("float m0 -2.0",!0),d=new rt("float r1 0.8",!0),f=new rt("float v1 0.276",!0),p=new rt("float m1 -1.0",!0),m=new rt("float r4 0.4",!0),v=new rt("float v4 0.046",!0),g=new rt("float m4 2.0",!0),y=new rt("float r5 0.305",!0),x=new rt("float v5 0.016",!0),b=new rt("float m5 3.0",!0),w=new rt("float r6 0.21",!0),_=new rt("float v6 0.0038",!0),S=new rt("float m6 4.0",!0),A=[c,u,h,d,f,p,m,v,g,y,x,b,w,_,S],T=new Le(`float roughnessToMip(float roughness) {
float mip = 0.0;
if (roughness >= r1) {
mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;
} else if (roughness >= r4) {
mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;
} else if (roughness >= r5) {
mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;
} else if (roughness >= r6) {
mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;
} else {
mip = -2.0 * log2(1.16 * roughness);// 1.16 = 1.79^0.25
}
return mip;
}`,A);return{bilinearCubeUV:l,roughnessToMip:T,m0:h,cubeUV_maxMipLevel:t}}();var To=class extends je{constructor(e){super("v3");this.nodeType="Normal";this.scope=e!=null?e:To.VIEW}getShared(){return this.scope===To.WORLD}build(e,t,n,i){let s=e.context[this.scope+"Normal"];return s?s.build(e,t,n,i):super.build(e,t,n)}generate(e,t,n,i,s){let o;switch(this.scope){case To.VIEW:e.isShader("vertex")?o="transformedNormal":o="geometryNormal";break;case To.LOCAL:e.isShader("vertex")?o="objectNormal":(e.requires.normal=!0,o="vObjectNormal");break;case To.WORLD:e.isShader("vertex")?o="inverseTransformDirection( transformedNormal, viewMatrix ).xyz":(e.requires.worldNormal=!0,o="vWNormal");break}return e.format(o,this.getType(e),t)}copy(e){return super.copy(e),this.scope=e.scope,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.scope=this.scope),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.scope&&(this.scope=e.scope),this}},mn=To;mn.LOCAL="local",mn.WORLD="world",mn.VIEW="view",mn.NORMAL="normal";pn.addKeyword("viewNormal",function(){return new mn(mn.VIEW)});pn.addKeyword("localNormal",function(){return new mn(mn.NORMAL)});pn.addKeyword("worldNormal",function(){return new mn(mn.WORLD)});var dr=class extends je{constructor(e){super("v3");this.nodeType="Position";this.scope=e!=null?e:dr.LOCAL}getType(){switch(this.scope){case dr.PROJECTION:return"v4"}return this.type}getShader(){switch(this.scope){case dr.LOCAL:case dr.WORLD:return!1}return!0}generate(e,t,n,i,s){let o;switch(this.scope){case dr.LOCAL:e.isShader("vertex")?o="transformed":(e.requires.position=!0,o="vPosition");break;case dr.WORLD:if(e.isShader("vertex"))return"( modelMatrix * vec4( transformed, 1.0 ) ).xyz";e.requires.worldPosition=!0,o="vWPosition";break;case dr.VIEW:o=e.isShader("vertex")?"-mvPosition.xyz":"vViewPosition";break;case dr.PROJECTION:o=e.isShader("vertex")?"( projectionMatrix * modelViewMatrix * vec4( position, 1.0 ) )":"vec4( 0.0 )";break}return e.format(o,this.getType(),t)}copy(e){return super.copy(e),this.scope=e.scope,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.scope=this.scope),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.scope&&(this.scope=e.scope),this}},_n=dr;_n.LOCAL="local",_n.WORLD="world",_n.VIEW="view",_n.PROJECTION="projection";pn.addKeyword("position",function(){return new _n});pn.addKeyword("worldPosition",function(){return new _n(_n.WORLD)});pn.addKeyword("viewPosition",function(){return new _n(_n.VIEW)});var Zi=class extends je{constructor(e){super("v3");this.nodeType="Reflect";this.scope=e!=null?e:Zi.CUBE}getUnique(e){return!e.context.viewNormal}getType(){switch(this.scope){case Zi.SPHERE:return"v2"}return this.type}generate(e,t){let n=this.getUnique(e);if(e.isShader("fragment")){let i;switch(this.scope){case Zi.VECTOR:{let s=new mn(mn.VIEW),o=e.context.roughness,a=s.build(e,"v3"),l=new _n(_n.VIEW).build(e,"v3"),c=o?o.build(e,"f"):void 0,u=`reflect( -normalize( ${l} ), ${a} )`;c&&(u=`normalize( mix( ${u}, ${a}, ${c} * ${c} ) )`);let h=`inverseTransformDirection( ${u}, viewMatrix )`;n?(e.addNodeCode(`vec3 reflectVec = ${h};`),i="reflectVec"):i=h;break}case Zi.CUBE:{let s=new Zi(Zi.VECTOR).build(e,"v3"),o="vec3( -"+s+".x, "+s+".yz )";n?(e.addNodeCode(`vec3 reflectCubeVec = ${o};`),i="reflectCubeVec"):i=o;break}case Zi.SPHERE:{let s=new Zi(Zi.VECTOR).build(e,"v3"),o="normalize( ( viewMatrix * vec4( "+s+", 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) ).xy * 0.5 + 0.5";n?(e.addNodeCode(`vec2 reflectSphereVec = ${o};`),i="reflectSphereVec"):i=o;break}}return e.format(i,this.getType(),t)}else return console.warn("ReflectNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.type,t)}copy(e){return super.copy(e),this.scope=e.scope,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.scope=this.scope),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.scope&&(this.scope=e.scope),this}},Qi=Zi;Qi.CUBE="cube",Qi.SPHERE="sphere",Qi.VECTOR="vector";var vc=class extends je{constructor(e=new kn,t,n){super("v4");this.nodeType="TextureCube";this.value=e,this.radianceNode=new _o(this.value,t!=null?t:new Qi(Qi.VECTOR),n),this.irradianceNode=new _o(this.value,new mn(mn.WORLD),new Te(1).setReadonly(!0))}generate(e,t){return e.isShader("fragment")?(e.require("irradiance"),e.context.bias&&e.context.bias.setTexture(this.value),(e.slot==="irradiance"?this.irradianceNode:this.radianceNode).build(e,t)):(console.warn("TextureCubeNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t))}copy(e){return super.copy(e),this.value.copy(e.value),this.radianceNode.copy(e.radianceNode),this.irradianceNode.copy(e.irradianceNode),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.value=this.value.toJSON(e).uuid,this.radianceNode&&(t.radianceNode=this.radianceNode.toJSON(e).uuid),this.irradianceNode&&(t.irradianceNode=this.irradianceNode.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=t.getNode(e.value)),e.radianceNode&&(this.radianceNode=t.getNode(e.radianceNode)),e.irradianceNode&&(this.irradianceNode=t.getNode(e.irradianceNode)),this}};var xc=class extends Ct{constructor(e=new as,t,n){super("v4",{shared:!0});this.nodeType="CubeTexture";this.value=e,this.uv=t!=null?t:new Qi,this.bias=n}getTexture(e,t){return super.generate(e,t,this.value.uuid,"tc")}generate(e,t){var c,u;if(t==="samplerCube")return this.getTexture(e,t);let n=this.getTexture(e,t),i=(c=this.uv)==null?void 0:c.build(e,"v3"),s=this.bias?this.bias.build(e,"f"):void 0;s===void 0&&e.context.bias&&(s=e.context.bias.setTexture(this).build(e,"f"));let o;s?o="texCubeBias( "+n+", "+i+", "+s+" )":o="texCube( "+n+", "+i+" )";let a={include:e.isShader("vertex"),ignoreCache:!0},l=this.getType(e);return e.addContext(a),this.colorSpace=(u=this.colorSpace)!=null?u:new Bt(new yt("",l)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(o),o=this.colorSpace.build(e,l),e.removeContext(),e.format(o,l,t)}copy(e){return super.copy(e),this.value.copy(e.value),e.uv?this.uv?this.uv.copy(e.uv):this.uv=e.uv.clone():this.uv=void 0,e.bias?this.bias?this.bias.copy(e.bias):this.bias=e.bias.clone():this.bias=void 0,this}toJSON(e){var n;let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.value&&(t.value=this.value.uuid),t.uv=(n=this.uv)==null?void 0:n.toJSON(e).uuid,this.bias&&(t.bias=this.bias.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=t.getTexture(e.value)),e.uv&&(this.uv=t.getNode(e.uv)),e.bias&&(this.bias=t.getNode(e.bias)),this}};var bx=["x","y","z","w"],_L=["float","vec2","vec3","vec4"],TL={float:"f",vec2:"v2",vec3:"v3",vec4:"v4",mat4:"v4",int:"i",bool:"b","float[]":"f[]","vec4[]":"v4[]"},EL={t:"sampler2D",tc:"samplerCube",b:"bool",i:"int",f:"float",c:"vec3",v2:"vec2",v3:"vec3",v4:"vec4",m3:"mat3",m4:"mat4","f[]":"float[]","v4[]":"vec4[]"},Zp=class{constructor(){this.includes={consts:{},functions:{},structs:{}};this.cache="";this.slot="";this.shader="";this.context={};this.getIncludesCode=function(){function e(t,n){return t.deps.length-n.deps.length}return function(n,i){let s=this.getIncludes(n,i);if(!s)return"";let o="";s=s.sort(e);for(let a=0;a<s.length;a++)s[a].src&&(o+=s[a].src+`
`);return o}}();this.slots=[],this.caches=[],this.contexts=[],this.keywords={},this.nodeData={},this.fragmentVariables={},this.requires={uv:[],color:[],lights:!1,fog:!1,transparent:!1,irradiance:!1,position:!1,worldPosition:!1,normal:!1,worldNormal:!1,vWorldViewDir:!1,vWorldNormal:!1,modelMatrix:!1,viewMatrix:!1,projectionMatrix:!1},this.includes={consts:[],functions:[],structs:[]},this.attributes={},this.prefixCode=["#ifdef TEXTURE_LOD_EXT"," #define texCube(a, b) textureCube(a, b)"," #define texCubeBias(a, b, c) textureCubeLodEXT(a, b, c)"," #define tex2D(a, b) texture2D(a, b)"," #define tex2DBias(a, b, c) texture2DLodEXT(a, b, c)","#else"," #define texCube(a, b) textureCube(a, b)"," #define texCubeBias(a, b, c) textureCube(a, b, c)"," #define tex2D(a, b) texture2D(a, b)"," #define tex2DBias(a, b, c) texture2D(a, b, c)","#endif",`
// NOTE: Include Spline's blending modes. This could be part of BlendNode
#define SPE_BLENDING_NORMAL 0
#define SPE_BLENDING_MULTIPLY 1
#define SPE_BLENDING_SCREEN 2
#define SPE_BLENDING_OVERLAY 3
vec3 spe_normalBlend( vec3 a, vec3 b, float alpha ) {
return mix( a, b, alpha );
}
vec3 spe_multiplyBlend( vec3 a, vec3 b, float alpha ) {
return mix( a, a * b, alpha );
}
vec3 spe_screenBlend( vec3 a, vec3 b, float alpha ) {
vec3 tmp = 1.0 - ( 1.0 - a ) * ( 1.0 - b );
return mix( a, tmp, alpha );
}
vec3 spe_overlayBlend( vec3 a, vec3 b, float alpha ) {
vec3 tmp = mix( 1. - 2. * (1. - a) * (1. - b), 2. * a * b, step( a, vec3(.5) ) );
return clamp( mix( a, tmp, alpha ), 0.0, 1.0 );
}
vec3 spe_blend( vec3 a, vec3 b, float alpha, int mode ) {
if ( mode == SPE_BLENDING_NORMAL ) return spe_normalBlend( a, b, alpha );
else if ( mode == SPE_BLENDING_MULTIPLY ) return spe_multiplyBlend( a, b, alpha );
else if ( mode == SPE_BLENDING_SCREEN ) return spe_screenBlend( a, b, alpha );
else if ( mode == SPE_BLENDING_OVERLAY ) return spe_overlayBlend( a, b, alpha );
return vec3( 1.0 );
}
`,"#include <packing>","#include <common>"].join(`
`),this.parsCode={vertex:["float neighbor_offset = 0.0001;",""].join(`
`),fragment:["float accumAlpha = 0.0;",`void accumulateAlpha(float alpha) {
accumAlpha += (1.0 - accumAlpha) * alpha;
}`,""].join(`
`)},this.code={vertex:"",fragment:""},this.nodeCode={vertex:"",fragment:""},this.resultCode={vertex:"",fragment:""},this.finalCode={vertex:"",fragment:""},this.inputs={uniforms:{list:[],vertex:[],fragment:[]},arrayUniforms:{list:[],vertex:[],fragment:[]},vars:{varying:[],vertex:[],fragment:[]}},this.defines={},this.uniforms={},this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.updaters=[],this.nodes=[],this.analyzing=!1}build(e,t){this.buildShader("vertex",e),this.buildShader("fragment",t);for(let n=0;n<this.requires.uv.length;n++)if(this.requires.uv[n]){let i=n>0?n+1:"";this.addVaryCode("varying vec2 vUv"+i+";"),n>0&&this.addVertexParsCode("attribute vec2 uv"+i+";"),this.addVertexFinalCode("vUv"+i+" = uv"+i+";")}return this.requires.color[0]&&(this.addVaryCode("varying vec4 vColor;"),this.addVertexParsCode("attribute vec4 color;"),this.addVertexFinalCode("vColor = color;")),this.requires.color[1]&&(this.addVaryCode("varying vec4 vColor2;"),this.addVertexParsCode("attribute vec4 color2;"),this.addVertexFinalCode("vColor2 = color2;")),this.requires.position&&(this.addVaryCode("varying vec3 vPosition;"),this.addVertexFinalCode("vPosition = transformed;")),this.requires.worldPosition&&(this.addVaryCode("varying vec3 vWPosition;"),this.addVertexFinalCode("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;")),this.requires.normal&&(this.addVaryCode("varying vec3 vObjectNormal;"),this.addVertexFinalCode("vObjectNormal = normal;")),this.requires.modelMatrix&&this.addFragmentParsCode("uniform mat4 modelMatrix;"),this.requires.viewMatrix&&this.addFragmentParsCode("uniform mat4 viewMatrix;"),this.requires.projectionMatrix&&this.addFragmentParsCode("uniform mat4 projectionMatrix;"),this.requires.worldNormal&&(this.addVaryCode("varying vec3 vWNormal;"),this.addVertexFinalCode("vWNormal = inverseTransformDirection( transformedNormal, viewMatrix ).xyz;")),this.requires.vWorldViewDir&&(this.addVaryCode("varying vec3 vWorldViewDir;"),this.addVertexFinalCode("vWorldViewDir = isPerspectiveMatrix( projectionMatrix ) ? ( (modelMatrix * vec4(position, 1.0)).xyz - cameraPosition ) : vec3( -viewMatrix[0][2], -viewMatrix[1][2], -viewMatrix[2][2] );")),this.requires.vWorldNormal&&(this.addVaryCode("varying vec3 vWorldNormal;"),this.addVertexFinalCode("vWorldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );")),this}buildShader(e,t){this.resultCode[e]=t.build(this.setShader(e),"v4")}setMaterial(e,t){return this.material=e,this.renderer=t,this.requires.lights=e.lights,this.requires.fog=e.fog,this.mergeDefines(e.defines),this}addFlow(e,t,n){return this.addSlot(e).addCache(t).addContext(n)}removeFlow(){return this.removeSlot().removeCache().removeContext()}addCache(e){return this.cache=e!=null?e:"",this.caches.push(this.cache),this}removeCache(){return this.caches.pop(),this.cache=this.caches[this.caches.length-1]||"",this}addContext(e){return this.context=Object.assign({},this.context,e),this.context.extra=this.context.extra||{},this.contexts.push(this.context),this}removeContext(){return this.contexts.pop(),this.context=this.contexts[this.contexts.length-1]||{},this}addSlot(e){return this.slot=e||"",this.slots.push(this.slot),this}removeSlot(){return this.slots.pop(),this.slot=this.slots[this.slots.length-1]||"",this}addFragmentVariable(e,t){this.fragmentVariables[e]===void 0&&(this.addFragmentCode(`${t} ${e};`),this.fragmentVariables[e]="")}addVertexCode(e){this.addCode(e,"vertex")}addFragmentCode(e){this.addCode(e,"fragment")}addCode(e,t){this.code[t!=null?t:this.shader]+=e+`
`}addVertexNodeCode(e){this.addNodeCode(e,"vertex")}addFragmentNodeCode(e){this.addNodeCode(e,"fragment")}addNodeCode(e,t){this.nodeCode[t!=null?t:this.shader]+=e+`
`}clearNodeCode(e){e=e!=null?e:this.shader;let t=this.nodeCode[e];return this.nodeCode[e]="",t}clearVertexNodeCode(){return this.clearNodeCode("vertex")}clearFragmentNodeCode(){return this.clearNodeCode("fragment")}addVertexFinalCode(e){this.addFinalCode(e,"vertex")}addFragmentFinalCode(e){this.addFinalCode(e,"fragment")}addFinalCode(e,t){this.finalCode[t!=null?t:this.shader]+=e+`
`}addVertexParsCode(e){this.addParsCode(e,"vertex")}addFragmentParsCode(e){this.addParsCode(e,"fragment")}addParsCode(e,t){this.parsCode[t!=null?t:this.shader]+=e+`
`}addVaryCode(e){this.addVertexParsCode(e),this.addFragmentParsCode(e)}isCache(e){return this.caches.indexOf(e)!==-1}isSlot(e){return this.slots.indexOf(e)!==-1}define(e,t){this.defines[e]=t===void 0?1:t}require(e){this.requires[e]=!0}isDefined(e){return this.defines[e]!==void 0}getVar(e,t,n,i="varying",s="V",o=""){let a=this.getVars(i),l=a[e];if(!l){let c=a.length;l={name:n||"node"+s+c+(o?"_"+o:""),type:t},a.push(l),a[e]=l}return l}getTempVar(e,t,n,i){return this.getVar(e,t,n,this.shader,"T",i)}getAttribute(e,t){if(!this.attributes[e]){let n=this.getVar(e,t);this.addVertexParsCode("attribute "+t+" "+e+";"),this.addVertexFinalCode(n.name+" = "+e+";"),this.attributes[e]={varying:n,name:e,type:t}}return this.attributes[e]}getCode(e){return[this.prefixCode,this.parsCode[e],this.getVarListCode(this.getVars("varying"),"varying"),this.getVarListCode(this.inputs.uniforms[e],"uniform"),this.getVarListCode(this.inputs.arrayUniforms[e],"uniform"),this.getIncludesCode("consts",e),this.getIncludesCode("structs",e),this.getIncludesCode("functions",e),"void main() {",this.getVarListCode(this.getVars(e)),this.code[e],this.resultCode[e],this.finalCode[e],"}"].join(`
`)}getVarListCode(e,t){t=t!=null?t:"";let n="";for(let i=0,s=e.length;i<s;++i){let o=e[i],a=o.type,l=o.name,c=o.size,u=this.getFormatByType(a);if(u===void 0)throw new Error("Node pars "+u+" not found.");u.includes("[]")?n+=t+" "+u.substring(0,u.length-2)+" "+l+`[${c}];
`:n+=t+" "+u+" "+l+`;
`}return n}getVars(e){return this.inputs.vars[e!=null?e:this.shader]}getNodeData(e){let t=e instanceof ze?e.uuid:e;return this.nodeData[t]=this.nodeData[t]||{}}createUniform(e,t,n,i,s,o){if(t.includes("[]")){let a=this.inputs.arrayUniforms,l=a.list.length,c=new Nh({type:t,size:n.size,name:i||"nodeUA"+l+(o?"_"+o:""),node:n,needsUpdate:s});return a.list.push(c),a[e].push(c),a[e][c.name]=c,this.uniforms[c.name]=c,c}else{let a=this.inputs.uniforms,l=a.list.length,c=new Nh({type:t,name:i||"nodeU"+l+(o?"_"+o:""),node:n,needsUpdate:s});return a.list.push(c),a[e].push(c),a[e][c.name]=c,this.uniforms[c.name]=c,c}}createVertexUniform(e,t,n,i,s){return this.createUniform("vertex",e,t,n,i,s)}createFragmentUniform(e,t,n,i,s){return this.createUniform("fragment",e,t,n,i,s)}include(e,t,n){var o;let i;if(e=typeof e=="string"?pn.get(e):e,this.context.include===!1)return e.name;e instanceof Le?i=this.includes.functions:e instanceof rt?i=this.includes.consts:e instanceof Ao&&(i=this.includes.structs);let s=i[this.shader]=i[this.shader]||[];if(e){let a=s[e.name];if(a||(a=s[e.name]={node:e,deps:[]},s.push(a),a.src=e.build(this,"source")),e instanceof Le&&t&&s[t.name]&&s[t.name].deps.indexOf(e)==-1&&(s[t.name].deps.push(e),(o=e.includes)==null?void 0:o.length)){let l=0;do this.include(e.includes[l++],t);while(l<e.includes.length)}return n&&(a.src=n),e.name}else throw new Error("Include not found.")}colorToVectorProperties(e){return e.replace("r","x").replace("g","y").replace("b","z").replace("a","w")}colorToVector(e){return e.replace(/c/g,"v3")}getIncludes(e,t){return this.includes[e][t||this.shader]}getConstructorFromLength(e){return _L[e-1]}isTypeMatrix(e){return/^m/.test(e)}getTypeLength(e){return e==="f"?1:parseInt(this.colorToVector(e).substr(1))}getTypeFromLength(e){return e===1?"f":"v"+e}findNode(...e){for(let t=0;t<arguments.length;t++){let n=e[t];if(n==null?void 0:n.isNode)return n}}resolve(...e){for(let t=0;t<arguments.length;t++){let n=e[t];if(n!==void 0){if(n.isNode)return n;if(n.isTexture)switch(n.mapping){case js:case Ws:return new xc(n);case Js:case Ho:return new vc(new kn(n));default:return new kn(n)}else{if(n.isVector2)return new In(n);if(n.isVector3)return new Un(n);if(n.isVector4)return new yc(n)}}}}format(e,t,n){switch(this.colorToVector(n+" <- "+t)){case"f <- v2":return e+".x";case"f <- v3":return e+".x";case"f <- v4":return e+".x";case"f <- i":case"f <- b":return"float( "+e+" )";case"v2 <- f":return"vec2( "+e+" )";case"v2 <- v3":return e+".xy";case"v2 <- v4":return e+".xy";case"v2 <- i":case"v2 <- b":return"vec2( float( "+e+" ) )";case"v3 <- f":return"vec3( "+e+" )";case"v3 <- v2":return"vec3( "+e+", 0.0 )";case"v3 <- v4":return e+".xyz";case"v3 <- i":case"v3 <- b":return"vec2( float( "+e+" ) )";case"v4 <- f":return"vec4( "+e+" )";case"v4 <- v2":return"vec4( "+e+", 0.0, 1.0 )";case"v4 <- v3":return"vec4( "+e+", 1.0 )";case"v4 <- i":case"v4 <- b":return"vec4( float( "+e+" ) )";case"i <- f":case"i <- b":return"int( "+e+" )";case"i <- v2":return"int( "+e+".x )";case"i <- v3":return"int( "+e+".x )";case"i <- v4":return"int( "+e+".x )";case"b <- f":return"( "+e+" != 0.0 )";case"b <- v2":return"( "+e+" != vec2( 0.0 ) )";case"b <- v3":return"( "+e+" != vec3( 0.0 ) )";case"b <- v4":return"( "+e+" != vec4( 0.0 ) )";case"b <- i":return"( "+e+" != 0 )"}return e}getTypeByFormat(e){return TL[e]||e}getFormatByType(e){return EL[e]||e}getUUID(e,t){return t=t!==void 0?t:!0,t&&this.cache&&(e=this.cache+"-"+e),e}getElementByIndex(e){return bx[e]}getIndexByElement(e){return bx.indexOf(e)}isShader(e){return this.shader===e}setShader(e){return this.shader=e,this}mergeDefines(e){for(let t in e)this.defines[t]=e[t];return this.defines}mergeUniform(e){for(let t in e)this.uniforms[t]=e[t];return this.uniforms}getTextureEncodingFromMap(e){let t;return e?e.isTexture&&(t=e.encoding):t=ln,t===ln&&this.context.gamma&&(t=Qs),t}};var Qa=class extends ze{constructor(e=new ze){super("v4");this.nodeType="Raw";this.value=e}generate(e){let t=this.value.analyzeAndFlow(e,this.type),n=t.code+`
`;return e.isShader("vertex")?n+="gl_Position = "+t.result+";":n+="gl_FragColor = "+t.result+";",n}copy(e){return super.copy(e),this.value.copy(e.value),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.value=this.value.toJSON(e).uuid),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=t.getNode(e.value)),this}};var Ni=class extends _t{constructor(e,t,n){super(n);this.isNodeMaterial=!0;this.type="NodeMaterial";this.wireframeLinecap="";this.wireframeLinejoin="";this.uniformsBackup={};this.userData={type:"",category:"",nodeType:""};this.fog=!0,this.vertex=e!=null?e:new Qa(new _n(_n.PROJECTION)),this.fragment=t!=null?t:new Qa(new ct(5855577)),this.updaters=[],this.isDetached=!0,this.dithering=!0,this.onBeforeCompile=this._onBeforeCompile}getDefines(){return this.defines}getUniforms(){return this.uniforms}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}_onBeforeCompile(e,t){this.build({renderer:t}),e.defines=this.defines,e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.extensionDerivatives=this.extensions.derivatives===!0,e.extensionFragDepth=this.extensions.fragDepth===!0,e.extensionDrawBuffers=this.extensions.drawBuffers===!0,e.extensionShaderTextureLOD=this.extensions.shaderTextureLOD===!0}_getLayerStack(e){let t=new Kn(this);return e&&(async()=>{for(;e.image===void 0;)await new Promise(n=>requestAnimationFrame(n));t.addLayerAt(1,{type:lt.TEXTURE,texture:e}),this.dispose()})(),t}clampUniformsForPreview(e,t){let n=(i,s,o)=>Math.min(Math.max(i,s),o);if(this.userData.layers){for(let i of this.userData.layers.getLayers())if(i.type==lt.DISPLACE){this.uniformsBackup[`f${i.id}_intensity`]=i.uniforms[`f${i.id}_intensity`].value;let s=n(i.uniforms[`f${i.id}_intensity`].value,e,t);i.uniforms[`f${i.id}_intensity`].value=s}}}restoreClampedUniforms(){if(this.userData.layers)for(let e of this.userData.layers.getLayers())e.type==lt.DISPLACE&&(e.uniforms[`f${e.id}_intensity`].value=this.uniformsBackup[`f${e.id}_intensity`])}customProgramCacheKey(){return this.getHash()}updateFrame(e){for(let t=0;t<this.updaters.length;++t)e.updateNode(this.updaters[t])}build(e){var n;e=e!=null?e:{};let t=(n=e.builder)!=null?n:new Zp;return t.setMaterial(this,e.renderer),t.build(this.vertex,this.fragment),this.vertexShader=t.getCode("vertex"),this.fragmentShader=t.getCode("fragment"),this.defines=t.defines,this.uniforms=t.uniforms,this.extensions=t.extensions,this.updaters=t.updaters,this.fog=t.requires.fog,this.lights=t.requires.lights,this.transparent=t.requires.transparent||this.blending>Vs,this}getHash(){let e="{";return e+='"vertex":'+this.vertex.getHash()+",",e+='"fragment":'+this.fragment.getHash(),e+="}",e}copy(e){let t=this.uuid;for(let n in e)this[n]=e[n];return this.uuid=t,e.userData!==void 0&&(this.userData=JSON.parse(JSON.stringify(e.userData))),this}toJSON(e){let t=this.userData.layers;this.userData.layers=void 0;let n=super.toJSON(e);return n.type="ShaderMaterial",n.userData={type:this.userData.type,category:this.userData.category,nodeType:this.type,layers:t.toJSON(e)},n.vertex=this.vertex.toJSON(e).uuid,n.fragment=this.fragment.toJSON(e).uuid,delete n.vertexShader,delete n.fragmentShader,delete n.color,delete n.shininess,delete n.specular,delete n.roughness,delete n.metalness,delete n.uniforms,e&&!e.materials[this.uuid]&&(e.materials[this.uuid]=n),this.userData.layers=t,n}fromJSON(e,t){var n;this.defines=(n=e.defines)!=null?n:{},this.depthFunc=e.depthFunc,this.depthWrite=e.depthWrite,this.side=e.side!==void 0?e.side:Oi,this.transparent=e.transparent,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.wireframe=e.wireframe,this.userData.layers.fromJSON(e.userData.layers,t,this)}};Object.defineProperties(Ni.prototype,{properties:{get:function(){return this.fragment.properties}},needsUpdate:{set:function(r){r===!0&&this.version++,this.needsCompile=r},get:function(){return this.needsCompile}}});var bc=class extends ze{constructor(){super("basic");this.nodeType="Basic";this.color=new ct(5855577)}generate(e){let t;if(e.isShader("vertex")){let n=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform(ki.merge([be.fog])),e.addParsCode(["varying vec3 vViewPosition;","#ifndef FLAT_SHADED"," varying vec3 vNormal;","#endif","#include <fog_pars_vertex>"].join(`
`));let i=["#include <beginnormal_vertex>",`
#if !defined( USE_LAYER_DISPLACE )
#include <defaultnormal_vertex>
#endif
vec3 displaced_position = position;
vec3 displaced_normal = normal;
#if defined( USE_LAYER_DISPLACE )
vec3 transformed;
vec3 transformedNormal;
#endif
`,"#ifndef FLAT_SHADED"," vNormal = normalize( transformedNormal );","#endif",`
#if !defined( USE_LAYER_DISPLACE )
#include <begin_vertex>
#endif /* !USE_LAYER_DISPLACE */
`];n&&i.push(n.code,n.result?"displaced_position = "+n.result+";":""),i.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),i.push("#include <project_vertex>","#include <fog_vertex>","#include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;","#include <worldpos_vertex>"),t=i.join(`
`)}else{this.color===void 0&&(this.color=new ct(5855577)),this.color.analyze(e,{slot:"color"}),this.alpha&&this.alpha.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"});let n=this.color.flow(e,"c",{slot:"color"}),i=this.alpha?this.alpha.flow(e,"f"):void 0,s=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0;e.requires.transparent=i!==void 0,e.addParsCode(["#include <fog_pars_fragment>","#include <dithering_pars_fragment>","varying vec3 vViewPosition;","#ifndef FLAT_SHADED"," varying vec3 vNormal;","#endif"].join(`
`));let o=["#include <normal_fragment_begin>",n.code];i&&o.push(i.code,"#ifdef ALPHATEST"," if ( "+i.result+" <= ALPHATEST ) discard;","#endif"),s?o.push(s.code,`vec3 outgoingLight = ${n.result};`,`vec3 finalColor = spe_blend(outgoingLight, ${s.result}, 1.0, SPE_BLENDING_NORMAL);`):o.push(`vec3 finalColor = ${n.result};`),i?o.push(`gl_FragColor = vec4( finalColor, accumAlpha * ${i.result} );`):o.push("gl_FragColor = vec4("+n.result+", 1.0 );"),o.push("#include <fog_fragment>","#include <dithering_fragment>"),t=o.join(`
`)}return t}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),e.position&&(this.position=e.position.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.color&&(t.color=this.color.toJSON(e).uuid),this.position&&(t.position=this.position.toJSON(e).uuid),this.alpha&&(t.alpha=this.alpha.toJSON(e).uuid),this.afterColor&&(t.afterColor=this.afterColor.toJSON(e).uuid),this.shadingAlpha&&(t.shadingAlpha=this.shadingAlpha.toJSON(e).uuid),this.shadingBlend&&(t.shadingBlend=this.shadingBlend.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.position&&(this.position=t.getNode(e.position)),e.color&&(this.color=t.getNode(e.color)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.afterColor&&(this.afterColor=t.getNode(e.afterColor)),e.shadingAlpha&&(this.shadingAlpha=t.getNode(e.shadingAlpha)),e.shadingBlend&&(this.shadingBlend=t.getNode(e.shadingBlend)),this}};var $p=class extends Ni{get color(){return this.fragment.color}set color(e){this.fragment.color=e}get afterColor(){return this.fragment.afterColor}set afterColor(e){this.fragment.afterColor=e}get alpha(){return this.fragment.alpha}set alpha(e){this.fragment.alpha=e}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(e){this.fragment.shadingAlpha=e}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(e){this.fragment.shadingBlend=e}get position(){return this.fragment.position}set position(e){this.fragment.position=e}constructor(e=new bc,t){super(e,e,t);this.type="BasicNodeMaterial",this.fragment=e}};var oi=class extends $p{constructor(e,t,n){super(t,e);this.userData.type="BasicMaterial",this.userData.category="Basic",this.userData.layers=n!=null?n:this._getLayerStack(e==null?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(e.userData.layers!==void 0&&e.userData.layers instanceof Kn){let t=e.userData.layers,n=e.fragment;super.copy(e);let i=n.clone();this.fragment=i,this.vertex=i;let s=t.clone(this);this.userData.layers=s}else super.copy(e);return this}static fromJSON(e,t,n){let i=n.getNode(t.vertex),s=new oi(void 0,i);return s.fromJSON(t,n),s}static fromMaterial(e){let t=new oi(e.map?{map:e.map}:{}),n=t.fragment;return n.color.value.copy(e.color),n.alpha.value=e.opacity,t}dispose(){super.dispose()}};var wc=class extends ze{constructor(){super("phong");this.nodeType="Phong";this.color=new ct(5855577),this.specular=new ct(1118481),this.shininess=new Te(30),this.shadingAlpha=new Te(1),this.shadingBlend=new it(0)}build(e){let t;if(e.define("PHONG"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){let n=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform(ki.merge([be.fog,be.lights])),e.addParsCode(["varying vec3 vViewPosition;","#ifndef FLAT_SHADED"," varying vec3 vNormal;","#endif","#include <fog_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(`
`));let i=["#include <beginnormal_vertex>",`
#ifndef USE_LAYER_DISPLACE
#include <defaultnormal_vertex>
#endif
vec3 displaced_position = position;
vec3 displaced_normal = normal;
#ifdef USE_LAYER_DISPLACE
vec3 transformed;
vec3 transformedNormal;
#endif
`,"#ifndef FLAT_SHADED"," vNormal = normalize( transformedNormal );","#endif",`
#ifndef USE_LAYER_DISPLACE
#include <begin_vertex>
#endif
`];n&&i.push(n.code,n.result?"displaced_position = "+n.result+";":""),i.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),i.push(" #include <project_vertex>"," #include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;"," #include <worldpos_vertex>"," #include <shadowmap_vertex>"," #include <fog_vertex>"),t=i.join(`
`)}else{this.color===void 0&&(this.color=new ct(5855577)),this.color.analyze(e,{slot:"color"}),this.specular.analyze(e),this.shininess.analyze(e),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);let n=this.color.flow(e,"c",{slot:"color"}),i=this.specular.flow(e,"c"),s=this.shininess.flow(e,"f"),o=this.shadingAlpha.flow(e,"f"),a=this.shadingBlend.flow(e,"i"),l=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,c=this.alpha?this.alpha.flow(e,"f"):void 0;e.requires.transparent=c!==void 0,e.addParsCode(["#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <lights_phong_pars_fragment>","#include <shadowmap_pars_fragment>","#include <dithering_pars_fragment>"].join(`
`));let u=["#include <normal_fragment_begin>",`
// NOTE: gl_FrontFacing alternative using face normal estimation.
vec3 viewdx = dFdx(vViewPosition);
vec3 viewdy = dFdy(vViewPosition);
vec3 faceNormal = normalize(cross(viewdx,viewdy));
if (dot(normal, faceNormal) < 0.0) {
normal *= -1.0;
}
`," BlinnPhongMaterial material;"];u.push(n.code," vec3 diffuseColor = "+n.result+";"," ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",i.code," vec3 specular = "+i.result+";",s.code," float shininess = max( 0.0001, "+s.result+" );"," float specularStrength = 1.0;"),c&&u.push(c.code,"#ifdef ALPHATEST","if ( "+c.result+" <= ALPHATEST ) discard;","#endif"),u.push("material.diffuseColor = diffuseColor;"),u.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include <lights_fragment_begin>","#include <lights_fragment_end>"),u.push("vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular;"),u.push(`
if (outgoingLight != diffuseColor) {
float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
accumAlpha += ( 1.0 - accumAlpha ) * ${o.result} * lightAccu;
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${o.result}, ${a.result} );
}
`),l&&u.push(l.code,`outgoingLight = spe_blend(outgoingLight, ${l.result}, 1.0, SPE_BLENDING_NORMAL);`),c?u.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${c.result} );`):u.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),u.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=u.join(`
`)}return t}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.specular=e.specular.clone(),this.shininess=e.shininess.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.position&&(t.position=this.position.toJSON(e).uuid),this.color&&(t.color=this.color.toJSON(e).uuid),t.specular=this.specular.toJSON(e).uuid,t.shininess=this.shininess.toJSON(e).uuid,t.shadingAlpha=this.shadingAlpha.toJSON(e).uuid,t.shadingBlend=this.shadingBlend.toJSON(e).uuid,this.afterColor&&(t.afterColor=this.afterColor.toJSON(e).uuid),this.alpha&&(t.alpha=this.alpha.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.position&&(this.position=t.getNode(e.position)),e.color&&(this.color=t.getNode(e.color)),e.specular&&(this.specular=t.getNode(e.specular)),e.shininess&&(this.shininess=t.getNode(e.shininess)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.shadingAlpha&&(this.shadingAlpha=t.getNode(e.shadingAlpha)),e.shadingBlend&&(this.shadingBlend=t.getNode(e.shadingBlend)),e.afterColor&&(this.afterColor=t.getNode(e.afterColor)),this}};var em=class extends Ni{get color(){return this.fragment.color}set color(e){this.fragment.color=e}get afterColor(){return this.fragment.afterColor}set afterColor(e){this.fragment.afterColor=e}get alpha(){return this.fragment.alpha}set alpha(e){this.fragment.alpha=e}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(e){this.fragment.shadingAlpha=e}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(e){this.fragment.shadingBlend=e}get position(){return this.fragment.position}set position(e){this.fragment.position=e}get specular(){return this.fragment.specular}set specular(e){this.fragment.specular=e}get shininess(){return this.fragment.shininess}set shininess(e){this.fragment.shininess=e}constructor(e=new wc,t){super(e,e,t);this.type="PhongNodeMaterial",this.fragment=e}};var Ci=class extends em{constructor(e,t,n){super(t,e);this.userData.type="PhongMaterial",this.userData.category="Phong",this.userData.layers=n!=null?n:this._getLayerStack(e==null?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(e.userData.layers!==void 0&&e.userData.layers instanceof Kn){let t=e.userData.layers,n=e.fragment;super.copy(e);let i=n.clone();this.fragment=i,this.vertex=i;let s=t.clone(this);this.userData.layers=s,i.shadingAlpha.value=n.shadingAlpha.value,i.shadingBlend.value=n.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,n){let i=n.getNode(t.vertex),s=new Ci(void 0,i);return s.fromJSON(t,n),s}static fromMaterial(e){let t=new Ci(e.map?{map:e.map}:{}),n=t.fragment;return n.color.value.copy(e.color),n.alpha.value=e.opacity,t}dispose(){super.dispose()}};var Sc=class extends ze{constructor(){super("lambert");this.nodeType="Lambert";this.color=new ct(5855577),this.emissive=new ct(0),this.emissiveIntensity=new Te(1),this.shadingAlpha=new Te(1),this.shadingBlend=new it(0)}build(e){let t;if(e.define("LAMBERT"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){let n=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform(ki.merge([be.fog,be.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef DOUBLE_SIDED"," #define DOUBLE_SIDED","#endif","#ifndef FLAT_SHADED"," varying vec3 vNormal;","#endif","#ifdef DOUBLE_SIDED"," varying vec3 vLightBack;"," varying vec3 vIndirectBack;","#endif","#include <bsdfs>","#include <lights_pars_begin>","#include <color_pars_vertex>","#include <fog_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(`
`));let i=["#include <beginnormal_vertex>",`
#ifndef USE_LAYER_DISPLACE
#include <defaultnormal_vertex>
#endif
vec3 displaced_position = position;
vec3 displaced_normal = normal;
#ifdef USE_LAYER_DISPLACE
vec3 transformed;
vec3 transformedNormal;
#endif
`,"#ifndef FLAT_SHADED"," vNormal = normalize( transformedNormal );","#endif",`
#ifndef USE_LAYER_DISPLACE
#include <begin_vertex>
#endif
`];n&&i.push(n.code,n.result?"displaced_position = "+n.result+";":""),i.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),i.push(" #include <project_vertex>"," #include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;"," #include <worldpos_vertex>",`
vec3 diffuse = vec3( 1.0 );
GeometricContext geometry;
geometry.position = mvPosition.xyz;
geometry.normal = normalize( transformedNormal );
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
GeometricContext backGeometry;
backGeometry.position = geometry.position;
backGeometry.normal = -geometry.normal;
backGeometry.viewDir = geometry.viewDir;
vLightFront = vec3( 0.0 );
vIndirectFront = vec3( 0.0 );
#ifdef DOUBLE_SIDED
vLightBack = vec3( 0.0 );
vIndirectBack = vec3( 0.0 );
#endif
IncidentLight directLight;
float dotNL;
vec3 directLightColor_Diffuse;
#if NUM_POINT_LIGHTS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );
dotNL = dot( geometry.normal, directLight.direction );
directLightColor_Diffuse = PI * directLight.color;
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
#ifdef DOUBLE_SIDED
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
#endif
}
#pragma unroll_loop_end
#endif
#if NUM_SPOT_LIGHTS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );
dotNL = dot( geometry.normal, directLight.direction );
directLightColor_Diffuse = PI * directLight.color;
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
#ifdef DOUBLE_SIDED
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
#endif
}
#pragma unroll_loop_end
#endif
#if NUM_DIR_LIGHTS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );
dotNL = dot( geometry.normal, directLight.direction );
directLightColor_Diffuse = PI * directLight.color;
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
#ifdef DOUBLE_SIDED
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
#endif
}
#pragma unroll_loop_end
#endif
#if NUM_HEMI_LIGHTS > 0
#pragma unroll_loop_start
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
#ifdef DOUBLE_SIDED
vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );
#endif
}
#pragma unroll_loop_end
#endif
`," #include <shadowmap_vertex>"," #include <fog_vertex>"),t=i.join(`
`)}else{this.color===void 0&&(this.color=new ct(5855577)),this.color.analyze(e,{slot:"color"}),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);let n=this.color.flow(e,"c",{slot:"color"}),i=this.emissive.flow(e,"c",{slot:"emissive"}),s=this.emissiveIntensity.flow(e,"f",{slot:"emissive"}),o=this.shadingAlpha.flow(e,"f"),a=this.shadingBlend.flow(e,"i"),l=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,c=this.alpha?this.alpha.flow(e,"f"):void 0;e.requires.transparent=c!==void 0,e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef DOUBLE_SIDED"," #define DOUBLE_SIDED","#endif","#ifndef FLAT_SHADED"," varying vec3 vNormal;","#endif","#ifdef DOUBLE_SIDED"," varying vec3 vLightBack;"," varying vec3 vIndirectBack;","#endif","#include <bsdfs>","#include <lights_pars_begin>","#include <fog_pars_fragment>","#include <shadowmap_pars_fragment>","#include <shadowmask_pars_fragment>","#include <clipping_planes_pars_fragment>","#include <dithering_pars_fragment>"].join(`
`));let u=["#include <normal_fragment_begin>",`
// NOTE: gl_FrontFacing alternative using face normal estimation.
vec3 viewdx = dFdx(vViewPosition);
vec3 viewdy = dFdy(vViewPosition);
vec3 faceNormal = normalize(cross(viewdx, viewdy));
bool isFrontFacing = (dot(normal, faceNormal) >= 0.0);
`,"#include <clipping_planes_fragment>"];u.push(n.code,"vec3 diffuseColor = "+n.result+";","ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );"),c&&u.push(c.code,"#ifdef ALPHATEST","if ( "+c.result+" <= ALPHATEST ) discard;","#endif"),u.push("#ifdef DOUBLE_SIDED"," reflectedLight.indirectDiffuse += (isFrontFacing) ? vIndirectFront : vIndirectBack;","#else"," reflectedLight.indirectDiffuse += vIndirectFront;","#endif","#include <lightmap_fragment>","reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );","#ifdef DOUBLE_SIDED"," reflectedLight.directDiffuse = (isFrontFacing) ? vLightFront : vLightBack;","#else"," reflectedLight.directDiffuse = vLightFront;","#endif","reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();"),i&&u.push(i.code,"reflectedLight.directDiffuse += "+i.result+" * "+s.result+";"),u.push("vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;"),u.push(`
if (outgoingLight != diffuseColor) {
float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
accumAlpha += ( 1.0 - accumAlpha ) * ${o.result} * lightAccu;
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${o.result}, ${a.result} );
}
`),l&&u.push(l.code,`outgoingLight = spe_blend(outgoingLight, ${l.result}, 1.0, SPE_BLENDING_NORMAL);`),c?u.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${c.result} );`):u.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),u.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=u.join(`
`)}return t}copy(e){return super.copy(e),this.emissiveIntensity=e.emissiveIntensity.clone(),e.color&&(this.color=e.color.clone()),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),e.emissive&&(this.emissive=e.emissive.clone()),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.position&&(t.position=this.position.toJSON(e).uuid),this.color&&(t.color=this.color.toJSON(e).uuid),t.emissiveIntensity=this.emissiveIntensity.toJSON(e).uuid,t.shadingAlpha=this.shadingAlpha.toJSON(e).uuid,t.shadingBlend=this.shadingBlend.toJSON(e).uuid,this.afterColor&&(t.afterColor=this.afterColor.toJSON(e).uuid),this.alpha&&(t.alpha=this.alpha.toJSON(e).uuid),this.emissive&&(t.emissive=this.emissive.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.position&&(this.position=t.getNode(e.position)),e.color&&(this.color=t.getNode(e.color)),e.shadingAlpha&&(this.shadingAlpha=t.getNode(e.shadingAlpha)),e.shadingBlend&&(this.shadingBlend=t.getNode(e.shadingBlend)),e.afterColor&&(this.afterColor=t.getNode(e.afterColor)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.emissiveIntensity&&(this.emissiveIntensity=t.getNode(e.emissiveIntensity)),this}};var tm=class extends Ni{get color(){return this.fragment.color}set color(e){this.fragment.color=e}get afterColor(){return this.fragment.afterColor}set afterColor(e){this.fragment.afterColor=e}get alpha(){return this.fragment.alpha}set alpha(e){this.fragment.alpha=e}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(e){this.fragment.shadingAlpha=e}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(e){this.fragment.shadingBlend=e}get position(){return this.fragment.position}set position(e){this.fragment.position=e}get emissive(){return this.fragment.emissive}set emissive(e){this.fragment.emissive=e}get emissiveIntensity(){return this.fragment.emissiveIntensity}set emissiveIntensity(e){this.fragment.emissiveIntensity=e}constructor(e=new Sc,t){super(e,e,t);this.type="LambertNodeMaterial",this.fragment=e}};var Mc=class extends tm{constructor(e,t,n){super(t,e);this.userData.type="LambertMaterial",this.userData.category="Lambert",this.userData.layers=n!=null?n:this._getLayerStack(e==null?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(e.userData.layers!==void 0&&e.userData.layers instanceof Kn){let t=e.userData.layers,n=e.fragment;super.copy(e);let i=n.clone();this.fragment=i,this.vertex=i;let s=t.clone(this);this.userData.layers=s,i.shadingAlpha.value=n.shadingAlpha.value,i.shadingBlend.value=n.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,n){let i=n.getNode(t.vertex),s=new Mc(void 0,i);return s.fromJSON(t,n),s}dispose(){super.dispose()}};var Ac=class extends ze{constructor(){super("toon");this.nodeType="Toon";this.color=new ct(5855577),this.specular=new ct(1118481),this.shininess=new Te(30),this.shadingAlpha=new Te(1),this.shadingBlend=new it(0)}build(e){let t;if(e.define("TOON"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){let n=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform(ki.merge([be.fog,be.lights])),e.addParsCode(["varying vec3 vViewPosition;","#ifndef FLAT_SHADED"," varying vec3 vNormal;","#endif","#include <fog_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(`
`));let i=["#include <beginnormal_vertex>",`
#ifndef USE_LAYER_DISPLACE
#include <defaultnormal_vertex>
#endif
vec3 displaced_position = position;
vec3 displaced_normal = normal;
#ifdef USE_LAYER_DISPLACE
vec3 transformed;
vec3 transformedNormal;
#endif
`,"#ifndef FLAT_SHADED"," vNormal = normalize( transformedNormal );","#endif",`
#ifndef USE_LAYER_DISPLACE
#include <begin_vertex>
#endif
`];n&&i.push(n.code,n.result?"displaced_position = "+n.result+";":""),i.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),i.push(" #include <project_vertex>"," #include <fog_vertex>"," #include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;"," #include <worldpos_vertex>"," #include <shadowmap_vertex>"," #include <fog_vertex>"),t=i.join(`
`)}else{this.color===void 0&&(this.color=new ct(5855577)),this.color.analyze(e,{slot:"color"}),this.specular.analyze(e),this.shininess.analyze(e),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);let n=this.color.flow(e,"c",{slot:"color"}),i=this.specular.flow(e,"c"),s=this.shininess.flow(e,"f"),o=this.shadingAlpha.flow(e,"f"),a=this.shadingBlend.flow(e,"i"),l=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,c=this.alpha?this.alpha.flow(e,"f"):void 0;e.requires.transparent=c!==void 0,e.addParsCode(["#include <gradientmap_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <dithering_pars_fragment>",`
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
struct ToonMaterial {
vec3 diffuseColor;
vec3 specularColor;
float specularShininess;
float specularStrength;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
#ifndef PHYSICALLY_CORRECT_LIGHTS
irradiance *= PI;
#endif
reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon
#define Material_LightProbeLOD( material ) (0)
`,"#include <shadowmap_pars_fragment>","#include <bumpmap_pars_fragment>","#include <normalmap_pars_fragment>"].join(`
`));let u=["#include <normal_fragment_begin>",`
// NOTE: gl_FrontFacing alternative using face normal estimation.
vec3 viewdx = dFdx(vViewPosition);
vec3 viewdy = dFdy(vViewPosition);
vec3 faceNormal = normalize(cross(viewdx,viewdy));
if (dot(normal, faceNormal) < 0.0) {
normal *= -1.0;
}
`," ToonMaterial material;"];u.push(n.code," vec3 diffuseColor = "+n.result+";"," ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",i.code," vec3 specular = "+i.result+";",s.code," float shininess = max( 0.0001, "+s.result+" );"," float specularStrength = 1.0;"),c&&u.push(c.code,"#ifdef ALPHATEST","if ( "+c.result+" <= ALPHATEST ) discard;","#endif"),u.push("material.diffuseColor = diffuseColor;"),u.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include <lights_fragment_begin>","#include <lights_fragment_end>"),u.push("vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular;"),u.push(`
if (outgoingLight != diffuseColor) {
float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
accumAlpha += ( 1.0 - accumAlpha ) * ${o.result} * lightAccu;
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${o.result}, ${a.result} );
}
`),l&&u.push(l.code,`outgoingLight = spe_blend(outgoingLight, ${l.result}, 1.0, SPE_BLENDING_NORMAL);`),c?u.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${c.result} );`):u.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),u.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=u.join(`
`)}return t}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.specular=e.specular.clone(),this.shininess=e.shininess.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.position&&(t.position=this.position.toJSON(e).uuid),this.color&&(t.color=this.color.toJSON(e).uuid),t.specular=this.specular.toJSON(e).uuid,t.shininess=this.shininess.toJSON(e).uuid,this.alpha&&(t.alpha=this.alpha.toJSON(e).uuid),this.shadingAlpha&&(t.shadingAlpha=this.shadingAlpha.toJSON(e).uuid),this.shadingBlend&&(t.shadingBlend=this.shadingBlend.toJSON(e).uuid),this.afterColor&&(t.afterColor=this.afterColor.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.position&&(this.position=t.getNode(e.position)),e.color&&(this.color=t.getNode(e.color)),e.specular&&(this.specular=t.getNode(e.specular)),e.shininess&&(this.shininess=t.getNode(e.shininess)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.shadingAlpha&&(this.shadingAlpha=t.getNode(e.shadingAlpha)),e.shadingBlend&&(this.shadingBlend=t.getNode(e.shadingBlend)),e.afterColor&&(this.afterColor=t.getNode(e.afterColor)),this}};var nm=class extends Ni{get color(){return this.fragment.color}set color(e){this.fragment.color=e}get afterColor(){return this.fragment.afterColor}set afterColor(e){this.fragment.afterColor=e}get alpha(){return this.fragment.alpha}set alpha(e){this.fragment.alpha=e}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(e){this.fragment.shadingAlpha=e}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(e){this.fragment.shadingBlend=e}get position(){return this.fragment.position}set position(e){this.fragment.position=e}get specular(){return this.fragment.specular}set specular(e){this.fragment.specular=e}get shininess(){return this.fragment.shininess}set shininess(e){this.fragment.shininess=e}constructor(e=new Ac,t){super(e,e,t);this.type="ToonNodeMaterial",this.fragment=e}};var _c=class extends nm{constructor(e,t,n){super(t,e);this.userData.type="ToonMaterial",this.userData.category="Toon",this.userData.layers=n!=null?n:this._getLayerStack(e==null?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(e.userData.layers!==void 0&&e.userData.layers instanceof Kn){let t=e.userData.layers,n=e.fragment;super.copy(e);let i=n.clone();this.fragment=i,this.vertex=i;let s=t.clone(this);this.userData.layers=s,i.shadingAlpha.value=n.shadingAlpha.value,i.shadingBlend.value=n.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,n){let i=n.getNode(t.vertex),s=new _c(void 0,i);return s.fromJSON(t,n),s}dispose(){super.dispose()}};var Tc=class extends ze{constructor(){super("standard");this.nodeType="Standard";this.color=new ct(5855577),this.roughness=new Te(.3),this.metalness=new Te(0),this.reflectivity=new Te(.5),this.shadingAlpha=new Te(1),this.shadingBlend=new it(0)}build(e){let t;if(e.define("STANDARD"),e.requires.lights=!0,e.extensions.derivatives=!0,e.extensions.shaderTextureLOD=!0,e.isShader("vertex")){let n=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform(ki.merge([be.fog,be.lights])),be.LTC_1&&(e.uniforms.ltc_1={value:void 0},e.uniforms.ltc_2={value:void 0}),e.addParsCode(["varying vec3 vViewPosition;","#ifndef FLAT_SHADED"," varying vec3 vNormal;","#endif","#include <fog_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(`
`));let i=["#include <beginnormal_vertex>",`
#if !defined( USE_LAYER_DISPLACE )
#include <defaultnormal_vertex>
#endif
vec3 displaced_position = position;
vec3 displaced_normal = normal;
#if defined( USE_LAYER_DISPLACE )
vec3 transformed;
vec3 transformedNormal;
#endif
`,"#ifndef FLAT_SHADED"," vNormal = normalize( transformedNormal );","#endif",`
#if !defined( USE_LAYER_DISPLACE )
#include <begin_vertex>
#endif /* !USE_LAYER_DISPLACE */
`];n&&i.push(n.code,n.result?"displaced_position = "+n.result+";":""),i.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),i.push("#include <project_vertex>","#include <fog_vertex>","#include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;","#include <worldpos_vertex>","#include <shadowmap_vertex>"),t=i.join(`
`)}else{let n={gamma:!0};this.color===void 0&&(this.color=new ct(5855577)),this.color.analyze(e,{slot:"color",context:n}),this.roughness.analyze(e),this.metalness.analyze(e),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e),this.reflectivity&&this.reflectivity.analyze(e);let i=this.color.flow(e,"c",{slot:"color",context:n}),s=this.roughness.flow(e,"f"),o=this.metalness.flow(e,"f"),a=this.shadingAlpha.flow(e,"f"),l=this.shadingBlend.flow(e,"i"),c=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,u=this.alpha?this.alpha.flow(e,"f"):void 0,h=this.reflectivity?this.reflectivity.flow(e,"f"):void 0;e.requires.transparent=u!==void 0,e.addParsCode(["varying vec3 vViewPosition;","#ifndef FLAT_SHADED"," varying vec3 vNormal;","#endif","#include <dithering_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <lights_physical_pars_fragment>","#include <shadowmap_pars_fragment>"].join(`
`));let d=["#include <clipping_planes_fragment>"," #include <normal_fragment_begin>",`
// NOTE: gl_FrontFacing alternative using face normal estimation.
vec3 viewdx = dFdx(vViewPosition);
vec3 viewdy = dFdy(vViewPosition);
vec3 faceNormal = normalize(cross(viewdx,viewdy));
if (dot(normal, faceNormal) < 0.0) {
normal *= -1.0;
}
`," PhysicalMaterial material;"," material.diffuseColor = vec3( 1.0 );"];d.push(i.code," vec3 diffuseColor = "+i.result+";"," ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",s.code," float roughnessFactor = "+s.result+";",o.code," float metalnessFactor = "+o.result+";"),u&&d.push(u.code,"#ifdef ALPHATEST"," if ( "+u.result+" <= ALPHATEST ) discard;","#endif"),d.push("vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );"),d.push("material.diffuseColor = diffuseColor * ( 1.0 - metalnessFactor );","material.specularRoughness = max( roughnessFactor, 0.0525 );","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );"),h?d.push(h.code,"material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( "+h.result+" ) ), diffuseColor, metalnessFactor );"):d.push("material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor, metalnessFactor );"),d.push("#include <lights_fragment_begin>"),d.push("#include <lights_fragment_end>"),d.push("vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular;"),d.push(`
if (outgoingLight != diffuseColor) {
float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
accumAlpha += ( 1.0 - accumAlpha ) * ${a.result} * lightAccu;
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${a.result}, ${l.result} );
}
`),c&&d.push(c.code,`outgoingLight = spe_blend(outgoingLight, ${c.result}, 1.0, SPE_BLENDING_NORMAL);`),u?d.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${u.result} );`):d.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),d.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=d.join(`
`)}return t}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.roughness=e.roughness.clone(),this.metalness=e.metalness.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.reflectivity&&(this.reflectivity=e.reflectivity.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.position&&(t.position=this.position.toJSON(e).uuid),this.color&&(t.color=this.color.toJSON(e).uuid),t.roughness=this.roughness.toJSON(e).uuid,t.metalness=this.metalness.toJSON(e).uuid,this.alpha&&(t.alpha=this.alpha.toJSON(e).uuid),this.reflectivity&&(t.reflectivity=this.reflectivity.toJSON(e).uuid),this.shadingAlpha&&(t.shadingAlpha=this.shadingAlpha.toJSON(e).uuid),this.shadingBlend&&(t.shadingBlend=this.shadingBlend.toJSON(e).uuid),this.afterColor&&(t.afterColor=this.afterColor.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.position&&(this.position=t.getNode(e.position)),e.color&&(this.color=t.getNode(e.color)),e.roughness&&(this.roughness=t.getNode(e.roughness)),e.metalness&&(this.metalness=t.getNode(e.metalness)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.reflectivity&&(this.reflectivity=t.getNode(e.reflectivity)),e.shadingAlpha&&(this.shadingAlpha=t.getNode(e.shadingAlpha)),e.shadingBlend&&(this.shadingBlend=t.getNode(e.shadingBlend)),e.afterColor&&(this.afterColor=t.getNode(e.afterColor)),this}};var im=class extends Ni{get color(){return this.fragment.color}set color(e){this.fragment.color=e}get afterColor(){return this.fragment.afterColor}set afterColor(e){this.fragment.afterColor=e}get alpha(){return this.fragment.alpha}set alpha(e){this.fragment.alpha=e}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(e){this.fragment.shadingAlpha=e}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(e){this.fragment.shadingBlend=e}get position(){return this.fragment.position}set position(e){this.fragment.position=e}get roughness(){return this.fragment.roughness}set roughness(e){this.fragment.roughness=e}get metalness(){return this.fragment.metalness}set metalness(e){this.fragment.metalness=e}get reflectivity(){return this.fragment.reflectivity}set reflectivity(e){this.fragment.reflectivity=e}constructor(e=new Tc,t){super(e,e,t);this.type="StandardNodeMaterial",this.fragment=e}};var Ec=class extends im{constructor(e,t,n){super(t,e);this.userData.type="PhysicalMaterial",this.userData.category="Physical",this.userData.layers=n!=null?n:this._getLayerStack(e==null?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(e.userData.layers!==void 0&&e.userData.layers instanceof Kn){let t=e.userData.layers,n=e.fragment;super.copy(e);let i=n.clone();this.fragment=i,this.vertex=i;let s=t.clone(this);this.userData.layers=s,i.shadingAlpha.value=n.shadingAlpha.value,i.shadingBlend.value=n.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,n){let i=n.getNode(t.vertex),s=new Ec(void 0,i);return s.fromJSON(t,n),s}dispose(){super.dispose()}};var wx={BasicMaterial:oi,PhongMaterial:Ci,LambertMaterial:Mc,ToonMaterial:_c,PhysicalMaterial:Ec};var Sx=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var o,a,l,c,u;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:0,cornerSegments:8,hollow:0},r.parameters),n=t.width/2,i=(a=t.radiusTop)!=null?a:n,s=(l=t.radiusBottom)!=null?l:n;return i===s?(i=n,s=n):i>s?(i=n,s=s*n/i):(i=i*n/s,s=n),{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((c=t.height)!=null?c:t.width),depth:Math.abs((u=t.depth)!=null?u:t.width),radiusTop:i,radiusBottom:s})}}static build(r){let{width:e,depth:t,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,radiusTop:c,radiusBottom:u,cornerRadius:h,cornerSegments:d,hollow:f}=r.parameters,p;return h||f?p=new Lh(c,u,n,i,s,o,a,l*Math.PI/180,h,h,d,f):p=new ds(c,u,n,i,s,o,a,l*Math.PI/180),p.scale(1,1,t/e),Object.assign(p,{userData:tt(Ue({},r),{type:"CylinderGeometry"})})}};function ys(r,e,t){t.x=r.x*e.x,t.y=r.y,t.z=r.x*e.y}function Mx(r){return new O(r.y,-r.x)}var Lh=class extends we{constructor(e,t,n,i,s,o,a,l,c,u,h,d,f=!1){super();this.type="RoundedCylinderBufferGeometry",e=e!==void 0?e:1,t=t!==void 0?t:1,n=n||1,i=Math.floor(i)||8,s=Math.floor(s)||1,o=o!==void 0?o:!1,a=a!==void 0?a:0,l=l!==void 0?l:Math.PI*2,o&&(c=0,u=0);let p=[],m=[],v=[],g=[],y=0,x=n/2,b=new M,w=new M;f&&e==0&&(e=c),f&&t==0&&(t=u);let _=new O(e,x),S=new O(t,-x),A=null,T=null,L=null,C=null,U=_.clone().sub(S),P=0,R=0,G=0;d>0&&(P=Math.min(e,t)*(1-d),R=e-P,G=t-P);let B=_.clone();B.x-=P;let j=Math.PI-U.angle(),ne=U.angle(),le=Math.tan(ne/2),W=Math.tan(j/2),z=le+W,D=d?z:W,K=d?z:le;if(c=Math.min(c,(e-R)/D,U.length()/z),u=Math.min(u,(t-G)/K,U.length()/z),c>0){let te=c/le;A=_.clone().sub(new O(te,c)),d&&(L=A.clone(),L.x-=P-z*c),_.sub(U.clone().setLength(te))}if(u>0){let te=u/W;T=S.clone().sub(new O(te,-u)),S.add(U.clone().setLength(te)),d&&(C=T.clone(),C.x-=P-z*u,B.sub(U.clone().setLength(te)))}U=_.clone().sub(S);let q=U.length()<.5,ee=[];for(let te=0;te<=i;te++){let X=[],se=te/i,$=se*l+a,H=new O(Math.sin($),Math.cos($));C&&T?(V(X,se,H,j,u,C,-1,!0),V(X,se,H,ne,u,T,-1,!1)):T?(de(X,H,T.x,0,-1),V(X,se,H,ne,u,T,-1,!1)):o||de(X,H,t,G,-1);let Q=Mx(U).normalize();if(ys(Q,H,b),!q)for(let ce=0;ce<=s;ce++){let ie=ce/s,N=U.clone().multiplyScalar(ie).add(S);ys(N,H,w),m.push(w.x,w.y,w.z),v.push(b.x,b.y,b.z),g.push(se,.5+w.y/n),X.push(y++)}if(L&&A?(V(X,se,H,j,c,A,1,!1),V(X,se,H,ne,c,L,1,!0)):A?(V(X,se,H,j,c,A,1,!1),de(X,H,A.x,0,1)):o||de(X,H,e,R,1),d&&!q){let ce=Mx(U).multiplyScalar(-1).normalize();ys(ce,H,b);for(let ie=0;ie<=s;ie++){let N=ie/s,E=U.clone().multiplyScalar(-N).add(B);ys(E,H,w),m.push(w.x,w.y,w.z),v.push(b.x,b.y,b.z),g.push(se,.5+w.y/n),X.push(y++)}}d&&!o&&X.push(X[0]),ee.push(X)}for(let te=0;te<ee.length-1;te++)for(let X=0;X<ee[0].length-1;X++){if(o&&d&&X==s)continue;let se=ee[te][X],$=ee[te+1][X],H=ee[te+1][X+1],Q=ee[te][X+1],ce=m[H*3+0],ie=m[H*3+2];p.push(se,$,Q),(ce!=0||ie!=0)&&p.push($,H,Q)}l<Math.PI*2&&(ae(-1,ee[0],a),ae(1,ee[ee.length-1],a+l)),this.setIndex(p),this.setAttribute("position",new ge(m,3)),this.setAttribute("normal",new ge(v,3)),this.setAttribute("uv",new ge(g,2));function V(te,X,se,$,H,Q,ce,ie){for(let N=0;N<h+1;N++){let E=N/h,Y=ce<0?E:1-E;ie&&(Y-=1),Y*=$;let re=new O(Math.sin(Y),Math.cos(Y)*ce),ye=re.clone().multiplyScalar(H).add(Q);ys(ye,se,w),m.push(w.x,w.y,w.z),ys(re,se,b),v.push(b.x,b.y,b.z),g.push(X,.5+w.y/n),te.push(y++)}}function de(te,X,se,$,H){let Q=new M,ce=new O,ie=[se,$];H<0&&ie.reverse();for(let N of ie)ce.set(N,x*H),ys(ce,X,Q),m.push(Q.x,Q.y,Q.z),v.push(0,H,0),g.push(.5,.5),te.push(y++)}function ae(te,X,se){let $=new O(Math.sin(se),Math.cos(se)),H=new O(-Math.cos(se),Math.sin(se)),Q=new M,ce=te<0?(E,Y,re)=>p.push(E,Y,re):(E,Y,re)=>p.push(E,re,Y),ie=new O((e+t+R+G)/4,0);ys(ie,$,Q),m.push(Q.x,Q.y,Q.z),v.push(H.x,0,H.y),g.push(.5,.5);let N=y++;for(let E of X){let Y=m.slice(E*3,E*3+3);m.push(...Y),v.push(H.x,0,H.y);let re=g.slice(E*2,E*2+2);g.push(...re),y++}for(let E=N+1;E<y-1;E++)ce(N,E,E+1);ce(N,y-1,N+1)}}};var Ax=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var n,i,s;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,radialSegments:32,heightSegments:32,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:0,cornerRadiusBottom:0,cornerSegments:8},r.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((i=t.height)!=null?i:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(r){let{width:e,depth:t,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,cornerRadiusTop:c,cornerRadiusBottom:u,cornerSegments:h}=r.parameters,d;return c>0||u>0||l<360?d=new Lh(0,e/2,n,i,s,o,a,l*Math.PI/180,c,u,h,0,!0):d=new oo(e/2,n,i,s,o),d.scale(1,1,t/e),Object.assign(d,{userData:tt(Ue({},r),{type:"ConeGeometry"})})}};var _x=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var n,i,s;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:0,cornerSegments:8},r.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((i=t.height)!=null?i:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(r){let{width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o,cornerRadius:a,cornerSegments:l}=r.parameters,c;return a==0?c=new jn(e,t,n,i,s,o):c=new Tx(e,t,n,i,s,o,a,l),Object.assign(c,{userData:tt(Ue({},r),{type:"CubeGeometry"})})}},rm=Math.PI/2,Tx=class extends we{constructor(e=1,t=1,n=1,i=1,s=1,o=1,a=0,l=4){super();this.type="BoxBufferGeometry";let c=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o),l=Math.floor(l),a=Math.min(a,e/2,t/2,n/2);let u=[],h=[],d=[],f=[],p=0,m=0;v("z","y","x",-1,-1,n,t,e,o,s,0),v("z","y","x",1,-1,n,t,-e,o,s,1),v("x","z","y",1,1,e,n,t,i,o,2),v("x","z","y",1,-1,e,n,-t,i,o,3),v("x","y","z",1,-1,e,t,n,i,s,4),v("x","y","z",-1,-1,e,t,-n,i,s,5),a>0&&(g("z","y","x",-1,-1,1,n,t,e,o,0),g("z","y","x",1,-1,-1,n,t,e,o,1),g("z","y","x",-1,1,-1,n,t,e,o,1),g("z","y","x",1,1,1,n,t,e,o,0),g("x","y","z",-1,-1,-1,e,t,n,i,0),g("x","y","z",1,-1,1,e,t,n,i,1),g("x","y","z",-1,1,1,e,t,n,i,0),g("x","y","z",1,1,-1,e,t,n,i,1),g("y","x","z",-1,-1,1,t,e,n,s,0),g("y","x","z",1,-1,-1,t,e,n,s,1),g("y","x","z",1,1,1,t,e,n,s,1),g("y","x","z",-1,1,-1,t,e,n,s,0),y(1,1,1),y(-1,1,1),y(1,-1,1),y(-1,-1,1),y(1,1,-1),y(-1,1,-1),y(1,-1,-1),y(-1,-1,-1)),this.setIndex(u),this.setAttribute("position",new ge(h,3)),this.setAttribute("normal",new ge(d,3)),this.setAttribute("uv",new ge(f,2));function v(x,b,w,_,S,A,T,L,C,U,P){let R=(A-2*a)/C,G=(T-2*a)/U,B=A/2-a,j=T/2-a,ne=L/2,le=C+1,W=U+1,z=0,D=0,K=new M;for(let q=0;q<W;q++){let ee=q*G-j;for(let V=0;V<le;V++){let de=V*R-B;K[x]=de*_,K[b]=ee*S,K[w]=ne,h.push(K.x,K.y,K.z),K[x]=0,K[b]=0,K[w]=L>0?1:-1,d.push(K.x,K.y,K.z),f.push(V/C),f.push(1-q/U),z+=1}}for(let q=0;q<U;q++)for(let ee=0;ee<C;ee++){let V=p+ee+le*q,de=p+ee+le*(q+1),ae=p+(ee+1)+le*(q+1),te=p+(ee+1)+le*q;u.push(V,de,te),u.push(de,ae,te),D+=6}c.addGroup(m,D,P),m+=D,p+=z}function g(x,b,w,_,S,A,T,L,C,U,P){let R=(T-2*a)/U,G=T/2-a,B=L/2-a,j=C/2,ne=U+1,le=0,W=0,z=new M,D=new M;for(let K=0;K<l+1;K++){let q=K/l*rm,ee=Math.sin(q)*a,V=(1-Math.cos(q))*a,de=Math.sin(q),ae=Math.cos(q);z[b]=(B+ee)*S,z[w]=(j-V)*A,D[x]=0,D[b]=de*Math.sign(z[b]),D[w]=ae*Math.sign(z[w]);for(let te=0;te<ne;te++){let X=te*R-G;z[x]=X*_,h.push(z.x,z.y,z.z),d.push(D.x,D.y,D.z),f.push(te/U),f.push(0),le+=1}}for(let K=0;K<l;K++)for(let q=0;q<U;q++){let ee=p+q+ne*K,V=p+q+ne*(K+1),de=p+(q+1)+ne*(K+1),ae=p+(q+1)+ne*K;u.push(ee,V,ae),u.push(V,de,ae),W+=6}c.addGroup(m,W,P),m+=W,p+=le}function y(x,b,w){let _=new M,S=new M(e/2,t/2,n/2);S.subScalar(a);let A=[],T=x*b*w>0?(C,U,P)=>u.push(C,U,P):(C,U,P)=>u.push(C,P,U);for(let C=0;C<=l;C++){let U=[],P=rm*(1-C/l),R=Math.cos(P),G=Math.sin(P),B=0;for(let j=0;j<=C;j++){let ne=Math.cos(B),le=Math.sin(B);_.x=R*ne,_.y=G,_.z=R*le;let W=S.clone().addScaledVector(_,a);h.push(x*W.x,b*W.y,w*W.z),d.push(x*_.x,b*_.y,w*_.z),f.push(0,0),U.push(p++),B+=rm/C}A.push(U)}let L=A.length-1;for(let C=0;C<L;C++){let U=A[C],P=A[C+1],R=U.length-1;T(U[0],P[1],P[0]);for(let G=1;G<=R;G++)T(U[G-1],U[G],P[G]),T(U[G],P[G+1],P[G])}}}};var Eo=class extends we{constructor(e,t,n,i=1,s=.2,o=4){super();this.type="PolyhedronGeometryRound";let a=[],l=[],c=[];u(),h(),this.setAttribute("position",new ge(a,3)),this.setAttribute("normal",new ge(c,3)),this.setAttribute("uv",new ge(l,2));return;function u(){var le;s=Math.min(1-1e-5,s),s==0&&(o=0);let f={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[n],p=new M,m=p.clone(),v=new qt,g=s*i,y=i-g,x=o+1,b=new M,w=(W,z)=>b.subVectors(W,z).normalize(),_=(W,z)=>Array(W).fill(void 0).map(z),S=_(e.length/3,(W,z)=>new M().fromArray(e,z*3).setLength(i)),A=[],T=1e6;for(let W=0;W<S.length;W++){let z=S[W],D=[],K,q,ee,V=1e10,de=-1;for(;(de=t.indexOf(W,de+1))!=-1;){let se=de-de%3;K=t[se+(de+1)%3],q=t[se+(de+2)%3],ee=z.distanceToSquared(S[K]),V=Math.min(V,ee),D.push([K,q,ee])}V+=1e-6;let ae=[],te=0,X=D.length;for(let se=0;se<X;se++){[K,q,ee]=D[te];let $=((le=A[K])==null?void 0:le.includes(W))==!0;ee<=V&&ae.push(K+ +$*T),te=D.findIndex(H=>H[0]==q)}A.push(ae)}let L=[];{let W=0,z=0,D,K,q=f==3;for(let ee=0;ee<=o;ee++){D=ee*(ee+1)/2,K=(ee+1)*(ee+2)/2;for(let V=0;V<o-ee;V++)[W,z]=[D+V+ee+2,K+V+ee+3],L.push(D,K,...q?[z,D]:[W,K],z,W),[D,K]=[W,z];L.push(D,K,D+o+2)}}let C=p.clone(),U=p.clone(),P=p.clone(),R=p.clone(),G=p.clone(),B=[],j=_(S.length,()=>_(f,()=>p.clone()));for(let W=0;W<S.length;W++){p.copy(S[W]).normalize(),C.copy(p).multiplyScalar(y);let z=A[W];for(let ae=0;ae<z.length;ae++){let te=z[ae],X=z[(ae+1)%f];v.setFromPointsAndIndices(S,W,te%T,X%T),v.b.sub(v.a).setLength(1e10).add(v.a),v.c.sub(v.a).setLength(1e10).add(v.a),v.closestPointToPoint(C,j[W][ae])}let D=[],K=[],q=[],ee=new M;o==0&&[...j[W]].reduce((ae,te)=>ae.add(te),ee).multiplyScalar(1/f);for(let ae=0;ae<f;ae++){let te=[],X=(ae-1+f)%f,se=j[W][X],$=j[W][ae];p.copy(se).sub(C),m.copy($).sub(C);let H=C.angleTo(p),Q=p.angleTo(m),ce=Math.cos(H)*g;o==0?U.copy(ee):U.copy(C).setLength(y+ce),K.push(ce);let ie=[U,se,$];for(let N=0;N<2;N++){let E=ie[N],Y=ie[N+1];R.subVectors(E,C),G.subVectors(Y,C),P.crossVectors(R,G).normalize();for(let re=0;re<x;re++){let ye=[H,Q][N]*re/x;p.copy(R).applyAxisAngle(P,ye).add(C),D.push(p.clone()),N&&(w(p,C),te.push([re==0?E:p.clone(),b.clone()]))}N&&(w(Y,C),te.push([Y,b.clone()]))}q.push(te)}B.push(q);let V=2*x,de=2;for(let ae=0;ae<f;ae++){let te=V*ae,X=V*((ae+1)%f),se=[D[te]];for(let H=1;H<x;H++){R=D[te+H],G=D[X+H],se.push(R);for(let Q=1,ce=H-de+1;Q<=ce;Q++)p.lerpVectors(R,G,Q/(ce+1)),p.sub(C).setLength(K[ae]).add(C),se.push(p.clone());se.push(G)}for(let H=0;H<x;H++)se.push(D[H+x+te]);se.push(D[X+x]);let $=L.map(H=>se[H]);a.push(...$.map(H=>[H.x,H.y,H.z]).flat()),c.push(...$.map(H=>(w(H,C),[b.x,b.y,b.z])).flat())}}let ne=[];for(let W=0;W<A.length;W++)for(let z=0;z<f;z++){let D=A[W][z];if(D<T){let K=A[D].findIndex(V=>V%T==W),q=B[W][z],ee=B[D][K];for(let V=0;V<x;V++){let de=q[V],ae=ee[x-V],te=q[V+1],X=ee[x-(V+1)];[de,ae,te,te,ae,X].forEach(se=>{a.push(se[0].x,se[0].y,se[0].z),c.push(se[1].x,se[1].y,se[1].z)})}ne.push(q[0][0],ee[x][0],q[x][0],ee[0][0])}}for(;ne.length;){let W,z,D,K;[W,z]=ne.splice(0,2);let q=[W];for(;W!=z;)q.push(z),D=ne.indexOf(z),K=D%2,z=ne.splice(D-K,2)[1-K];b.subVectors(q[0],q[1]).cross(p.subVectors(q[0],q[2])).normalize();let ee=b.dot(q[0])<0;ee&&b.negate();for(let V=1;V<=q.length-2;V++)[q[V+ +ee],q[V+1-+ee],q[0]].forEach(de=>{a.push(de.x,de.y,de.z),c.push(b.x,b.y,b.z)})}}function h(){let d=new M;for(let S=0;S<a.length;S+=3){d.x=a[S+0],d.y=a[S+1],d.z=a[S+2];let A=w(d)/2/Math.PI+.5,T=_(d)/Math.PI+.5;l.push(A,1-T)}let f=new M,p=new M,m=new M,v=new M,g=new O,y=new O,x=new O,b=(S,A,T,L)=>{L<0&&S.x===1&&(l[A]=S.x-1),T.x===0&&T.z===0&&(l[A]=L/2/Math.PI+.5)};for(let S=0,A=0;S<a.length;S+=9,A+=6){f.set(a[S+0],a[S+1],a[S+2]),p.set(a[S+3],a[S+4],a[S+5]),m.set(a[S+6],a[S+7],a[S+8]),g.set(l[A+0],l[A+1]),y.set(l[A+2],l[A+3]),x.set(l[A+4],l[A+5]),v.copy(f).add(p).add(m).divideScalar(3);let T=w(v);b(g,A+0,f,T),b(y,A+2,p,T),b(x,A+4,m,T)}for(let S=0;S<l.length;S+=6){let A=l[S+0],T=l[S+2],L=l[S+4],C=Math.max(A,T,L),U=Math.min(A,T,L);C>.9&&U<.1&&(A<.2&&(l[S+0]+=1),T<.2&&(l[S+2]+=1),L<.2&&(l[S+4]+=1))}function w(S){return Math.atan2(S.z,-S.x)}function _(S){return Math.atan2(-S.y,Math.sqrt(S.x*S.x+S.z*S.z))}}}static fromJSON(e){return new Eo(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}};var Ex=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var n,i,s;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,detail:0,corner:0,cornerSides:4},r.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((i=t.height)!=null?i:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(r){let{width:e,height:t,depth:n,detail:i,corner:s,cornerSides:o}=r.parameters,a=i===0&&s!==0?new Ih(e*.5,s,o):new ao(e*.5,i);return a.scale(1,t/e,n/e),Object.assign(a,{userData:tt(Ue({},r),{type:"DodecahedronGeometry"})})}},Ih=class extends Eo{constructor(e=1,t=.2,n=4){let i=(1+Math.sqrt(5))/2,s=1/i,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-i,0,-s,i,0,s,-i,0,s,i,-s,-i,0,-s,i,0,s,-i,0,s,i,0,-i,0,-s,i,0,-s,-i,0,s,i,0,s],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],l="DodecahedronGeometry";super(o,a,l,e,t,n);this.type=l}static fromJSON(e){return new Ih(e.radius,e.corner,e.cornerSides)}};var Nc=1e-12,Cc=class{constructor(e){this.position=new O;this.startPosition=new O;this.uuid=Ee.generateUUID();this.position=e.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(e){this.position.copy(this.startPosition).add(e)}copy(e){return this.position.copy(e.position),this.startPosition.copy(e.startPosition),this}clone(){return new Cc(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},Lc=class extends Cc{constructor(e){super(e.position);this.parent=e}copy(e){return super.copy(e),this}clone(){return new Lc(this.parent).copy(this)}},vs=class extends Cc{constructor(e,t){super(t);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=e,this.controls.push(new Lc(this),new Lc(this))}getOppositeControl(e){let t=this.controls.indexOf(e);return t===0?this.controls[1]:t===1?this.controls[0]:null}applyOffsetToControls(e,t=1){for(let n=0,i=this.controls.length;n<i;n++){let s=this.controls[n];this.position.distanceTo(s.position)<=t?s.position.copy(this.position):s.applyOffset(e)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(e){return super.copy(e),this.controls[0].copy(e.controls[0]),this.controls[1].copy(e.controls[1]),this.roundness=e.roundness,this.uuid=e.uuid,this}clone(){return new vs(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}},sm=r=>r,Ic=new O,om=new O,NL=new O,CL=new O,LL=new O,IL=new O,Nx=new M,Cx=new M;function Lx(r){let e=new O;e.addVectors(r.v0,Ic.subVectors(r.v1,r.v0).multiplyScalar(2/3));let t=new O;return t.addVectors(r.v2,om.subVectors(r.v1,r.v2).multiplyScalar(2/3)),new ii(r.v0,e,t,r.v2)}function Pc(r,e,t=Number.EPSILON){return Math.abs(r-e)<t}function PL(r,e,t=Number.EPSILON){return r.distanceTo(e)<t}function DL(r,e,t=Number.EPSILON){return r.distanceTo(e)<t}function am(r,e,t){let n=Math.sqrt(Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2)),i=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),s=Math.sqrt(Math.pow(t.x-r.x,2)+Math.pow(t.y-r.y,2));return Math.acos((i*i+n*n-s*s)/(2*i*n))}function Ix(r,e,t,n,i){let s=Math.sqrt(Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2)),o=(r.y+e.y)/2,a=(r.x+e.x)/2,l=Math.sqrt(Math.pow(t,2)-Math.pow(s/2,2))*(r.y-e.y)/s,c=Math.sqrt(Math.pow(t,2)-Math.pow(s/2,2))*(e.x-r.x)/s;return n.set(a+l,o+c),i.set(a-l,o-c),[n,i]}function Px(r,e,t){let n=r.distanceTo(t),i=e.distanceTo(t);return n<i?e:r}function Dx(r,e,t,n,i,s){let o=e.x-r.x,a=e.y-r.y,l=t.x-r.x,c=t.y-r.y,u=Math.sqrt((o+l)*(o+l)+(a+c)*(a+c)),h;return am(e,r,t)>Math.PI&&(u*=-1),Pc(c,a)?h=(a+c)*(n/u-.5)*8/3/(o-l):h=(o+l)*(n/u-.5)*8/3/(c-a),i.set(e.x-h*a,e.y+h*o),s.set(t.x+h*c,t.y-h*l),[i,s]}function lm(r,e){return r.position.equals(r.controls[1].position)&&e.position.equals(e.controls[0].position)}function Rx(r,e,t,n,i=.5){let s=Ic.subVectors(e,r).multiplyScalar(i).add(r),o=om.subVectors(t,e).multiplyScalar(i).add(e),a=NL.subVectors(n,t).multiplyScalar(i).add(t),l=s,c=CL.subVectors(o,s).multiplyScalar(i).add(s),u=LL.subVectors(a,o).multiplyScalar(i).add(o),h=a,d=IL.subVectors(u,c).multiplyScalar(i).add(c);return[r.x,r.y,l.x,l.y,c.x,c.y,d.x,d.y,u.x,u.y,h.x,h.y,n.x,n.y]}function Bx(r,e,t=12,n=!0){let i=Cx.set(0,0,0),s,o=0,a=[];for(let l=0;l<e.length;l++){let c=sm(e[l]),u=Ic,h=xs(c,t);a.push(h);for(let d=0;d<=h;d++)if(c instanceof ii||c instanceof Wi||c instanceof ri){if(c.getPoint(d/h,u),i.set(u.x,u.y,0),s!==void 0&&DL(s,i))continue;s===void 0&&(s=Nx),s.copy(i),r.setXYZ(o,i.x,i.y,i.z),o++}}return n&&o>1&&!(r.getX(o-1)===r.getX(0)&&r.getY(o-1)===r.getY(0)&&r.getZ(o-1)===r.getZ(0))&&(r.setXYZ(o,r.getX(0),r.getY(0),r.getZ(0)),o++),r}function Ox(r,e,t,n=12,i=!0){let s=Cx.set(0,0,0),o=0,a=[];for(let l=0;l<e.length;l++){if(t[l]===!1)continue;let c,u=sm(e[l]),h=Ic,d=xs(u,n);a.push(d);for(let f=0;f<=d;f++)if(u instanceof ii||u instanceof Wi||u instanceof ri){if(u.getPoint(f/d,h),s.set(h.x,h.y,0),c==null?void 0:c.equals(s))continue;c===void 0?c=Nx:(r.setXYZ(o,c.x,c.y,c.z),o++,r.setXYZ(o,s.x,s.y,s.z),o++),c.copy(s)}}return i&&o>1&&!(r.getX(o-1)===r.getX(0)&&r.getY(o-1)===r.getY(0)&&r.getZ(o-1)===r.getZ(0))&&(r.setXYZ(o,r.getX(0),r.getY(0),r.getZ(0)),o++),a}function cm(r,e=12,t=!1){let n=[];for(let i=0,s=r.length;i<s;i++){let o=r[i],a=0;if(t&&o.roundedCurveCorner!==void 0){let l=xs(o.roundedCurveCorner,e)*.5;i>0&&(n[i-1]+=l),a+=l}o.curveAfter!==void 0&&(a+=xs(o.curveAfter,e)),n.push(a)}return r.length>0&&t&&r[0].roundedCurveCorner!==void 0&&(n[r.length-1]+=xs(r[0].roundedCurveCorner,e)*.5),n}function xs(r,e=12){return r&&r instanceof lo?e*2:r&&(r instanceof ri||r instanceof dh)?1:r&&r instanceof Ea?e*r.points.length:e}function Fx(r,e,t=12,n=!0){let i,s=0;for(let o=0;o<e.length;o++){let a=sm(e[o]),l=xs(a,t),c=Ic;for(let u=0;u<=l;u++)if(a instanceof ii||a instanceof Wi||a instanceof ri){if(a.getPoint(u/l,c),i!==void 0&&PL(i,c,Nc))continue;i===void 0&&(i=om),i.copy(c),r.push(c.x,c.y),s++}}return Pc(r[0],r[r.length-2],Nc)&&Pc(r[1],r[r.length-1],Nc)&&(r.pop(),r.pop()),n&&s>1&&!(Pc(r[s-1],r[1],Nc)&&Pc(r[s-2],r[0],Nc))&&(r.push(r[0],r[1]),s++),r}var um=new O,RL=new O,BL=new O,OL=new O,FL=new O,zL=new O,Lt=class extends yi{constructor(e=100,t=100){super();this.points=[];this.shapeHoles=[];this.eventDispatcher=new cn;this.plane=new ni(new M(0,0,-1));this.subdivision=0;this.controlSnapDistance=4;this.pointIDs=0;this.isMesh2D=!1;this._roundness=0;this.isClosed=!1;this.useCubicForRoundedCorners=!0;this.uuid=Ee.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=e,this._height=t}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let t=0,n=this.points.length;t<n;t++)this.points[t].roundness=e;this.needsUpdate=!0}}getBezierPoint(e){if(e<=this.points.length-1)return this.points[e];if(this.shapeHoles.length>0)for(let t=0,n=this.shapeHoles.length;t<n;t++){let i=this.shapeHoles[t],s=e-this.points.length;if(s<=i.points.length-1)return i.points[s]}throw new Error("This shape does not have a point for this index: "+e)}getBezierPointIndex(e){let t=this.points.indexOf(e);if(t>=0)return t;if(t=this.points.length,this.shapeHoles.length>0)for(let n=0,i=this.shapeHoles.length;n<i;n++){let s=this.shapeHoles[n],o=s.points.indexOf(e);if(o>=0)return t+o;t+=s.points.length}return-1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(t=>t.points));return[...this.points,...e]}applySize(e,t){e===0&&(e=.001),t===0&&(t=.001),this.applyScale(e/this.width,t/this.height),this._width=e,this._height=t}applyScale(e,t){let n=um.set(e,t);for(let i=0,s=this.points.length;i<s;i++){let o=this.points[i];o.position.multiply(n),o.controls[0].position.multiply(n),o.controls[1].position.multiply(n)}for(let i=0,s=this.shapeHoles.length;i<s;i++)this.shapeHoles[i].applyScale(e,t);this._update(!1)}createPoint(e,t=0,n=Ee.generateUUID()){let i;e instanceof O?i=e:i=new O(e,t);let s=new vs(n,i);return s.roundness=this.roundness,s}addPoint(e){this.points.push(e),this.needsUpdate=!0}addPointAt(e,t){this.points.splice(t,0,e),this.needsUpdate=!0}getPointByUuid(e){for(let t=0,n=this.points.length;t<n;t++){let i=this.points[t];if(i.uuid===e)return i}return null}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(e){let t=this.points.indexOf(e);t>=0&&this.points.splice(t,1),this.needsUpdate=!0}update(e=!0){for(let t=0,n=this.shapeHoles.length;t<n;t++)this.shapeHoles[t].update(!1);this._update(e)}extractShapePointsToBuffer(e,t=12,n=!1){this.subdivision=t,this.curveDivisions===void 0&&this.computeCurveDivisions(t);let i=n?this.roundedCurveDivisions:this.curveDivisions;return Bx(e,n?this.roundedCurves:this.curves,t,this.autoClose),i.reduce((s,o)=>s+o,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=cm(this.points,e,!1),this.roundedCurveDivisions=cm(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,n=12){return Ox(e,this.curves,t,n,this.autoClose).reduce((s,o)=>s+o,0)*2}extractShapePointsToFlatArray(e,t=12){return this.subdivision=t,this.curveDivisions===void 0&&this.computeCurveDivisions(t),Fx(e,this.roundedCurves,t,this.autoClose)}getCurveIndexFromVertexId(e,t=!1){let n=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let i=t?this.roundedCurveDivisions:this.curveDivisions,s=0;t&&this.points[0].roundedCurveCorner!==void 0&&(s=xs(this.points[0].roundedCurveCorner,this.subdivision)*.5);let o=e-s;o<0&&(o+=i.reduce((a,l)=>a+l,0));for(let a=0,l=i.length;a<l;a++){let c=i[a];if(o<n+c)return[a,(o-n+1)/c];n+=c}return[0,1]}getCurveT(e,t,n){let i=this.points[e],s=this.points[e>=this.points.length-1?0:e+1],o=this.curveDivisions,a=o[e];if(lm(i,s)){let u=i.position.distanceTo(s.position);return i.position.distanceTo(um.set(n.x,n.y))/u}let l=0;for(let u=0;u<e;u++)l+=o[u];return(t-l)/a}dispose(){this.eventDispatcher=null}_applyCurveForPoint(e,t){lm(t,e)?this.lineTo(e.position.x,e.position.y):this.bezierCurveTo(t.controls[1].position.x,t.controls[1].position.y,e.controls[0].position.x,e.controls[0].position.y,e.position.x,e.position.y);let n=this.curves[this.curves.length-1];e.curveBefore=n,t.curveAfter=n;let i=n.clone();e.roundedCurveBefore=i,t.roundedCurveAfter=i,e.roundedCurveCorner=void 0,this.roundedCurves.push(i)}_update(e=!0){var n;if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let i=0,s=this.points.length;i<s;i++){let o=this.points[i];if(i===0)this.moveTo(o.position.x,o.position.y);else{let a=this.points[i-1];this._applyCurveForPoint(o,a)}}let t=this.getLastPoint();if((t==null?void 0:t.curveAfter)&&(t.curveAfter=void 0),this.isClosed){let i=this.points[0],s=this.points[this.points.length-1];this._applyCurveForPoint(i,s)}if(this.points.length>2){let i=0;for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s],l=a.roundness;if(!a.controlsMoved()&&l>0){let c=a.curveBefore,u=a.curveAfter;if(c===void 0||u===void 0)continue;let h=a.roundedCurveBefore,d=a.roundedCurveAfter,f=c.getLength(),p=u.getLength(),m=Math.min(l,f*.499),v=Math.min(l,p*.499),g=Math.min(m,v),y=1-g/f,x=g/p,b=c.getPointAt(y,um),w=u.getPointAt(x,RL);this._subSplitCurve(c,h,y,b,void 0),this._subSplitCurve(u,d,x,void 0,w);let _;if(this.useCubicForRoundedCorners){let S=am(b,a.position,w)/2,A=Math.tan(S)*b.distanceTo(a.position),[T,L]=Ix(b,w,A,BL,OL),C=Px(T,L,a.position),[U,P]=Dx(C,b,w,A,FL,zL);_=new ii(b.clone(),U.clone(),P.clone(),w.clone())}else _=new Wi(b.clone(),a.position.clone(),w.clone());a.roundedCurveCorner=_,this.roundedCurves.splice(s+i,0,_),i++}}}e&&((n=this.eventDispatcher)==null||n.dispatchEvent({type:"update"}))}_subSplitCurve(e,t,n,i,s){if(e instanceof ri)i!==void 0&&t.v2.copy(i),s!==void 0&&t.v1.copy(s);else{let o=e,a=t,l=o.getUtoTmapping(n,0),c=Rx(o.v0,o.v1,o.v2,o.v3,l);return i!==void 0&&(a.v0.set(c[0],c[1]),a.v1.set(c[2],c[3]),a.v2.set(c[4],c[5]),a.v3.set(c[6],c[7])),s!==void 0&&(a.v0.set(c[6],c[7]),a.v1.set(c[8],c[9]),a.v2.set(c[10],c[11]),a.v3.set(c[12],c[13])),a}return t}clone(){let e=new Lt(this._width,this._height);return e.points=this.points.map(t=>t.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(t=>t.clone()),e}toJSON(){return{points:this.points.reduce((e,t)=>e.concat(t.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){var n;this.points=[],this.pointIDs=0;let t=e.points.length/7;for(let i=0;i<t;i++){let s=i*7,o=e.points[s+0],a=e.points[s+1],l=e.points[s+2],c=e.points[s+3],u=e.points[s+4],h=e.points[s+5],d=e.points[s+6],f=new vs(Ee.generateUUID(),new O(o,a));f.controls[0].position.set(l,c),f.controls[1].position.set(u,h),f.roundness=d,this.points.push(f)}return this.shapeHoles=((n=e.shapeHoles)==null?void 0:n.length)?e.shapeHoles.map(i=>{let s=new Lt;return s.fromJSON(i),s}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e){let t=(i,s)=>{s instanceof ii&&s.v3.equals(i.position)&&i.controls[0].position.copy(s.v2)},n=i=>{let s=[],o,a;for(o=0,a=i.length;o<a;o++)i[o]instanceof Wi&&(i[o]=Lx(i[o]));for(o=0,a=i.length;o<a;o++){let u=i[o],h=o>0?i[o-1]:null,d;u instanceof ii?(d=this.createPoint(u.v0),d.controls[1].position.copy(u.v1)):u instanceof ri&&(d=this.createPoint(u.v1)),d!==void 0&&(h!==null&&t(d,h),s.push(d))}let l=i[i.length-1],c=!1;return l instanceof ii?l.v3.equals(s[0].position)&&(s[0].controls[0].position.copy(l.v2),c=!0):l instanceof ri&&l.v2.equals(s[0].position)&&(c=!0),this.isClosed=c,s};return this.points=n(e.curves),e instanceof yi&&(this.shapeHoles=e.holes.map(i=>{let s=new Lt;return s.fromShape(i),s})),this.update(),this}};var hm=Math.PI*2;function dm({x:r,y:e},t,n,i,s){return{x:r*t+i,y:e*n+s}}function GL(r,e){let t=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:4/3*Math.tan(e/4),n=Math.cos(r),i=Math.sin(r),s=Math.cos(r+e),o=Math.sin(r+e);return[{x:n-i*t,y:i+n*t},{x:s+o*t,y:o-s*t},{x:s,y:o}]}function zx(r,e,t,n){let i=r*n-e*t<0?-1:1,s=Math.min(1,Math.max(-1,r*t+e*n));return i*Math.acos(s)}function UL(r,e,t,n,i,s,o,a,l,c){let u=Math.pow(i,2),h=Math.pow(s,2),d=Math.pow(o,2),f=Math.pow(a,2),p=u*h-u*f-h*d;p<0&&(p=0),p/=u*f+h*d,p=Math.sqrt(p)*(l===c?-1:1);let m=p*i/s*a,v=p*-s/i*o,g=m+(r+t)/2,y=v+(e+n)/2,x=(o-m)/i,b=(a-v)/s,w=(-o-m)/i,_=(-a-v)/s,S=zx(1,0,x,b),A=zx(x,b,w,_);return!c&&A>0&&(A-=hm),c&&A<0&&(A+=hm),{centerx:g,centery:y,ang1:S,ang2:A}}function Gx({px:r,py:e,cx:t,cy:n,rx:i,ry:s,largeArcFlag:o,sweepFlag:a}){let l=[];if(i===0||s===0)return[];let c=(r-t)/2,u=(e-n)/2;if(c===0&&u===0)return[];i=Math.abs(i),s=Math.abs(s);let h=Math.pow(c,2)/Math.pow(i,2)+Math.pow(u,2)/Math.pow(s,2);h>1&&(i*=Math.sqrt(h),s*=Math.sqrt(h));let d=UL(r,e,t,n,i,s,c,u,o,a),{ang1:f,ang2:p}=d,{centerx:m,centery:v}=d,g=Math.abs(p)/(hm/4);Math.abs(1-g)<1e-7&&(g=1);let y=Math.max(Math.ceil(g),1);p/=y;for(let x=0;x<y;x++)l.push(GL(f,p)),f+=p;return l.map(x=>{let{x:b,y:w}=dm(x[0],i,s,m,v),{x:_,y:S}=dm(x[1],i,s,m,v),{x:A,y:T}=dm(x[2],i,s,m,v);return{x1:b,y1:w,x2:_,y2:S,x:A,y:T}})}var Wt;(function(r){r[r.ODD=0]="ODD",r[r.NONZERO=1]="NONZERO",r[r.POSITIVE=2]="POSITIVE",r[r.NEGATIVE=3]="NEGATIVE",r[r.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(Wt||(Wt={}));var gn;(function(r){r[r.POLYGONS=0]="POLYGONS",r[r.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",r[r.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(gn||(gn={}));function Xe(r,e){if(!r)throw e||"Assertion Failed!"}var We=function(){function r(){}return r.vertEq=function(e,t){return e.s===t.s&&e.t===t.t},r.vertLeq=function(e,t){return e.s<t.s||e.s===t.s&&e.t<=t.t},r.transLeq=function(e,t){return e.t<t.t||e.t===t.t&&e.s<=t.s},r.edgeGoesLeft=function(e){return r.vertLeq(e.Dst,e.Org)},r.edgeGoesRight=function(e){return r.vertLeq(e.Org,e.Dst)},r.vertL1dist=function(e,t){return Math.abs(e.s-t.s)+Math.abs(e.t-t.t)},r.edgeEval=function(e,t,n){Xe(r.vertLeq(e,t)&&r.vertLeq(t,n));var i=t.s-e.s,s=n.s-t.s;return i+s>0?i<s?t.t-e.t+(e.t-n.t)*(i/(i+s)):t.t-n.t+(n.t-e.t)*(s/(i+s)):0},r.edgeSign=function(e,t,n){Xe(r.vertLeq(e,t)&&r.vertLeq(t,n));var i=t.s-e.s,s=n.s-t.s;return i+s>0?(t.t-n.t)*i+(t.t-e.t)*s:0},r.transEval=function(e,t,n){Xe(r.transLeq(e,t)&&r.transLeq(t,n));var i=t.t-e.t,s=n.t-t.t;return i+s>0?i<s?t.s-e.s+(e.s-n.s)*(i/(i+s)):t.s-n.s+(n.s-e.s)*(s/(i+s)):0},r.transSign=function(e,t,n){Xe(r.transLeq(e,t)&&r.transLeq(t,n));var i=t.t-e.t,s=n.t-t.t;return i+s>0?(t.s-n.s)*i+(t.s-e.s)*s:0},r.vertCCW=function(e,t,n){return e.s*(t.t-n.t)+t.s*(n.t-e.t)+n.s*(e.t-t.t)>=0},r.interpolate=function(e,t,n,i){return e=e<0?0:e,n=n<0?0:n,e<=n?n===0?(t+i)/2:t+(i-t)*(e/(e+n)):i+(t-i)*(n/(e+n))},r.intersect=function(e,t,n,i,s){var o,a,l;r.vertLeq(e,t)||(l=e,e=t,t=l),r.vertLeq(n,i)||(l=n,n=i,i=l),r.vertLeq(e,n)||(l=e,e=n,n=l,l=t,t=i,i=l),r.vertLeq(n,t)?r.vertLeq(t,i)?(o=r.edgeEval(e,n,t),a=r.edgeEval(n,t,i),o+a<0&&(o=-o,a=-a),s.s=r.interpolate(o,n.s,a,t.s)):(o=r.edgeSign(e,n,t),a=-r.edgeSign(e,i,t),o+a<0&&(o=-o,a=-a),s.s=r.interpolate(o,n.s,a,i.s)):s.s=(n.s+t.s)/2,r.transLeq(e,t)||(l=e,e=t,t=l),r.transLeq(n,i)||(l=n,n=i,i=l),r.transLeq(e,n)||(l=e,e=n,n=l,l=t,t=i,i=l),r.transLeq(n,t)?r.transLeq(t,i)?(o=r.transEval(e,n,t),a=r.transEval(n,t,i),o+a<0&&(o=-o,a=-a),s.t=r.interpolate(o,n.t,a,t.t)):(o=r.transSign(e,n,t),a=-r.transSign(e,i,t),o+a<0&&(o=-o,a=-a),s.t=r.interpolate(o,n.t,a,i.t)):s.t=(n.t+t.t)/2},r}(),Dc=function(){function r(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}return r}(),Ph=function(){function r(e){this.side=e,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(r.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),r}(),Za=function(){function r(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0}return r}(),Ux=function(){function r(){var e=new Za,t=new Dc,n=new Ph(0),i=new Ph(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,n.next=n,n.Sym=i,i.next=i,i.Sym=n,this.vHead=e,this.fHead=t,this.eHead=n,this.eHeadSym=i}return r.prototype.makeEdge_=function(e){var t=new Ph(0),n=new Ph(1);e.Sym.side<e.side&&(e=e.Sym);var i=e.Sym.next;return n.next=i,i.Sym.next=t,t.next=e,e.Sym.next=n,t.Sym=n,t.Onext=t,t.Lnext=n,t.Org=null,t.Lface=null,t.winding=0,t.activeRegion=null,n.Sym=t,n.Onext=n,n.Lnext=t,n.Org=null,n.Lface=null,n.winding=0,n.activeRegion=null,t},r.prototype.splice_=function(e,t){var n=e.Onext,i=t.Onext;n.Sym.Lnext=t,i.Sym.Lnext=e,e.Onext=i,t.Onext=n},r.prototype.makeVertex_=function(e,t,n){var i=e;Xe(i,"Vertex can't be null!");var s=n.prev;i.prev=s,s.next=i,i.next=n,n.prev=i,i.anEdge=t;var o=t;do o.Org=i,o=o.Onext;while(o!==t)},r.prototype.makeFace_=function(e,t,n){var i=e;Xe(i,"Face can't be null");var s=n.prev;i.prev=s,s.next=i,i.next=n,n.prev=i,i.anEdge=t,i.trail=null,i.marked=!1,i.inside=n.inside;var o=t;do o.Lface=i,o=o.Lnext;while(o!==t)},r.prototype.killEdge_=function(e){e.Sym.side<e.side&&(e=e.Sym);var t=e.next,n=e.Sym.next;t.Sym.next=n,n.Sym.next=t},r.prototype.killVertex_=function(e,t){var n=e.anEdge,i=n;do i.Org=t,i=i.Onext;while(i!==n);var s=e.prev,o=e.next;o.prev=s,s.next=o},r.prototype.killFace_=function(e,t){var n=e.anEdge,i=n;do i.Lface=t,i=i.Lnext;while(i!==n);var s=e.prev,o=e.next;o.prev=s,s.next=o},r.prototype.makeEdge=function(){var e=new Za,t=new Za,n=new Dc,i=this.makeEdge_(this.eHead);return this.makeVertex_(e,i,this.vHead),this.makeVertex_(t,i.Sym,this.vHead),this.makeFace_(n,i,this.fHead),i},r.prototype.splice=function(e,t){var n=!1,i=!1;if(e!==t){if(t.Org!==e.Org&&(i=!0,this.killVertex_(t.Org,e.Org)),t.Lface!==e.Lface&&(n=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(t,e),!i){var s=new Za;this.makeVertex_(s,t,e.Org),e.Org.anEdge=e}if(!n){var o=new Dc;this.makeFace_(o,t,e.Lface),e.Lface.anEdge=e}}},r.prototype.delete=function(e){var t=e.Sym,n=!1;if(e.Lface!==e.Rface&&(n=!0,this.killFace_(e.Lface,e.Rface)),e.Onext===e)this.killVertex_(e.Org,null);else if(e.Rface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev),!n){var i=new Dc;this.makeFace_(i,e,e.Lface)}t.Onext===t?(this.killVertex_(t.Org,null),this.killFace_(t.Lface,null)):(e.Lface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev)),this.killEdge_(e)},r.prototype.addEdgeVertex=function(e){var t=this.makeEdge_(e),n=t.Sym;this.splice_(t,e.Lnext),t.Org=e.Dst;var i=new Za;return this.makeVertex_(i,n,t.Org),t.Lface=n.Lface=e.Lface,t},r.prototype.splitEdge=function(e){var t=this.addEdgeVertex(e),n=t.Sym;return this.splice_(e.Sym,e.Sym.Oprev),this.splice_(e.Sym,n),e.Dst=n.Org,n.Dst.anEdge=n.Sym,n.Rface=e.Rface,n.winding=e.winding,n.Sym.winding=e.Sym.winding,n.idx=e.idx,n.Sym.idx=e.Sym.idx,n},r.prototype.connect=function(e,t){var n=!1,i=this.makeEdge_(e),s=i.Sym;if(t.Lface!==e.Lface&&(n=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(i,e.Lnext),this.splice_(s,t),i.Org=e.Dst,s.Org=t.Org,i.Lface=s.Lface=e.Lface,e.Lface.anEdge=s,!n){var o=new Dc;this.makeFace_(o,i,e.Lface)}return i},r.prototype.zapFace=function(e){var t=e.anEdge,n,i,s,o,a;i=t.Lnext;do n=i,i=n.Lnext,n.Lface=null,n.Rface===null&&(n.Onext===n?this.killVertex_(n.Org,null):(n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),s=n.Sym,s.Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(n));while(n!=t);o=e.prev,a=e.next,a.prev=o,o.next=a},r.prototype.countFaceVerts_=function(e){var t=e.anEdge,n=0;do n++,t=t.Lnext;while(t!==e.anEdge);return n},r.prototype.mergeConvexFaces=function(e){var t,n,i,s,o,a,l;for(t=this.fHead.next;t!==this.fHead;t=t.next)if(!!t.inside)for(n=t.anEdge,o=n.Org;i=n.Lnext,s=n.Sym,s&&s.Lface&&s.Lface.inside&&(a=this.countFaceVerts_(t),l=this.countFaceVerts_(s.Lface),a+l-2<=e&&We.vertCCW(n.Lprev.Org,n.Org,s.Lnext.Lnext.Org)&&We.vertCCW(s.Lprev.Org,s.Org,n.Lnext.Lnext.Org)&&(i=s.Lnext,this.delete(s),n=null,s=null)),!(n&&n.Lnext.Org===o);)n=i;return!0},r.prototype.check=function(){var e=this.fHead,t=this.vHead,n=this.eHead,i,s,o,a,l,c;for(s=e,s=e;(i=s.next)!==e;s=i){Xe(i.prev===s),l=i.anEdge;do Xe(l.Sym!==l),Xe(l.Sym.Sym===l),Xe(l.Lnext.Onext.Sym===l),Xe(l.Onext.Sym.Lnext===l),Xe(l.Lface===i),l=l.Lnext;while(l!==i.anEdge)}for(Xe(i.prev===s&&i.anEdge===null),a=t,a=t;(o=a.next)!==t;a=o){Xe(o.prev===a),l=o.anEdge;do Xe(l.Sym!==l),Xe(l.Sym.Sym===l),Xe(l.Lnext.Onext.Sym===l),Xe(l.Onext.Sym.Lnext===l),Xe(l.Org===o),l=l.Onext;while(l!==o.anEdge)}for(Xe(o.prev===a&&o.anEdge===null),c=n,c=n;(l=c.next)!==n;c=l)Xe(l.Sym.next===c.Sym),Xe(l.Sym!==l),Xe(l.Sym.Sym===l),Xe(l.Org!==null),Xe(l.Dst!==null),Xe(l.Lnext.Onext.Sym===l),Xe(l.Onext.Sym.Lnext===l);Xe(l.Sym.next===c.Sym&&l.Sym===this.eHeadSym&&l.Sym.Sym===l&&l.Org===null&&l.Dst===null&&l.Lface===null&&l.Rface===null)},r}(),kx=function(){function r(){this.handle=null}return r}(),Vx=function(){function r(){this.key=null,this.node=0}return r}(),kL=function(){function r(e,t){this.leq=t,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=e,this.nodes=[],this.handles=[];for(var n=0;n<e+1;n++)this.nodes[n]=new kx,this.handles[n]=new Vx;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return r.prototype.floatDown_=function(e){var t=this.nodes,n=this.handles,i,s,o;for(i=t[e].handle;;){if(o=e<<1,o<this.size&&this.leq(n[t[o+1].handle].key,n[t[o].handle].key)&&++o,Xe(o<=this.max),s=t[o].handle,o>this.size||this.leq(n[i].key,n[s].key)){t[e].handle=i,n[i].node=e;break}t[e].handle=s,n[s].node=e,e=o}},r.prototype.floatUp_=function(e){var t=this.nodes,n=this.handles,i,s,o;for(i=t[e].handle;;){if(o=e>>1,s=t[o].handle,o===0||this.leq(n[s].key,n[i].key)){t[e].handle=i,n[i].node=e;break}t[e].handle=s,n[s].node=e,e=o}},r.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},r.prototype.min=function(){return this.handles[this.nodes[1].handle].key},r.prototype.insert=function(e){var t,n;if(t=++this.size,t*2>this.max){this.max*=2;var i,s;for(s=this.nodes.length,this.nodes.length=this.max+1,i=s;i<this.nodes.length;i++)this.nodes[i]=new kx;for(s=this.handles.length,this.handles.length=this.max+1,i=s;i<this.handles.length;i++)this.handles[i]=new Vx}return this.freeList===0?n=t:(n=this.freeList,this.freeList=this.handles[n].node),this.nodes[t].handle=n,this.handles[n].node=t,this.handles[n].key=e,this.initialized&&this.floatUp_(t),n},r.prototype.extractMin=function(){var e=this.nodes,t=this.handles,n=e[1].handle,i=t[n].key;return this.size>0&&(e[1].handle=e[this.size].handle,t[e[1].handle].node=1,t[n].key=null,t[n].node=this.freeList,this.freeList=n,--this.size,this.size>0&&this.floatDown_(1)),i},r.prototype.delete=function(e){var t=this.nodes,n=this.handles,i;Xe(e>=1&&e<=this.max&&n[e].key!==null),i=n[e].node,t[i].handle=t[this.size].handle,n[t[i].handle].node=i,--this.size,i<=this.size&&(i<=1||this.leq(n[t[i>>1].handle].key,n[t[i].handle].key)?this.floatDown_(i):this.floatUp_(i)),n[e].key=null,n[e].node=this.freeList,this.freeList=e},r}(),fm=function(){function r(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}return r}(),Hx=function(){function r(){this.key=null,this.next=null,this.prev=null}return r}(),VL=function(){function r(e,t){this.frame=e,this.leq=t,this.head=new Hx,this.head.next=this.head,this.head.prev=this.head}return r.prototype.min=function(){return this.head.next},r.prototype.max=function(){return this.head.prev},r.prototype.insert=function(e){return this.insertBefore(this.head,e)},r.prototype.search=function(e){var t=this.head;do t=t.next;while(t.key!==null&&!this.leq(this.frame,e,t.key));return t},r.prototype.insertBefore=function(e,t){do e=e.prev;while(e.key!==null&&!this.leq(this.frame,e.key,t));var n=new Hx;return n.key=t,n.next=e.next,e.next.prev=n,n.prev=e,e.next=n,n},r.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},r}(),HL=function(){function r(){}return r.regionBelow=function(e){return e.nodeUp.prev.key},r.regionAbove=function(e){return e.nodeUp.next.key},r.debugEvent=function(e){},r.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},r.edgeLeq=function(e,t,n){var i=e.event,s=t.eUp,o=n.eUp;if(s.Dst===i)return o.Dst===i?We.vertLeq(s.Org,o.Org)?We.edgeSign(o.Dst,s.Org,o.Org)<=0:We.edgeSign(s.Dst,o.Org,s.Org)>=0:We.edgeSign(o.Dst,i,o.Org)<=0;if(o.Dst===i)return We.edgeSign(s.Dst,i,s.Org)>=0;var a=We.edgeEval(s.Dst,i,s.Org),l=We.edgeEval(o.Dst,i,o.Org);return a>=l},r.deleteRegion=function(e,t){t.fixUpperEdge&&Xe(t.eUp.winding===0),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},r.fixUpperEdge=function(e,t,n){Xe(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,t.eUp=n,n.activeRegion=t},r.topLeftRegion=function(e,t){var n=t.eUp.Org,i;do t=r.regionAbove(t);while(t.eUp.Org===n);if(t.fixUpperEdge){if(i=e.mesh.connect(r.regionBelow(t).eUp.Sym,t.eUp.Lnext),i===null)return null;r.fixUpperEdge(e,t,i),t=r.regionAbove(t)}return t},r.topRightRegion=function(e){var t=e.eUp.Dst;do e=r.regionAbove(e);while(e.eUp.Dst===t);return e},r.addRegionBelow=function(e,t,n){var i=new fm;return i.eUp=n,i.nodeUp=e.dict.insertBefore(t.nodeUp,i),i.fixUpperEdge=!1,i.sentinel=!1,i.dirty=!1,n.activeRegion=i,i},r.isWindingInside=function(e,t){switch(e.windingRule){case Wt.ODD:return(t&1)!=0;case Wt.NONZERO:return t!==0;case Wt.POSITIVE:return t>0;case Wt.NEGATIVE:return t<0;case Wt.ABS_GEQ_TWO:return t>=2||t<=-2}throw new Error("Invalid winding rulle")},r.computeWinding=function(e,t){t.windingNumber=r.regionAbove(t).windingNumber+t.eUp.winding,t.inside=r.isWindingInside(e,t.windingNumber)},r.finishRegion=function(e,t){var n=t.eUp,i=n.Lface;i.inside=t.inside,i.anEdge=n,r.deleteRegion(e,t)},r.finishLeftRegions=function(e,t,n){for(var i,s=null,o=t,a=t.eUp;o!==n;){if(o.fixUpperEdge=!1,s=r.regionBelow(o),i=s.eUp,i.Org!=a.Org){if(!s.fixUpperEdge){r.finishRegion(e,o);break}i=e.mesh.connect(a.Lprev,i.Sym),r.fixUpperEdge(e,s,i)}a.Onext!==i&&(e.mesh.splice(i.Oprev,i),e.mesh.splice(a,i)),r.finishRegion(e,o),a=s.eUp,o=s}return a},r.addRightEdges=function(e,t,n,i,s,o){var a,l,c,u,h=!0;c=n;do Xe(We.vertLeq(c.Org,c.Dst)),r.addRegionBelow(e,t,c.Sym),c=c.Onext;while(c!==i);for(s===null&&(s=r.regionBelow(t).eUp.Rprev),l=t,u=s;a=r.regionBelow(l),c=a.eUp.Sym,c.Org===u.Org;)c.Onext!==u&&(e.mesh.splice(c.Oprev,c),e.mesh.splice(u.Oprev,c)),a.windingNumber=l.windingNumber-c.winding,a.inside=r.isWindingInside(e,a.windingNumber),l.dirty=!0,!h&&r.checkForRightSplice(e,l)&&(r.addWinding(c,u),r.deleteRegion(e,l),e.mesh.delete(u)),h=!1,l=a,u=c;l.dirty=!0,Xe(l.windingNumber-c.winding===a.windingNumber),o&&r.walkDirtyRegions(e,l)},r.spliceMergeVertices=function(e,t,n){e.mesh.splice(t,n)},r.vertexWeights=function(e,t,n){var i=We.vertL1dist(t,e),s=We.vertL1dist(n,e),o=.5*s/(i+s),a=.5*i/(i+s);e.coords[0]+=o*t.coords[0]+a*n.coords[0],e.coords[1]+=o*t.coords[1]+a*n.coords[1],e.coords[2]+=o*t.coords[2]+a*n.coords[2]},r.getIntersectData=function(e,t,n,i,s,o){t.coords[0]=t.coords[1]=t.coords[2]=0,t.idx=-1,r.vertexWeights(t,n,i),r.vertexWeights(t,s,o)},r.checkForRightSplice=function(e,t){var n=r.regionBelow(t),i=t.eUp,s=n.eUp;if(We.vertLeq(i.Org,s.Org)){if(We.edgeSign(s.Dst,i.Org,s.Org)>0)return!1;We.vertEq(i.Org,s.Org)?i.Org!==s.Org&&(e.pq.delete(i.Org.pqHandle),r.spliceMergeVertices(e,s.Oprev,i)):(e.mesh.splitEdge(s.Sym),e.mesh.splice(i,s.Oprev),t.dirty=n.dirty=!0)}else{if(We.edgeSign(i.Dst,s.Org,i.Org)<0)return!1;r.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(i.Sym),e.mesh.splice(s.Oprev,i)}return!0},r.checkForLeftSplice=function(e,t){var n=r.regionBelow(t),i=t.eUp,s=n.eUp,o;if(Xe(!We.vertEq(i.Dst,s.Dst)),We.vertLeq(i.Dst,s.Dst)){if(We.edgeSign(i.Dst,s.Dst,i.Org)<0)return!1;r.regionAbove(t).dirty=t.dirty=!0,o=e.mesh.splitEdge(i),e.mesh.splice(s.Sym,o),o.Lface.inside=t.inside}else{if(We.edgeSign(s.Dst,i.Dst,s.Org)>0)return!1;t.dirty=n.dirty=!0,o=e.mesh.splitEdge(s),e.mesh.splice(i.Lnext,s.Sym),o.Rface.inside=t.inside}return!0},r.checkForIntersect=function(e,t){var n=r.regionBelow(t),i=t.eUp,s=n.eUp,o=i.Org,a=s.Org,l=i.Dst,c=s.Dst,u,h,d=new Za,f,p;if(Xe(!We.vertEq(c,l)),Xe(We.edgeSign(l,e.event,o)<=0),Xe(We.edgeSign(c,e.event,a)>=0),Xe(o!==e.event&&a!==e.event),Xe(!t.fixUpperEdge&&!n.fixUpperEdge),o===a||(u=Math.min(o.t,l.t),h=Math.max(a.t,c.t),u>h))return!1;if(We.vertLeq(o,a)){if(We.edgeSign(c,o,a)>0)return!1}else if(We.edgeSign(l,a,o)<0)return!1;return r.debugEvent(e),We.intersect(l,o,c,a,d),Xe(Math.min(o.t,l.t)<=d.t),Xe(d.t<=Math.max(a.t,c.t)),Xe(Math.min(c.s,l.s)<=d.s),Xe(d.s<=Math.max(a.s,o.s)),We.vertLeq(d,e.event)&&(d.s=e.event.s,d.t=e.event.t),f=We.vertLeq(o,a)?o:a,We.vertLeq(f,d)&&(d.s=f.s,d.t=f.t),We.vertEq(d,o)||We.vertEq(d,a)?(r.checkForRightSplice(e,t),!1):!We.vertEq(l,e.event)&&We.edgeSign(l,e.event,d)>=0||!We.vertEq(c,e.event)&&We.edgeSign(c,e.event,d)<=0?c===e.event?(e.mesh.splitEdge(i.Sym),e.mesh.splice(s.Sym,i),t=r.topLeftRegion(e,t),i=r.regionBelow(t).eUp,r.finishLeftRegions(e,r.regionBelow(t),n),r.addRightEdges(e,t,i.Oprev,i,i,!0),!0):l===e.event?(e.mesh.splitEdge(s.Sym),e.mesh.splice(i.Lnext,s.Oprev),n=t,t=r.topRightRegion(t),p=r.regionBelow(t).eUp.Rprev,n.eUp=s.Oprev,s=r.finishLeftRegions(e,n,null),r.addRightEdges(e,t,s.Onext,i.Rprev,p,!0),!0):(We.edgeSign(l,e.event,d)>=0&&(r.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(i.Sym),i.Org.s=e.event.s,i.Org.t=e.event.t),We.edgeSign(c,e.event,d)<=0&&(t.dirty=n.dirty=!0,e.mesh.splitEdge(s.Sym),s.Org.s=e.event.s,s.Org.t=e.event.t),!1):(e.mesh.splitEdge(i.Sym),e.mesh.splitEdge(s.Sym),e.mesh.splice(s.Oprev,i),i.Org.s=d.s,i.Org.t=d.t,i.Org.pqHandle=e.pq.insert(i.Org),r.getIntersectData(e,i.Org,o,l,a,c),r.regionAbove(t).dirty=t.dirty=n.dirty=!0,!1)},r.walkDirtyRegions=function(e,t){for(var n=r.regionBelow(t),i,s;;){for(;n.dirty;)t=n,n=r.regionBelow(n);if(!t.dirty&&(n=t,t=r.regionAbove(t),t===null||!t.dirty))return;if(t.dirty=!1,i=t.eUp,s=n.eUp,i.Dst!==s.Dst&&r.checkForLeftSplice(e,t)&&(n.fixUpperEdge?(r.deleteRegion(e,n),e.mesh.delete(s),n=r.regionBelow(t),s=n.eUp):t.fixUpperEdge&&(r.deleteRegion(e,t),e.mesh.delete(i),t=r.regionAbove(n),i=t.eUp)),i.Org!==s.Org)if(i.Dst!==s.Dst&&!t.fixUpperEdge&&!n.fixUpperEdge&&(i.Dst===e.event||s.Dst===e.event)){if(r.checkForIntersect(e,t))return}else r.checkForRightSplice(e,t);i.Org===s.Org&&i.Dst===s.Dst&&(r.addWinding(s,i),r.deleteRegion(e,t),e.mesh.delete(i),t=r.regionAbove(n))}},r.connectRightVertex=function(e,t,n){var i,s=n.Onext,o=r.regionBelow(t),a=t.eUp,l=o.eUp,c=!1;if(a.Dst!==l.Dst&&r.checkForIntersect(e,t),We.vertEq(a.Org,e.event)&&(e.mesh.splice(s.Oprev,a),t=r.topLeftRegion(e,t),s=r.regionBelow(t).eUp,r.finishLeftRegions(e,r.regionBelow(t),o),c=!0),We.vertEq(l.Org,e.event)&&(e.mesh.splice(n,l.Oprev),n=r.finishLeftRegions(e,o,null),c=!0),c){r.addRightEdges(e,t,n.Onext,s,s,!0);return}We.vertLeq(l.Org,a.Org)?i=l.Oprev:i=a,i=e.mesh.connect(n.Lprev,i),r.addRightEdges(e,t,i,i.Onext,i.Onext,!1),i.Sym.activeRegion.fixUpperEdge=!0,r.walkDirtyRegions(e,t)},r.connectLeftDegenerate=function(e,t,n){var i,s,o,a,l;if(i=t.eUp,We.vertEq(i.Org,n)){Xe(!1),r.spliceMergeVertices(e,i,n.anEdge);return}if(!We.vertEq(i.Dst,n)){e.mesh.splitEdge(i.Sym),t.fixUpperEdge&&(e.mesh.delete(i.Onext),t.fixUpperEdge=!1),e.mesh.splice(n.anEdge,i),r.sweepEvent(e,n);return}Xe(!1),t=r.topRightRegion(t),l=r.regionBelow(t),o=l.eUp.Sym,s=a=o.Onext,l.fixUpperEdge&&(Xe(s!==o),r.deleteRegion(e,l),e.mesh.delete(o),o=s.Oprev),e.mesh.splice(n.anEdge,o),We.edgeGoesLeft(s)||(s=null),r.addRightEdges(e,t,o.Onext,a,s,!0)},r.connectLeftVertex=function(e,t){var n,i,s,o,a,l,c=new fm;if(c.eUp=t.anEdge.Sym,n=e.dict.search(c).key,i=r.regionBelow(n),!!i){if(o=n.eUp,a=i.eUp,We.edgeSign(o.Dst,t,o.Org)===0){r.connectLeftDegenerate(e,n,t);return}if(s=We.vertLeq(a.Dst,o.Dst)?n:i,n.inside||s.fixUpperEdge){if(s===n)l=e.mesh.connect(t.anEdge.Sym,o.Lnext);else{var u=e.mesh.connect(a.Dnext,t.anEdge);l=u.Sym}s.fixUpperEdge?r.fixUpperEdge(e,s,l):r.computeWinding(e,r.addRegionBelow(e,n,l)),r.sweepEvent(e,t)}else r.addRightEdges(e,n,t.anEdge,t.anEdge,null,!0)}},r.sweepEvent=function(e,t){e.event=t,r.debugEvent(e);for(var n=t.anEdge;n.activeRegion===null;)if(n=n.Onext,n===t.anEdge){r.connectLeftVertex(e,t);return}var i=r.topLeftRegion(e,n.activeRegion);Xe(i!==null);var s=r.regionBelow(i),o=s.eUp,a=r.finishLeftRegions(e,s,null);a.Onext===o?r.connectRightVertex(e,i,a):r.addRightEdges(e,i,a.Onext,o,o,!0)},r.addSentinel=function(e,t,n,i){var s=new fm,o=e.mesh.makeEdge();o.Org.s=n,o.Org.t=i,o.Dst.s=t,o.Dst.t=i,e.event=o.Dst,s.eUp=o,s.windingNumber=0,s.inside=!1,s.fixUpperEdge=!1,s.sentinel=!0,s.dirty=!1,s.nodeUp=e.dict.insert(s)},r.initEdgeDict=function(e){e.dict=new VL(e,r.edgeLeq);var t=e.bmax[0]-e.bmin[0],n=e.bmax[1]-e.bmin[1],i=e.bmin[0]-t,s=e.bmax[0]+t,o=e.bmin[1]-n,a=e.bmax[1]+n;r.addSentinel(e,i,s,o),r.addSentinel(e,i,s,a)},r.doneEdgeDict=function(e){for(var t,n=0;(t=e.dict.min().key)!==null;)t.sentinel||(Xe(t.fixUpperEdge),Xe(++n==1)),Xe(t.windingNumber===0),r.deleteRegion(e,t)},r.removeDegenerateEdges=function(e){var t,n,i,s=e.mesh.eHead;for(t=s.next;t!==s;t=n)n=t.next,i=t.Lnext,We.vertEq(t.Org,t.Dst)&&t.Lnext.Lnext!==t&&(r.spliceMergeVertices(e,i,t),e.mesh.delete(t),t=i,i=t.Lnext),i.Lnext===t&&(i!==t&&((i===n||i===n.Sym)&&(n=n.next),e.mesh.delete(i)),(t===n||t===n.Sym)&&(n=n.next),e.mesh.delete(t))},r.initPriorityQ=function(e){var t,n,i,s=0;for(i=e.mesh.vHead,n=i.next;n!==i;n=n.next)s++;for(s+=8,t=e.pq=new kL(s,We.vertLeq),i=e.mesh.vHead,n=i.next;n!==i;n=n.next)n.pqHandle=t.insert(n);return n!==i?!1:(t.init(),!0)},r.donePriorityQ=function(e){e.pq=null},r.removeDegenerateFaces=function(e,t){var n,i,s;for(n=t.fHead.next;n!==t.fHead;n=i)i=n.next,s=n.anEdge,Xe(s.Lnext!==s),s.Lnext.Lnext===s&&(r.addWinding(s.Onext,s),e.mesh.delete(s));return!0},r.computeInterior=function(e,t){t===void 0&&(t=!0);var n,i;if(r.removeDegenerateEdges(e),!r.initPriorityQ(e))return!1;for(r.initEdgeDict(e);(n=e.pq.extractMin())!==null;){for(;i=e.pq.min(),!(i===null||!We.vertEq(i,n));)i=e.pq.extractMin(),r.spliceMergeVertices(e,n.anEdge,i.anEdge);r.sweepEvent(e,n)}return e.event=e.dict.min().key.eUp.Org,r.debugEvent(e),r.doneEdgeDict(e),r.donePriorityQ(e),r.removeDegenerateFaces(e,e.mesh)?(t&&e.mesh.check(),!0):!1},r}(),jL=function(){function r(){this.mesh=new Ux,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=Wt.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return r.prototype.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},r.prototype.normalize_=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];if(!t)throw"Zero-size vector!";t=Math.sqrt(t),e[0]/=t,e[1]/=t,e[2]/=t},r.prototype.longAxis_=function(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t},r.prototype.computeNormal_=function(e){var t,n,i,s,o,a,l=[0,0,0],c=[0,0,0],u=[0,0,0],h=[0,0,0],d=[0,0,0],f=[null,null,null],p=[null,null,null],m=this.mesh.vHead;t=m.next;for(var v=0;v<3;++v)s=t.coords[v],c[v]=s,p[v]=t,l[v]=s,f[v]=t;for(t=m.next;t!==m;t=t.next)for(var g=0;g<3;++g)s=t.coords[g],s<c[g]&&(c[g]=s,p[g]=t),s>l[g]&&(l[g]=s,f[g]=t);var y=0;if(l[1]-c[1]>l[0]-c[0]&&(y=1),l[2]-c[2]>l[y]-c[y]&&(y=2),c[y]>=l[y]){e[0]=0,e[1]=0,e[2]=1;return}for(a=0,n=p[y],i=f[y],u[0]=n.coords[0]-i.coords[0],u[1]=n.coords[1]-i.coords[1],u[2]=n.coords[2]-i.coords[2],t=m.next;t!==m;t=t.next)h[0]=t.coords[0]-i.coords[0],h[1]=t.coords[1]-i.coords[1],h[2]=t.coords[2]-i.coords[2],d[0]=u[1]*h[2]-u[2]*h[1],d[1]=u[2]*h[0]-u[0]*h[2],d[2]=u[0]*h[1]-u[1]*h[0],o=d[0]*d[0]+d[1]*d[1]+d[2]*d[2],o>a&&(a=o,e[0]=d[0],e[1]=d[1],e[2]=d[2]);a<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(u)]=1)},r.prototype.checkOrientation_=function(){for(var e=this.mesh.fHead,t,n=this.mesh.vHead,i,s=0,o=e.next;o!==e;o=o.next)if(i=o.anEdge,!(i.winding<=0))do s+=(i.Org.s-i.Dst.s)*(i.Org.t+i.Dst.t),i=i.Lnext;while(i!==o.anEdge);if(s<0){for(t=n.next;t!==n;t=t.next)t.t=-t.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},r.prototype.projectPolygon_=function(){var e=this.mesh.vHead,t=[0,0,0],n,i,s=!1;t[0]=this.normal[0],t[1]=this.normal[1],t[2]=this.normal[2],!t[0]&&!t[1]&&!t[2]&&(this.computeNormal_(t),s=!0),n=this.sUnit,i=this.tUnit;var o=this.longAxis_(t);n[o]=0,n[(o+1)%3]=1,n[(o+2)%3]=0,i[o]=0,i[(o+1)%3]=0,i[(o+2)%3]=t[o]>0?1:-1;for(var a=e.next;a!==e;a=a.next)a.s=this.dot_(a.coords,n),a.t=this.dot_(a.coords,i);s&&this.checkOrientation_();for(var l=!0,c=e.next;c!==e;c=c.next)l?(this.bmin[0]=this.bmax[0]=c.s,this.bmin[1]=this.bmax[1]=c.t,l=!1):(c.s<this.bmin[0]&&(this.bmin[0]=c.s),c.s>this.bmax[0]&&(this.bmax[0]=c.s),c.t<this.bmin[1]&&(this.bmin[1]=c.t),c.t>this.bmax[1]&&(this.bmax[1]=c.t))},r.prototype.addWinding_=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},r.prototype.tessellateMonoRegion_=function(e,t){var n,i;if(n=t.anEdge,!(n.Lnext!==n&&n.Lnext.Lnext!==n))throw"Mono region invalid";for(;We.vertLeq(n.Dst,n.Org);n=n.Lprev);for(;We.vertLeq(n.Org,n.Dst);n=n.Lnext);i=n.Lprev;for(var s=void 0;n.Lnext!==i;)if(We.vertLeq(n.Dst,i.Org)){for(;i.Lnext!==n&&(We.edgeGoesLeft(i.Lnext)||We.edgeSign(i.Org,i.Dst,i.Lnext.Dst)<=0);)s=e.connect(i.Lnext,i),i=s.Sym;i=i.Lprev}else{for(;i.Lnext!==n&&(We.edgeGoesRight(n.Lprev)||We.edgeSign(n.Dst,n.Org,n.Lprev.Org)>=0);)s=e.connect(n,n.Lprev),n=s.Sym;n=n.Lnext}if(i.Lnext===n)throw"Mono region invalid";for(;i.Lnext.Lnext!==n;)s=e.connect(i.Lnext,i),i=s.Sym;return!0},r.prototype.tessellateInterior_=function(e){for(var t,n=e.fHead.next;n!==e.fHead;n=t)if(t=n.next,n.inside&&!this.tessellateMonoRegion_(e,n))return!1;return!0},r.prototype.discardExterior_=function(e){for(var t,n=e.fHead.next;n!==e.fHead;n=t)t=n.next,n.inside||e.zapFace(n)},r.prototype.setWindingNumber_=function(e,t,n){for(var i,s=e.eHead.next;s!==e.eHead;s=i)i=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?t:-t:n?e.delete(s):s.winding=0},r.prototype.getNeighbourFace_=function(e){return!e.Rface||!e.Rface.inside?-1:e.Rface.n},r.prototype.outputPolymesh_=function(e,t,n,i){var s,o=0,a=0,l;n>3&&e.mergeConvexFaces(n);for(var c=e.vHead.next;c!==e.vHead;c=c.next)c.n=-1;for(var u=e.fHead.next;u!==e.fHead;u=u.next)if(u.n=-1,!!u.inside){s=u.anEdge,l=0;do{var c=s.Org;c.n===-1&&(c.n=a,a++),l++,s=s.Lnext}while(s!==u.anEdge);if(l>n)throw"Face vertex greater that support polygon";u.n=o,++o}this.elementCount=o,t===gn.CONNECTED_POLYGONS&&(o*=2),this.elements=[],this.elements.length=o*n,this.vertexCount=a,this.vertices=[],this.vertices.length=a*i,this.vertexIndices=[],this.vertexIndices.length=a;for(var c=e.vHead.next;c!==e.vHead;c=c.next)if(c.n!==-1){var h=c.n*i;this.vertices[h+0]=c.coords[0],this.vertices[h+1]=c.coords[1],i>2&&(this.vertices[h+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var d=0,u=e.fHead.next;u!==e.fHead;u=u.next)if(!!u.inside){s=u.anEdge,l=0;do{var c=s.Org;this.elements[d++]=c.n,l++,s=s.Lnext}while(s!==u.anEdge);for(var f=l;f<n;++f)this.elements[d++]=-1;if(t===gn.CONNECTED_POLYGONS){s=u.anEdge;do this.elements[d++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==u.anEdge);for(var p=l;p<n;++p)this.elements[d++]=-1}}},r.prototype.outputContours_=function(e,t){var n,i,s=0,o=0;this.vertexCount=0,this.elementCount=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(!!a.inside){i=n=a.anEdge;do this.vertexCount++,n=n.Lnext;while(n!==i);this.elementCount++}this.elements=[],this.elements.length=this.elementCount*2,this.vertices=[],this.vertices.length=this.vertexCount*t,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var l=0,c=0,u=0;s=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(!!a.inside){o=0,i=n=a.anEdge;do this.vertices[l++]=n.Org.coords[0],this.vertices[l++]=n.Org.coords[1],t>2&&(this.vertices[l++]=n.Org.coords[2]),this.vertexIndices[c++]=this.vertexIdCallback?this.vertexIdCallback(n):n.Org.idx,o++,n=n.Lnext;while(n!==i);this.elements[u++]=s,this.elements[u++]=o,s+=o}},r.prototype.addContour=function(e,t){this.mesh===null&&(this.mesh=new Ux),e<2&&(e=2),e>3&&(e=3);for(var n=null,i=0;i<t.length;i+=e)n===null?(n=this.mesh.makeEdge(),this.mesh.splice(n,n.Sym)):(this.mesh.splitEdge(n),n=n.Lnext),n.Org.coords[0]=t[i+0],n.Org.coords[1]=t[i+1],e>2?n.Org.coords[2]=t[i+2]:n.Org.coords[2]=0,n.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(n),n.winding=1,n.Sym.winding=-1},r.prototype.tesselate=function(e,t,n,i,s,o){if(e===void 0&&(e=Wt.ODD),t===void 0&&(t=gn.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,s&&(this.normal[0]=s[0],this.normal[1]=s[1],this.normal[2]=s[2]),this.windingRule=e,i<2&&(i=2),i>3&&(i=3),!this.mesh)return!1;this.projectPolygon_(),HL.computeInterior(this,o);var a=this.mesh;return t===gn.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),o&&a.check(),t===gn.BOUNDARY_CONTOURS?this.outputContours_(a,i):this.outputPolymesh_(a,t,n,i),!0},r}();function No(r){var e=r.windingRule,t=e===void 0?Wt.ODD:e,n=r.elementType,i=n===void 0?gn.POLYGONS:n,s=r.polySize,o=s===void 0?3:s,a=r.vertexSize,l=a===void 0?2:a,c=r.normal,u=c===void 0?[0,0,1]:c,h=r.contours,d=h===void 0?[]:h,f=r.strict,p=f===void 0?!0:f,m=r.debug,v=m===void 0?!1:m;if(!d&&p)throw new Error("Contours can't be empty");if(!!d){var g=new jL;r.edgeCreateCallback&&(g.edgeCreateCallback=r.edgeCreateCallback),r.vertexIdCallback&&(g.vertexIdCallback=r.vertexIdCallback);for(var y=0;y<d.length;y++)g.addContour(l||2,d[y]);return g.tesselate(t,i,o,l,u,p),{vertices:g.vertices,vertexIndices:g.vertexIndices,vertexCount:g.vertexCount,elements:g.elements,elementCount:g.elementCount,mesh:v?g.mesh:void 0}}}var X4=Wt.ODD,q4=Wt.NONZERO,Y4=Wt.POSITIVE,K4=Wt.NEGATIVE,Q4=Wt.ABS_GEQ_TWO,Z4=gn.POLYGONS,$4=gn.CONNECTED_POLYGONS,eH=gn.BOUNDARY_CONTOURS;var Rc=class extends we{constructor(e,t=12,n=100,i={}){super();this.type="ShapeGeometry";this.windingRule=Wt.ODD;this.elementType=gn.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._drawCount=0,this._shape=e,this._curveSegments=t,this._maxCount=n,this._maxDrawCount=n*3,this._triangulationOptions=Object.assign({windingRule:Wt.ODD,elementType:gn.POLYGONS,polySize:3,vertexSize:2,strict:!0},i),this._positionAttribute=new Re(new Float32Array(n*3),3),this._normalAttribute=new Re(new Float32Array(n*3),3),this._uvAttribute=new Re(new Float32Array(n*2),2),this._indexAttribute=new Re(new Uint32Array(n*3),1),this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.updateFromShape()}copy(e){return this._drawCount=e.drawCount,this._maxDrawCount=e._maxDrawCount,this._maxCount=e.maxCount,super.copy(e)}get curveSegments(){return this._curveSegments}set curveSegments(e){this._curveSegments=e,this.updateFromShape()}get drawCount(){return this._drawCount}get maxDrawCount(){return this._maxDrawCount}get maxCount(){return this._maxCount}updateFromShape(){let e=this._shape.extractShapePointsToFlatArray([],this._curveSegments),t=this._shape.shapeHoles.map(l=>l.extractShapePointsToFlatArray([],this._curveSegments)),n,i=!0,s=!0,o,a;for(let l=0,c=e.length/2;l<c;l++){let u=l*2,h=e[u+0],d=e[u+1];if(o!==void 0&&h!==o&&(i=!1),a!==void 0&&d!==a&&(s=!1),o=h,a=d,!i&&!s)break}if(!i&&!s&&(n=No({contours:[e,...t],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})),this._positionAttribute.array.fill(0),this._normalAttribute.array.fill(0),this._uvAttribute.array.fill(0),this._indexAttribute.array.fill(0),this._drawCount=0,n){let l=1/0,c=-1/0,u=1/0,h=-1/0;for(let p=0,m=n.vertexCount;p<m;p++){let v=p*2,g=n.vertices[v+0],y=n.vertices[v+1];g<l&&(l=g),g>c&&(c=g),y<u&&(u=y),y>h&&(h=y)}let d=c-l,f=h-u;for(let p=0,m=n.vertexCount;p<m;p++){let v=p*2,g=n.vertices[v+0],y=n.vertices[v+1],x=(g-l)/d,b=(y-u)/f;this._positionAttribute.setXYZ(p,g,y,0),this._normalAttribute.setXYZ(p,0,0,1),this._uvAttribute.setXY(p,x,b)}for(let p=0,m=n.elementCount;p<m;p++){let v=p*3,g=n.elements[v+0],y=n.elements[v+1],x=n.elements[v+2];this._indexAttribute.setX(v+0,g),this._indexAttribute.setX(v+1,y),this._indexAttribute.setX(v+2,x),this._drawCount+=3}}return this._positionAttribute.needsUpdate=!0,this._normalAttribute.needsUpdate=!0,this._uvAttribute.needsUpdate=!0,this._indexAttribute.needsUpdate=!0,this.setDrawRange(0,this._drawCount),this._drawCount>this._maxDrawCount}};var Rh=class{constructor(e=256,t=!1){this.capacity=e,this.size=0,this.debug=t,this.debug&&console.log(`allocating with cap ${e}`);let n=e*Rh.eSize;this.buffer=new ArrayBuffer(n);let i=Float32Array.BYTES_PER_ELEMENT,s=0;this.positions=new Float32Array(this.buffer,s*i,3*e),s+=3*e,this.normals=new Float32Array(this.buffer,s*i,3*e),s+=3*e,this.uvs=new Float32Array(this.buffer,s*i,2*e)}realloc(e,t=!1){if(e<this.size)throw Error("cannot shrink buffer");if(e<=this.capacity&&!t)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${e}`);let n=e*Rh.eSize,i=new ArrayBuffer(n),s=Float32Array.BYTES_PER_ELEMENT,o=0,a=new Float32Array(i,o*s,3*e);o+=3*e;let l=new Float32Array(i,o*s,3*e);o+=3*e;let c=new Float32Array(i,o*s,2*e);a.set(this.positions.slice(0,this.size*3)),l.set(this.normals.slice(0,this.size*3)),c.set(this.uvs.slice(0,this.size*2)),this.buffer=i,this.positions=a,this.normals=l,this.uvs=c,this.capacity=e}get(e=1){let t=this.size+e;if(t>this.capacity){let i=this.capacity;for(;t>i;)i*=2;this.realloc(i)}let n=this.size;return this.size=t,n}reserve(e){let t=this.size+e;t>this.capacity&&this.realloc(t)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}},Dh=Rh;Dh.eSize=(3+3+2)*Float32Array.BYTES_PER_ELEMENT;var pm=(r,e)=>([t,n])=>(n<t&&(n+=e),(r>=t?r:r+e)<=n),mm=class extends we{constructor(e,t,n=0,i=12,s=3){super();this.type="ShapeGeometry";this.vertexCache={};this._shape=e,this._depth=t,n<=0?(this._bevelSize=0,this._bevelSegments=0):(this._bevelSize=Math.min(n,t/2-1e-12),this._bevelSegments=Math.floor(s));let o=this._shape.extractShapePointsToFlatArray([],i),a=this._shape.shapeHoles.map(_=>{let S=_.extractShapePointsToFlatArray([],i),A=[];for(let T=S.length-1;T>=1;T-=2){let L=S[T-1],C=S[T-0];A.push(L,C)}return A}),l=No({windingRule:Wt.ODD,elementType:gn.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[o]}),c=No({windingRule:Wt.ODD,elementType:gn.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...a]});if(!l)throw new Error("error generating geometry");let u=l.elementCount;if(c){l.elementCount+=c.elementCount;for(let _=0;_<c.elements.length;_++){let S=c.elements[_],A=_%2==0?l.vertexCount:0;l.elements.push(S+A)}for(let _=0;_<c.vertexIndices.length;_++){let S=c.vertexIndices[_],A=l.vertexCount;l.vertexIndices.push(S+A)}for(let _=0;_<c.vertices.length;_++){let S=c.vertices[_];l.vertices.push(S)}}let h=1/0,d=-1/0,f=1/0,p=-1/0;for(let _=0,S=l.vertexCount;_<S;_++){let A=_*2,T=l.vertices[A+0],L=l.vertices[A+1];T<h&&(h=T),T>d&&(d=T),L<f&&(f=L),L>p&&(p=L)}this._minX=h,this._minY=f,this._width=d-h,this._height=p-f;let m=l.vertexCount*2*(2+this._bevelSegments);this._buffer=new Dh(m);let v=[],g=[];for(let _=l.elementCount-1,S=l.elementCount;_>=0;_--){let A=_>=u,T=_*2,L=l.elements[T+0],C=l.elements[T+1],U=L+C,P={start:L,count:C,normals:[],continuous:[],concave:[]},R=L,G=U-1,B=L+1,j=this._shape.roundedCurves.length;do{let z=R-L,D=l.vertices[G*2+0],K=l.vertices[G*2+1],q=l.vertices[R*2+0],ee=l.vertices[R*2+1],V=l.vertices[B*2+0],de=l.vertices[B*2+1],ae=q-D,te=ee-K,X=Math.sqrt(ae*ae+te*te);ae/=X,te/=X;let se=q-V,$=ee-de,H=Math.sqrt(se*se+$*$);se/=H,$/=H,P.normals[z*2+0]=-$,P.normals[z*2+1]=se,P.concave[z]=ae*$-te*se>0;let Q=l.vertexIndices[R];if(Array.isArray(Q))P.continuous[z]=!1;else{let[ce,ie]=this._shape.getCurveIndexFromVertexId(Q-1,!0);if(ie>0&&ie<1)P.continuous[z]=!0;else{let N=ie===1?ce+1:ce-1;N=(N+j)%j;let E=ie===1?0:1,Y=this._shape.roundedCurves[ce].getTangent(ie),re=this._shape.roundedCurves[N].getTangent(E);P.continuous[z]=Y.dot(re)>.95}}A&&(P.normals[z*2+0]*=-1,P.normals[z*2+1]*=-1),[G,R,B]=[R,B,B+1],B>=U&&(B-=C)}while(B!==L+1);let ne=[];ne.push({bevelI:0,angle:0,size:0,boundary:{vertices:l.vertices.slice(L*2,U*2),vertexCount:C,vertexIndices:new Array(C).fill(!0).map((z,D)=>[D,D]),elements:[0,C],elementCount:1,mesh:null},reverseMap:[],insetPoints:l.vertices.slice(L*2,U*2)});for(let z=1;z<=this._bevelSegments;z++){let D=z/this._bevelSegments*Math.PI/2,K=(1-Math.cos(D))*this._bevelSize,q=[],ee=[],V=[],de=[],ae=0;for(let X=0;X<C;X++){let se=X*2,$=(X-1+C)%C*2,H=l.vertices[P.start*2+se+0],Q=l.vertices[P.start*2+se+1],ce=-P.normals[$+0]*K,ie=-P.normals[$+1]*K,N=-P.normals[se+0]*K,E=-P.normals[se+1]*K;if(P.concave[X]||!P.concave[X]&&A){let Y=Math.atan2(ie,ce),re=Math.atan2(E,N);re>Y&&(re-=Math.PI*2);let ye=re-Y;if(P.continuous[X]||A){let pe=Y+ye/2,Ie=Math.cos(pe)*K,ve=Math.sin(pe)*K;q[2*ae+0]=H+Ie*(A?-1:1),q[2*ae+1]=Q+ve*(A?-1:1),de[ae]=X,ae++}else{let pe=Math.max(1,Math.floor(i/4*Math.abs(ye)/Math.PI));for(let Ie=0;Ie<=pe;Ie++){let ve=Y+ye*(Ie/pe),Fe=Math.cos(ve)*K,Ce=Math.sin(ve)*K;q[2*ae+0]=H+Fe,q[2*ae+1]=Q+Ce,de[ae]=X,ae++}}}else q[2*ae+0]=H+ce,q[2*ae+1]=Q+ie,de[ae]=X,ee[X]=ae,ae++,q[2*ae+0]=H,q[2*ae+1]=Q,de[ae]=X,ae++,q[2*ae+0]=H+N,q[2*ae+1]=Q+E,de[ae]=X,V[X]=ae,ae++}let te=No({windingRule:Wt.POSITIVE,elementType:gn.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[q],edgeCreateCallback:X=>{let $=X.Org.idx,H=de[$],Q=de[($+1)%de.length];X.idx=[H,Q],X.Sym.idx=[Q,H]},vertexIdCallback:X=>{let se=X.Lprev.idx;return[se?se[1]:0,X.idx[0]]}});if(!te)throw console.log("Error"),new Error(`error generating bevel geometry for ${z}'th loop`);if(!te.vertexCount)break;for(let X=0;X<te.vertexIndices.length;X++){let[se,$]=te.vertexIndices[X];if(se===$)continue;let H=$;$<se&&(H+=C);for(let Q=se;Q<H;Q++){let ce=Q%C,ie=(Q+1)%C;if(!P.continuous[ce]||!P.continuous[ie]){te.vertexIndices[X]=[se,ce],te.vertexIndices.splice(X+1,0,[ie,$]),te.vertices.splice((X+1)*2,0,te.vertices[X*2],te.vertices[X*2+1]);break}}}ne.push({bevelI:z,angle:D,size:K,boundary:te,reverseMap:de,insetPoints:q})}let le=(z,D,K)=>{let q=0,ee=z.boundary.vertexIndices.length;for(;q<ee&&K(z.boundary.vertexIndices[D]);)D=(D+1)%ee,q++;return q},W=v.length;for(let z=1;z<ne.length;z++){let D=ne[z-1],K=ne[z],q=D.boundary.vertexIndices.length,ee=K.boundary.vertexIndices.length;if(!q||!ee)break;let V=P.concave.length,de=0,ae=pm(de,C);for(;!D.boundary.vertexIndices.filter(ae).length||!K.boundary.vertexIndices.filter(ae).length;)de++,ae=pm(de,C);let te=D.boundary.vertexIndices.findIndex(ae),X=K.boundary.vertexIndices.findIndex(ae);do te=(te+1)%q;while(ae(D.boundary.vertexIndices[te]));do X=(X+1)%ee;while(ae(K.boundary.vertexIndices[X]));de=(de+1)%C;let se=de,$=this.buildBevelVert(P,D,(te-1+q)%q),H=this.buildBevelVert(P,K,(X-1+ee)%ee),Q=$,ce=H,ie,N,E=!1;do{ae=pm(de,C);let Y=le(D,te,ae),re=le(K,X,ae),ye=E;if(E=!1,Y&&!re){for(let pe=0;pe<Y;pe++)ie=this.buildBevelVert(P,D,(te+pe)%q,pe/(Y-1)),v.push(Q.topN,ie.topP,ce.topN),v.push(ie.bottomP,Q.bottomN,ce.bottomN),Q=ie;E=!0}else if(!Y&&re)for(let pe=0;pe<re;pe++)N=this.buildBevelVert(P,K,(X+pe)%ee,pe/(re-1)),v.push(ce.topN,Q.topP,N.topP),v.push(Q.bottomP,ce.bottomN,N.bottomP),ce=N;else if(Y&&re)if(ie=this.buildBevelVert(P,D,te,0),N=this.buildBevelVert(P,K,X,0),ye?(v.push(Q.topN,N.topP,ce.topN),v.push(Q.topN,ie.topP,N.topP),v.push(N.bottomP,Q.bottomN,ce.bottomN),v.push(ie.bottomP,Q.bottomN,N.bottomP)):(v.push(Q.topN,ie.topP,ce.topN),v.push(ce.topN,ie.topP,N.topP),v.push(ie.bottomP,Q.bottomN,ce.bottomN),v.push(ie.bottomP,ce.bottomN,N.bottomP)),Q=ie,ce=N,Y===re)for(let pe=1;pe<Y;pe++)ie=this.buildBevelVert(P,D,(te+pe)%q,pe/(Y-1)),N=this.buildBevelVert(P,K,(X+pe)%ee,pe/(re-1)),v.push(Q.topN,ie.topP,ce.topN),v.push(ce.topN,ie.topP,N.topP),v.push(ie.bottomP,Q.bottomN,ce.bottomN),v.push(ie.bottomP,ce.bottomN,N.bottomP),Q=ie,ce=N;else if(Y>re){let pe=Y/re,Ie=0;for(let ve=1;ve<Y;ve++)ie=this.buildBevelVert(P,D,(te+ve)%q,ve/(Y-1)),v.push(Q.topN,ie.topP,ce.topN),v.push(ie.bottomP,Q.bottomN,ce.bottomN),Q=ie,ve>(Ie+1)*pe&&(Ie++,N=this.buildBevelVert(P,K,(X+Ie)%ee,Ie/(re-1)),v.push(ce.topN,ie.topP,N.topP),v.push(ie.bottomP,ce.bottomN,N.bottomP),ce=N)}else{let pe=re/Y,Ie=0;for(let ve=1;ve<re;ve++)N=this.buildBevelVert(P,K,(X+ve)%ee,ve/(re-1)),v.push(ce.topN,ie.topP,N.topP),v.push(ie.bottomP,ce.bottomN,N.bottomP),ce=N,ve>(Ie+1)*pe&&(Ie++,ie=this.buildBevelVert(P,D,(te+Ie)%q,Ie/(Y-1)),v.push(Q.topN,ie.topP,ce.topN),v.push(ie.bottomP,Q.bottomN,ce.bottomN),Q=ie)}te=(te+Y)%q,X=(X+re)%ee,de=(de+1)%V}while(de!==se)}{let z=ne[0];for(let D=0,K=z.boundary.vertexCount;D<K;D++){let q=this.buildBevelVert(P,z,D),ee=this.buildBevelVert(P,z,(D+1)%K);v.push(ee.topP,q.topN,q.bottomN),v.push(ee.topP,q.bottomN,ee.bottomP)}}if(A){let z=[];for(let D=v.length-1;D>=W+2;D-=3){let K=v[D-2],q=v[D-1],ee=v[D-0];z.push(ee,q,K)}v.splice(W,v.length-W,...z)}if(A){let z=[];for(let D=ne[ne.length-1].boundary.vertices.length-1;D>=1;D-=2){let K=ne[ne.length-1].boundary.vertices[D-1],q=ne[ne.length-1].boundary.vertices[D-0];z.push(K,q)}g.push(z)}if(!A){let z=ne[ne.length-1],D=No({windingRule:ne.length>1?Wt.POSITIVE:Wt.ODD,elementType:gn.POLYGONS,vertexSize:2,strict:!0,contours:[z.insetPoints,...g]});if(!D)throw new Error("Error generating geometry for surface");for(let K=0;K<D.elementCount*3;K+=3){let q=this.buildSurfaceVert(D,D.elements[K+0]),ee=this.buildSurfaceVert(D,D.elements[K+1]),V=this.buildSurfaceVert(D,D.elements[K+2]);v.push(q.top,ee.top,V.top),v.push(V.bottom,ee.bottom,q.bottom)}}this.vertexCache={}}this._buffer.shrink();let y=new Re(Uint32Array.from(v),1),x=new Re(this._buffer.positions,3),b=new Re(this._buffer.normals,3),w=new Re(this._buffer.uvs,2);x.needsUpdate=!0,b.needsUpdate=!0,w.needsUpdate=!0,y.needsUpdate=!0,this.setAttribute("position",x),this.setAttribute("normal",b),this.setAttribute("uv",w),this.setIndex(y)}buildSurfaceVert(e,t){let n=t.toString();if(n in this.vertexCache)return this.vertexCache[n];let i=e.vertices[t*2+0],s=e.vertices[t*2+1],o=(i-this._minX)/this._width,a=(s-this._minY)/this._height,l=this._buffer.get(2),c=l*3,u=l*2,h={top:l+0,bottom:l+1};return this._buffer.positions[c+0]=i,this._buffer.positions[c+1]=s,this._buffer.positions[c+2]=this._depth,this._buffer.normals[c+0]=0,this._buffer.normals[c+1]=0,this._buffer.normals[c+2]=1,this._buffer.uvs[u+0]=o,this._buffer.uvs[u+1]=a,this._buffer.positions[c+3]=i,this._buffer.positions[c+4]=s,this._buffer.positions[c+5]=0,this._buffer.normals[c+3]=0,this._buffer.normals[c+4]=0,this._buffer.normals[c+5]=-1,this._buffer.uvs[u+2]=o,this._buffer.uvs[u+3]=a,this.vertexCache[n]=h,h}buildBevelVert(e,t,n,i=1){let s=`${t.bevelI}:${n}`;if(s in this.vertexCache)return this.vertexCache[s];let[o,a]=t.boundary.vertexIndices[n],l,c,u,h;o!==a?(c=o,l=a,h=!1,u=e.continuous[c]&&e.continuous[l]):(l=o,c=(l-1+e.count)%e.count,h=e.concave[l]&&t.bevelI>0,u=e.continuous[l]||h);let d=Math.cos(t.angle),f=Math.sin(t.angle),p=n*2,m=l*2,v=c*2,g=t.boundary.vertices[p+0],y=t.boundary.vertices[p+1],x=(1-f)*this._bevelSize,b=(g-this._minX)/this._width,w=(y-this._minY)/this._height,_=e.normals[m+0],S=e.normals[m+1],A=e.normals[v+0],T=e.normals[v+1];if(h){let R=A-_,G=T-S;_=_+R*(1-i),S=S+G*(1-i);let B=Math.sqrt(_*_+S*S);_/=B,S/=B}let L=this._buffer.get(u?2:4),C=L*3,U=L*2,P={i:n,fi:l,topP:L+0,topN:L+0,bottomP:L+1,bottomN:L+1};return this._buffer.positions[C+0]=g,this._buffer.positions[C+1]=y,this._buffer.positions[C+2]=this._depth-x,this._buffer.normals[C+0]=_*d,this._buffer.normals[C+1]=S*d,this._buffer.normals[C+2]=f,this._buffer.uvs[U+0]=b,this._buffer.uvs[U+1]=w,this._buffer.positions[C+3]=g,this._buffer.positions[C+4]=y,this._buffer.positions[C+5]=x,this._buffer.normals[C+3]=_*d,this._buffer.normals[C+4]=S*d,this._buffer.normals[C+5]=-f,this._buffer.uvs[U+2]=w,this._buffer.uvs[U+3]=b,u||(L+=2,C+=6,U+=4,P.topP=L+0,P.bottomP=L+1,this._buffer.positions[C+0]=g,this._buffer.positions[C+1]=y,this._buffer.positions[C+2]=this._depth-x,this._buffer.normals[C+0]=A*d,this._buffer.normals[C+1]=T*d,this._buffer.normals[C+2]=f,this._buffer.uvs[U+0]=b,this._buffer.uvs[U+1]=w,this._buffer.positions[C+3]=g,this._buffer.positions[C+4]=y,this._buffer.positions[C+5]=x,this._buffer.normals[C+3]=A*d,this._buffer.normals[C+4]=T*d,this._buffer.normals[C+5]=-f,this._buffer.uvs[U+2]=w,this._buffer.uvs[U+3]=b),this.vertexCache[s]=P,P}};var Pn=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var c,u,h,d,f,p,m;let t=Object.assign({},(c=e==null?void 0:e.parameters)!=null?c:{width:100,subdivisions:40,roundness:0,extrudeDepth:0,surfaceMaxCount:100,extrudeBevelSize:0,extrudeBevelSegments:3},r.parameters),n=Math.abs(t.width),i=Math.abs((u=t.height)!=null?u:t.width),s=Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(h=t.depth)!=null?h:0),o=(d=r.shape)!=null?d:e==null?void 0:e.shape,a=(f=o==null?void 0:o.roundness)!=null?f:t.roundness;o!==void 0&&(o instanceof Lt?(o.width!==n||o.height!==i)&&o.applySize(n,i):o=new Lt(n,i).fromJSON(o),((p=r.parameters)==null?void 0:p.roundness)!==void 0&&((m=r.parameters)==null?void 0:m.roundness)>0&&o.update(!1));let l=o!=null?o:new Lt(n,i);return{parameters:Object.assign(t,{width:n,height:i,depth:s,extrudeDepth:s,roundness:a}),shape:l}}static build(r){let{extrudeDepth:e,extrudeBevelSize:t,extrudeBevelSegments:n,subdivisions:i,roundness:s,surfaceMaxCount:o}=r.parameters;r.shape.roundness=s;let a;return e<=0?a=new Rc(r.shape,i,o):a=new mm(r.shape,e,t,i,n),Object.assign(a,{userData:tt(Ue({},r),{type:"VectorGeometry"})})}};var jx=Math.PI*2,Wx=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var i,s,o;let t=Object.assign({},(i=e==null?void 0:e.parameters)!=null?i:{width:100,depth:0,spikes:128,angle:360,innerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1e3},r.parameters);return{shape:r.shape&&r.shape instanceof Lt?r.shape:new Lt,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(o=t.depth)!=null?o:0)})}}static build(r){let{width:e,height:t,spikes:n,angle:i,innerRadius:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,surfaceMaxCount:c}=r.parameters,u=r.shape,h=e*.5,d=t*.5,f=WL(u,h,d,i*Math.PI/180,n,s);u.isClosed=!0,u.update();let p=Pn.create({shape:u,parameters:{subdivisions:f,surfaceMaxCount:c,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(p,{userData:tt(Ue({},r),{type:"EllipseGeometry"})})}};function WL(r,e,t,n,i,s){if(n>=jx)return i>30||i%4==0?(XL(r,e,t,s),Math.round(i/4)):Jx(r,n,i,e,t,s);let o={x:0,y:t},a=n+Math.PI*.5,l={x:Math.cos(a)*e,y:Math.sin(a)*t},c=Gx({px:o.x,py:o.y,cx:l.x,cy:l.y,rx:e,ry:t,largeArcFlag:n>Math.PI,sweepFlag:!0});return i>30||i%c.length==0?JL(r,o.x,o.y,c,i,e,t,s):Jx(r,n,i,e,t,s)}function JL(r,e,t,n,i,s,o,a){let l=Math.round(i/n.length);r.addPoint($a(e,t));for(let c=0,u=n.length;c<u;c++){let h=n[c],d=r.points[c],f=$a(h.x,h.y);d.controls[1].position.set(h.x1,h.y1),f.controls[0].position.set(h.x2,h.y2),r.addPoint(f)}return a>0?Xx(r,s,o,a):r.addPoint($a(0,0)),l}function Jx(r,e,t,n,i,s){let o=-e/t;for(let a=0;a<=t;a++){let l=o*a,c=Math.sin(l)*n,u=Math.cos(l)*i;r.addPoint($a(c,u))}return e<jx?s>0?Xx(r,n,i,s):r.addPoint($a(0,0)):(r.removePoint(r.points[r.points.length-1]),s>0&&qx(r,n,i,s)),1}function XL(r,e,t,n=0,i=0,s=0){let o=.5522847498,a=e*o,l=t*o;r.addPoint(Bh(i-e,s,i-e,s-l,i-e,s+l)),r.addPoint(Bh(i,s+t,i-a,s+t,i+a,s+t)),r.addPoint(Bh(i+e,s,i+e,s+l,i+e,s-l)),r.addPoint(Bh(i,s-t,i+a,s-t,i-a,s-t)),n>0&&qx(r,e,t,n)}function $a(r,e){return new vs(Ee.generateUUID(),new O(r,e))}function Bh(r,e,t,n,i,s){let o=$a(r,e);return o.controls[0].position.set(t,n),o.controls[1].position.set(i,s),o}function Xx(r,e,t,n){Yx(r,e,t,n).forEach(s=>r.addPoint(s))}function qx(r,e,t,n){let i=Yx(r,e,t,n),s=new Lt;i.forEach(o=>s.addPoint(o)),s.isClosed=!0,r.shapeHoles.push(s)}function Yx(r,e,t,n){let i=n*e/100,s=i*(Math.abs(t)/Math.abs(e)),o=new O(i/e,s/t),a=r.points.map(l=>l.clone()).reverse();return a.forEach(l=>{l.position.multiply(o);let c=l.controls[0].position.clone().multiply(o),u=l.controls[1].position.clone().multiply(o);l.controls[0].position.copy(u),l.controls[1].position.copy(c)}),a}var Kx=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var a,l,c;let t=Object.assign({},(a=e==null?void 0:e.parameters)!=null?a:{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},r.parameters),n=Math.abs(t.width),i=Math.abs((l=t.height)!=null?l:n),s=Math.abs((c=t.depth)!=null?c:n),o=Math.abs(Math.min(n,s))/2;return{parameters:Object.assign(t,{width:n,height:i,depth:s,radius:o,segments:Math.round(t.segments),pathSegments:Math.round(t.pathSegments),cornerSegments:Math.round(t.cornerSegments)})}}static build(r){let{width:e,height:t,depth:n,radius:i,revolutions:s,segments:o,pathRadius:a,pathType:l,pathSegments:c,cornerRadius:u,cornerSegments:h}=r.parameters,d=new Oh(!1,e,t,n,i,s,o,a,l,c,u,h);return Object.assign(d,{userData:tt(Ue({},r),{type:"HelixGeometry"})})}},Oh=class extends we{constructor(e,t,n,i,s,o,a,l,c,u,h,d){super();let f=e&&o===1;f&&(d=0),h>100&&(h=100);let p=()=>new M,m=new M,v=p(),g=p(),y=p(),x,b,w,_,S,A,T,L,C=p(),U=p(),P=p(),R=p(),G=p(),B=p(),j=p(),ne=p(),le=n-2*l+.001,W=le/o,z=Math.ceil(a*o),D=z+1,K=le/z,q=-le/2,ee=u+1,V=2*Math.PI/u,de=Math.PI/2/d,ae=.01,te=Math.min((1-h/100)*l,l-ae),X=l-te,se=0,$=2,H=d*$+$,Q=ee*H/$,ce=Q+ee*D,ie=ee*(D+H),[N,E,Y]=[3,3,2].map(ke=>Array(ie*ke).fill(0)),re=[],ye=s-l;function pe(ke,ht){let ft=Math.PI/2;A=ht*K,L=2*Math.PI*(A%W)/W+ft,A+=q,T=Math.sin(L)*ye,S=Math.cos(L)*ye,e?ke.set(S,T,A):ke.set(S,A,T)}pe(m,-1e-10),pe(v,0),C.copy(m),pe(m,1);let Ie=m.distanceTo(v),ve=X+te,Fe=Ie*z+2*ve,Ce=te,J=Fe-ve;for(let ke=0;ke<=z;ke++){pe(g,ke),ne.subVectors(g,C).normalize(),C.copy(g),B.copy(g).setComponent(+e+1,0).normalize(),j.crossVectors(ne,B).normalize();let ht=ke===0,ft=ke===z,Bn=ht?3*Math.PI/2:de,Mt=ht?Ce:J,Tn=ht?ee:ce,En=ht?0:ie-ee,Di=ne.clone().multiplyScalar(ht?-X:X).add(g),_r=ne.clone().multiplyScalar(ht?-1:1).normalize();for(let xn=0;xn<ee;xn++){let F=xn*V;if(U.addVectors(m.copy(B).multiplyScalar(l*Math.cos(F)),v.copy(j).multiplyScalar(l*Math.sin(F))),P.copy(U).normalize(),ht||ft){f||(se=En+xn,[0,1,2].forEach(Pe=>{N[se*3+Pe]=Di.getComponent(Pe),E[se*3+Pe]=_r.getComponent(Pe)}),Y[se*2]=+ft,Y[se*2+1]=xn/u),v.copy(P).multiplyScalar(te),y.addVectors(g,v);for(let Pe=0;Pe<d;Pe++){let et=Pe*de+Bn;R.addVectors(m.copy(ne).multiplyScalar(X*Math.sin(et)),v.copy(P).multiplyScalar(X*Math.cos(et))),G.copy(R).normalize(),v.addVectors(y,R),R.normalize(),se=Tn+Pe*ee+xn,[0,1,2].forEach(Nn=>{N[se*3+Nn]=v.getComponent(Nn),E[se*3+Nn]=G.getComponent(Nn)});let Ft=+ht+Math.sin(et);Y[se*2]=(Mt+X*Ft)/Fe,Y[se*2+1]=xn/u}}v.addVectors(g,U),se=Q+ke*ee+xn,[0,1,2].forEach(Pe=>{N[se*3+Pe]=v.getComponent(Pe),E[se*3+Pe]=P.getComponent(Pe)}),Y[se*2]=(ve+ke*Ie)/Fe,Y[se*2+1]=xn/u}}let xe=D+2*d+$,he=1,[Ne,Be]=f?[he,he+D-1]:[0,xe-1];for(let ke=Ne;ke<=Be-1;ke++){let ht=f&&ke===Be-1;for(let ft=0;ft<ee-1;ft++)x=ke*ee+ft,b=x+1,w=(ht?ft:x)+ee,_=(ht?ft+1:b)+ee,ke===0?re.push(b,_,w):ke===xe-2?re.push(x,b,w):re.push(x,b,w,b,_,w)}this.setIndex(re),this.setAttribute("position",new ge(N,3)),this.setAttribute("normal",new ge(E,3)),this.setAttribute("uv",new ge(Y,2))}};var Qx=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var n,i,s;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,detail:0,corner:0,cornerSides:4},r.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((i=t.height)!=null?i:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(r){let{width:e,height:t,depth:n,detail:i,corner:s,cornerSides:o}=r.parameters,a=i===0&&s!==0?new Fh(e*.5,s,o):new co(e*.5,i);return a.scale(1,t/e,n/e),Object.assign(a,{userData:tt(Ue({},r),{type:"IcosahedronGeometry"})})}},Fh=class extends Eo{constructor(e=1,t=.2,n=4){let 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],o=[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],a="IcosahedronGeometry";super(s,o,a,e,t,n);this.type=a}static fromJSON(e){return new Fh(e.radius,e.corner,e.cornerSides)}};var Zx=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var n,i,s,o,a;((i=(n=r.parameters)==null?void 0:n.points)!=null?i:[]).forEach(l=>{Array.isArray(l)&&(l.x=l[0],l.y=l[1])});let t=Object.assign({},(s=e==null?void 0:e.parameters)!=null?s:{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},r.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs((a=t.depth)!=null?a:t.width)})}}static build(r){let{points:e,segments:t,verticalSegments:n}=r.parameters,i=new yi;i.moveTo(e[0].x,e[0].y),i.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let s=new uo(i.extractPoints(n).shape,t);return s.rotateZ(Math.PI),Object.assign(s,{userData:tt(Ue({},r),{type:"LatheGeometry"})})}};var fr=new me,gm=new Ke,zh=new M,Co=class extends cn{constructor(){super();this.uuid=Ee.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}applyMatrix4(e){let t=new Dt().getNormalMatrix(e);for(let n=0,i=this.vertices.length;n<i;n++)this.vertices[n].applyMatrix4(e);for(let n=0,i=this.faces.length;n<i;n++){let s=this.faces[n];s.normal.applyMatrix3(t).normalize();for(let o=0,a=s.vertexNormals.length;o<a;o++)s.vertexNormals[o].applyMatrix3(t).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this}rotateX(e){return fr.makeRotationX(e),this.applyMatrix4(fr),this}rotateY(e){return fr.makeRotationY(e),this.applyMatrix4(fr),this}rotateZ(e){return fr.makeRotationZ(e),this.applyMatrix4(fr),this}translate(e,t,n){return fr.makeTranslation(e,t,n),this.applyMatrix4(fr),this}scale(e,t,n){return fr.makeScale(e,t,n),this.applyMatrix4(fr),this}lookAt(e){return gm.lookAt(e),gm.updateMatrix(),this.applyMatrix4(gm.matrix),this}fromBufferGeometry(e){let t=this,n=e.index!==null?e.index:void 0,i=e.attributes;if(i.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;let s=i.position,o=i.normal,a=i.color,l=i.uv,c=i.uv2;c!==void 0&&(this.faceVertexUvs[1]=[]);for(let d=0;d<s.count;d++)t.vertices.push(new M().fromBufferAttribute(s,d)),a!==void 0&&t.colors.push(new fe().fromBufferAttribute(a,d));function u(d,f,p,m){let v=a===void 0?[]:[t.colors[d].clone(),t.colors[f].clone(),t.colors[p].clone()],g=o===void 0?[]:[new M().fromBufferAttribute(o,d),new M().fromBufferAttribute(o,f),new M().fromBufferAttribute(o,p)],y=new Bc(d,f,p,g,v,m);t.faces.push(y),l!==void 0&&t.faceVertexUvs[0].push([new O().fromBufferAttribute(l,d),new O().fromBufferAttribute(l,f),new O().fromBufferAttribute(l,p)]),c!==void 0&&t.faceVertexUvs[1].push([new O().fromBufferAttribute(c,d),new O().fromBufferAttribute(c,f),new O().fromBufferAttribute(c,p)])}let h=e.groups;if(h.length>0)for(let d=0;d<h.length;d++){let f=h[d],p=f.start,m=f.count;for(let v=p,g=p+m;v<g;v+=3)n!==void 0?u(n.getX(v),n.getX(v+1),n.getX(v+2),f.materialIndex):u(v,v+1,v+2,f.materialIndex)}else if(n!==void 0)for(let d=0;d<n.count;d+=3)u(n.getX(d),n.getX(d+1),n.getX(d+2));else for(let d=0;d<s.count;d+=3)u(d,d+1,d+2);return this.computeFaceNormals(),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(zh).negate(),this.translate(zh.x,zh.y,zh.z),this}normalize(){this.computeBoundingSphere();let e=this.boundingSphere.center,t=this.boundingSphere.radius,n=t===0?1:1/t,i=new me;return i.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(i),this}computeFaceNormals(){let e=new M,t=new M;for(let n=0,i=this.faces.length;n<i;n++){let s=this.faces[n],o=this.vertices[s.a],a=this.vertices[s.b],l=this.vertices[s.c];e.subVectors(l,a),t.subVectors(o,a),e.cross(t),e.normalize(),s.normal.copy(e)}}computeVertexNormals(e=!0){let t=new Array(this.vertices.length);for(let n=0,i=this.vertices.length;n<i;n++)t[n]=new M;if(e){let n=new M,i=new M;for(let s=0,o=this.faces.length;s<o;s++){let a=this.faces[s],l=this.vertices[a.a],c=this.vertices[a.b],u=this.vertices[a.c];n.subVectors(u,c),i.subVectors(l,c),n.cross(i),t[a.a].add(n),t[a.b].add(n),t[a.c].add(n)}}else{this.computeFaceNormals();for(let n=0,i=this.faces.length;n<i;n++){let s=this.faces[n];t[s.a].add(s.normal),t[s.b].add(s.normal),t[s.c].add(s.normal)}}for(let n=0,i=this.vertices.length;n<i;n++)t[n].normalize();for(let n=0,i=this.faces.length;n<i;n++){let s=this.faces[n],o=s.vertexNormals;o.length===3?(o[0].copy(t[s.a]),o[1].copy(t[s.b]),o[2].copy(t[s.c])):(o[0]=t[s.a].clone(),o[1]=t[s.b].clone(),o[2]=t[s.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeFlatVertexNormals(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let n=this.faces[e],i=n.vertexNormals;i.length===3?(i[0].copy(n.normal),i[1].copy(n.normal),i[2].copy(n.normal)):(i[0]=n.normal.clone(),i[1]=n.normal.clone(),i[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let t=0,n=this.faces.length;t<n;t++){let i=this.faces[t];i.__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]);for(let s=0,o=i.vertexNormals.length;s<o;s++)i.__originalVertexNormals[s]?i.__originalVertexNormals[s].copy(i.vertexNormals[s]):i.__originalVertexNormals[s]=i.vertexNormals[s].clone()}let e=new Co;e.faces=this.faces;for(let t=0,n=this.morphTargets.length;t<n;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];let s=this.morphNormals[t].faceNormals,o=this.morphNormals[t].vertexNormals;for(let a=0,l=this.faces.length;a<l;a++){let c=new M,u={a:new M,b:new M,c:new M};s.push(c),o.push(u)}}let i=this.morphNormals[t];e.vertices=this.morphTargets[t].vertices,e.computeFaceNormals(),e.computeVertexNormals();for(let s=0,o=this.faces.length;s<o;s++){let a=this.faces[s],l=i.faceNormals[s],c=i.vertexNormals[s];l.copy(a.normal),c.a.copy(a.vertexNormals[0]),c.b.copy(a.vertexNormals[1]),c.c.copy(a.vertexNormals[2])}}for(let t=0,n=this.faces.length;t<n;t++){let i=this.faces[t];i.normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals}}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new tn),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ti),this.boundingSphere.setFromPoints(this.vertices)}merge(e,t,n=0){if(!(e&&e.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);return}let i,s=this.vertices.length,o=this.vertices,a=e.vertices,l=this.faces,c=e.faces,u=this.colors,h=e.colors;t!==void 0&&(i=new Dt().getNormalMatrix(t));for(let d=0,f=a.length;d<f;d++){let m=a[d].clone();t!==void 0&&m.applyMatrix4(t),o.push(m)}for(let d=0,f=h.length;d<f;d++)u.push(h[d].clone());for(let d=0,f=c.length;d<f;d++){let p=c[d],m,v,g=p.vertexNormals,y=p.vertexColors,x=new Bc(p.a+s,p.b+s,p.c+s);x.normal.copy(p.normal),i!==void 0&&x.normal.applyMatrix3(i).normalize();for(let b=0,w=g.length;b<w;b++)m=g[b].clone(),i!==void 0&&m.applyMatrix3(i).normalize(),x.vertexNormals.push(m);x.color.copy(p.color);for(let b=0,w=y.length;b<w;b++)v=y[b],x.vertexColors.push(v.clone());x.materialIndex=p.materialIndex+n,l.push(x)}for(let d=0,f=e.faceVertexUvs.length;d<f;d++){let p=e.faceVertexUvs[d];this.faceVertexUvs[d]===void 0&&(this.faceVertexUvs[d]=[]);for(let m=0,v=p.length;m<v;m++){let g=p[m],y=[];for(let x=0,b=g.length;x<b;x++)y.push(g[x].clone());this.faceVertexUvs[d].push(y)}}}mergeMesh(e){if(!(e&&e.isMesh)){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)}mergeVertices(e=4){let t={},n=[],i=[],s=Math.pow(10,e);for(let l=0,c=this.vertices.length;l<c;l++){let u=this.vertices[l],h=Math.round(u.x*s)+"_"+Math.round(u.y*s)+"_"+Math.round(u.z*s);t[h]===void 0?(t[h]=l,n.push(this.vertices[l]),i[l]=n.length-1):i[l]=i[t[h]]}let o=[];for(let l=0,c=this.faces.length;l<c;l++){let u=this.faces[l];u.a=i[u.a],u.b=i[u.b],u.c=i[u.c];let h=[u.a,u.b,u.c];for(let d=0;d<3;d++)if(h[d]===h[(d+1)%3]){o.push(l);break}}for(let l=o.length-1;l>=0;l--){let c=o[l];this.faces.splice(c,1);for(let u=0,h=this.faceVertexUvs.length;u<h;u++)this.faceVertexUvs[u].splice(c,1)}let a=this.vertices.length-n.length;return this.vertices=n,a}setFromPoints(e){this.vertices=[];for(let t=0,n=e.length;t<n;t++){let i=e[t];this.vertices.push(new M(i.x,i.y,i.z||0))}return this}sortFacesByMaterialIndex(){let e=this.faces,t=e.length;for(let l=0;l<t;l++)e[l]._id=l;function n(l,c){return l.materialIndex-c.materialIndex}e.sort(n);let i=this.faceVertexUvs[0],s=this.faceVertexUvs[1],o,a;i&&i.length===t&&(o=[]),s&&s.length===t&&(a=[]);for(let l=0;l<t;l++){let c=e[l]._id;o&&o.push(i[c]),a&&a.push(s[c])}o&&(this.faceVertexUvs[0]=o),a&&(this.faceVertexUvs[1]=a)}toJSON(){let e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),this.parameters!==void 0){let p=this.parameters;for(let m in p)p[m]!==void 0&&(e[m]=p[m]);return e}let t=[];for(let p=0;p<this.vertices.length;p++){let m=this.vertices[p];t.push(m.x,m.y,m.z)}let n=[],i=[],s={},o=[],a={},l=[],c={};for(let p=0;p<this.faces.length;p++){let m=this.faces[p],v=!0,g=!1,y=this.faceVertexUvs[0][p]!==void 0,x=m.normal.length()>0,b=m.vertexNormals.length>0,w=m.color.r!==1||m.color.g!==1||m.color.b!==1,_=m.vertexColors.length>0,S=0;if(S=u(S,0,0),S=u(S,1,v),S=u(S,2,g),S=u(S,3,y),S=u(S,4,x),S=u(S,5,b),S=u(S,6,w),S=u(S,7,_),n.push(S),n.push(m.a,m.b,m.c),n.push(m.materialIndex),y){let A=this.faceVertexUvs[0][p];n.push(f(A[0]),f(A[1]),f(A[2]))}if(x&&n.push(h(m.normal)),b){let A=m.vertexNormals;n.push(h(A[0]),h(A[1]),h(A[2]))}if(w&&n.push(d(m.color)),_){let A=m.vertexColors;n.push(d(A[0]),d(A[1]),d(A[2]))}}function u(p,m,v){return v?p|1<<m:p&~(1<<m)}function h(p){let m=p.x.toString()+p.y.toString()+p.z.toString();return s[m]!==void 0||(s[m]=i.length/3,i.push(p.x,p.y,p.z)),s[m]}function d(p){let m=p.r.toString()+p.g.toString()+p.b.toString();return a[m]!==void 0||(a[m]=o.length,o.push(p.getHex())),a[m]}function f(p){let m=p.x.toString()+p.y.toString();return c[m]!==void 0||(c[m]=l.length/2,l.push(p.x,p.y)),c[m]}return e.data={},e.data.vertices=t,e.data.normals=i,o.length>0&&(e.data.colors=o),l.length>0&&(e.data.uvs=[l]),e.data.faces=n,e}clone(){return new Co().copy(this)}copy(e){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;let t=e.vertices;for(let d=0,f=t.length;d<f;d++)this.vertices.push(t[d].clone());let n=e.colors;for(let d=0,f=n.length;d<f;d++)this.colors.push(n[d].clone());let i=e.faces;for(let d=0,f=i.length;d<f;d++)this.faces.push(i[d].clone());for(let d=0,f=e.faceVertexUvs.length;d<f;d++){let p=e.faceVertexUvs[d];this.faceVertexUvs[d]===void 0&&(this.faceVertexUvs[d]=[]);for(let m=0,v=p.length;m<v;m++){let g=p[m],y=[];for(let x=0,b=g.length;x<b;x++){let w=g[x];y.push(w.clone())}this.faceVertexUvs[d].push(y)}}let s=e.morphTargets;for(let d=0,f=s.length;d<f;d++){let p={};if(p.name=s[d].name,s[d].vertices!==void 0){p.vertices=[];for(let m=0,v=s[d].vertices.length;m<v;m++)p.vertices.push(s[d].vertices[m].clone())}if(s[d].normals!==void 0){p.normals=[];for(let m=0,v=s[d].normals.length;m<v;m++)p.normals.push(s[d].normals[m].clone())}this.morphTargets.push(p)}let o=e.morphNormals;for(let d=0,f=o.length;d<f;d++){let p={};if(o[d].vertexNormals!==void 0){p.vertexNormals=[];for(let m=0,v=o[d].vertexNormals.length;m<v;m++){let g=o[d].vertexNormals[m],y={};y.a=g.a.clone(),y.b=g.b.clone(),y.c=g.c.clone(),p.vertexNormals.push(y)}}if(o[d].faceNormals!==void 0){p.faceNormals=[];for(let m=0,v=o[d].faceNormals.length;m<v;m++)p.faceNormals.push(o[d].faceNormals[m].clone())}this.morphNormals.push(p)}let a=e.skinWeights;for(let d=0,f=a.length;d<f;d++)this.skinWeights.push(a[d].clone());let l=e.skinIndices;for(let d=0,f=l.length;d<f;d++)this.skinIndices.push(l[d].clone());let c=e.lineDistances;for(let d=0,f=c.length;d<f;d++)this.lineDistances.push(c[d]);let u=e.boundingBox;u!==null&&(this.boundingBox=u.clone());let h=e.boundingSphere;return h!==null&&(this.boundingSphere=h.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this}toBufferGeometry(){let e=new $x().fromGeometry(this),t=new we,n=new Float32Array(e.vertices.length*3);if(t.setAttribute("position",new Re(n,3).copyVector3sArray(e.vertices)),e.normals.length>0){let i=new Float32Array(e.normals.length*3);t.setAttribute("normal",new Re(i,3).copyVector3sArray(e.normals))}if(e.colors.length>0){let i=new Float32Array(e.colors.length*3);t.setAttribute("color",new Re(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){let i=new Float32Array(e.uvs.length*2);t.setAttribute("uv",new Re(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){let i=new Float32Array(e.uvs2.length*2);t.setAttribute("uv2",new Re(i,2).copyVector2sArray(e.uvs2))}t.groups=e.groups;for(let i in e.morphTargets){let s=[],o=e.morphTargets[i];for(let a=0,l=o.length;a<l;a++){let c=o[a],u=new ge(c.data.length*3,3);u.name=c.name,s.push(u.copyVector3sArray(c.data))}t.morphAttributes[i]=s}if(e.skinIndices.length>0){let i=new ge(e.skinIndices.length*4,4);t.setAttribute("skinIndex",i.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){let i=new ge(e.skinWeights.length*4,4);t.setAttribute("skinWeight",i.copyVector4sArray(e.skinWeights))}return e.boundingSphere!==null&&(t.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(t.boundingBox=e.boundingBox.clone()),t}computeTangents(){console.error("THREE.Geometry: .computeTangents() has been removed.")}computeLineDistances(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}applyMatrix(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}dispose(){this.dispatchEvent({type:"dispose"})}static createBufferGeometryFromObject(e){let t=new we,n=e.geometry;if(e.isPoints||e.isLine){let i=new ge(n.vertices.length*3,3),s=new ge(n.colors.length*3,3);if(t.setAttribute("position",i.copyVector3sArray(n.vertices)),t.setAttribute("color",s.copyColorsArray(n.colors)),n.lineDistances&&n.lineDistances.length===n.vertices.length){let o=new ge(n.lineDistances.length,1);t.setAttribute("lineDistance",o.copyArray(n.lineDistances))}n.boundingSphere!==null&&(t.boundingSphere=n.boundingSphere.clone()),n.boundingBox!==null&&(t.boundingBox=n.boundingBox.clone())}else e.isMesh&&(t=n.toBufferGeometry());return t}};Co.prototype.isGeometry=!0;var $x=class{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){let t=[],n,i,s,o=e.faces;for(i=0;i<o.length;i++){let a=o[i];a.materialIndex!==s&&(s=a.materialIndex,n!==void 0&&(n.count=i*3-n.start,t.push(n)),n={start:i*3,materialIndex:s})}n!==void 0&&(n.count=i*3-n.start,t.push(n)),this.groups=t}fromGeometry(e){let t=e.faces,n=e.vertices,i=e.faceVertexUvs,s=i[0]&&i[0].length>0,o=i[1]&&i[1].length>0,a=e.morphTargets,l=a.length,c;if(l>0){c=[];for(let g=0;g<l;g++)c[g]={name:a[g].name,data:[]};this.morphTargets.position=c}let u=e.morphNormals,h=u.length,d;if(h>0){d=[];for(let g=0;g<h;g++)d[g]={name:u[g].name,data:[]};this.morphTargets.normal=d}let f=e.skinIndices,p=e.skinWeights,m=f.length===n.length,v=p.length===n.length;n.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let g=0;g<t.length;g++){let y=t[g];this.vertices.push(n[y.a],n[y.b],n[y.c]);let x=y.vertexNormals;if(x.length===3)this.normals.push(x[0],x[1],x[2]);else{let w=y.normal;this.normals.push(w,w,w)}let b=y.vertexColors;if(b.length===3)this.colors.push(b[0],b[1],b[2]);else{let w=y.color;this.colors.push(w,w,w)}if(s===!0){let w=i[0][g];w!==void 0?this.uvs.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",g),this.uvs.push(new O,new O,new O))}if(o===!0){let w=i[1][g];w!==void 0?this.uvs2.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",g),this.uvs2.push(new O,new O,new O))}for(let w=0;w<l;w++){let _=a[w].vertices;c[w].data.push(_[y.a],_[y.b],_[y.c])}for(let w=0;w<h;w++){let _=u[w].vertexNormals[g];d[w].data.push(_.a,_.b,_.c)}m&&this.skinIndices.push(f[y.a],f[y.b],f[y.c]),v&&this.skinWeights.push(p[y.a],p[y.b],p[y.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}},Bc=class{constructor(e,t,n,i,s,o=0){this.a=e,this.b=t,this.c=n,this.normal=i&&i.isVector3?i:new M,this.vertexNormals=Array.isArray(i)?i:[],this.color=s&&s.isColor?s:new fe,this.vertexColors=Array.isArray(s)?s:[],this.materialIndex=o}clone(){return new this.constructor().copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}};var qL=["a","b","c"];function YL(r,e){switch(e){case"c":return r.c;case"b":return r.b;case"a":default:return r.a}}function ym(r,e,t){let n=Math.min(r,e),i=Math.max(r,e),s=n+"_"+i;return t.get(s)}function vm(r,e,t,n,i,s){let o=Math.min(r,e),a=Math.max(r,e),l=o+"_"+a,c;if(n.has(l))c=n.get(l);else{let u=t[o],h=t[a];c={a:u,b:h,newEdge:null,faces:[]},n.set(l,c)}c.faces.push(i),s[r].edges.push(c),s[e].edges.push(c)}function KL(r,e,t,n){let i,s,o;for(i=0,s=r.length;i<s;i++)t[i]={edges:[]};for(i=0,s=e.length;i<s;i++)o=e[i],vm(o.a,o.b,r,n,o,t),vm(o.b,o.c,r,n,o,t),vm(o.c,o.a,r,n,o,t)}function Gh(r,e,t,n,i){r.push(new Bc(e,t,n,void 0,void 0,i))}function el(r,e){return Math.abs(e-r)/2+Math.min(r,e)}function Uh(r,e,t,n){r.push([e.clone(),t.clone(),n.clone()])}var xm=class{constructor(e=1){this.subdivisions=e}modify(e){e instanceof we?e=new Co().fromBufferGeometry(e):e=e.clone(),e.mergeVertices();let t=this.subdivisions;for(;t-- >0;)this._smooth(e);return e.computeFaceNormals(),e.computeVertexNormals(),e}_smooth(e){let t=new M,n,i,s,o,a,l=e.vertices,c=e.faces,u=e.faceVertexUvs[0],h=u!==void 0&&u.length>0,d=[],f=new Map;KL(l,c,d,f);let p=[],m,v,g,y,x,b,w;for(let ae of Array.from(f.keys())){for(v=f.get(ae),g=new M,x=3/8,b=1/8,w=v.faces.length,w!=2&&(x=.5,b=0,w!=1),g.addVectors(v.a,v.b).multiplyScalar(x),t.set(0,0,0),o=0;o<w;o++){for(y=v.faces[o],a=0;a<3&&(m=l[YL(y,qL[a])],!(m!==v.a&&m!==v.b));a++);m&&t.add(m)}t.multiplyScalar(b),g.add(t),v.newEdge=p.length,p.push(g)}let _,S,A,T,L,C,U,P=[];for(i=0,s=l.length;i<s;i++){for(C=l[i],L=d[i].edges,n=L.length,n==3?_=3/16:n>3&&(_=3/(8*n)),S=1-n*Number(_),A=_,n<=2&&(n==2?(S=3/4,A=1/8):n==1||n==0),U=C.clone().multiplyScalar(S),t.set(0,0,0),o=0;o<n;o++)T=L[o],m=T.a!==C?T.a:T.b,t.add(m);t.multiplyScalar(Number(A)),U.add(t),P.push(U)}let R=P.concat(p),G=P.length,B,j,ne,le=[],W=[],z,D,K,q,ee=new O,V=new O,de=new O;for(i=0,s=c.length;i<s;i++)y=c[i],B=Number(ym(y.a,y.b,f).newEdge)+G,j=Number(ym(y.b,y.c,f).newEdge)+G,ne=Number(ym(y.c,y.a,f).newEdge)+G,Gh(le,B,j,ne,y.materialIndex),Gh(le,y.a,B,ne,y.materialIndex),Gh(le,y.b,j,B,y.materialIndex),Gh(le,y.c,ne,j,y.materialIndex),h&&(z=u[i],D=z[0],K=z[1],q=z[2],ee.set(el(D.x,K.x),el(D.y,K.y)),V.set(el(K.x,q.x),el(K.y,q.y)),de.set(el(D.x,q.x),el(D.y,q.y)),Uh(W,ee,V,de),Uh(W,D,ee,de),Uh(W,K,V,ee),Uh(W,q,de,V));e.vertices=R,e.faces=le,h&&(e.faceVertexUvs[0]=W)}};var yn=new M,Lo=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var s,o;let t=(o=(s=r.geometry)!=null?s:e==null?void 0:e.geometry)!=null?o:new we().copy(new jn(100,100,100)),n;e===void 0?(t.computeBoundingBox(),t.boundingBox.getSize(yn),n={width:yn.x,height:yn.y,depth:yn.z,subdivisions:0}):n=e.parameters;let i=Ue(Ue({},n),r.parameters);return{parameters:{width:Math.abs(i.width),height:Math.abs(i.height),depth:Math.abs(i.depth),subdivisions:Math.abs(i.subdivisions)},geometry:t}}static build(r){var l;let{width:e,height:t,depth:n,subdivisions:i}=r.parameters,s=(l=r.geometry)!=null?l:new we().copy(new jn(100,100,100)),o=s.userData.parameters;o===void 0?(s.computeBoundingBox(),s.boundingBox.getSize(yn)):yn.set(o.width,o.height,o.depth),(e!==yn.x||t!==yn.y||n!==yn.z)&&s.scale(yn.x===0?1:e/yn.x,yn.y===0?1:t/yn.y,yn.z===0?1:n/yn.z);let a=s.originalGeometry;return i>0?(a===void 0||(o==null?void 0:o.subdivisions)>i)&&(a===void 0&&(a=s),s=new xm(i).modify(a).toBufferGeometry()):(a!==void 0&&(s=a),a=void 0),a!==void 0&&Object.assign(s,{originalGeometry:a}),delete r.geometry,Object.assign(s,{userData:tt(Ue({},r),{type:"NonParametricGeometry"})})}static loadFromUrl(r,e,t){new Ia(t).load(r,i=>{let s=this.normalizeInputs({geometry:i});i.boundingBox.getSize(yn);let o=100/yn.x;Object.assign(s.parameters,{width:100,height:yn.y*o,depth:yn.z*o}),e(this.build(s))})}};var e0=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var i,s,o,a;let t=Object.assign({},(i=e==null?void 0:e.parameters)!=null?i:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:3},r.parameters);return{shape:r.shape&&r.shape instanceof Lt?r.shape:new Lt,parameters:Object.assign(t,{surfaceMaxCount:((s=t.surfaceMaxCount)!=null?s:t.cornerRadius>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(a=t.depth)!=null?a:0)})}}static build(r){let{width:e,height:t,spikes:n,cornerRadius:i,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a,surfaceMaxCount:l}=r.parameters,c=r.shape,u=e*.5,h=t*.5,d=0,f=0,p=2*Math.PI/n;for(let v=0;v<n;v++){let g=p*v,y=d+Math.sin(g)*u,x=f+Math.cos(g)*h;c.addPoint(c.createPoint(y,x))}c.isClosed=!0;for(let v=0,g=c.points.length;v<g;v++)c.points[v].roundness=i;c.roundness=i,c.update();let m=Pn.create({shape:c,parameters:{surfaceMaxCount:l,roundness:i,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}});return Object.assign(m,{userData:tt(Ue({},r),{type:"PolygonGeometry"})})}};var t0=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var n,i,s;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},r.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((i=t.height)!=null?i:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(r){let{width:e,height:t,depth:n,radialSegments:i,heightSegments:s,openEnded:o,cornerRadius:a,cornerSegments:l}=r.parameters,c=new n0(e*.5,t,i,s,o,a,l);return c.scale(1,1,n/e),Object.assign(c,{userData:tt(Ue({},r),{type:"PyramidGeometry"})})}};function Oc(r,e,t){t.x=r.x*e.x,t.y=r.y,t.z=r.x*e.y}function bm(r,e,t,n,i,s){let o=e.clone().sub(r),a=t.clone().sub(r),l=o.angleTo(a);if(o.normalize(),a.normalize(),n===i){let c=o.add(a).normalize();s.copy(r).addScaledVector(c,n/Math.sin(l/2))}else{let c=o.angleTo(a);s.copy(r),s.addScaledVector(o,i/Math.sin(c)),s.addScaledVector(a,n/Math.sin(c))}}function QL(r,e,t){let n=r.clone().sub(e),i=t.clone().sub(e);return n.projectOnVector(i),n.add(e)}var n0=class extends we{constructor(e=.5,t=1,n=4,i=1,s=!1,o=0,a=4){super();n=Math.floor(Math.max(3,n)),i=Math.floor(i),a=Math.floor(a);let l=[],c=[],u=[],h=[],d=0,f=t/2,p=Math.PI/n,m=e*Math.cos(Math.PI/n),v=2*Math.PI/n,g=(n-2)*Math.PI/n,y=Math.PI-g,x=new M(0,-f,0),b=new M(0,f,0),w=new O(e,-f),_=new O(m,-f),S=new O(0,b.y).sub(_),A=new O(0,b.y).sub(w),T=new O(S.y,-S.x).normalize(),L=new O(A.y,-A.x).normalize(),U=e*Math.cos(Math.PI/n)*Math.tan((Math.PI-S.angle())/2)-1e-8;o=Math.min(o,U);let P;{let W=new M(T.x,T.y,0),z=new M(Math.cos(v)*W.x,W.y,Math.sin(v)*W.x);P=W.angleTo(z)}let R=o/Math.tan((Math.PI-S.angle())/2),G=o/Math.tan((Math.PI-P)/2),B=new M;if(!s){c.push(x.x,x.y,x.z),u.push(0,-1,0),h.push(0,0);let W=d++,z=[],D=w.clone(),K=R/Math.cos(Math.PI/n);D.x-=K;for(let q=0;q<n;q++){let ee=q/n*Math.PI*2+p,V=new O(Math.sin(ee),Math.cos(ee));Oc(D,V,B),c.push(B.x,B.y,B.z),u.push(0,-1,0),h.push(0,0),z.push(d++)}for(let q=0;q<z.length;q++)l.push(z[q],W,z[(q+1)%z.length])}let j=[];{let W=new M,z=new M,D=new M,K=new M,q=new M,ee=new M;for(let V=0;V<n;V++){let de=V/n*Math.PI*2+p,ae=(V+.5)/n*Math.PI*2+p,te=(V+1)/n*Math.PI*2+p,X=new O(Math.sin(de),Math.cos(de)),se=new O(Math.sin(ae),Math.cos(ae)),$=new O(Math.sin(te),Math.cos(te));Oc(w,X,z),Oc(w,$,D),Oc(T,se,W),bm(b,z,D,G,G,K),c.push(K.x,K.y,K.z),bm(z,b,D,G,R,q),c.push(q.x,q.y,q.z),bm(D,z,b,R,G,ee),c.push(ee.x,ee.y,ee.z),u.push(W.x,W.y,W.z),u.push(W.x,W.y,W.z),u.push(W.x,W.y,W.z),h.push(0,0),h.push(0,0),h.push(0,0);let H=d++,Q=d++,ce=d++;if(l.push(H,Q,ce),o>0){{let E=z.clone().add(D).multiplyScalar(.5),Y=b.clone().sub(E).normalize(),ye=x.clone().sub(E).normalize().add(Y).normalize().multiplyScalar(-1),pe=ee.clone().sub(q);ne(E,pe,ye,S.angle())}let ie,N;{let E=new M;Oc(L,$,E);let Y=ee.clone().add(K).multiplyScalar(.5);Y=QL(Y,D,b);let re=ee.clone().sub(K);[ie,N]=ne(Y,re,E,P,K.y)}{let E=ie,Y=E.clone().setY(0).normalize(),re=new M(0,-1,0),ye=Y.clone().cross(re);le(E,Y,re,ye)}j.concat(N);{let E=S.angle(),Y=Math.PI-E,re=b.clone();re.y-=o/Math.sin(E-Math.PI/2);let ye=new M,pe=[];for(let ve=0;ve<a;ve++){let Fe=[],Ce=Math.PI/2-Y*ve/a,J=Math.cos(Ce),xe=Math.sin(Ce),he=ae;for(let Ne=0;Ne<=ve;Ne++){let Be=Math.cos(he),ke=Math.sin(he);W.x=J*ke,W.y=xe,W.z=J*Be,ye.copy(re).addScaledVector(W,o),c.push(ye.x,ye.y,ye.z),u.push(W.x,W.y,W.z),h.push(0,0),Fe.push(d++),he+=Math.PI*2/ve/n}pe.push(Fe)}N.reverse(),pe.push(N);let Ie=pe.length-1;for(let ve=0;ve<Ie;ve++){let Fe=pe[ve],Ce=pe[ve+1],J=Fe.length-1;l.push(Ce[1],Fe[0],Ce[0]);for(let xe=1;xe<=J;xe++)l.push(Fe[xe],Fe[xe-1],Ce[xe]),l.push(Ce[xe+1],Fe[xe],Ce[xe])}}}}}this.setIndex(l),this.setAttribute("position",new ge(c,3)),this.setAttribute("normal",new ge(u,3)),this.setAttribute("uv",new ge(h,2));function ne(W,z,D,K,q){let ee=-K/2,V=(Math.PI-K)/2,de=z.clone().normalize().cross(D);W.addScaledVector(D,-o/Math.sin(V));let ae=new M,te=new M,X=1,se=d,$=[];for(let H=0;H<=a;H++){let Q=ee+H/a*K;te.set(0,0,0),te.addScaledVector(de,Math.sin(Q)),te.addScaledVector(D,Math.cos(Q));for(let ce=0;ce<=X;ce++){let ie=ce/X-.5;if(ae.copy(W),ae.addScaledVector(z,ie),ae.addScaledVector(te,o),q!=null){let N=Math.max(0,ae.y-q);ae.addScaledVector(z,-N/z.y)}c.push(ae.x,ae.y,ae.z),u.push(te.x,te.y,te.z),h.push(0,0),ce===0&&$.push(d),d++}}for(let H=0;H<a;H++)for(let Q=0;Q<X;Q++){let ce=se+Q+(X+1)*H,ie=ce+(X+1),N=ie+1,E=ce+1;l.push(ce,ie,E),l.push(ie,N,E)}return[W.clone().addScaledVector(z,.5),$]}function le(W,z,D,K){let q=Math.PI/2,ee=A.angle()-q,V=[],de=new M,ae=new M;for(let X=0;X<=a;X++){let se=[],$=X/a;for(let H=0;H<=X;H++){let ce=((X?H/X:0)-.5)*y,ie=Math.cos(ce),N=Math.sin(ce),E=Math.atan(Math.tan(ee)*ie),Y=(q+E)*$,re=Math.cos(Y),ye=Math.sin(Y);de.set(0,0,0),de.addScaledVector(z,ye*ie),de.addScaledVector(D,re),de.addScaledVector(K,ye*N),ae.copy(W).addScaledVector(de,o),c.push(ae.x,ae.y,ae.z),u.push(de.x,de.y,de.z),h.push(0,0),se.push(d++)}V.push(se)}let te=V.length-1;for(let X=0;X<te;X++){let se=V[X],$=V[X+1],H=se.length-1;l.push(se[0],$[1],$[0]);for(let Q=1;Q<=H;Q++)l.push(se[Q-1],se[Q],$[Q]),l.push(se[Q],$[Q+1],$[Q])}}}};var kh=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var o,a,l,c,u;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},r.parameters),n=Object.assign((a=e==null?void 0:e.ui)!=null?a:{enabledIndieCorners:!1},r.ui),i=t.cornerRadius.reduce((h,d)=>h+d,0);return{shape:r.shape&&r.shape instanceof Lt?r.shape:new Lt,parameters:Object.assign(t,{surfaceMaxCount:((l=t.surfaceMaxCount)!=null?l:i>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((c=t.height)!=null?c:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(u=t.depth)!=null?u:0)}),ui:n}}static build(r){let e=r.shape,{width:t,height:n,cornerRadius:i,cornerType:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,surfaceMaxCount:c}=r.parameters,u={x:t*.5,y:n*.5},h={x:-u.x,y:-u.y},d={x:u.x,y:u.y};function f(w,_,S){return _>t&&S>n?Math.min(w*t/_,w*n/S):_>t?w*t/_:S>n?w*n/S:w}let p=[];p[0]=i[0]===0?0:f(i[0],i[0]+i[3],i[0]+i[1]),p[1]=i[1]===0?0:f(i[1],i[1]+i[2],i[1]+i[0]),p[2]=i[2]===0?0:f(i[2],i[2]+i[1],i[2]+i[3]),p[3]=i[3]===0?0:f(i[3],i[3]+i[0],i[3]+i[2]);let m=h.x,v=d.x,g=d.y,y=h.y;e.addPoint(e.createPoint(m,g)),e.addPoint(e.createPoint(v,g)),e.addPoint(e.createPoint(v,y)),e.addPoint(e.createPoint(m,y)),e.isClosed=!0;let x=!0;for(let w=0,_=e.points.length;w<_;w++)e.points[w].roundness=p[w],w>0&&p[w]!==p[w-1]&&(x=!1);x&&(e.roundness=p[0]),e.useCubicForRoundedCorners=s!==1,e.update();let b=Pn.create({shape:e,parameters:{surfaceMaxCount:c,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(b,{userData:tt(Ue({},r),{type:"RectangleGeometry"})})}};var i0=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var n,i,s;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:Math.PI},r.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((i=t.height)!=null?i:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(r){let{width:e=100,height:t=e,depth:n=e,widthSegments:i=64,heightSegments:s=64,phiStart:o,phiLength:a,thetaStart:l,thetaLength:c}=r.parameters,u=new Ji(.5*e,i,s,o,a,l,c);return u.scale(1,t/e,n/e),Object.assign(u,{userData:tt(Ue({},r),{type:"SphereGeometry"})})}};var r0=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var i,s,o,a;let t=Object.assign({},(i=e==null?void 0:e.parameters)!=null?i:{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},r.parameters);return{shape:r.shape&&r.shape instanceof Lt?r.shape:new Lt,parameters:Object.assign(t,{surfaceMaxCount:((s=t.surfaceMaxCount)!=null?s:t.cornerRadius>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(a=t.depth)!=null?a:0)})}}static build(r){let{width:e,height:t,innerRadiusPercent:n,spikes:i,cornerRadius:s,angle:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c,surfaceMaxCount:u}=r.parameters,h=r.shape,d=e*.5,f=t*.5,p=0,m=0,v=o*Math.PI/360/i,g=Math.PI/2*3*-1,y=d*n/100,x=f*n/100;if(i==3&&n==50){v=2*Math.PI/i;for(let w=0;w<i;w++){let _=v*w,S=p+Math.sin(_)*d,A=m+Math.cos(_)*f;h.addPoint(h.createPoint(S,A))}}else for(let w=0;w<i;w++){let _=p+Math.cos(g)*d,S=m+Math.sin(g)*f;h.addPoint(h.createPoint(_,S)),g+=v,_=p+Math.cos(g)*y,S=m+Math.sin(g)*x,w<=i,h.addPoint(h.createPoint(_,S)),g+=v}h.isClosed=!0;for(let w=0,_=h.points.length;w<_;w++)h.points[w].roundness=s;h.roundness=s,h.update();let b=Pn.create({shape:h,parameters:{surfaceMaxCount:u,roundness:s,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c}});return Object.assign(b,{userData:tt(Ue({},r),{type:"StarGeometry"})})}};var s0=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var n,i,s;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0},r.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((i=t.height)!=null?i:t.width),depth:Math.abs((s=t.depth)!=null?s:0)})}}static build(r){let{width:e,height:t}=r.parameters,n=new ls(e,t);return Object.assign(n,{userData:tt(Ue({},r),{type:"TextFrameGeometry"})})}};var o0=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var o,a,l;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,radialSegments:32,tubularSegments:64,arc:Math.PI*2,cornerRadius:30,cornerSegments:8},r.parameters),n=Math.abs(t.width),i=Math.abs((a=t.height)!=null?a:t.width),s=Math.abs((l=t.depth)!=null?l:t.width*.25);return{parameters:Object.assign(t,{width:n,height:i,depth:s})}}static build(r){let{width:e,height:t,depth:n,radialSegments:i,tubularSegments:s,arc:o,cornerRadius:a,cornerSegments:l}=r.parameters,c=ZL(e,t,n,e*.5,o,s,0,0,i,a,l);return c.scale(1,t/e,1),Object.assign(c,{userData:tt(Ue({},r),{type:"TorusGeometry"})})}};function ZL(r,e,t,n,i,s,o,a,l,c,u){return[e,t]=[t,e],o=e/2,i/=2*Math.PI,i==1&&(c=0),new Oh(!0,r,e,t,n,i,s,o,a,l,c,u)}var a0=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var n,i,s;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:1,tube:50,tubularSegments:64,radialSegments:32,p:2,q:3},r.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((i=t.height)!=null?i:t.width),depth:Math.abs((s=t.depth)!=null?s:1)})}}static build(r){let{width:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:o}=r.parameters,a=e*.5-t,l=new ho(a,t,n,i,s,o);return Object.assign(l,{userData:tt(Ue({},r),{type:"TorusKnotGeometry"})})}};var l0=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var i,s,o,a;let t=Object.assign({},(i=e==null?void 0:e.parameters)!=null?i:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},r.parameters);return{shape:r.shape&&r.shape instanceof Lt?r.shape:new Lt,parameters:Object.assign(t,{surfaceMaxCount:((s=t.surfaceMaxCount)!=null?s:t.cornerRadius>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width*(t.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(a=t.depth)!=null?a:0)})}}static build(r){let{width:e=100,height:t,cornerRadius:n,depth:i,extrudeBevelSize:s,extrudeBevelSegments:o,isRect:a,surfaceMaxCount:l}=r.parameters,c=r.shape,u=e*.5,h=t*.5;a?(c.addPoint(c.createPoint(-u,h)),c.addPoint(c.createPoint(u,-h)),c.addPoint(c.createPoint(-u,-h))):(c.addPoint(c.createPoint(0,h)),c.addPoint(c.createPoint(u,-h)),c.addPoint(c.createPoint(-u,-h))),c.isClosed=!0;for(let f=0,p=c.points.length;f<p;f++)c.points[f].roundness=n;c.roundness=n,c.update();let d=Pn.create({shape:c,parameters:{surfaceMaxCount:l,roundness:n,depth:i,extrudeBevelSize:s,extrudeBevelSegments:o}});return Object.assign(d,{userData:tt(Ue({},r),{type:"TriangleGeometry"})})}};var tl=class{static computeTangents(e){e.computeTangents(),console.warn("THREE.BufferGeometryUtils: .computeTangents() has been removed. Use BufferGeometry.computeTangents() instead.")}static mergeBufferGeometries(e,t=!1){let n=e[0].index!==null,i=new Set(Object.keys(e[0].attributes)),s=new Set(Object.keys(e[0].morphAttributes)),o={},a={},l=e[0].morphTargetsRelative,c=new we,u=0;for(let h=0;h<e.length;++h){let d=e[h],f=0;if(n!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in d.attributes){if(!i.has(p))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;o[p]===void 0&&(o[p]=[]),o[p].push(d.attributes[p]),f++}if(f!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(l!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!s.has(p))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;a[p]===void 0&&(a[p]=[]),a[p].push(d.morphAttributes[p])}if(c.userData.mergedUserData=c.userData.mergedUserData||[],c.userData.mergedUserData.push(d.userData),t){let p;if(n)p=d.index.count;else if(d.attributes.position!==void 0)p=d.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;c.addGroup(u,p,h),u+=p}}if(n){let h=0,d=[];for(let f=0;f<e.length;++f){let p=e[f].index;for(let m=0;m<p.count;++m)d.push(p.getX(m)+h);h+=e[f].attributes.position.count}c.setIndex(d)}for(let h in o){let d=this.mergeBufferAttributes(o[h]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+h+" attribute."),null;c.setAttribute(h,d)}for(let h in a){let d=a[h][0].length;if(d===0)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[h]=[];for(let f=0;f<d;++f){let p=[];for(let v=0;v<a[h].length;++v)p.push(a[h][v][f]);let m=this.mergeBufferAttributes(p);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+h+" morphAttribute."),null;c.morphAttributes[h].push(m)}}return c}static mergeBufferAttributes(e){let t,n,i,s=0;for(let l=0;l<e.length;++l){let c=e[l];if(c.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(t===void 0&&(t=c.array.constructor),t!==c.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(n===void 0&&(n=c.itemSize),n!==c.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=c.normalized),i!==c.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;s+=c.array.length}let o=new t(s),a=0;for(let l=0;l<e.length;++l)o.set(e[l].array,a),a+=e[l].array.length;return new Re(o,n,i)}static interleaveAttributes(e){let t,n=0,i=0;for(let u=0,h=e.length;u<h;++u){let d=e[u];if(t===void 0&&(t=d.array.constructor),t!==d.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;n+=d.array.length,i+=d.itemSize}let s=new Vi(new t(n),i),o=0,a=[],l=["getX","getY","getZ","getW"],c=["setX","setY","setZ","setW"];for(let u=0,h=e.length;u<h;u++){let d=e[u],f=d.itemSize,p=d.count,m=new Ti(s,f,o,d.normalized);a.push(m),o+=f;for(let v=0;v<p;v++)for(let g=0;g<f;g++)m[c[g]](v,d[l[g]](v))}return a}static estimateBytesUsed(e){let t=0;for(let i in e.attributes){let s=e.getAttribute(i);t+=s.count*s.itemSize*s.array.BYTES_PER_ELEMENT}let n=e.getIndex();return t+=n?n.count*n.itemSize*n.array.BYTES_PER_ELEMENT:0,t}static mergeVertices(e,t=1e-4){t=Math.max(t,Number.EPSILON);let n={},i=e.getIndex(),s=e.getAttribute("position"),o=i?i.count:s.count,a=0,l=Object.keys(e.attributes),c={},u={},h=[],d=["getX","getY","getZ","getW"];for(let v=0,g=l.length;v<g;v++){let y=l[v];c[y]=[];let x=e.morphAttributes[y];x&&(u[y]=new Array(x.length).fill().map(()=>[]))}let f=Math.log10(1/t),p=Math.pow(10,f);for(let v=0;v<o;v++){let g=i?i.getX(v):v,y="";for(let x=0,b=l.length;x<b;x++){let w=l[x],_=e.getAttribute(w),S=_.itemSize;for(let A=0;A<S;A++)y+=`${~~(_[d[A]](g)*p)},`}if(y in n)h.push(n[y]);else{for(let x=0,b=l.length;x<b;x++){let w=l[x],_=e.getAttribute(w),S=e.morphAttributes[w],A=_.itemSize,T=c[w],L=u[w];for(let C=0;C<A;C++){let U=d[C];if(T.push(_[U](g)),S)for(let P=0,R=S.length;P<R;P++)L[P].push(S[P][U](g))}}n[y]=a,h.push(a),a++}}let m=e.clone();for(let v=0,g=l.length;v<g;v++){let y=l[v],x=e.getAttribute(y),b=new x.array.constructor(c[y]),w=new Re(b,x.itemSize,x.normalized);if(m.setAttribute(y,w),y in u)for(let _=0;_<u[y].length;_++){let S=e.morphAttributes[y][_],A=new S.array.constructor(u[y][_]),T=new Re(A,S.itemSize,S.normalized);m.morphAttributes[y][_]=T}}return m.setIndex(h),m}static toTrianglesDrawMode(e,t){if(t===ef)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===Ko||t===Su){let n=e.getIndex();if(n===null){let a=[],l=e.getAttribute("position");if(l!==void 0){for(let c=0;c<l.count;c++)a.push(c);e.setIndex(a),n=e.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e}let i=n.count-2,s=[];if(t===Ko)for(let a=1;a<=i;a++)s.push(n.getX(0)),s.push(n.getX(a)),s.push(n.getX(a+1));else for(let a=0;a<i;a++)a%2==0?(s.push(n.getX(a)),s.push(n.getX(a+1)),s.push(n.getX(a+2))):(s.push(n.getX(a+2)),s.push(n.getX(a+1)),s.push(n.getX(a)));s.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let o=e.clone();return o.setIndex(s),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}static computeMorphedAttributes(e){if(e.geometry.isBufferGeometry!==!0)return console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry."),null;let t=new M,n=new M,i=new M,s=new M,o=new M,a=new M,l=new M,c=new M,u=new M;function h(z,D,K,q,ee,V,de,ae,te){t.fromBufferAttribute(K,V),n.fromBufferAttribute(K,de),i.fromBufferAttribute(K,ae);let X=z.morphTargetInfluences;if(D.morphTargets&&q&&X){l.set(0,0,0),c.set(0,0,0),u.set(0,0,0);for(let se=0,$=q.length;se<$;se++){let H=X[se],Q=q[se];H!==0&&(s.fromBufferAttribute(Q,V),o.fromBufferAttribute(Q,de),a.fromBufferAttribute(Q,ae),ee?(l.addScaledVector(s,H),c.addScaledVector(o,H),u.addScaledVector(a,H)):(l.addScaledVector(s.sub(t),H),c.addScaledVector(o.sub(n),H),u.addScaledVector(a.sub(i),H)))}t.add(l),n.add(c),i.add(u)}z.isSkinnedMesh&&(z.boneTransform(V,t),z.boneTransform(de,n),z.boneTransform(ae,i)),te[V*3+0]=t.x,te[V*3+1]=t.y,te[V*3+2]=t.z,te[de*3+0]=n.x,te[de*3+1]=n.y,te[de*3+2]=n.z,te[ae*3+0]=i.x,te[ae*3+1]=i.y,te[ae*3+2]=i.z}let d=e.geometry,f=e.material,p,m,v,g=d.index,y=d.attributes.position,x=d.morphAttributes.position,b=d.morphTargetsRelative,w=d.attributes.normal,_=d.morphAttributes.position,S=d.groups,A=d.drawRange,T,L,C,U,P,R,G,B,j=new Float32Array(y.count*y.itemSize),ne=new Float32Array(w.count*w.itemSize);if(g!==null)if(Array.isArray(f))for(T=0,C=S.length;T<C;T++)for(P=S[T],R=f[P.materialIndex],G=Math.max(P.start,A.start),B=Math.min(P.start+P.count,A.start+A.count),L=G,U=B;L<U;L+=3)p=g.getX(L),m=g.getX(L+1),v=g.getX(L+2),h(e,R,y,x,b,p,m,v,j),h(e,R,w,_,b,p,m,v,ne);else for(G=Math.max(0,A.start),B=Math.min(g.count,A.start+A.count),T=G,C=B;T<C;T+=3)p=g.getX(T),m=g.getX(T+1),v=g.getX(T+2),h(e,f,y,x,b,p,m,v,j),h(e,f,w,_,b,p,m,v,ne);else if(y!==void 0)if(Array.isArray(f))for(T=0,C=S.length;T<C;T++)for(P=S[T],R=f[P.materialIndex],G=Math.max(P.start,A.start),B=Math.min(P.start+P.count,A.start+A.count),L=G,U=B;L<U;L+=3)p=L,m=L+1,v=L+2,h(e,R,y,x,b,p,m,v,j),h(e,R,w,_,b,p,m,v,ne);else for(G=Math.max(0,A.start),B=Math.min(y.count,A.start+A.count),T=G,C=B;T<C;T+=3)p=T,m=T+1,v=T+2,h(e,f,y,x,b,p,m,v,j),h(e,f,w,_,b,p,m,v,ne);let le=new ge(j,3),W=new ge(ne,3);return{positionAttribute:y,normalAttribute:w,morphedPositionAttribute:le,morphedNormalAttribute:W}}};var $L,c0=new Promise(r=>{$L=r});var ot;c0.then(r=>{ot=r});var Fc=new M,pr=new M,zc=new me;function u0(r,...e){let t=0;for(let s of e)t+=s.length;let n=new r(t),i=0;for(let s of e)n.set(s,i),i+=s.length;return n}var nl,Qn=(nl=class{static create(r){return this.build(this.normalizeInputs(r))}static normalizeInputs(r,e){var a,l;let t=(a=r.geometry)!=null?a:e==null?void 0:e.geometry,{width:n,height:i,depth:s}=t.userData.parameters,o=Ue(Ue({},(l=e==null?void 0:e.parameters)!=null?l:{width:n,height:i,depth:s,subdivisions:1}),r.parameters);return{parameters:tt(Ue({},o),{width:Math.abs(o.width),height:Math.abs(o.height),depth:Math.abs(o.depth)}),geometry:t,subdivPointer:e==null?void 0:e.subdivPointer,smoothShading:e==null?void 0:e.smoothShading}}static build(r){let e=r.geometry,t=r.geometry.originalGeometry,{width:n,height:i,depth:s,subdivisions:o}=r.parameters,a=e.userData.parameters;Fc.set(a.width,a.height,a.depth),(n!==Fc.x||i!==Fc.y||s!==Fc.z)&&(pr.set(n,i,s).divide(Fc),zc.makeScale(isNaN(pr.x)||pr.x===0?1:pr.x,isNaN(pr.y)||pr.y===0?1:pr.y,isNaN(pr.z)||pr.z===0?1:pr.z),e.applyMatrix4(zc),t?(t.applyMatrix4(zc),t.getAttribute("positionWASM").applyMatrix4(zc)):e.getAttribute("positionWASM").applyMatrix4(zc));let l,c;return t!==void 0?(c=e,l=t):l=e,r.subdivPointer===void 0&&(this.allocate(l),l==null||l.dispose(),l=this.buildLevel(!0,r.smoothShading),l.computeBoundingSphere(),r.subdivPointer=this.activeSubdivPtr,this.getTopologicalMesh(l)),o>0?((o!==(a==null?void 0:a.subdivisions)||t===void 0)&&(r.subdivPointer!==this.activeSubdivPtr&&(this.activeSubdivPtr=r.subdivPointer),c==null||c.dispose(),ot.set_destination_refinement_level(r.subdivPointer,o),c=this.buildLevel(!1,r.smoothShading),c.boundingSphere=l.boundingSphere),e=c,t=l,delete t.userData.parameters):(e=l,c==null||c.dispose(),t=void 0),Object.assign(e,{originalGeometry:t,subdivPointer:this.activeSubdivPtr,userData:{parameters:r.parameters,type:"SubdivGeometry"}})}static allocate(r){var x;let e,t,n,i=[],s=[];if(r.userData.type!=="SubdivGeometry"){let b=tl.mergeVertices(r,(x=this.mergeVerticesToleranceExceptions[r.userData.type])!=null?x:1.1);e=b.attributes.position.array;let w=b.getIndex().array,_=w.length;switch(r.userData.type){case"TorusGeometry":case"TorusKnotGeometry":case"CubeGeometry":t=new Uint32Array(_/3*2),n=new Uint8Array(_/6).fill(4);for(let U=0,P=0;U<_;U+=6)t[P++]=w[U],t[P++]=w[U+1],t[P++]=w[U+4],t[P++]=w[U+5];break;case"SphereGeometry":case"HelixGeometry":case"CylinderGeometry":case"ConeGeometry":let S,A;if(r.userData.type==="SphereGeometry")A=r.parameters.heightSegments,S=r.parameters.widthSegments;else if(r.userData.type==="CylinderGeometry")A=r.parameters.heightSegments+2,S=r.parameters.radialSegments;else if(r.userData.type==="ConeGeometry")A=r.parameters.heightSegments+1,S=r.parameters.radialSegments;else{let{pathSegments:U,segments:P,revolutions:R}=r.userData.parameters;A=Math.ceil(P*R)+2,S=U}t=new Uint32Array(2*S*3+(A-2)*S*4),n=new Uint8Array(2*S+(A-2)*S);let T=0,L=0,C=0;if(r.userData.type==="SphereGeometry"||r.userData.type==="HelixGeometry"){for(;L<3*S;)t[L++]=w[T++],t[L++]=w[T++],t[L++]=w[T++],n[C++]=3;for(;L<3*S+4*(A-2)*S;T+=6)t[L++]=w[T],t[L++]=w[T+1],t[L++]=w[T+4],t[L++]=w[T+5],n[C++]=4}else for(;L<4*(A-2)*S;T+=6)t[L++]=w[T],t[L++]=w[T+1],t[L++]=w[T+4],t[L++]=w[T+5],n[C++]=4;for(;L<t.length;)t[L++]=w[T++],t[L++]=w[T++],t[L++]=w[T++],n[C++]=3;break;default:t=w,n=new Uint8Array(_/3).fill(3);break}}else if(r.getAttribute("positionWASM")!==void 0)e=r.getAttribute("positionWASM").array,t=r.getAttribute("indexWASM").array,n=r.getAttribute("verticesPerFaceWASM").array;else{let b=r.getAttribute("faceMap");r.deleteAttribute("faceMap");let w=tl.mergeVertices(r,2);r.setAttribute("faceMap",b),e=w.attributes.position.array;let _=[],S=b.array;n=new Uint8Array(S[S.length-1]+1).fill(3);let A=w.getIndex().array;for(let T=0,L=S.length;T<L;)S[T]===S[T+1]?(n[S[T]]++,_.push(...new Set(A.slice(3*T,3*T+6))),T+=2):(_.push(...A.slice(3*T,3*T+3)),T++);t=new Uint32Array(_)}let o=e.length,a=t.length,l=n.length,c=e.length+i.length+s.length,u=t.length+n.length,h=c*Float32Array.BYTES_PER_ELEMENT+u*Uint32Array.BYTES_PER_ELEMENT,d=c*Float32Array.BYTES_PER_ELEMENT,f=u*Uint32Array.BYTES_PER_ELEMENT,p=ot._malloc(h),m=new Float32Array(ot.HEAPF32.buffer,p,c),v=new Uint32Array(ot.HEAPU32.buffer,p+d,u),g=u0(Float32Array,e,i,s),y=u0(Uint32Array,t,n);m.set(g,0),v.set(y,0),this.activeSubdivPtr=ot.alloc_subdivision_surface(p,o,p+d,a,p+d+t.length*Uint32Array.BYTES_PER_ELEMENT,l),ot._free(p)}static buildLevel(r,e,t){let n=ot.get_mesh_data(this.activeSubdivPtr,r?ot.Level.CONTROL:ot.Level.REFINED,e!=null?e:!r),i=8,s=ot.HEAPU32.subarray(n>>2,(n>>2)+i),o=s.subarray(4,4+4),a=0,l=ot.HEAPU32[s[a]>>2],c=ot.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;let u=ot.HEAPU32[s[a]>>2],h=ot.HEAPF32.subarray(u>>2,(u>>2)+o[a]);a++;let d=ot.HEAPU32[s[a]>>2],f=ot.HEAPU32.subarray(d>>2,(d>>2)+o[a]);a++;let p=ot.HEAPU32[s[a]>>2],m=ot.HEAPU32.subarray(p>>2,(p>>2)+o[a]);if(a++,t===void 0){let v=new we;if(v.setIndex(new is(m,1)),v.setAttribute("position",new ge(c,3)),v.setAttribute("normal",new ge(h,3)),r){v.setAttribute("faceMap",new is(f,1));let g=new Float32Array(h.length/3*4).fill(0);v.setAttribute("color",new Re(g,4))}return ot.free_mesh_data(n),v.userData.type="SubdivGeometry",v}t.getAttribute("position").copyArray(c),t.getAttribute("normal").copyArray(h),t.attributes.position.needsUpdate=!0,t.attributes.normal.needsUpdate=!0,ot.free_mesh_data(n)}static buildControlCageWireframe(r,e){let t=ot.get_wireframe_data_for_base_level(this.activeSubdivPtr),n=4,i=ot.HEAPU32.subarray(t>>2,(t>>2)+n),s=i.subarray(2,2+2),o=0,a=ot.HEAPU32[i[o]>>2],l=ot.HEAPF32.subarray(a>>2,(a>>2)+s[o]);o++;let c=ot.HEAPU32[i[o]>>2],u=ot.HEAPU32.subarray(c>>2,(c>>2)+s[o]);if(r===void 0){let h=new we;h.setAttribute("position",new ge(l,3));let d=new Float32Array(l.length);for(let f=0,p=l.length;f<p;)d[f++]=e.r,d[f++]=e.g,d[f++]=e.b;return h.setAttribute("color",new Re(d,3)),h.setIndex(new is(u,1)),ot.free_wireframe_data_for_base_level(t),h}r.getAttribute("position").copyArray(l),r.attributes.position.needsUpdate=!0,ot.free_wireframe_data_for_base_level(t)}static clone(r,e,t){this.activeSubdivPtr=ot.copy_subdivision_surface(e),ot.set_destination_refinement_level(this.activeSubdivPtr,r.subdivisions);let n=this.buildLevel(!0,t);Qn.getTopologicalMesh(n);let i,s,o;return r.subdivisions>0?(o=this.buildLevel(!1,t),i=o,s=n,delete s.userData.parameters):(i=n,s=void 0),Object.assign(i,{originalGeometry:s,userData:{parameters:r,type:"SubdivGeometry"}})}static getTopologicalMesh(r){let e=ot.get_topological_data(this.activeSubdivPtr),t=6,n=ot.HEAPU32.subarray(e>>2,(e>>2)+t),i=n.subarray(3,3+3),s=0,o=ot.HEAPU32[n[s]>>2],a=ot.HEAPF32.subarray(o>>2,(o>>2)+i[s]);s++;let l=ot.HEAPU32[n[s]>>2],c=ot.HEAPU32.subarray(l>>2,(l>>2)+i[s]);s++;let u=ot.HEAPU32[n[s]>>2],h=ot.HEAPU32.subarray(u>>2,(u>>2)+i[s]);r.setAttribute("positionWASM",new ge(a,3)),r.setAttribute("indexWASM",new is(c,1)),r.setAttribute("verticesPerFaceWASM",new Sf(h,1)),ot.free_topological_data(e)}},nl.checkpoints=[],nl.checkpointCurrentIndex=-1,nl.maxCheckpoints=30,nl.mergeVerticesToleranceExceptions={DodecahedronGeometry:2},nl);var Gc={};fA(Gc,{addBarycentricAttribute:()=>n2,fixUvs:()=>r2,loadFromUrl:()=>i2,resizeGeometry:()=>t2,roundShapePolygon:()=>e2});var h0=function(r,e){let t=e.x-r.x,n=e.y-r.y,i=Math.sqrt(t*t+n*n),s=t/i,o=n/i,a=Math.atan2(o,s);return{x:t,y:n,len:i,nx:s,ny:o,ang:a}},e2=(r,e,t)=>{let n,i,s,o,a,l,c,u,h,d,f,p,m,v,g=e.length;for(o=e[g-2],r.curves=[],n=1;n<g-1;n++){a=e[n%g],l=e[(n+1)%g];let y=h0(a,o),x=h0(a,l);c=y.nx*x.ny-y.ny*x.nx,u=y.nx*x.nx-y.ny*-x.ny,f=Math.asin(c),h=1,d=!1,u<0?f<0?f=Math.PI+f:(f=Math.PI-f,h=-1,d=!0):f>0&&(h=-1,d=!0),p=f/2,v=Math.abs(Math.cos(p)*t/Math.sin(p)),v>Math.min(y.len/2,x.len/2)?(v=Math.min(y.len/2,x.len/2),m=Math.abs(v*Math.sin(p)/Math.cos(p))):m=t,i=a.x+x.nx*v,s=a.y+x.ny*v,i+=-x.ny*m*h,s+=x.nx*m*h,r.absarc(i,s,m,y.ang+Math.PI/2*h,x.ang-Math.PI/2*h,d),o=a,a=l}r.closePath()},t2=(r,{width:e,height:t,depth:n})=>{e=Math.abs(e),t=Math.abs(t),n=Math.abs(n);let i=r.userData.parameters,s,o,a;e===0?(e=i.width,s=1):s=e/i.width,t===0?(t=i.height,o=1):o=t/i.height,n===0?(n=i.depth,a=1):a=n/i.depth,r.scale(s,o,a),i.width=e,i.height=t,i.depth=n},n2=(r,e)=>{let t=[new M(1,0,0),new M(0,1,0),new M(0,0,1)],n=r.attributes.position,i=new Float32Array(n.count*3);for(let s=0,o=n.count;s<o;s++)t[s%3].toArray(i,s*3);r.setAttribute(e,new ge(i,3))},i2=r=>new Promise(e=>{new Ia().load(r,n=>e(n))}),r2=(r,e,t)=>{let n=r.getAttribute("uv");if(n)for(let i=0;i<n.count;i++){let s=n.getX(i),o=n.getY(i);n.setXY(i,(s+e/2)/e,1-(o-t/2)/t*-1)}};var Uc={ConeGeometry:Ax,CubeGeometry:_x,CylinderGeometry:Sx,DodecahedronGeometry:Ex,EllipseGeometry:Wx,HelixGeometry:Kx,IcosahedronGeometry:Qx,LatheGeometry:Zx,NonParametricGeometry:Lo,PolygonGeometry:e0,PyramidGeometry:t0,RectangleGeometry:kh,SphereGeometry:i0,StarGeometry:r0,TextFrameGeometry:s0,TorusGeometry:o0,TorusKnotGeometry:a0,TriangleGeometry:l0,VectorGeometry:Pn,SubdivGeometry:Qn},kc=r=>Uc[r.type].create(r);var Vh=r=>"isEntity"in r,ai=r=>"isAbstractMesh"in r;var Hh=r=>"objectHelper"in r;var il=new tn,Dn=new M,Je=new M,vn=new me;function s2(r,e,t=0,n=e.count){let i=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,c=-1/0;for(let u=t;u<n;u++){let h=e.getX(u),d=e.getY(u),f=e.getZ(u);h<i&&(i=h),d<s&&(s=d),f<o&&(o=f),h>a&&(a=h),d>l&&(l=d),f>c&&(c=f)}return r.min.set(i,s,o),r.max.set(a,l,c),r}var d0=(r,e,t,n)=>{var i,s;if(ai(r)){let o=r.geometry.userData.parameters,a=r.geometry.getAttribute("position");r.geometry.userData.type==="SubdivGeometry"?Dn.copy(((i=r.geometry.originalGeometry)!=null?i:r.geometry).boundingSphere.center):(s2(il,a,r.geometry.drawRange.start,r.geometry.drawRange.count<1/0?r.geometry.drawRange.count:a.count),il.getCenter(Dn)),r.forceComputeSize?il.getSize(Je).multiplyScalar(.5):Je.set(o.width,o.height,(s=o.depth)!=null?s:0).multiplyScalar(.5)}else if(Hh(r)&&n===!0){let o=r.geometryHelper.getAttribute("position");il.setFromArray(o.array),il.getCenter(Dn),il.getSize(Je).multiplyScalar(.5)}else Dn.setScalar(0),Je.setScalar(0);vn.copy(e).multiply(r.matrixWorld),Je.x===0&&Je.y===0&&Je.z===0?t.push(new M(Dn.x,Dn.y,Dn.z).applyMatrix4(vn)):t.push(new M(-Je.x,Je.y,Je.z).add(Dn).applyMatrix4(vn),new M(-Je.x,-Je.y,Je.z).add(Dn).applyMatrix4(vn),new M(Je.x,-Je.y,Je.z).add(Dn).applyMatrix4(vn),new M(Je.x,Je.y,Je.z).add(Dn).applyMatrix4(vn),new M(-Je.x,Je.y,-Je.z).add(Dn).applyMatrix4(vn),new M(-Je.x,-Je.y,-Je.z).add(Dn).applyMatrix4(vn),new M(Je.x,-Je.y,-Je.z).add(Dn).applyMatrix4(vn),new M(Je.x,Je.y,-Je.z).add(Dn).applyMatrix4(vn))},jh=class extends tn{constructor(e,t){super(e,t);this.transform=new me;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}setFromObjectSize(e,t=!1){e.updateWorldMatrix(!1,!1),this.makeEmpty(),this.transform=e.matrixWorld;let n=new me().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,n,t)}expandByObjectSize(e,t,n=!1){let i=[];return n===!0?e.traverseEntity(s=>d0(s,t,i,"enableHelper"in e&&e.enableHelper)):d0(e,t,i,"enableHelper"in e&&e.enableHelper),this.setFromPoints(i)}getCenter(e){return e=super.getCenter(e),e.applyMatrix4(this.transform),e}getPositionToCenter(e){return e=super.getCenter(e),e}computeVertices(){this.getSize(Je).multiplyScalar(.5),this.getCenter(Dn),vn.copy(this.transform).setPosition(Dn),this.vertices=[new M(-Je.x,Je.y,Je.z).applyMatrix4(vn),new M(-Je.x,-Je.y,Je.z).applyMatrix4(vn),new M(Je.x,-Je.y,Je.z).applyMatrix4(vn),new M(Je.x,Je.y,Je.z).applyMatrix4(vn),new M(-Je.x,Je.y,-Je.z).applyMatrix4(vn),new M(-Je.x,-Je.y,-Je.z).applyMatrix4(vn),new M(Je.x,-Je.y,-Je.z).applyMatrix4(vn),new M(Je.x,Je.y,-Je.z).applyMatrix4(vn)]}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=[new qn(this.vertices[0],this.vertices[3]),new qn(this.vertices[1],this.vertices[2]),new qn(this.vertices[5],this.vertices[6]),new qn(this.vertices[4],this.vertices[7]),new qn(this.vertices[0],this.vertices[1]),new qn(this.vertices[3],this.vertices[2]),new qn(this.vertices[7],this.vertices[6]),new qn(this.vertices[4],this.vertices[5]),new qn(this.vertices[0],this.vertices[4]),new qn(this.vertices[1],this.vertices[5]),new qn(this.vertices[2],this.vertices[6]),new qn(this.vertices[3],this.vertices[7])],this.centerEdges=this.edges.map(e=>e.getCenter(new M))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=[new M().copy(this.vertices[0]).sub(this.vertices[2]).multiplyScalar(.5).add(this.vertices[2]),new M().copy(this.vertices[7]).sub(this.vertices[5]).multiplyScalar(.5).add(this.vertices[5]),new M().copy(this.vertices[4]).sub(this.vertices[1]).multiplyScalar(.5).add(this.vertices[1]),new M().copy(this.vertices[3]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6]),new M().copy(this.vertices[4]).sub(this.vertices[3]).multiplyScalar(.5).add(this.vertices[3]),new M().copy(this.vertices[1]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6])]}};function wm(r,e,t,n){if(n===0)return t.copy(r);if(n===1)return t.copy(e);let i=r.w*e.w+r.x*e.x+r.y*e.y+r.z*e.z;if(i>=1)return t.copy(r);let s=1-i*i;if(s<=Number.EPSILON){let u=1-n;return t.w=u*r.w+n*e.w,t.x=u*r.x+n*e.x,t.y=u*r.y+n*e.y,t.z=u*r.z+n*e.z,t.normalize(),t}let o=Math.sqrt(s),a=Math.atan2(o,i),l=Math.sin((1-n)*a)/o,c=Math.sin(n*a)/o;return t.w=r.w*l+e.w*c,t.x=r.x*l+e.x*c,t.y=r.y*l+e.y*c,t.z=r.z*l+e.z*c,t}function o2(r,e,t){let n=r.clone().sub(e),i=t.clone().sub(e);return n.dot(i)/e.distanceTo(t)}function a2(r,e){return r.clone().dot(e)/e.length()}function l2(r,e,t,n,i=!1){let s=t-r,o=n-e,a=Math.atan2(o,s)*(180/Math.PI);return i&&a<0&&(a=360+a),a}function c2(r,e,t){let n=r.clone().sub(e),i=t.clone().sub(e),s=e.distanceTo(r),o=e.distanceTo(t),a=n.dot(i)/(s*o);return Math.acos(a)}function u2(r,e){let t=(r+"e").split("e");return t=(Math.round(Number(t[0]+"e"+(+t[1]+e)))+"e").split("e"),+(t[0]+"e"+(+t[1]-e))}function h2(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}var d2=str=>eval(str.replace(/[^0-9()+\-*/.]/g,"")),C5={slerp:wm,getProjection:o2,projectOnVector:a2,angle2D:l2,angle3D:c2,round:u2,swapArrayValues:h2,evaluate:d2};var Io=new Set;var $i;(function(a){a[a.LINEAR=0]="LINEAR",a[a.EASE=1]="EASE",a[a.EASE_IN=2]="EASE_IN",a[a.EASE_OUT=3]="EASE_OUT",a[a.EASE_IN_OUT=4]="EASE_IN_OUT",a[a.CUBIC=5]="CUBIC",a[a.SPRING=6]="SPRING"})($i||($i={}));var rl=class{constructor(){this.easing=4;this.duration=1e3;this.delay=0;this.cubicControls=[.5,.05,.1,.3];this.springParameters={mass:1,stiffness:80,damping:10,velocity:0};this.repeat=!1;this.cycle=!1;this.rewind=!1}get sp_mass(){return this.springParameters.mass}set sp_mass(e){this.springParameters.mass=e}get sp_stiffness(){return this.springParameters.stiffness}set sp_stiffness(e){this.springParameters.stiffness=e}get sp_damping(){return this.springParameters.damping}set sp_damping(e){this.springParameters.damping=e}get sp_velocity(){return this.springParameters.velocity}set sp_velocity(e){this.springParameters.velocity=e}copy(e){return this.easing=e.easing,this.duration=e.duration,this.delay=e.delay,this.cubicControls=[...e.cubicControls],this.springParameters=Ue({},e.springParameters),this.repeat=e.repeat,this.cycle=e.cycle,this.rewind=e.rewind,this}clone(){return new rl().copy(this)}toJSON(){let e={easing:this.easing,duration:this.duration,delay:this.delay,cubicControls:this.cubicControls,springParameters:Ue({},this.springParameters)};return this.repeat===!0&&(e.repeat=!0),this.cycle===!0&&(e.cycle=!0),this.rewind===!0&&(e.rewind=!0),this.object!==void 0&&(e.object=this.object.uuid),this.state!==void 0&&(e.state=this.state.uuid),e}fromJSON(e,t,n){return this.easing=e.easing,this.duration=e.duration,this.delay=e.delay,this.cubicControls=[...e.cubicControls],this.springParameters.mass=e.springParameters.mass,this.springParameters.stiffness=e.springParameters.stiffness,this.springParameters.damping=e.springParameters.damping,this.springParameters.velocity=e.springParameters.velocity,e.repeat!==void 0&&(this.repeat=e.repeat),e.cycle!==void 0&&(this.cycle=e.cycle),e.rewind!==void 0&&(this.rewind=e.rewind),e.object!==void 0&&(this.object=t[e.object]),e.state!==void 0&&(this.state=n[e.state]),this}};function f2(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var Ze;(function(h){h[h.MOUSE_DOWN=0]="MOUSE_DOWN",h[h.MOUSE_UP=1]="MOUSE_UP",h[h.MOUSE_HOVER=2]="MOUSE_HOVER",h[h.MOUSE_ENTER=3]="MOUSE_ENTER",h[h.MOUSE_LEAVE=4]="MOUSE_LEAVE",h[h.KEY_DOWN=5]="KEY_DOWN",h[h.KEY_UP=6]="KEY_UP",h[h.START=7]="START",h[h.OPEN_LINK=8]="OPEN_LINK",h[h.LOOK_AT=9]="LOOK_AT",h[h.FOLLOW=10]="FOLLOW"})(Ze||(Ze={}));var sl=class{constructor(e,t){this.targets=[];this.ui={isCollapsed:!1};this._type=e,this.key=t}get type(){return this._type}set type(e){this._type=e,e===9?this.distance=1e3:this.distance=void 0,e!==5&&e!==6&&(this.key=void 0)}newTarget(e){let t=new rl;if(t.object=e,e!==void 0){let n=e.interaction.states;n.length>0&&(t.state=n[n.length-1])}return this.targets.push(t),Io.add(t),t}addTarget(e,t=0){this.targets.splice(t,0,e),Io.add(e)}removeTarget(e){Io.delete(this.targets[e]),this.targets.splice(e,1)}dispatchReverse(){for(let e=0,t=this.targets.length;e<t;++e){let n=this.targets[e];n.state!==void 0&&n.object!==void 0&&n.object.interaction.reverse(n)}}dispatch(){if(this.url!==void 0&&(this._type===8||this._type===0||this._type===1||this._type===5||this._type===6))f2()?window.location.assign(this.url):window.open(this.url,"_blank");else for(let e=0,t=this.targets.length;e<t;++e){let n=this.targets[e];n.state!==void 0&&n.object!==void 0&&n.object.interaction.play(n)}}copy(e){return this._type=e.type,this.key=e.key,this.url=e.url,this.distance=e.distance,this.ui.isCollapsed=e.ui.isCollapsed,this}clone(){return new sl().copy(this)}toJSON(){let e={type:this._type,key:this.key,ui:{isCollapsed:this.ui.isCollapsed}};if(this.url!==void 0&&(e.url=this.url),this.distance!==void 0&&(e.distance=this.distance),this.targets.length>0){e.targets=[];for(let t=0,n=this.targets.length;t<n;++t)e.targets.push(this.targets[t].toJSON())}return e}fromJSON(e,t,n){if(this._type=e.type,this.key=e.key,this.targets=[],this.ui={isCollapsed:e.ui.isCollapsed},this.url=e.url,e.distance!==void 0&&(this.distance=e.distance),e.targets!==void 0)for(let i=0,s=e.targets.length;i<s;++i)this.addTarget(new rl().fromJSON(e.targets[i],t,n),i);return this}};var bs=class{constructor(){this.uuid=Ee.generateUUID();this.name="";this.position=new M;this.rotation=new On;this.scale=new M;this.hiddenMatrix=new me}update(e){this.updateMatrix(e),"geometry"in e&&this.updateGeometry(e),"material"in e&&this.updateMaterial(e),e.objectType==="CombinedCamera"&&this.updateCamera(e)}updateCamera(e){this.camera={zoomPersp:e.perspCamera.zoom,zoomOrtho:e.orthoCamera.zoom,targetOffset:e.targetOffset}}updateMatrix(e){this.position.copy(e.position),this.rotation.copy(e.rotation),this.scale.copy(e.scale),"hiddenMatrix"in e&&this.hiddenMatrix.copy(e.hiddenMatrix)}updateGeometry(e){if("geometry"in e){let{width:t,height:n,depth:i}=e.geometry.userData.parameters;this.geometry={width:t,height:n,depth:i}}}updateMaterial(e){if("material"in e)if(e.material instanceof Array){this.material=[];for(let t=0,n=e.material.length;t<n;++t){let i=e.material[t],s=[],o=i.layersList.head;for(;o;)s.push(o.clone()),o=o.next;this.material.push({layersList:s})}}else{let t=e.material,n=[],i=t.layersList.head;for(;i;)n.push(i.clone()),i=i.next;this.material={layersList:n}}}execute(e){if(e.position.copy(this.position),e.rotation.copy(this.rotation),e.scale.copy(this.scale),"hiddenMatrix"in e&&e.hiddenMatrix.copy(this.hiddenMatrix),"geometry"in e&&this.geometry!==void 0){let n=e.geometry.userData.parameters,i=this.geometry;(i.width!==n.width||i.height!==n.height||i.depth!==n.depth)&&e.updateGeometry({parameters:{width:i.width,height:i.height,depth:i.depth}})}if("material"in e){let t=e.material;if(t instanceof Array){let n=this.material;for(let i=0,s=n.length;i<s;++i){let o=t[i].layersList.head,a=n[i].layersList,l=0;for(;o;)o.copy(a[l++]),o=o.next;t[i].dispose()}}else{if(t.userData.isAsset)return;let n=0,i=t.layersList.head,o=this.material.layersList;for(;i;)i.copyUniforms(o[n++]),i=i.next;t.dispose()}}this.camera&&e.objectType==="CombinedCamera"&&(e=e,e.zoom=e.cameraType==="OrthographicCamera"?this.camera.zoomOrtho:this.camera.zoomPersp,e.targetOffset=this.camera.targetOffset,e.updateProjectionMatrix())}copy(e){if(this.name=e.name,this.position.copy(e.position),this.rotation.copy(e.rotation),this.scale.copy(e.scale),this.hiddenMatrix.copy(e.hiddenMatrix),e.geometry!==void 0&&(this.geometry={width:e.geometry.width,height:e.geometry.height,depth:e.geometry.depth}),e.material!==void 0)if(e.material instanceof Array){this.material=[];for(let t=0,n=e.material.length;t<n;++t)this.material.push({layersList:e.material[t].layersList.map(i=>i.clone())})}else this.material={layersList:e.material.layersList.map(t=>t.clone())};return e.camera!==void 0&&(this.camera={zoomPersp:e.camera.zoomPersp,zoomOrtho:e.camera.zoomOrtho,targetOffset:e.camera.targetOffset}),this}clone(){return new bs().copy(this)}toJSON(e){let t={uuid:this.uuid,name:this.name,position:this.position.toArray(),rotation:this.rotation.toArray(),scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};if(this.geometry!==void 0&&(t.geometry={width:this.geometry.width,height:this.geometry.height,depth:this.geometry.depth}),this.material!==void 0)if(this.material instanceof Array){t.material=[];for(let n=0,i=this.material.length;n<i;++n)t.material.push({layersList:this.material[n].layersList.map(s=>s.toJSON(e))})}else t.material={layersList:this.material.layersList.map(n=>n.toJSON(e))};return this.camera!==void 0&&(t.camera={zoomPersp:this.camera.zoomPersp,zoomOrtho:this.camera.zoomOrtho,targetOffset:this.camera.targetOffset}),t}fromJSON(e,t){var n;if(this.uuid=e.uuid,this.name=e.name,this.position.fromArray(e.position),this.rotation.fromArray(e.rotation),this.scale.fromArray(e.scale),this.hiddenMatrix.fromArray(e.hiddenMatrix),e.geometry!==void 0&&(this.geometry={width:e.geometry.width,height:e.geometry.height,depth:e.geometry.depth}),e.material!==void 0)if(e.material instanceof Array){this.material=[];for(let i=0,s=e.material.length;i<s;++i)this.material.push({layersList:e.material[i].layersList.map(o=>kp(o,t))})}else this.material={layersList:e.material.layersList.map(i=>kp(i,t))};return e.camera!==void 0&&(this.camera={zoomPersp:e.camera.zoomPersp,zoomOrtho:e.camera.zoomOrtho,targetOffset:(n=e.camera.targetOffset)!=null?n:-1}),this}};"use strict";var f0={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0,rewind:!0},Sm={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},p2=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],Wh={CSS:{},springs:{}};function mr(r,e,t){return Math.min(Math.max(r,e),t)}function Vc(r,e){return r.indexOf(e)>-1}function Mm(r,e){return r.apply(null,e)}var qe={arr:function(r){return Array.isArray(r)},obj:function(r){return Vc(Object.prototype.toString.call(r),"Object")},pth:function(r){return qe.obj(r)&&r.hasOwnProperty("totalLength")},svg:function(r){return r instanceof SVGElement},inp:function(r){return r instanceof HTMLInputElement},dom:function(r){return!("isNode"in r)&&(r.nodeType||qe.svg(r))},str:function(r){return typeof r=="string"},fnc:function(r){return typeof r=="function"},und:function(r){return typeof r=="undefined"},hex:function(r){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(r)},rgb:function(r){return/^rgb/.test(r)},hsl:function(r){return/^hsl/.test(r)},col:function(r){return qe.hex(r)||qe.rgb(r)||qe.hsl(r)},key:function(r){return!f0.hasOwnProperty(r)&&!Sm.hasOwnProperty(r)&&r!=="targets"&&r!=="keyframes"}};function p0(r){var e=/\(([^)]+)\)/.exec(r);return e?e[1].split(",").map(function(t){return parseFloat(t)}):[]}function m0(r,e){var t=p0(r),n=mr(qe.und(t[0])?1:t[0],.1,100),i=mr(qe.und(t[1])?100:t[1],.1,100),s=mr(qe.und(t[2])?10:t[2],.1,100),o=mr(qe.und(t[3])?0:t[3],.1,100),a=Math.sqrt(i/n),l=s/(2*Math.sqrt(i*n)),c=l<1?a*Math.sqrt(1-l*l):0,u=1,h=l<1?(l*a+-o)/c:-o+a;function d(p){var m=e?e*p/1e3:p;return l<1?m=Math.exp(-m*l*a)*(u*Math.cos(c*m)+h*Math.sin(c*m)):m=(u+h*m)*Math.exp(-m*a),p===0||p===1?p:1-m}function f(){var p=Wh.springs[r];if(p)return p;for(var m=1/6,v=0,g=0;;)if(v+=m,d(v)===1){if(g++,g>=16)break}else g=0;var y=v*m*1e3;return Wh.springs[r]=y,y}return e?d:f}function m2(r){return r===void 0&&(r=10),function(e){return Math.ceil(mr(e,1e-6,1)*r)*(1/r)}}var g2=function(){var r=11,e=1/(r-1);function t(u,h){return 1-3*h+3*u}function n(u,h){return 3*h-6*u}function i(u){return 3*u}function s(u,h,d){return((t(h,d)*u+n(h,d))*u+i(h))*u}function o(u,h,d){return 3*t(h,d)*u*u+2*n(h,d)*u+i(h)}function a(u,h,d,f,p){var m,v,g=0;do v=h+(d-h)/2,m=s(v,f,p)-u,m>0?d=v:h=v;while(Math.abs(m)>1e-7&&++g<10);return v}function l(u,h,d,f){for(var p=0;p<4;++p){var m=o(h,d,f);if(m===0)return h;var v=s(h,d,f)-u;h-=v/m}return h}function c(u,h,d,f){if(!(0<=u&&u<=1&&0<=d&&d<=1))return;var p=new Float32Array(r);if(u!==h||d!==f)for(var m=0;m<r;++m)p[m]=s(m*e,u,d);function v(g){for(var y=0,x=1,b=r-1;x!==b&&p[x]<=g;++x)y+=e;--x;var w=(g-p[x])/(p[x+1]-p[x]),_=y+w*e,S=o(_,u,d);return S>=.001?l(g,_,u,d):S===0?_:a(g,y,y+e,u,d)}return function(g){return u===h&&d===f||g===0||g===1?g:s(v(g),h,f)}}return c}(),g0=function(){var r={linear:function(){return function(n){return n}}},e={Sine:function(){return function(n){return 1-Math.cos(n*Math.PI/2)}},Circ:function(){return function(n){return 1-Math.sqrt(1-n*n)}},Back:function(){return function(n){return n*n*(3*n-2)}},Bounce:function(){return function(n){for(var i,s=4;n<((i=Math.pow(2,--s))-1)/11;);return 1/Math.pow(4,3-s)-7.5625*Math.pow((i*3-2)/22-n,2)}},Elastic:function(n,i){n===void 0&&(n=1),i===void 0&&(i=.5);var s=mr(n,1,10),o=mr(i,.1,2);return function(a){return a===0||a===1?a:-s*Math.pow(2,10*(a-1))*Math.sin((a-1-o/(Math.PI*2)*Math.asin(1/s))*(Math.PI*2)/o)}}},t=["Quad","Cubic","Quart","Quint","Expo"];return t.forEach(function(n,i){e[n]=function(){return function(s){return Math.pow(s,i+2)}}}),Object.keys(e).forEach(function(n){var i=e[n];r["easeIn"+n]=i,r["easeOut"+n]=function(s,o){return function(a){return 1-i(s,o)(1-a)}},r["easeInOut"+n]=function(s,o){return function(a){return a<.5?i(s,o)(a*2)/2:1-i(s,o)(a*-2+2)/2}}}),r}();function Am(r,e){if(qe.fnc(r))return r;var t=r.split("(")[0],n=g0[t],i=p0(r);switch(t){case"spring":return m0(r,e);case"cubicBezier":return Mm(g2,i);case"steps":return Mm(m2,i);default:return Mm(n,i)}}function y0(r){try{var e=document.querySelectorAll(r);return e}catch(t){return}}function Jh(r,e){for(var t=r.length,n=arguments.length>=2?arguments[1]:void 0,i=[],s=0;s<t;s++)if(s in r){var o=r[s];e.call(n,o,s,r)&&i.push(o)}return i}function Xh(r){return r.reduce(function(e,t){return e.concat(qe.arr(t)?Xh(t):t)},[])}function v0(r){return qe.arr(r)?r:(qe.str(r)&&(r=y0(r)||r),r instanceof NodeList||r instanceof HTMLCollection?[].slice.call(r):[r])}function _m(r,e){return r.some(function(t){return t===e})}function Tm(r){var e={};for(var t in r)e[t]=r[t];return e}function Em(r,e){var t=Tm(r);for(var n in r)t[n]=e.hasOwnProperty(n)?e[n]:r[n];return t}function qh(r,e){var t=Tm(r);for(var n in e)t[n]=qe.und(r[n])?e[n]:r[n];return t}function y2(r){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(r);return e?"rgba("+e[1]+",1)":r}function v2(r){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,t=r.replace(e,function(a,l,c,u){return l+l+c+c+u+u}),n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),i=parseInt(n[1],16),s=parseInt(n[2],16),o=parseInt(n[3],16);return"rgba("+i+","+s+","+o+",1)"}function x2(r){var e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(r)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(r),t=parseInt(e[1],10)/360,n=parseInt(e[2],10)/100,i=parseInt(e[3],10)/100,s=e[4]||1;function o(d,f,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?d+(f-d)*6*p:p<1/2?f:p<2/3?d+(f-d)*(2/3-p)*6:d}var a,l,c;if(n==0)a=l=c=i;else{var u=i<.5?i*(1+n):i+n-i*n,h=2*i-u;a=o(h,u,t+1/3),l=o(h,u,t),c=o(h,u,t-1/3)}return"rgba("+a*255+","+l*255+","+c*255+","+s+")"}function b2(r){if(qe.rgb(r))return y2(r);if(qe.hex(r))return v2(r);if(qe.hsl(r))return x2(r)}function Gr(r){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(r);if(e)return e[1]}function w2(r){if(Vc(r,"translate")||r==="perspective")return"px";if(Vc(r,"rotate")||Vc(r,"skew"))return"deg"}function Nm(r,e){return qe.fnc(r)?r(e.target,e.id,e.total):r}function gr(r,e){return r.getAttribute(e)}function Cm(r,e,t){var n=Gr(e);if(_m([t,"deg","rad","turn"],n))return e;var i=Wh.CSS[e+t];if(!qe.und(i))return i;var s=100,o=document.createElement(r.tagName),a=r.parentNode&&r.parentNode!==document?r.parentNode:document.body;a.appendChild(o),o.style.position="absolute",o.style.width=s+t;var l=s/o.offsetWidth;a.removeChild(o);var c=l*parseFloat(e);return Wh.CSS[e+t]=c,c}function x0(r,e,t){if(e in r.style){var n=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=r.style[e]||getComputedStyle(r).getPropertyValue(n)||"0";return t?Cm(r,i,t):i}}function Lm(r,e){if(qe.dom(r)&&!qe.inp(r)&&(gr(r,e)||qe.svg(r)&&r[e]))return"attribute";if(qe.dom(r)&&_m(p2,e))return"transform";if(qe.dom(r)&&e!=="transform"&&x0(r,e))return"css";if(r[e]!=null)return"object"}function b0(r){if(!!qe.dom(r)){for(var e=r.style.transform||"",t=/(\w+)\(([^)]*)\)/g,n=new Map,i;i=t.exec(e);)n.set(i[1],i[2]);return n}}function S2(r,e,t,n){var i=Vc(e,"scale")?1:0+w2(e),s=b0(r).get(e)||i;return t&&(t.transforms.list.set(e,s),t.transforms.last=e),n?Cm(r,s,n):s}function Im(r,e,t,n){switch(Lm(r,e)){case"transform":return S2(r,e,n,t);case"css":return x0(r,e,t);case"attribute":return gr(r,e);default:return r[e]||0}}function Pm(r,e){var t=/^(\*=|\+=|-=)/.exec(r);if(!t)return r;var n=Gr(r)||0,i=parseFloat(e),s=parseFloat(r.replace(t[0],""));switch(t[0][0]){case"+":return i+s+n;case"-":return i-s+n;case"*":return i*s+n}}function w0(r,e){if(qe.col(r))return b2(r);if(/\s/g.test(r))return r;var t=Gr(r),n=t?r.substr(0,r.length-t.length):r;return e?n+e:n}function Dm(r,e){return Math.sqrt(Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2))}function M2(r){return Math.PI*2*gr(r,"r")}function A2(r){return gr(r,"width")*2+gr(r,"height")*2}function _2(r){return Dm({x:gr(r,"x1"),y:gr(r,"y1")},{x:gr(r,"x2"),y:gr(r,"y2")})}function S0(r){for(var e=r.points,t=0,n,i=0;i<e.numberOfItems;i++){var s=e.getItem(i);i>0&&(t+=Dm(n,s)),n=s}return t}function T2(r){var e=r.points;return S0(r)+Dm(e.getItem(e.numberOfItems-1),e.getItem(0))}function M0(r){if(r.getTotalLength)return r.getTotalLength();switch(r.tagName.toLowerCase()){case"circle":return M2(r);case"rect":return A2(r);case"line":return _2(r);case"polyline":return S0(r);case"polygon":return T2(r)}}function E2(r){var e=M0(r);return r.setAttribute("stroke-dasharray",e),e}function N2(r){for(var e=r.parentNode;qe.svg(e)&&qe.svg(e.parentNode);)e=e.parentNode;return e}function A0(r,e){var t=e||{},n=t.el||N2(r),i=n.getBoundingClientRect(),s=gr(n,"viewBox"),o=i.width,a=i.height,l=t.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:n,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function C2(r,e){var t=qe.str(r)?y0(r)[0]:r,n=e||100;return function(i){return{property:i,el:t,svg:A0(t),totalLength:M0(t)*(n/100)}}}function L2(r,e){function t(a){a===void 0&&(a=0);var l=e+a>=1?e+a:0;return r.el.getPointAtLength(l)}var n=A0(r.el,r.svg),i=t(),s=t(-1),o=t(1);switch(r.property){case"x":return(i.x-n.x)*n.w;case"y":return(i.y-n.y)*n.h;case"angle":return Math.atan2(o.y-s.y,o.x-s.x)*180/Math.PI}}function _0(r,e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,n=w0(qe.pth(r)?r.totalLength:r,e)+"";return{original:n,numbers:n.match(t)?n.match(t).map(Number):[0],strings:qe.str(r)||e?n.split(t):[]}}function T0(r){var e=r?Xh(qe.arr(r)?r.map(v0):v0(r)):[];return Jh(e,function(t,n,i){return i.indexOf(t)===n})}function E0(r){var e=T0(r);return e.map(function(t,n){return{target:t,id:n,total:e.length,transforms:{list:b0(t)}}})}function I2(r,e){var t=Tm(e);if(/^spring/.test(t.easing)&&(t.duration=m0(t.easing)),qe.arr(r)){var n=r.length,i=n===2&&!qe.obj(r[0]);i?r={value:r}:qe.fnc(e.duration)||(t.duration=e.duration/n)}var s=qe.arr(r)?r:[r];return s.map(function(o,a){var l=qe.obj(o)&&!qe.pth(o)?o:{value:o};return qe.und(l.delay)&&(l.delay=a?0:e.delay),qe.und(l.endDelay)&&(l.endDelay=a===s.length-1?e.endDelay:0),l}).map(function(o){return qh(o,t)})}function P2(r){for(var e=Jh(Xh(r.map(function(s){return Object.keys(s)})),function(s){return qe.key(s)}).reduce(function(s,o){return s.indexOf(o)<0&&s.push(o),s},[]),t={},n=function(s){var o=e[s];t[o]=r.map(function(a){var l={};for(var c in a)qe.key(c)?c==o&&(l.value=a[c]):l[c]=a[c];return l})},i=0;i<e.length;i++)n(i);return t}function D2(r,e){var t=[],n=e.keyframes;n&&(e=qh(P2(n),e));for(var i in e)qe.key(i)&&t.push({name:i,tweens:I2(e[i],r)});return t}function R2(r,e){var t={};for(var n in r){var i=Nm(r[n],e);qe.arr(i)&&(i=i.map(function(s){return Nm(s,e)}),i.length===1&&(i=i[0])),t[n]=i}return t.duration=parseFloat(t.duration),t.delay=parseFloat(t.delay),t}function B2(r,e){var t;return r.tweens.map(function(n){var i=R2(n,e),s=i.value,o=qe.arr(s)?s[1]:s,a=Gr(o),l=Im(e.target,r.name,a,e),c=t?t.to.original:l,u=qe.arr(s)?s[0]:c,h=Gr(u)||Gr(l),d=a||h;return qe.und(o)&&(o=c),i.from=_0(u,d),i.to=_0(Pm(o,u),d),i.start=t?t.end:0,i.end=i.start+i.delay+i.duration+i.endDelay,i.easing=Am(i.easing,i.duration),i.isPath=qe.pth(s),i.isColor=qe.col(i.from.original),i.isColor&&(i.round=1),t=i,i})}var N0={css:function(r,e,t){return r.style[e]=t},attribute:function(r,e,t){return r.setAttribute(e,t)},object:function(r,e,t){return r[e]=t},transform:function(r,e,t,n,i){if(n.list.set(e,t),e===n.last||i){var s="";n.list.forEach(function(o,a){s+=a+"("+o+") "}),r.style.transform=s}}};function C0(r,e){var t=E0(r);t.forEach(function(n){for(var i in e){var s=Nm(e[i],n),o=n.target,a=Gr(s),l=Im(o,i,a,n),c=a||Gr(l),u=Pm(w0(s,c),l),h=Lm(o,i);N0[h](o,i,u,n.transforms,!0)}})}function O2(r,e){var t=Lm(r.target,e.name);if(t){var n=B2(e,r),i=n[n.length-1];return{type:t,property:e.name,animatable:r,tweens:n,duration:i.end,delay:n[0].delay,endDelay:i.endDelay}}}function F2(r,e){return Jh(Xh(r.map(function(t){return e.map(function(n){return O2(t,n)})})),function(t){return!qe.und(t)})}function L0(r,e){var t=r.length,n=function(s){return s.timelineOffset?s.timelineOffset:0},i={};return i.duration=t?Math.max.apply(Math,r.map(function(s){return n(s)+s.duration})):e.duration,i.delay=t?Math.min.apply(Math,r.map(function(s){return n(s)+s.delay})):e.delay,i.endDelay=t?i.duration-Math.max.apply(Math,r.map(function(s){return n(s)+s.duration-s.endDelay})):e.endDelay,i}var I0=0;function z2(r){var e=Em(f0,r),t=Em(Sm,r),n=D2(t,r),i=E0(r.targets),s=F2(i,n),o=L0(s,t),a=I0;return I0++,qh(e,{id:a,children:[],animatables:i,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}var li=[],P0=[],Yh,G2=function(){function r(){Yh=requestAnimationFrame(e)}function e(t){var n=li.length;if(n){for(var i=0;i<n;){var s=li[i];if(!s.paused)s.tick(t);else{var o=li.indexOf(s);o>-1&&(li.splice(o,1),n=li.length)}i++}r()}else Yh=cancelAnimationFrame(Yh)}return r}();function U2(){document.hidden?(li.forEach(function(r){return r.pause()}),P0=li.slice(0),un.running=li=[]):P0.forEach(function(r){return r.play()})}typeof document!="undefined"&&document.addEventListener("visibilitychange",U2);function un(r){r===void 0&&(r={});var e=0,t=0,n=0,i,s=0,o=null;function a(x){var b=window.Promise&&new Promise(function(w){return o=w});return x.finished=b,b}var l=z2(r),c=a(l);function u(){var x=l.direction;x!=="alternate"&&(l.direction=x!=="normal"?"normal":"reverse"),l.reversed=!l.reversed,i.forEach(function(b){return b.reversed=l.reversed})}function h(x){return l.reversed?l.duration-x:x}function d(){e=0,t=h(l.currentTime)*(1/un.speed)}function f(x,b){b&&b.seek(x-b.timelineOffset)}function p(x){if(l.reversePlayback)for(var w=s;w--;)f(x,i[w]);else for(var b=0;b<s;b++)f(x,i[b])}function m(x){var b=0,w=l.animations,_=w.length;for(l.reversePlayback===!0&&l.rewind===!1&&(x=l.duration-x);b<_;){var S=w[b],A=S.animatable,T=S.tweens,L=T.length-1,C=T[L];L&&(C=Jh(T,function(ae){return x<ae.end})[0]||C);for(var U=mr(x-C.start-C.delay,0,C.duration)/C.duration,P=isNaN(U)?1:C.easing(U),R=C.to.strings,G=C.round,B=[],j=C.to.numbers.length,ne=void 0,le=0;le<j;le++){var W=void 0;if(l.reversePlayback===!0&&l.rewind===!1)var z=C.to.numbers[le],D=C.from.numbers[le]||0;else var D=C.to.numbers[le],z=C.from.numbers[le]||0;C.isPath?W=L2(C.value,P*D):W=z+P*(D-z),G&&(C.isColor&&le>2||(W=Math.round(W*G)/G)),B.push(W)}var K=R.length;if(!K)ne=B[0];else{ne=R[0];for(var q=0;q<K;q++){var ee=R[q],V=R[q+1],de=B[q];isNaN(de)||(V?ne+=de+V:ne+=de+" ")}}N0[S.type](A.target,S.property,ne,A.transforms),S.currentValue=ne,b++}}function v(x){l[x]&&!l.passThrough&&l[x](l)}function g(){l.remaining&&l.remaining!==!0&&l.remaining--}function y(x){var b=l.duration,w=l.delay,_=b-l.endDelay,S=h(x);l.progress=mr(S/b*100,0,100),l.reversePlayback=S<l.currentTime,i&&p(S),!l.began&&l.currentTime>0&&(l.began=!0,v("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,v("loopBegin")),S<=w&&l.currentTime!==0&&m(0),(S>=_&&l.currentTime!==b||!b)&&m(b),S>w&&S<_?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,v("changeBegin")),v("change"),m(S)):l.changeBegan&&(l.changeCompleted=!0,l.changeBegan=!1,v("changeComplete")),l.currentTime=mr(S,0,b),l.began&&v("update"),x>=b&&(t=0,g(),l.remaining?(e=n,v("loopComplete"),l.loopBegan=!1,l.direction==="alternate"&&u()):(l.paused=!0,l.completed||(l.completed=!0,v("loopComplete"),v("complete"),!l.passThrough&&"Promise"in window&&(o(),c=a(l)))))}return l.reset=function(){var x=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed=x==="reverse",l.remaining=l.loop,i=l.children,s=i.length;for(var b=s;b--;)l.children[b].reset();(l.reversed&&l.loop!==!0||x==="alternate"&&l.loop===1)&&l.remaining++,m(l.reversed?l.duration:0)},l.set=function(x,b){return C0(x,b),l},l.tick=function(x){n=x,e||(e=n),y((n+(t-e))*un.speed)},l.seek=function(x){y(h(x))},l.pause=function(){l.paused=!0,d()},l.play=function(){!l.paused||(l.completed&&l.reset(),l.paused=!1,li.push(l),d(),Yh||G2())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.reset(),l.autoplay&&l.play(),l}function D0(r,e){for(var t=e.length;t--;)_m(r,e[t].animatable.target)&&e.splice(t,1)}function k2(r){for(var e=T0(r),t=li.length;t--;){var n=li[t],i=n.animations,s=n.children;D0(e,i);for(var o=s.length;o--;){var a=s[o],l=a.animations;D0(e,l),!l.length&&!a.children.length&&s.splice(o,1)}!i.length&&!s.length&&n.pause()}}function V2(r,e){e===void 0&&(e={});var t=e.direction||"normal",n=e.easing?Am(e.easing):null,i=e.grid,s=e.axis,o=e.from||0,a=o==="first",l=o==="center",c=o==="last",u=qe.arr(r),h=parseFloat(u?r[0]:r),d=u?parseFloat(r[1]):0,f=Gr(u?r[1]:r)||0,p=e.start||0+(u?h:0),m=[],v=0;return function(g,y,x){if(a&&(o=0),l&&(o=(x-1)/2),c&&(o=x-1),!m.length){for(var b=0;b<x;b++){if(!i)m.push(Math.abs(o-b));else{var w=l?(i[0]-1)/2:o%i[0],_=l?(i[1]-1)/2:Math.floor(o/i[0]),S=b%i[0],A=Math.floor(b/i[0]),T=w-S,L=_-A,C=Math.sqrt(T*T+L*L);s==="x"&&(C=-T),s==="y"&&(C=-L),m.push(C)}v=Math.max.apply(Math,m)}n&&(m=m.map(function(P){return n(P/v)*v})),t==="reverse"&&(m=m.map(function(P){return s?P<0?P*-1:-P:Math.abs(v-P)}))}var U=u?(d-h)/v:h;return p+U*(Math.round(m[y]*100)/100)+f}}function H2(r){r===void 0&&(r={});var e=un(r);return e.duration=0,e.add=function(t,n){var i=li.indexOf(e),s=e.children;i>-1&&li.splice(i,1);function o(d){d.passThrough=!0}for(var a=0;a<s.length;a++)o(s[a]);var l=qh(t,Em(Sm,r));l.targets=l.targets||r.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=qe.und(n)?c:Pm(n,c),o(e),l.rewind=e.rewind,e.seek(l.timelineOffset);var u=un(l);o(u),s.push(u);var h=L0(s,r);return e.delay=h.delay,e.endDelay=h.endDelay,e.duration=h.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e}un.version="3.2.0";un.speed=1;un.running=li;un.remove=k2;un.get=Im;un.set=C0;un.convertPx=Cm;un.path=C2;un.setDashoffset=E2;un.stagger=V2;un.timeline=H2;un.easing=Am;un.penner=g0;un.random=function(r,e){return Math.floor(Math.random()*(e-r+1))+r};var Hc=un;var Rm=class{constructor(e){this.i=e}updateObject(){this.i.selectedState!==void 0&&this.i.states[this.i.selectedState].updateMatrix(this.i.object)}updateCamera(){this.i.selectedState===void 0||this.i.object.objectType!=="CombinedCamera"||(this.i.states[this.i.selectedState].updateMatrix(this.i.object),this.i.states[this.i.selectedState].updateCamera(this.i.object))}updateGeometry(){this.i.selectedState===void 0||ai(this.i.object)===!1||(this.i.states[this.i.selectedState].updateMatrix(this.i.object),this.i.states[this.i.selectedState].updateGeometry(this.i.object))}updateSceneGraph(e,t){let n=new me,i=new me;e.updateWorldMatrix(!0,!1),i.copy(e.matrixWorld).invert();for(let s=0,o=this.i.states.length;s<o;++s){let a=this.i.states[s];n.copy(i),this.i.object.parent!==null&&(this.i.object.parent.updateWorldMatrix(!0,!1),n.multiply(this.i.object.parent.matrixWorld)),a.hiddenMatrix.premultiply(n)}}updateMaterialLayer(e){if(this.i.selectedState===void 0||ai(this.i.object)===!1)return;let n=this.i.object.selectedMaterial,i=this.i.states[this.i.selectedState],o=(n!==void 0?i.material[n]:i.material).layersList.find(a=>a.id===e.id);o==null||o.copy(e)}pushMaterialLayer(e){if(this.i.states.length===0||ai(this.i.object)===!1)return;let t=this.i.object;if(t.material instanceof Array){let n=t.selectedMaterial;if(n!==void 0)for(let i=0,s=this.i.states.length;i<s;++i){let o=e.clone();this.i.selectedState!==i&&(o.uniforms[`f${o.id}_alpha`].value=0),this.i.states[i].material[n].layersList.push(o)}}else for(let n=0,i=this.i.states.length;n<i;++n){let s=e.clone();this.i.selectedState!==n&&(s.uniforms[`f${s.id}_alpha`].value=0),this.i.states[n].material.layersList.push(s)}}popMaterialLayer(){if(this.i.states.length===0||ai(this.i.object)===!1)return;let e=this.i.object;if(e.material instanceof Array){let t=e.selectedMaterial;if(t!==void 0)for(let n=0,i=this.i.states.length;n<i;++n)this.i.states[n].material[t].layersList.pop()}else for(let t=0,n=this.i.states.length;t<n;++t)this.i.states[t].material.layersList.pop()}removeMaterialLayer(e){if(this.i.states.length===0||ai(this.i.object)===!1)return null;let t=this.i.object,n=[];if(t.material instanceof Array)for(let i=0,s=this.i.states.length;i<s;++i){let o=t.selectedMaterial;if(o!==void 0){let l=this.i.states[i].material[o];n.push({layer:l.layersList[e]}),l.layersList.splice(e,1)}}else for(let i=0,s=this.i.states.length;i<s;++i){let a=this.i.states[i].material;n.push({layer:a.layersList[e]}),a.layersList.splice(e,1)}return{states:n,pos:e}}restoreMaterialLayerRemoved(e){if(this.i.states.length===0||ai(this.i.object)===!1)return;let t=this.i.object;if(t.material instanceof Array)for(let n=0,i=this.i.states.length;n<i;++n){let s=t.selectedMaterial;s!==void 0&&this.i.states[n].material[s].layersList.splice(e.pos,0,e.states[n].layer)}else for(let n=0,i=this.i.states.length;n<i;++n)this.i.states[n].material.layersList.splice(e.pos,0,e.states[n].layer)}changeMaterialLayer(e){if(this.i.states.length===0||ai(this.i.object)===!1)return null;let t=this.i.object,n=[],i=0;if(t.material instanceof Array){let s=t.selectedMaterial;if(s!==void 0){let l=this.i.states[Number(this.i.selectedState)].material[s].layersList;for(let c=0,u=l.length;c<u;++c)if(l[c].id===e.id){i=c;break}for(let c=0,u=this.i.states.length;c<u;++c){let h=this.i.states[c].material[s].layersList[i],d=e.clone();this.i.selectedState!==c&&(d.uniforms[`f${d.id}_alpha`].value=Number(h.uniforms[`f${h.id}_alpha`].value)),this.i.states[c].material[s].layersList[i]=d,n.push({layer:h})}}}else{let s=this.i.states[Number(this.i.selectedState)].material.layersList;for(let o=0,a=s.length;o<a;++o)if(s[o].id===e.id){i=o;break}for(let o=0,a=this.i.states.length;o<a;++o){let l=this.i.states[o].material.layersList[i],c=e.clone();this.i.selectedState!==o&&(c.uniforms[`f${c.id}_alpha`].value=Number(l.uniforms[`f${l.id}_alpha`].value)),this.i.states[o].material.layersList[i]=c,n.push({layer:l})}}return{states:n,pos:i}}restoreMaterialLayerChanged(e){if(this.i.states.length===0||ai(this.i.object)===!1)return;let t=this.i.object;if(t.material instanceof Array){let n=t.selectedMaterial;if(n!==void 0)for(let i=0,s=this.i.states.length;i<s;++i)this.i.states[i].material[n].layersList[e.pos]=e.states[i].layer}else for(let n=0,i=this.i.states.length;n<i;++n)this.i.states[n].material.layersList[e.pos]=e.states[n].layer}moveMaterialLayer(e,t){if(this.i.states.length===0||ai(this.i.object)===!1)return;let n=this.i.object;if(n.material instanceof Array){let i=n.selectedMaterial;if(i!==void 0)for(let s=0,o=this.i.states.length;s<o;++s){let a=this.i.states[s].material[i].layersList,l=a.splice(t,1)[0];a.splice(e,0,l)}}else for(let i=0,s=this.i.states.length;i<s;++i){let o=this.i.states[i].material.layersList,a=o.splice(t,1)[0];o.splice(e,0,a)}}restoreMaterialLayerMoved(e,t){this.moveMaterialLayer(e,t)}setMaterialLayers(e){let t=this.i.object,n=[];if(t.material instanceof Array){let i=t.selectedMaterial;if(i!==void 0)for(let s=0,o=this.i.states.length;s<o;++s){let a=this.i.states[s].material[i];n.push({layersList:a.layersList});let l=e.head;for(a.layersList=[];l!==void 0;)a.layersList.push(l.clone()),l=l.next}}else for(let i=0,s=this.i.states.length;i<s;++i){let o=this.i.states[i].material;n.push({layersList:o.layersList});let a=e.head;for(o.layersList=[];a!==void 0;)o.layersList.push(a.clone()),a=a.next}return{states:n}}restoreMaterialLayersSet(e){let t=this.i.object;if(t.material instanceof Array){let n=t.selectedMaterial;if(n!==void 0)for(let i=0,s=this.i.states.length;i<s;++i)this.i.states[i].material[n].layersList=e.states[i].layersList}else for(let n=0,i=this.i.states.length;n<i;++n)this.i.states[n].material.layersList=e.states[n].layersList}};function R0(r){var o;let e=[],t=r.groups,n=r.getAttribute("position").array,i=r.getAttribute("normal").array,s=(o=r.getAttribute("uv"))==null?void 0:o.array;return t.forEach(a=>{let l=a.count,c=new we,u=new Float32Array(l*3),h=new Float32Array(l*3),d=new Float32Array(l*2);for(let f=0;f<l;f++){let p=3*(a.start+f),m=3*f;if(u[m]=n[p],u[m+1]=n[p+1],u[m+2]=n[p+2],h[m]=i[p],h[m+1]=i[p+1],h[m+2]=i[p+2],s){let v=2*(a.start+f),g=2*f;d[g]=s[v],d[g+1]=s[v+1]}}c.setAttribute("position",new ge(u,3)),c.setAttribute("normal",new ge(h,3)),s&&c.setAttribute("uv",new ge(d,2)),e.push(c)}),e}var jc=class{constructor(){this.pluginCallbacks=[],this.register(function(e){return new k0(e)}),this.register(function(e){return new V0(e)}),this.register(function(e){return new H0(e)}),this.register(function(e){return new j0(e)}),this.register(function(e){return new W0(e)})}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,n){let i=new U0,s=[];for(let o=0,a=this.pluginCallbacks.length;o<a;o++)s.push(this.pluginCallbacks[o](i));i.setPlugins(s),i.write(e,t,n)}},Et={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,FLOAT:5126,UNSIGNED_INT:5125,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},wi={};wi[Pt]=Et.NEAREST;wi[Xs]=Et.NEAREST_MIPMAP_NEAREST;wi[qs]=Et.NEAREST_MIPMAP_LINEAR;wi[$e]=Et.LINEAR;wi[jo]=Et.LINEAR_MIPMAP_NEAREST;wi[Ai]=Et.LINEAR_MIPMAP_LINEAR;wi[Zt]=Et.CLAMP_TO_EDGE;wi[di]=Et.REPEAT;wi[qr]=Et.MIRRORED_REPEAT;var B0={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},O0=12,j2=1179937895,W2=2,F0=8,J2=1313821514,X2=5130562;function Wc(r,e){return r.length===e.length&&r.every(function(t,n){return t===e[n]})}function q2(r){if(window.TextEncoder!==void 0)return new TextEncoder().encode(r).buffer;let e=new Uint8Array(new ArrayBuffer(r.length));for(let t=0,n=r.length;t<n;t++){let i=r.charCodeAt(t);e[t]=i>255?32:i}return e.buffer}function Y2(r){return Wc(r.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function K2(r,e,t){let n={min:new Array(r.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(r.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let i=e;i<e+t;i++)for(let s=0;s<r.itemSize;s++){let o;r.itemSize>4?o=r.array[i*r.itemSize+s]:s===0?o=r.getX(i):s===1?o=r.getY(i):s===2?o=r.getZ(i):s===3&&(o=r.getW(i)),n.min[s]=Math.min(n.min[s],o),n.max[s]=Math.max(n.max[s],o)}return n}function z0(r){return Math.ceil(r/4)*4}function Bm(r,e=0){let t=z0(r.byteLength);if(t!==r.byteLength){let n=new Uint8Array(t);if(n.set(new Uint8Array(r)),e!==0)for(let i=r.byteLength;i<t;i++)n[i]=e;return n.buffer}return r}var G0=null,U0=class{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}write(e,t,n){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e);let i=this;Promise.all(this.pending).then(function(){let s=i.buffers,o=i.json,a=i.options,l=i.extensionsUsed,c=new Blob(s,{type:"application/octet-stream"}),u=Object.keys(l);if(u.length>0&&(o.extensionsUsed=u),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=c.size),a.binary===!0){let h=new window.FileReader;h.readAsArrayBuffer(c),h.onloadend=function(){let d=Bm(h.result),f=new DataView(new ArrayBuffer(F0));f.setUint32(0,d.byteLength,!0),f.setUint32(4,X2,!0);let p=Bm(q2(JSON.stringify(o)),32),m=new DataView(new ArrayBuffer(F0));m.setUint32(0,p.byteLength,!0),m.setUint32(4,J2,!0);let v=new ArrayBuffer(O0),g=new DataView(v);g.setUint32(0,j2,!0),g.setUint32(4,W2,!0);let y=O0+m.byteLength+p.byteLength+f.byteLength+d.byteLength;g.setUint32(8,y,!0);let x=new Blob([v,m,p,f,d],{type:"application/octet-stream"}),b=new window.FileReader;b.readAsArrayBuffer(x),b.onloadend=function(){t(b.result)}}}else if(o.buffers&&o.buffers.length>0){let h=new window.FileReader;h.readAsDataURL(c),h.onloadend=function(){let d=h.result;o.buffers[0].uri=d,t(o)}}else t(o)})}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;let n=this.options,i=this.extensionsUsed;try{let s=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&s.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(let o in s.gltfExtensions)t.extensions[o]=s.gltfExtensions[o],i[o]=!0;delete s.gltfExtensions}Object.keys(s).length>0&&(t.extras=s)}catch(s){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+s.message)}}getUID(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;let n=new M;for(let i=0,s=e.count;i<s;i++)if(Math.abs(n.fromBufferAttribute(e,i).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){let t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);let n=e.clone(),i=new M;for(let s=0,o=n.count;s<o;s++)i.fromBufferAttribute(n,s),i.x===0&&i.y===0&&i.z===0?i.setX(1):i.normalize(),n.setXYZ(s,i.x,i.y,i.z);return t.attributesNormalized.set(e,n),n}applyTextureTransform(e,t){let n=!1,i={};(t.offset.x!==0||t.offset.y!==0)&&(i.offset=t.offset.toArray(),n=!0),t.rotation!==0&&(i.rotation=t.rotation,n=!0),(t.repeat.x!==1||t.repeat.y!==1)&&(i.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=i,this.extensionsUsed.KHR_texture_transform=!0)}processBuffer(e){let t=this.json,n=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),n.push(e),0}processBufferView(e,t,n,i,s){let o=this.json;o.bufferViews||(o.bufferViews=[]);let a;t===Et.UNSIGNED_BYTE?a=1:t===Et.UNSIGNED_SHORT?a=2:a=4;let l=z0(i*e.itemSize*a),c=new DataView(new ArrayBuffer(l)),u=0;for(let f=n;f<n+i;f++)for(let p=0;p<e.itemSize;p++){let m;e.itemSize>4?m=e.array[f*e.itemSize+p]:p===0?m=e.getX(f):p===1?m=e.getY(f):p===2?m=e.getZ(f):p===3&&(m=e.getW(f)),t===Et.FLOAT?c.setFloat32(u,m,!0):t===Et.UNSIGNED_INT?c.setUint32(u,m,!0):t===Et.UNSIGNED_SHORT?c.setUint16(u,m,!0):t===Et.UNSIGNED_BYTE&&c.setUint8(u,m),u+=a}let h={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};return s!==void 0&&(h.target=s),s===Et.ARRAY_BUFFER&&(h.byteStride=e.itemSize*a),this.byteOffset+=l,o.bufferViews.push(h),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){let t=this,n=t.json;return n.bufferViews||(n.bufferViews=[]),new Promise(function(i){let s=new window.FileReader;s.readAsArrayBuffer(e),s.onloadend=function(){let o=Bm(s.result),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};t.byteOffset+=o.byteLength,i(n.bufferViews.push(a)-1)}})}processAccessor(e,t,n,i){let s=this.options,o=this.json,a={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"},l;if(e.array.constructor===Float32Array)l=Et.FLOAT;else if(e.array.constructor===Uint32Array)l=Et.UNSIGNED_INT;else if(e.array.constructor===Uint16Array)l=Et.UNSIGNED_SHORT;else if(e.array.constructor===Uint8Array)l=Et.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");if(n===void 0&&(n=0),i===void 0&&(i=e.count),s.truncateDrawRange&&t!==void 0&&t.index===null){let f=n+i,p=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count;n=Math.max(n,t.drawRange.start),i=Math.min(f,p)-n,i<0&&(i=0)}if(i===0)return null;let c=K2(e,n,i),u;t!==void 0&&(u=e===t.index?Et.ELEMENT_ARRAY_BUFFER:Et.ARRAY_BUFFER);let h=this.processBufferView(e,l,n,i,u),d={bufferView:h.id,byteOffset:h.byteOffset,componentType:l,count:i,max:c.max,min:c.min,type:a[e.itemSize]};return e.normalized===!0&&(d.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(d)-1}processImage(e,t,n){let i=this,s=i.cache,o=i.json,a=i.options,l=i.pending;s.images.has(e)||s.images.set(e,{});let c=s.images.get(e),u=t===zt?"image/png":"image/jpeg",h=u+":flipY/"+n.toString();if(c[h]!==void 0)return c[h];o.images||(o.images=[]);let d={mimeType:u};if(a.embedImages){let p=G0=G0||document.createElement("canvas");p.width=Math.min(e.width,a.maxTextureSize),p.height=Math.min(e.height,a.maxTextureSize);let m=p.getContext("2d");if(n===!0&&(m.translate(0,p.height),m.scale(1,-1)),typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas!="undefined"&&e instanceof OffscreenCanvas||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap)m.drawImage(e,0,0,p.width,p.height);else{t!==zt&&t!==Nt&&console.error("GLTFExporter: Only RGB and RGBA formats are supported."),(e.width>a.maxTextureSize||e.height>a.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);let v=new Uint8ClampedArray(e.height*e.width*4);if(t===zt)for(let g=0;g<v.length;g+=4)v[g+0]=e.data[g+0],v[g+1]=e.data[g+1],v[g+2]=e.data[g+2],v[g+3]=e.data[g+3];else for(let g=0,y=0;g<v.length;g+=4,y+=3)v[g+0]=e.data[y+0],v[g+1]=e.data[y+1],v[g+2]=e.data[y+2],v[g+3]=255;m.putImageData(new ImageData(v,e.width,e.height),0,0)}a.binary===!0?l.push(new Promise(function(v){p.toBlob(function(g){i.processBufferViewImage(g).then(function(y){d.bufferView=y,v()})},u)})):d.uri=p.toDataURL(u)}else d.uri=e.src;let f=o.images.push(d)-1;return c[h]=f,f}processSampler(e){let t=this.json;t.samplers||(t.samplers=[]);let n={magFilter:wi[e.magFilter],minFilter:wi[e.minFilter],wrapS:wi[e.wrapS],wrapT:wi[e.wrapT]};return t.samplers.push(n)-1}processTexture(e){let t=this.cache,n=this.json;if(t.textures.has(e))return t.textures.get(e);n.textures||(n.textures=[]);let i={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY)};e.name&&(i.name=e.name),this._invokeAll(function(o){o.writeTexture&&o.writeTexture(e,i)});let s=n.textures.push(i)-1;return t.textures.set(e,s),s}processMaterial(e){let t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);let i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");let s=e.color.toArray().concat([e.opacity]);if(Wc(s,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=s),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap)if(e.metalnessMap===e.roughnessMap){let a={index:this.processTexture(e.metalnessMap)};this.applyTextureTransform(a,e.metalnessMap),i.pbrMetallicRoughness.metallicRoughnessTexture=a}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if(e.map){let a={index:this.processTexture(e.map)};this.applyTextureTransform(a,e.map),i.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){let a=e.emissive.clone().multiplyScalar(e.emissiveIntensity),l=Math.max(a.r,a.g,a.b);if(l>1&&(a.multiplyScalar(1/l),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),l>0&&(i.emissiveFactor=a.toArray()),e.emissiveMap){let c={index:this.processTexture(e.emissiveMap)};this.applyTextureTransform(c,e.emissiveMap),i.emissiveTexture=c}}if(e.normalMap){let a={index:this.processTexture(e.normalMap)};e.normalScale&&e.normalScale.x!==1&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),i.normalTexture=a}if(e.aoMap){let a={index:this.processTexture(e.aoMap),texCoord:1};e.aoMapIntensity!==1&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),i.occlusionTexture=a}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===Xt&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,i)});let o=n.materials.push(i)-1;return t.materials.set(e,o),o}processMesh(e){let t=this.cache,n=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let x=0,b=e.material.length;x<b;x++)i.push(e.material[x].uuid);else i.push(e.material.uuid);let s=i.join(":");if(t.meshes.has(s))return t.meshes.get(s);let o=e.geometry,a;if(e.isLineSegments?a=Et.LINES:e.isLineLoop?a=Et.LINE_LOOP:e.isLine?a=Et.LINE_STRIP:e.isPoints?a=Et.POINTS:a=e.material.wireframe?Et.LINES:Et.TRIANGLES,o.isBufferGeometry!==!0)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");let l={},c={},u=[],h=[],d={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},f=o.getAttribute("normal");f!==void 0&&!this.isNormalizedNormalAttribute(f)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),o.setAttribute("normal",this.createNormalizedNormalAttribute(f)));let p=null;for(let x in o.attributes){if(x.substr(0,5)==="morph")continue;let b=o.attributes[x];if(x=d[x]||x.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(x)||(x="_"+x),t.attributes.has(this.getUID(b))){c[x]=t.attributes.get(this.getUID(b));continue}p=null;let _=b.array;x==="JOINTS_0"&&!(_ instanceof Uint16Array)&&!(_ instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),p=new Re(new Uint16Array(_),b.itemSize,b.normalized));let S=this.processAccessor(p||b,o);S!==null&&(c[x]=S,t.attributes.set(this.getUID(b),S))}if(f!==void 0&&o.setAttribute("normal",f),Object.keys(c).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){let x=[],b=[],w={};if(e.morphTargetDictionary!==void 0)for(let _ in e.morphTargetDictionary)w[e.morphTargetDictionary[_]]=_;for(let _=0;_<e.morphTargetInfluences.length;++_){let S={},A=!1;for(let T in o.morphAttributes){if(T!=="position"&&T!=="normal"){A||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),A=!0);continue}let L=o.morphAttributes[T][_],C=T.toUpperCase(),U=o.attributes[T];if(t.attributes.has(this.getUID(L))){S[C]=t.attributes.get(this.getUID(L));continue}let P=L.clone();if(!o.morphTargetsRelative)for(let R=0,G=L.count;R<G;R++)P.setXYZ(R,L.getX(R)-U.getX(R),L.getY(R)-U.getY(R),L.getZ(R)-U.getZ(R));S[C]=this.processAccessor(P,o),t.attributes.set(this.getUID(U),S[C])}h.push(S),x.push(e.morphTargetInfluences[_]),e.morphTargetDictionary!==void 0&&b.push(w[_])}l.weights=x,b.length>0&&(l.extras={},l.extras.targetNames=b)}let m=Array.isArray(e.material);if(m&&o.groups.length===0)return null;let v=m?e.material:[e.material],g=m?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let x=0,b=g.length;x<b;x++){let w={mode:a,attributes:c};if(this.serializeUserData(o,w),h.length>0&&(w.targets=h),o.index!==null){let S=this.getUID(o.index);(g[x].start!==void 0||g[x].count!==void 0)&&(S+=":"+g[x].start+":"+g[x].count),t.attributes.has(S)?w.indices=t.attributes.get(S):(w.indices=this.processAccessor(o.index,o,g[x].start,g[x].count),t.attributes.set(S,w.indices)),w.indices===null&&delete w.indices}let _=this.processMaterial(v[g[x].materialIndex]);_!==null&&(w.material=_),u.push(w)}l.primitives=u,n.meshes||(n.meshes=[]),this._invokeAll(function(x){x.writeMesh&&x.writeMesh(e,l)});let y=n.meshes.push(l)-1;return t.meshes.set(s,y),y}processCamera(e){let t=this.json;t.cameras||(t.cameras=[]);let n=e.isOrthographicCamera,i={type:n?"orthographic":"perspective"};return n?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:Ee.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),t.cameras.push(i)-1}processAnimation(e,t){let n=this.json,i=this.nodeMap;n.animations||(n.animations=[]),e=jc.Utils.mergeMorphTargetTracks(e.clone(),t);let s=e.tracks,o=[],a=[];for(let l=0;l<s.length;++l){let c=s[l],u=nt.parseTrackName(c.name),h=nt.findNode(t,u.nodeName),d=B0[u.propertyName];if(u.objectName==="bones"&&(h.isSkinnedMesh===!0?h=h.skeleton.getBoneByName(u.objectIndex):h=void 0),!h||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;let f=1,p=c.values.length/c.times.length;d===B0.morphTargetInfluences&&(p/=h.morphTargetInfluences.length);let m;c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(m="CUBICSPLINE",p/=3):c.getInterpolation()===Yr?m="STEP":m="LINEAR",a.push({input:this.processAccessor(new Re(c.times,f)),output:this.processAccessor(new Re(c.values,p)),interpolation:m}),o.push({sampler:a.length-1,target:{node:i.get(h),path:d}})}return n.animations.push({name:e.name||"clip_"+n.animations.length,samplers:a,channels:o}),n.animations.length-1}processSkin(e){let t=this.json,n=this.nodeMap,i=t.nodes[n.get(e)],s=e.skeleton;if(s===void 0)return null;let o=e.skeleton.bones[0];if(o===void 0)return null;let a=[],l=new Float32Array(s.bones.length*16),c=new me;for(let h=0;h<s.bones.length;++h)a.push(n.get(s.bones[h])),c.copy(s.boneInverses[h]),c.multiply(e.bindMatrix).toArray(l,h*16);return t.skins===void 0&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new Re(l,16)),joints:a,skeleton:n.get(o)}),i.skin=t.skins.length-1}processNode(e){let t=this.json,n=this.options,i=this.nodeMap;t.nodes||(t.nodes=[]);let s={};if(n.trs){let a=e.quaternion.toArray(),l=e.position.toArray(),c=e.scale.toArray();Wc(a,[0,0,0,1])||(s.rotation=a),Wc(l,[0,0,0])||(s.translation=l),Wc(c,[1,1,1])||(s.scale=c)}else e.matrixAutoUpdate&&e.updateMatrix(),Y2(e.matrix)===!1&&(s.matrix=e.matrix.elements);if(e.name!==""&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints){let a=this.processMesh(e);a!==null&&(s.mesh=a)}else e.isCamera&&(s.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){let a=[];for(let l=0,c=e.children.length;l<c;l++){let u=e.children[l];if(u.visible||n.onlyVisible===!1){let h=this.processNode(u);h!==null&&a.push(h)}}a.length>0&&(s.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,s)});let o=t.nodes.push(s)-1;return i.set(e,o),o}processScene(e){let t=this.json,n=this.options;t.scenes||(t.scenes=[],t.scene=0);let i={};e.name!==""&&(i.name=e.name),t.scenes.push(i);let s=[];for(let o=0,a=e.children.length;o<a;o++){let l=e.children[o];if(l.visible||n.onlyVisible===!1){let c=this.processNode(l);c!==null&&s.push(c)}}s.length>0&&(i.nodes=s),this.serializeUserData(e,i)}processObjects(e){let t=new An;t.name="AuxScene";for(let n=0;n<e.length;n++)t.children.push(e[n]);this.processScene(t)}processInput(e){let t=this.options;e=e instanceof Array?e:[e],this._invokeAll(function(i){i.beforeParse&&i.beforeParse(e)});let n=[];for(let i=0;i<e.length;i++)e[i]instanceof An?this.processScene(e[i]):n.push(e[i]);n.length>0&&this.processObjects(n);for(let i=0;i<this.skins.length;++i)this.processSkin(this.skins[i]);for(let i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i],e[0]);this._invokeAll(function(i){i.afterParse&&i.afterParse(e)})}_invokeAll(e){for(let t=0,n=this.plugins.length;t<n;t++)e(this.plugins[t])}},k0=class{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}let n=this.writer,i=n.json,s=n.extensionsUsed,o={};e.name&&(o.name=e.name),o.color=e.color.toArray(),o.intensity=e.intensity,e.isDirectionalLight?o.type="directional":e.isPointLight?(o.type="point",e.distance>0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,o.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),s[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},s[this.name]=!0);let a=i.extensions[this.name].lights;a.push(o),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}},V0=class{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;let i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}},H0=class{constructor(e){this.writer=e,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(e,t){if(!e.isGLTFSpecularGlossinessMaterial)return;let n=this.writer,i=n.extensionsUsed,s={};t.pbrMetallicRoughness.baseColorFactor&&(s.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor);let o=[1,1,1];if(e.specular.toArray(o,0),s.specularFactor=o,s.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(s.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap){let a={index:n.processTexture(e.specularMap)};n.applyTextureTransform(a,e.specularMap),s.specularGlossinessTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}},j0=class{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;let n=this.writer,i=n.extensionsUsed,s={};if(s.transmissionFactor=e.transmission,e.transmissionMap){let o={index:n.processTexture(e.transmissionMap)};n.applyTextureTransform(o,e.transmissionMap),s.transmissionTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}},W0=class{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.thickness===0)return;let n=this.writer,i=n.extensionsUsed,s={};if(s.thicknessFactor=e.thickness,e.thicknessMap){let o={index:n.processTexture(e.thicknessMap)};n.applyTextureTransform(o,e.thicknessMap),s.thicknessTexture=o}s.attenuationDistance=e.attenuationDistance,s.attenuationColor=e.attenuationTint.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}};jc.Utils={insertKeyframe:function(r,e){let t=.001,n=r.getValueSize(),i=new r.TimeBufferType(r.times.length+1),s=new r.ValueBufferType(r.values.length+n),o=r.createInterpolant(new r.ValueBufferType(n)),a;if(r.times.length===0){i[0]=e;for(let l=0;l<n;l++)s[l]=0;a=0}else if(e<r.times[0]){if(Math.abs(r.times[0]-e)<t)return 0;i[0]=e,i.set(r.times,1),s.set(o.evaluate(e),0),s.set(r.values,n),a=0}else if(e>r.times[r.times.length-1]){if(Math.abs(r.times[r.times.length-1]-e)<t)return r.times.length-1;i[i.length-1]=e,i.set(r.times,0),s.set(r.values,0),s.set(o.evaluate(e),r.values.length),a=i.length-1}else for(let l=0;l<r.times.length;l++){if(Math.abs(r.times[l]-e)<t)return l;if(r.times[l]<e&&r.times[l+1]>e){i.set(r.times.slice(0,l+1),0),i[l+1]=e,i.set(r.times.slice(l+1),l+2),s.set(r.values.slice(0,(l+1)*n),0),s.set(o.evaluate(e),(l+1)*n),s.set(r.values.slice((l+1)*n),(l+2)*n),a=l+1;break}}return r.times=i,r.values=s,a},mergeMorphTargetTracks:function(r,e){let t=[],n={},i=r.tracks;for(let s=0;s<i.length;++s){let o=i[s],a=nt.parseTrackName(o.name),l=nt.findNode(e,a.nodeName);if(a.propertyName!=="morphTargetInfluences"||a.propertyIndex===void 0){t.push(o);continue}if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),o=o.clone(),o.setInterpolation(Er)}let c=l.morphTargetInfluences.length,u=l.morphTargetDictionary[a.propertyIndex];if(u===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+a.propertyIndex);let h;if(n[l.uuid]===void 0){h=o.clone();let f=new h.ValueBufferType(c*h.times.length);for(let p=0;p<h.times.length;p++)f[p*c+u]=h.values[p];h.name=(a.nodeName||"")+".morphTargetInfluences",h.values=f,n[l.uuid]=h,t.push(h);continue}let d=o.createInterpolant(new o.ValueBufferType(1));h=n[l.uuid];for(let f=0;f<h.times.length;f++)h.values[f*c+u]=d.evaluate(h.times[f]);for(let f=0;f<o.times.length;f++){let p=this.insertKeyframe(h,o.times[f]);h.values[p*c+u]=o.values[f]}}return r.tracks=t,r}};var Kh,Qh,Zh;async function J0(){if(Kh&&Qh&&Zh)return{gltfTransform:Kh,DracoMeshCompressionExtension:Qh,addIndex:Zh};let[{WebIO:r},{KHRONOS_EXTENSIONS:e,DracoMeshCompression:t},{weld:n},{createEncoderModule:i},s]=await Promise.all([import("@gltf-transform/core"),import("@gltf-transform/extensions"),import("@gltf-transform/functions"),import("draco3dgltf"),fetch("/_libraries/draco_encoder.wasm").then(l=>l.arrayBuffer())]),o=new r,a=await i({wasmBinary:s});return o.registerExtensions(e).registerDependencies({"draco3d.encoder":a}),Kh=o,Qh=t,Zh=n({tolerance:1e-4}),{gltfTransform:Kh,DracoMeshCompressionExtension:Qh,addIndex:Zh}}var vS=Cg(Y0());var rI=typeof global=="object"&&global&&global.Object===Object&&global,ed=rI;var sI=typeof self=="object"&&self&&self.Object===Object&&self,oI=ed||sI||Function("return this")(),en=oI;var aI=en.Symbol,Zn=aI;var K0=Object.prototype,lI=K0.hasOwnProperty,cI=K0.toString,Jc=Zn?Zn.toStringTag:void 0;function uI(r){var e=lI.call(r,Jc),t=r[Jc];try{r[Jc]=void 0;var n=!0}catch(s){}var i=cI.call(r);return n&&(e?r[Jc]=t:delete r[Jc]),i}var Q0=uI;var hI=Object.prototype,dI=hI.toString;function fI(r){return dI.call(r)}var Z0=fI;var pI="[object Null]",mI="[object Undefined]",$0=Zn?Zn.toStringTag:void 0;function gI(r){return r==null?r===void 0?mI:pI:$0&&$0 in Object(r)?Q0(r):Z0(r)}var er=gI;function yI(r){return r!=null&&typeof r=="object"}var $n=yI;var vI="[object Symbol]";function xI(r){return typeof r=="symbol"||$n(r)&&er(r)==vI}var tr=xI;function bI(r,e){for(var t=-1,n=r==null?0:r.length,i=Array(n);++t<n;)i[t]=e(r[t],t,r);return i}var ol=bI;var wI=Array.isArray,Jt=wI;var SI=1/0,eb=Zn?Zn.prototype:void 0,tb=eb?eb.toString:void 0;function nb(r){if(typeof r=="string")return r;if(Jt(r))return ol(r,nb)+"";if(tr(r))return tb?tb.call(r):"";var e=r+"";return e=="0"&&1/r==-SI?"-0":e}var ib=nb;var MI=/\s/;function AI(r){for(var e=r.length;e--&&MI.test(r.charAt(e)););return e}var rb=AI;var _I=/^\s+/;function TI(r){return r&&r.slice(0,rb(r)+1).replace(_I,"")}var sb=TI;function EI(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var Rn=EI;var ob=0/0,NI=/^[-+]0x[0-9a-f]+$/i,CI=/^0b[01]+$/i,LI=/^0o[0-7]+$/i,II=parseInt;function PI(r){if(typeof r=="number")return r;if(tr(r))return ob;if(Rn(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Rn(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=sb(r);var t=CI.test(r);return t||LI.test(r)?II(r.slice(2),t?2:8):NI.test(r)?ob:+r}var Fm=PI;function DI(r){return r}var td=DI;var RI="[object AsyncFunction]",BI="[object Function]",OI="[object GeneratorFunction]",FI="[object Proxy]";function zI(r){if(!Rn(r))return!1;var e=er(r);return e==BI||e==OI||e==RI||e==FI}var nd=zI;var GI=en["__core-js_shared__"],id=GI;var ab=function(){var r=/[^.]+$/.exec(id&&id.keys&&id.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function UI(r){return!!ab&&ab in r}var lb=UI;var kI=Function.prototype,VI=kI.toString;function HI(r){if(r!=null){try{return VI.call(r)}catch(e){}try{return r+""}catch(e){}}return""}var Ur=HI;var jI=/[\\^$.*+?()[\]{}|]/g,WI=/^\[object .+?Constructor\]$/,JI=Function.prototype,XI=Object.prototype,qI=JI.toString,YI=XI.hasOwnProperty,KI=RegExp("^"+qI.call(YI).replace(jI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function QI(r){if(!Rn(r)||lb(r))return!1;var e=nd(r)?KI:WI;return e.test(Ur(r))}var cb=QI;function ZI(r,e){return r==null?void 0:r[e]}var ub=ZI;function $I(r,e){var t=ub(r,e);return cb(t)?t:void 0}var ci=$I;var eP=ci(en,"WeakMap"),rd=eP;var hb=Object.create,tP=function(){function r(){}return function(e){if(!Rn(e))return{};if(hb)return hb(e);r.prototype=e;var t=new r;return r.prototype=void 0,t}}(),db=tP;function nP(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e}var fb=nP;var iP=function(){try{var r=ci(Object,"defineProperty");return r({},"",{}),r}catch(e){}}(),zm=iP;function rP(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r}var pb=rP;var sP=9007199254740991,oP=/^(?:0|[1-9]\d*)$/;function aP(r,e){var t=typeof r;return e=e==null?sP:e,!!e&&(t=="number"||t!="symbol"&&oP.test(r))&&r>-1&&r%1==0&&r<e}var sd=aP;function lP(r,e,t){e=="__proto__"&&zm?zm(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}var od=lP;function cP(r,e){return r===e||r!==r&&e!==e}var al=cP;var uP=Object.prototype,hP=uP.hasOwnProperty;function dP(r,e,t){var n=r[e];(!(hP.call(r,e)&&al(n,t))||t===void 0&&!(e in r))&&od(r,e,t)}var ad=dP;function fP(r,e,t,n){var i=!t;t||(t={});for(var s=-1,o=e.length;++s<o;){var a=e[s],l=n?n(t[a],r[a],a,t,r):void 0;l===void 0&&(l=r[a]),i?od(t,a,l):ad(t,a,l)}return t}var ws=fP;var pP=9007199254740991;function mP(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=pP}var ll=mP;function gP(r){return r!=null&&ll(r.length)&&!nd(r)}var Ss=gP;var yP=Object.prototype;function vP(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||yP;return r===t}var cl=vP;function xP(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}var mb=xP;var bP="[object Arguments]";function wP(r){return $n(r)&&er(r)==bP}var Gm=wP;var gb=Object.prototype,SP=gb.hasOwnProperty,MP=gb.propertyIsEnumerable,AP=Gm(function(){return arguments}())?Gm:function(r){return $n(r)&&SP.call(r,"callee")&&!MP.call(r,"callee")},ld=AP;function _P(){return!1}var yb=_P;var vb=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xb=vb&&typeof module=="object"&&module&&!module.nodeType&&module,TP=xb&&xb.exports===vb,bb=TP?en.Buffer:void 0,EP=bb?bb.isBuffer:void 0,NP=EP||yb,Do=NP;var CP="[object Arguments]",LP="[object Array]",IP="[object Boolean]",PP="[object Date]",DP="[object Error]",RP="[object Function]",BP="[object Map]",OP="[object Number]",FP="[object Object]",zP="[object RegExp]",GP="[object Set]",UP="[object String]",kP="[object WeakMap]",VP="[object ArrayBuffer]",HP="[object DataView]",jP="[object Float32Array]",WP="[object Float64Array]",JP="[object Int8Array]",XP="[object Int16Array]",qP="[object Int32Array]",YP="[object Uint8Array]",KP="[object Uint8ClampedArray]",QP="[object Uint16Array]",ZP="[object Uint32Array]",Ut={};Ut[jP]=Ut[WP]=Ut[JP]=Ut[XP]=Ut[qP]=Ut[YP]=Ut[KP]=Ut[QP]=Ut[ZP]=!0;Ut[CP]=Ut[LP]=Ut[VP]=Ut[IP]=Ut[HP]=Ut[PP]=Ut[DP]=Ut[RP]=Ut[BP]=Ut[OP]=Ut[FP]=Ut[zP]=Ut[GP]=Ut[UP]=Ut[kP]=!1;function $P(r){return $n(r)&&ll(r.length)&&!!Ut[er(r)]}var wb=$P;function eD(r){return function(e){return r(e)}}var Ms=eD;var Sb=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Xc=Sb&&typeof module=="object"&&module&&!module.nodeType&&module,tD=Xc&&Xc.exports===Sb,Um=tD&&ed.process,nD=function(){try{var r=Xc&&Xc.require&&Xc.require("util").types;return r||Um&&Um.binding&&Um.binding("util")}catch(e){}}(),kr=nD;var Mb=kr&&kr.isTypedArray,iD=Mb?Ms(Mb):wb,cd=iD;var rD=Object.prototype,sD=rD.hasOwnProperty;function oD(r,e){var t=Jt(r),n=!t&&ld(r),i=!t&&!n&&Do(r),s=!t&&!n&&!i&&cd(r),o=t||n||i||s,a=o?mb(r.length,String):[],l=a.length;for(var c in r)(e||sD.call(r,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||sd(c,l)))&&a.push(c);return a}var ud=oD;function aD(r,e){return function(t){return r(e(t))}}var hd=aD;var lD=hd(Object.keys,Object),Ab=lD;var cD=Object.prototype,uD=cD.hasOwnProperty;function hD(r){if(!cl(r))return Ab(r);var e=[];for(var t in Object(r))uD.call(r,t)&&t!="constructor"&&e.push(t);return e}var _b=hD;function dD(r){return Ss(r)?ud(r):_b(r)}var vr=dD;function fD(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e}var Tb=fD;var pD=Object.prototype,mD=pD.hasOwnProperty;function gD(r){if(!Rn(r))return Tb(r);var e=cl(r),t=[];for(var n in r)n=="constructor"&&(e||!mD.call(r,n))||t.push(n);return t}var Eb=gD;function yD(r){return Ss(r)?ud(r,!0):Eb(r)}var ul=yD;var vD=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xD=/^\w*$/;function bD(r,e){if(Jt(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||tr(r)?!0:xD.test(r)||!vD.test(r)||e!=null&&r in Object(e)}var hl=bD;var wD=ci(Object,"create"),Vr=wD;function SD(){this.__data__=Vr?Vr(null):{},this.size=0}var Nb=SD;function MD(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var Cb=MD;var AD="__lodash_hash_undefined__",_D=Object.prototype,TD=_D.hasOwnProperty;function ED(r){var e=this.__data__;if(Vr){var t=e[r];return t===AD?void 0:t}return TD.call(e,r)?e[r]:void 0}var Lb=ED;var ND=Object.prototype,CD=ND.hasOwnProperty;function LD(r){var e=this.__data__;return Vr?e[r]!==void 0:CD.call(e,r)}var Ib=LD;var ID="__lodash_hash_undefined__";function PD(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=Vr&&e===void 0?ID:e,this}var Pb=PD;function dl(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}dl.prototype.clear=Nb;dl.prototype.delete=Cb;dl.prototype.get=Lb;dl.prototype.has=Ib;dl.prototype.set=Pb;var km=dl;function DD(){this.__data__=[],this.size=0}var Db=DD;function RD(r,e){for(var t=r.length;t--;)if(al(r[t][0],e))return t;return-1}var As=RD;var BD=Array.prototype,OD=BD.splice;function FD(r){var e=this.__data__,t=As(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():OD.call(e,t,1),--this.size,!0}var Rb=FD;function zD(r){var e=this.__data__,t=As(e,r);return t<0?void 0:e[t][1]}var Bb=zD;function GD(r){return As(this.__data__,r)>-1}var Ob=GD;function UD(r,e){var t=this.__data__,n=As(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this}var Fb=UD;function fl(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}fl.prototype.clear=Db;fl.prototype.delete=Rb;fl.prototype.get=Bb;fl.prototype.has=Ob;fl.prototype.set=Fb;var _s=fl;var kD=ci(en,"Map"),Ts=kD;function VD(){this.size=0,this.__data__={hash:new km,map:new(Ts||_s),string:new km}}var zb=VD;function HD(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}var Gb=HD;function jD(r,e){var t=r.__data__;return Gb(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Es=jD;function WD(r){var e=Es(this,r).delete(r);return this.size-=e?1:0,e}var Ub=WD;function JD(r){return Es(this,r).get(r)}var kb=JD;function XD(r){return Es(this,r).has(r)}var Vb=XD;function qD(r,e){var t=Es(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this}var Hb=qD;function pl(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}pl.prototype.clear=zb;pl.prototype.delete=Ub;pl.prototype.get=kb;pl.prototype.has=Vb;pl.prototype.set=Hb;var Ro=pl;var YD="Expected a function";function Vm(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(YD);var t=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=t.cache;if(s.has(i))return s.get(i);var o=r.apply(this,n);return t.cache=s.set(i,o)||s,o};return t.cache=new(Vm.Cache||Ro),t}Vm.Cache=Ro;var jb=Vm;var KD=500;function QD(r){var e=jb(r,function(n){return t.size===KD&&t.clear(),n}),t=e.cache;return e}var Wb=QD;var ZD=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$D=/\\(\\)?/g,eR=Wb(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(ZD,function(t,n,i,s){e.push(i?s.replace($D,"$1"):n||t)}),e}),Jb=eR;function tR(r){return r==null?"":ib(r)}var Xb=tR;function nR(r,e){return Jt(r)?r:hl(r,e)?[r]:Jb(Xb(r))}var dd=nR;var iR=1/0;function rR(r){if(typeof r=="string"||tr(r))return r;var e=r+"";return e=="0"&&1/r==-iR?"-0":e}var Ns=rR;function sR(r,e){e=dd(e,r);for(var t=0,n=e.length;r!=null&&t<n;)r=r[Ns(e[t++])];return t&&t==n?r:void 0}var ml=sR;function oR(r,e,t){var n=r==null?void 0:ml(r,e);return n===void 0?t:n}var qb=oR;function aR(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}var fd=aR;var lR=hd(Object.getPrototypeOf,Object),pd=lR;function cR(){this.__data__=new _s,this.size=0}var Yb=cR;function uR(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}var Kb=uR;function hR(r){return this.__data__.get(r)}var Qb=hR;function dR(r){return this.__data__.has(r)}var Zb=dR;var fR=200;function pR(r,e){var t=this.__data__;if(t instanceof _s){var n=t.__data__;if(!Ts||n.length<fR-1)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new Ro(n)}return t.set(r,e),this.size=t.size,this}var $b=pR;function gl(r){var e=this.__data__=new _s(r);this.size=e.size}gl.prototype.clear=Yb;gl.prototype.delete=Kb;gl.prototype.get=Qb;gl.prototype.has=Zb;gl.prototype.set=$b;var Cs=gl;function mR(r,e){return r&&ws(e,vr(e),r)}var ew=mR;function gR(r,e){return r&&ws(e,ul(e),r)}var tw=gR;var nw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,iw=nw&&typeof module=="object"&&module&&!module.nodeType&&module,yR=iw&&iw.exports===nw,rw=yR?en.Buffer:void 0,sw=rw?rw.allocUnsafe:void 0;function vR(r,e){if(e)return r.slice();var t=r.length,n=sw?sw(t):new r.constructor(t);return r.copy(n),n}var ow=vR;function xR(r,e){for(var t=-1,n=r==null?0:r.length,i=0,s=[];++t<n;){var o=r[t];e(o,t,r)&&(s[i++]=o)}return s}var aw=xR;function bR(){return[]}var md=bR;var wR=Object.prototype,SR=wR.propertyIsEnumerable,lw=Object.getOwnPropertySymbols,MR=lw?function(r){return r==null?[]:(r=Object(r),aw(lw(r),function(e){return SR.call(r,e)}))}:md,yl=MR;function AR(r,e){return ws(r,yl(r),e)}var cw=AR;var _R=Object.getOwnPropertySymbols,TR=_R?function(r){for(var e=[];r;)fd(e,yl(r)),r=pd(r);return e}:md,gd=TR;function ER(r,e){return ws(r,gd(r),e)}var uw=ER;function NR(r,e,t){var n=e(r);return Jt(r)?n:fd(n,t(r))}var yd=NR;function CR(r){return yd(r,vr,yl)}var qc=CR;function LR(r){return yd(r,ul,gd)}var hw=LR;var IR=ci(en,"DataView"),vd=IR;var PR=ci(en,"Promise"),xd=PR;var DR=ci(en,"Set"),bd=DR;var dw="[object Map]",RR="[object Object]",fw="[object Promise]",pw="[object Set]",mw="[object WeakMap]",gw="[object DataView]",BR=Ur(vd),OR=Ur(Ts),FR=Ur(xd),zR=Ur(bd),GR=Ur(rd),Bo=er;(vd&&Bo(new vd(new ArrayBuffer(1)))!=gw||Ts&&Bo(new Ts)!=dw||xd&&Bo(xd.resolve())!=fw||bd&&Bo(new bd)!=pw||rd&&Bo(new rd)!=mw)&&(Bo=function(r){var e=er(r),t=e==RR?r.constructor:void 0,n=t?Ur(t):"";if(n)switch(n){case BR:return gw;case OR:return dw;case FR:return fw;case zR:return pw;case GR:return mw}return e});var Hr=Bo;var UR=Object.prototype,kR=UR.hasOwnProperty;function VR(r){var e=r.length,t=new r.constructor(e);return e&&typeof r[0]=="string"&&kR.call(r,"index")&&(t.index=r.index,t.input=r.input),t}var yw=VR;var HR=en.Uint8Array,vl=HR;function jR(r){var e=new r.constructor(r.byteLength);return new vl(e).set(new vl(r)),e}var xl=jR;function WR(r,e){var t=e?xl(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.byteLength)}var vw=WR;var JR=/\w*$/;function XR(r){var e=new r.constructor(r.source,JR.exec(r));return e.lastIndex=r.lastIndex,e}var xw=XR;var bw=Zn?Zn.prototype:void 0,ww=bw?bw.valueOf:void 0;function qR(r){return ww?Object(ww.call(r)):{}}var Sw=qR;function YR(r,e){var t=e?xl(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.length)}var Mw=YR;var KR="[object Boolean]",QR="[object Date]",ZR="[object Map]",$R="[object Number]",eB="[object RegExp]",tB="[object Set]",nB="[object String]",iB="[object Symbol]",rB="[object ArrayBuffer]",sB="[object DataView]",oB="[object Float32Array]",aB="[object Float64Array]",lB="[object Int8Array]",cB="[object Int16Array]",uB="[object Int32Array]",hB="[object Uint8Array]",dB="[object Uint8ClampedArray]",fB="[object Uint16Array]",pB="[object Uint32Array]";function mB(r,e,t){var n=r.constructor;switch(e){case rB:return xl(r);case KR:case QR:return new n(+r);case sB:return vw(r,t);case oB:case aB:case lB:case cB:case uB:case hB:case dB:case fB:case pB:return Mw(r,t);case ZR:return new n;case $R:case nB:return new n(r);case eB:return xw(r);case tB:return new n;case iB:return Sw(r)}}var Aw=mB;function gB(r){return typeof r.constructor=="function"&&!cl(r)?db(pd(r)):{}}var _w=gB;var yB="[object Map]";function vB(r){return $n(r)&&Hr(r)==yB}var Tw=vB;var Ew=kr&&kr.isMap,xB=Ew?Ms(Ew):Tw,Nw=xB;var bB="[object Set]";function wB(r){return $n(r)&&Hr(r)==bB}var Cw=wB;var Lw=kr&&kr.isSet,SB=Lw?Ms(Lw):Cw,Iw=SB;var MB=1,AB=2,_B=4,Pw="[object Arguments]",TB="[object Array]",EB="[object Boolean]",NB="[object Date]",CB="[object Error]",Dw="[object Function]",LB="[object GeneratorFunction]",IB="[object Map]",PB="[object Number]",Rw="[object Object]",DB="[object RegExp]",RB="[object Set]",BB="[object String]",OB="[object Symbol]",FB="[object WeakMap]",zB="[object ArrayBuffer]",GB="[object DataView]",UB="[object Float32Array]",kB="[object Float64Array]",VB="[object Int8Array]",HB="[object Int16Array]",jB="[object Int32Array]",WB="[object Uint8Array]",JB="[object Uint8ClampedArray]",XB="[object Uint16Array]",qB="[object Uint32Array]",Ot={};Ot[Pw]=Ot[TB]=Ot[zB]=Ot[GB]=Ot[EB]=Ot[NB]=Ot[UB]=Ot[kB]=Ot[VB]=Ot[HB]=Ot[jB]=Ot[IB]=Ot[PB]=Ot[Rw]=Ot[DB]=Ot[RB]=Ot[BB]=Ot[OB]=Ot[WB]=Ot[JB]=Ot[XB]=Ot[qB]=!0;Ot[CB]=Ot[Dw]=Ot[FB]=!1;function wd(r,e,t,n,i,s){var o,a=e&MB,l=e&AB,c=e&_B;if(t&&(o=i?t(r,n,i,s):t(r)),o!==void 0)return o;if(!Rn(r))return r;var u=Jt(r);if(u){if(o=yw(r),!a)return fb(r,o)}else{var h=Hr(r),d=h==Dw||h==LB;if(Do(r))return ow(r,a);if(h==Rw||h==Pw||d&&!i){if(o=l||d?{}:_w(r),!a)return l?uw(r,tw(o,r)):cw(r,ew(o,r))}else{if(!Ot[h])return i?r:{};o=Aw(r,h,a)}}s||(s=new Cs);var f=s.get(r);if(f)return f;s.set(r,o),Iw(r)?r.forEach(function(v){o.add(wd(v,e,t,v,r,s))}):Nw(r)&&r.forEach(function(v,g){o.set(g,wd(v,e,t,g,r,s))});var p=c?l?hw:qc:l?ul:vr,m=u?void 0:p(r);return pb(m||r,function(v,g){m&&(g=v,v=r[g]),ad(o,g,wd(v,e,t,g,r,s))}),o}var Bw=wd;var YB=1,KB=4;function QB(r){return Bw(r,YB|KB)}var Hm=QB;var ZB="__lodash_hash_undefined__";function $B(r){return this.__data__.set(r,ZB),this}var Ow=$B;function eO(r){return this.__data__.has(r)}var Fw=eO;function Sd(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new Ro;++e<t;)this.add(r[e])}Sd.prototype.add=Sd.prototype.push=Ow;Sd.prototype.has=Fw;var zw=Sd;function tO(r,e){for(var t=-1,n=r==null?0:r.length;++t<n;)if(e(r[t],t,r))return!0;return!1}var Gw=tO;function nO(r,e){return r.has(e)}var Uw=nO;var iO=1,rO=2;function sO(r,e,t,n,i,s){var o=t&iO,a=r.length,l=e.length;if(a!=l&&!(o&&l>a))return!1;var c=s.get(r),u=s.get(e);if(c&&u)return c==e&&u==r;var h=-1,d=!0,f=t&rO?new zw:void 0;for(s.set(r,e),s.set(e,r);++h<a;){var p=r[h],m=e[h];if(n)var v=o?n(m,p,h,e,r,s):n(p,m,h,r,e,s);if(v!==void 0){if(v)continue;d=!1;break}if(f){if(!Gw(e,function(g,y){if(!Uw(f,y)&&(p===g||i(p,g,t,n,s)))return f.push(y)})){d=!1;break}}else if(!(p===m||i(p,m,t,n,s))){d=!1;break}}return s.delete(r),s.delete(e),d}var Md=sO;function oO(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t}var kw=oO;function aO(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}var Vw=aO;var lO=1,cO=2,uO="[object Boolean]",hO="[object Date]",dO="[object Error]",fO="[object Map]",pO="[object Number]",mO="[object RegExp]",gO="[object Set]",yO="[object String]",vO="[object Symbol]",xO="[object ArrayBuffer]",bO="[object DataView]",Hw=Zn?Zn.prototype:void 0,jm=Hw?Hw.valueOf:void 0;function wO(r,e,t,n,i,s,o){switch(t){case bO:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case xO:return!(r.byteLength!=e.byteLength||!s(new vl(r),new vl(e)));case uO:case hO:case pO:return al(+r,+e);case dO:return r.name==e.name&&r.message==e.message;case mO:case yO:return r==e+"";case fO:var a=kw;case gO:var l=n&lO;if(a||(a=Vw),r.size!=e.size&&!l)return!1;var c=o.get(r);if(c)return c==e;n|=cO,o.set(r,e);var u=Md(a(r),a(e),n,i,s,o);return o.delete(r),u;case vO:if(jm)return jm.call(r)==jm.call(e)}return!1}var jw=wO;var SO=1,MO=Object.prototype,AO=MO.hasOwnProperty;function _O(r,e,t,n,i,s){var o=t&SO,a=qc(r),l=a.length,c=qc(e),u=c.length;if(l!=u&&!o)return!1;for(var h=l;h--;){var d=a[h];if(!(o?d in e:AO.call(e,d)))return!1}var f=s.get(r),p=s.get(e);if(f&&p)return f==e&&p==r;var m=!0;s.set(r,e),s.set(e,r);for(var v=o;++h<l;){d=a[h];var g=r[d],y=e[d];if(n)var x=o?n(y,g,d,e,r,s):n(g,y,d,r,e,s);if(!(x===void 0?g===y||i(g,y,t,n,s):x)){m=!1;break}v||(v=d=="constructor")}if(m&&!v){var b=r.constructor,w=e.constructor;b!=w&&"constructor"in r&&"constructor"in e&&!(typeof b=="function"&&b instanceof b&&typeof w=="function"&&w instanceof w)&&(m=!1)}return s.delete(r),s.delete(e),m}var Ww=_O;var TO=1,Jw="[object Arguments]",Xw="[object Array]",Ad="[object Object]",EO=Object.prototype,qw=EO.hasOwnProperty;function NO(r,e,t,n,i,s){var o=Jt(r),a=Jt(e),l=o?Xw:Hr(r),c=a?Xw:Hr(e);l=l==Jw?Ad:l,c=c==Jw?Ad:c;var u=l==Ad,h=c==Ad,d=l==c;if(d&&Do(r)){if(!Do(e))return!1;o=!0,u=!1}if(d&&!u)return s||(s=new Cs),o||cd(r)?Md(r,e,t,n,i,s):jw(r,e,l,t,n,i,s);if(!(t&TO)){var f=u&&qw.call(r,"__wrapped__"),p=h&&qw.call(e,"__wrapped__");if(f||p){var m=f?r.value():r,v=p?e.value():e;return s||(s=new Cs),i(m,v,t,n,s)}}return d?(s||(s=new Cs),Ww(r,e,t,n,i,s)):!1}var Yw=NO;function Kw(r,e,t,n,i){return r===e?!0:r==null||e==null||!$n(r)&&!$n(e)?r!==r&&e!==e:Yw(r,e,t,n,Kw,i)}var _d=Kw;var CO=1,LO=2;function IO(r,e,t,n){var i=t.length,s=i,o=!n;if(r==null)return!s;for(r=Object(r);i--;){var a=t[i];if(o&&a[2]?a[1]!==r[a[0]]:!(a[0]in r))return!1}for(;++i<s;){a=t[i];var l=a[0],c=r[l],u=a[1];if(o&&a[2]){if(c===void 0&&!(l in r))return!1}else{var h=new Cs;if(n)var d=n(c,u,l,r,e,h);if(!(d===void 0?_d(u,c,CO|LO,n,h):d))return!1}}return!0}var Qw=IO;function PO(r){return r===r&&!Rn(r)}var Td=PO;function DO(r){for(var e=vr(r),t=e.length;t--;){var n=e[t],i=r[n];e[t]=[n,i,Td(i)]}return e}var Zw=DO;function RO(r,e){return function(t){return t==null?!1:t[r]===e&&(e!==void 0||r in Object(t))}}var Ed=RO;function BO(r){var e=Zw(r);return e.length==1&&e[0][2]?Ed(e[0][0],e[0][1]):function(t){return t===r||Qw(t,r,e)}}var $w=BO;function OO(r,e){return r!=null&&e in Object(r)}var eS=OO;function FO(r,e,t){e=dd(e,r);for(var n=-1,i=e.length,s=!1;++n<i;){var o=Ns(e[n]);if(!(s=r!=null&&t(r,o)))break;r=r[o]}return s||++n!=i?s:(i=r==null?0:r.length,!!i&&ll(i)&&sd(o,i)&&(Jt(r)||ld(r)))}var tS=FO;function zO(r,e){return r!=null&&tS(r,e,eS)}var nS=zO;var GO=1,UO=2;function kO(r,e){return hl(r)&&Td(e)?Ed(Ns(r),e):function(t){var n=qb(t,r);return n===void 0&&n===e?nS(t,r):_d(e,n,GO|UO)}}var iS=kO;function VO(r){return function(e){return e==null?void 0:e[r]}}var rS=VO;function HO(r){return function(e){return ml(e,r)}}var sS=HO;function jO(r){return hl(r)?rS(Ns(r)):sS(r)}var oS=jO;function WO(r){return typeof r=="function"?r:r==null?td:typeof r=="object"?Jt(r)?iS(r[0],r[1]):$w(r):oS(r)}var aS=WO;function JO(r){return function(e,t,n){for(var i=-1,s=Object(e),o=n(e),a=o.length;a--;){var l=o[r?a:++i];if(t(s[l],l,s)===!1)break}return e}}var lS=JO;var XO=lS(),cS=XO;function qO(r,e){return r&&cS(r,e,vr)}var uS=qO;function YO(r,e){return function(t,n){if(t==null)return t;if(!Ss(t))return r(t,n);for(var i=t.length,s=e?i:-1,o=Object(t);(e?s--:++s<i)&&n(o[s],s,o)!==!1;);return t}}var hS=YO;var KO=hS(uS),dS=KO;var QO=function(){return en.Date.now()},Nd=QO;var ZO="Expected a function",$O=Math.max,e3=Math.min;function t3(r,e,t){var n,i,s,o,a,l,c=0,u=!1,h=!1,d=!0;if(typeof r!="function")throw new TypeError(ZO);e=Fm(e)||0,Rn(t)&&(u=!!t.leading,h="maxWait"in t,s=h?$O(Fm(t.maxWait)||0,e):s,d="trailing"in t?!!t.trailing:d);function f(_){var S=n,A=i;return n=i=void 0,c=_,o=r.apply(A,S),o}function p(_){return c=_,a=setTimeout(g,e),u?f(_):o}function m(_){var S=_-l,A=_-c,T=e-S;return h?e3(T,s-A):T}function v(_){var S=_-l,A=_-c;return l===void 0||S>=e||S<0||h&&A>=s}function g(){var _=Nd();if(v(_))return y(_);a=setTimeout(g,m(_))}function y(_){return a=void 0,d&&n?f(_):(n=i=void 0,o)}function x(){a!==void 0&&clearTimeout(a),c=0,n=l=i=a=void 0}function b(){return a===void 0?o:y(Nd())}function w(){var _=Nd(),S=v(_);if(n=arguments,i=this,l=_,S){if(a===void 0)return p(l);if(h)return clearTimeout(a),a=setTimeout(g,e),f(l)}return a===void 0&&(a=setTimeout(g,e)),o}return w.cancel=x,w.flush=b,w}var Wm=t3;function n3(r,e){var t=-1,n=Ss(r)?Array(r.length):[];return dS(r,function(i,s,o){n[++t]=e(i,s,o)}),n}var fS=n3;function i3(r,e){var t=r.length;for(r.sort(e);t--;)r[t]=r[t].value;return r}var pS=i3;function r3(r,e){if(r!==e){var t=r!==void 0,n=r===null,i=r===r,s=tr(r),o=e!==void 0,a=e===null,l=e===e,c=tr(e);if(!a&&!c&&!s&&r>e||s&&o&&l&&!a&&!c||n&&o&&l||!t&&l||!i)return 1;if(!n&&!s&&!c&&r<e||c&&t&&i&&!n&&!s||a&&t&&i||!o&&i||!l)return-1}return 0}var mS=r3;function s3(r,e,t){for(var n=-1,i=r.criteria,s=e.criteria,o=i.length,a=t.length;++n<o;){var l=mS(i[n],s[n]);if(l){if(n>=a)return l;var c=t[n];return l*(c=="desc"?-1:1)}}return r.index-e.index}var gS=s3;function o3(r,e,t){e.length?e=ol(e,function(s){return Jt(s)?function(o){return ml(o,s.length===1?s[0]:s)}:s}):e=[td];var n=-1;e=ol(e,Ms(aS));var i=fS(r,function(s,o,a){var l=ol(e,function(c){return c(s)});return{criteria:l,index:++n,value:s}});return pS(i,function(s,o){return gS(s,o,t)})}var yS=o3;function a3(r,e,t,n){return r==null?[]:(Jt(e)||(e=e==null?[]:[e]),t=n?void 0:t,Jt(t)||(t=t==null?[]:[t]),yS(r,e,t))}var Jm=a3;var Cd={isPublish:!1,gltfQueue:[]};function Yc(r,e,t){return r[e.uuid]===void 0&&(r[e.uuid]=e.toJSON(t)),e.uuid}var l3=new jc;function xS(r,e,t){if(r[e.uuid]===void 0)if(e.userData.type==="NonParametricGeometry"||e.userData.type==="SubdivGeometry"){if(e.userData.type==="SubdivGeometry")if(Cd.isPublish)e=Lo.create({geometry:e.clone()}),e.userData.parameters.subdivisions===0&&(delete e.attributes.color,delete e.attributes.faceMap,delete e.attributes.positionWASM,delete e.attributes.indexWASM,delete e.attributes.verticesPerFaceWASM);else{let i=e.originalGeometry;if(i){let s=e.userData;e=i.clone(),e.userData=s}else e=e.clone();delete e.attributes.color,delete e.attributes.faceMap,delete e.attributes.position,delete e.attributes.normal,e.index=null}let n=e.originalGeometry;if(n!==void 0){let i=e.userData;e=n,e.userData=i}if(!Cd.isPublish)r[e.uuid]=e.toJSON();else{let i={type:"NonParametricGeometry",uuid:e.uuid,userData:{}};e.name!==""&&(i.name=e.name),Object.keys(e.userData).length>0&&(i.userData=Ue({},e.userData));let s=e.index===null,o=new Jn;if(Array.isArray(t))R0(e).forEach((l,c)=>{let u=new gt(l,new Xi);o.add(u),l.userData.groupIndex=c,l.userData.materialIndex=e.groups[c].materialIndex,l.index===null&&(s=!0)});else{let a=new gt(e,new Xi);o.add(a)}Cd.gltfQueue.push(new Promise(async a=>{await Promise.all(Cd.gltfQueue),l3.parse(o,async l=>{let{gltfTransform:c,DracoMeshCompressionExtension:u,addIndex:h}=await J0(),d=c.readJSON({json:Hm(l),resources:{}});d.createExtension(u).setRequired(!0).setEncoderOptions({quantizationVolume:"scene"}),s&&await d.transform(h);try{let{json:f,resources:p}=c.writeJSON(d),m=vS.default.fromByteArray(new Uint8Array(p[".bin"]));f.buffers[0].uri=`data:application/octet-stream;base64,${m}`,i.gltf=f,a()}catch(f){i.gltf=l,a()}},{})})),r[e.uuid]=i}}else{let n=e.userData;if(n.type==="VectorGeometry"){let i=e.userData.shape;n=Object.assign({},n,{shape:i.toJSON()})}r[e.uuid]={uuid:e.uuid,userData:n}}return e.uuid}function bl(r){let e=[];for(let t in r){let n=r[t];delete n.metadata,e.push(n)}return e}function bS(r){let e=[];for(let t in r)e.push(r[t]);return e}var Is=class{constructor(e){this.object=e;this.uuid=Ee.generateUUID();this.states=[];this.events=[];this._interpolateMaterialBetweenValues=(e,t,n,i=t.getNames())=>{var s,o,a,l,c;for(let u=0,h=i.length;u<h;++u){let d=i[u],f=`f${t.id}_${d}`,p=`f${n.id}_${d}`,m=t.uniforms[f],v=n.uniforms[p];if(!(m.value===void 0||v===void 0)){if(d==="mode"){m.value!==v.value&&(m.value=v.value);continue}if(typeof m.value=="boolean"){m.value!==v.value&&(m.value=v.value);continue}if(typeof m.value=="number"){m.value!==v.value&&((s=this._animation)==null||s.add({targets:m,value:Number(v.value)},0));continue}if("isVector2"in m.value){m.value.equals(v.value)===!1&&((o=this._animation)==null||o.add({targets:m,x:v.value.x,y:v.value.y},0));continue}if("isVector3"in m.value){m.value.equals(v.value)===!1&&((a=this._animation)==null||a.add({targets:m,x:v.value.x,y:v.value.y,z:v.value.z},0));continue}if("isColor"in m.value){m.value.equals(v.value)===!1&&((l=this._animation)==null||l.add({targets:m.value,r:v.value.r,g:v.value.g,b:v.value.b},0));continue}}}if(t.backLayer){let h=`f${t.backLayer.id}_alpha`,d=t.backLayer.uniforms[h];(c=this._animation)==null||c.add({targets:d,value:0},0)}};this._interpolateMaterialBetweenLayers=(e,t,n)=>{var c,u,h;let i=e.layersList;if(t.backLayer===void 0){let d=n.getValues();d.alpha=0,t.backLayer=i.addLayerBeforeAt(d,t),t.backLayer.isBack=!0,e.dispose()}let s=`f${t.id}_alpha`,o=`f${(c=t.backLayer)==null?void 0:c.id}_alpha`,a=t.uniforms[s],l=(u=t.backLayer)==null?void 0:u.uniforms[o];(h=this._animation)==null||h.add({targets:a,value:0},0).add({targets:l,value:n.uniforms[`f${n.id}_alpha`].value},0)};this._interpolateMaterialTexture=(e,t,n)=>{var d;let i=`f${t.id}_texture`,s=t.uniforms[i].value,o=n.uniforms[`f${n.id}_texture`].value,a=t.uniforms[`f${t.id}_crop`],l=n.uniforms[`f${n.id}_crop`];a&&l&&a.value!==l.value&&(a.value=Number(l.value)),(s.wrapS!==o.wrapS||s.wrapT!==o.wrapT)&&(s.wrapS=o.wrapS,s.wrapT=o.wrapT,s.needsUpdate=!0);let c=s.matrix,u=o.matrix;if(c.equals(u)===!1){let f={repeatX:s.repeat.x,repeatY:s.repeat.y,offsetX:s.offset.x,offsetY:s.offset.y};(d=this._animation)==null||d.add({targets:f,repeatX:o.repeat.x,repeatY:o.repeat.y,offsetX:o.offset.x,offsetY:o.offset.y,update:()=>{s.repeat.set(f.repeatX,f.repeatY),s.offset.set(f.offsetX,f.offsetY),s.updateMatrix(),s.needsUpdate=!0}},0)}let h=["alpha","mode"];t.type==="displace_map"&&h.push("intensity"),this._interpolateMaterialBetweenValues(e,t,n,h)};this._interpolateMaterialGradient=(e,t,n)=>{var p;let i=t.uniforms[`f${t.id}_num`],s=n.uniforms[`f${n.id}_num`],o=`f${t.id}_steps`,a=`f${n.id}_steps`,l=t.uniforms[o],c=n.uniforms[a],u=`f${t.id}_colors`,h=`f${n.id}_colors`,d=t.uniforms[u],f=n.uniforms[h];if(i.value<=s.value){let m=d.value[i.value-1];for(let v=Number(i.value);v<s.value;++v)l.value[v]=1,d.value[v].copy(m);i.value!==s.value&&(i.value=Number(s.value));for(let v=0;v<s.value;++v){let g=d.value[v],y=f.value[v];if(l.value[v]!==c.value[v]||!g.equals(y)){let x={value:l.value[v]};(p=this._animation)==null||p.add({targets:[x,g],value:c.value[v],x:y.x,y:y.y,z:y.z,w:y.w,update:()=>{l.value[v]=x.value}},0)}}}else{let m=[];for(let g=0;g<s.value;++g){let y=d.value[g],x=f.value[g];if(l.value[g]!==c.value[g]||!y.equals(x)){let b={value:l.value[g]};m.push(new Promise(w=>{var _;(_=this._animation)==null||_.add({targets:[b,y],value:c.value[g],x:x.x,y:x.y,z:x.z,w:x.w,update:()=>{l.value[g]=b.value},complete:()=>{w(g)}},0)}))}}let v=f.value[s.value-1];for(let g=Number(s.value);g<i.value;++g){let y=d.value[g];(l.value[g]!==c.value[g]||!y.equals(v))&&m.push(new Promise(x=>{var w;let b={value:l.value[g]};(w=this._animation)==null||w.add({targets:[b,y],value:1,x:v.x,y:v.y,z:v.z,w:v.w,update:()=>{l.value[g]=b.value},complete:()=>{x(g)}},0)}))}Promise.all(m).then(()=>{i.value=Number(s.value)},()=>{})}this._interpolateMaterialBetweenValues(e,t,n,["alpha","mode","gl_type","smooth","offset","morph","angle"])};this.statesManager=new Rm(this)}static get isAllAnimationsEnded(){let e;for(let t in Is.isAnimating){if(Is.isAnimating[t])return!1;e=!0}return e}computeCache(){return this.cache={mouseDown:this.events.find(e=>e.type===Ze.MOUSE_DOWN),mouseUp:this.events.find(e=>e.type===Ze.MOUSE_UP),mouseHover:this.events.find(e=>e.type===Ze.MOUSE_HOVER),start:this.events.find(e=>e.type===Ze.START),lookAt:this.events.find(e=>e.type===Ze.LOOK_AT),follow:this.events.find(e=>e.type===Ze.FOLLOW),keyDown:this.events.filter(e=>e.type===Ze.KEY_DOWN),keyUp:this.events.filter(e=>e.type===Ze.KEY_UP)},this.cache}newState(e){let t=new bs;return t.name=e,t.update(this.object),this.selectedState=this.states.length,this.states.push(t),t}addState(e,t){this.states.splice(t,0,e)}removeState(e){this.selectedState===e&&(this.selectedState=void 0),this.states.splice(e,1)}selectState(e){e!==void 0&&this.states[e].execute(this.object),this.selectedState=e}hasEventType(e,t){return e===Ze.KEY_DOWN||e===Ze.KEY_UP?t===void 0?!1:this.events.some(n=>n.type===e&&n.key===t):this.events.some(n=>n.type===e)}newEvent(){let e=[Ze.MOUSE_DOWN,Ze.MOUSE_UP,Ze.MOUSE_HOVER,Ze.KEY_DOWN].find(n=>this.hasEventType(n)===!1),t=new sl(e);return this.events.push(t),t}addEvent(e,t){this.events.splice(t,0,e);let n=this.events[t].targets;for(let i=0,s=n.length;i<s;++i)n[i].object!==void 0&&Io.add(n[i])}removeEvent(e){let t=this.events[e].targets;for(let n=0,i=t.length;n<i;++n)t[n].object!==void 0&&Io.delete(t[n]);this.events.splice(e,1)}copy(e){this.selectedState=e.selectedState;for(let t=0,n=e.states.length;t<n;++t)this.addState(e.states[t].clone(),t);for(let t=0,n=e.events.length;t<n;++t){this.addEvent(e.events[t].clone(),t);let i=e.events[t].targets;for(let s=0,o=i.length;s<o;++s){let a=i[s].clone();i[s].object===e.object?(a.object=this.object,a.state=this.states[e.states.indexOf(i[s].state)]):(a.object=i[s].object,a.state=i[s].state),this.events[t].addTarget(a,s)}}return this}clone(e){return new Is(e).copy(this)}toJSON(e){e===void 0&&(e={nodes:{},geometries:{},materials:{},textures:{},images:{},interactionStates:{}});let t={uuid:this.uuid};if(this.selectedState!==void 0&&(t.selectedState=this.selectedState),this.states.length>0){t.states=[];for(let n=0,i=this.states.length;n<i;++n)t.states.push(Yc(e.interactionStates,this.states[n],e))}if(this.events.length>0){t.events=[];for(let n=0,i=this.events.length;n<i;++n)t.events.push(this.events[n].toJSON())}return t}fromJSON(e,t,n){var i;if(this.uuid=e.uuid,this.selectedState=e.selectedState,this.states=[],this.events=[],e.states!==void 0)for(let s=0,o=e.states.length;s<o;++s){let a=n[e.states[s]];this.states.push(a),((i=a.camera)==null?void 0:i.targetOffset)===-1&&(a.camera.targetOffset=this.object.getDistanceToTarget())}if(e.events!==void 0)for(let s=0,o=e.events.length;s<o;++s)this.events.push(new sl().fromJSON(e.events[s],t,n));return this}start(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0,this._removeBackLayer()),this.states.length>1?(this.states[0].execute(this.object),this._currentState=this.states[0],this._prevState=void 0):this._state0!==void 0?this._state0.execute(this.object):this.events.some(e=>e.type===Ze.LOOK_AT||e.type===Ze.FOLLOW)&&(this._state0=new bs,this._state0.update(this.object))}end(){var e;this._animation!==void 0&&(this._animation.pause(),this._animation=void 0,this._removeBackLayer()),this.states.length>1?this.states[(e=this.selectedState)!=null?e:0].execute(this.object):this._state0!==void 0&&(this._state0.execute(this.object),this._state0=void 0),this._currentState=void 0,this._prevState=void 0}lookAt(e){var t;this.object.lookAt(e),(t=this._animation)==null||t.finished.then(()=>{this.lookAt(e)})}follow(e){this.object.position.copy(e),this.object.parent!==null&&this.object.position.applyMatrix4(new me().copy(this.object.parent.matrixWorld).invert()),this.object.position.applyMatrix4(new me().copy(this.object.hiddenMatrix).invert())}play(e){this.object.visible&&e.state!==void 0&&this.animate(e.state,e)}reverse(e){this.object.visible&&this._prevState!==void 0&&this.animate(this._prevState,e)}_removeBackLayer(){if("material"in this.object){let e=this.object.material;if(e instanceof Array)for(let t=0,n=e.length;t<n;++t){let i=e[t].layersList,s=i.head;for(;s;)if(s.backLayer){delete s.backLayer;let o=s.next;i.removeLayer(s.id),s=o}else s.isBack&&(s.isBack=!1),s=s.next}else{let t=e.layersList,n=t.head;for(;n;)for(;n;)if(n.backLayer){delete n.backLayer;let i=n.next;t.removeLayer(n.id),n=i}else n.isBack&&(n.isBack=!1),n=n.next}}}getTimingFunction(e,t,n){switch(e){case $i.LINEAR:return"cubicBezier( 0, 0, 1, 1 )";case $i.EASE:return"cubicBezier( .25, .1, .25, 1 )";case $i.EASE_IN:return"cubicBezier( .42, 0, 1, 1 )";case $i.EASE_OUT:return"cubicBezier( 0, 0, .58, 1 )";case $i.EASE_IN_OUT:return"cubicBezier( .42, 0, .58, 1 )";case $i.CUBIC:return`cubicBezier( ${t[0]}, ${t[1]}, ${t[2]}, ${t[3]} )`;case $i.SPRING:return`spring( ${n.mass}, ${n.stiffness}, ${n.damping}, ${n.velocity} )`}}animate(e,t){var n,i,s,o,a,l;if(Is.isAnimating[e.uuid]=!0,this._currentState===e){if((n=this._animation)==null?void 0:n.reversed){let c=(s=(i=this._animation)==null?void 0:i.currentTime)!=null?s:0;(o=this._animation)==null||o.reset(),(a=this._animation)==null||a.seek(c),(l=this._animation)==null||l.play()}}else this._prevState=this._currentState,this._currentState=e,this._animation!==void 0&&(Is.isAnimating[this._prevState.uuid]=!1,this._animation.pause()),this._removeBackLayer(),t.cycle===!0&&t.repeat===!0?this._animation=Hc.timeline({duration:t.duration,delay:t.delay/2,endDelay:t.delay/2,direction:"alternate",loop:!0,rewind:t.rewind,easing:this.getTimingFunction(t.easing,t.cubicControls,t.springParameters)}):t.cycle===!0&&t.repeat===!1?this._animation=Hc.timeline({duration:t.duration,delay:t.delay,endDelay:t.delay/2,direction:"alternate",rewind:t.rewind,easing:this.getTimingFunction(t.easing,t.cubicControls,t.springParameters)}):t.cycle===!1&&t.repeat===!0?this._animation=Hc.timeline({duration:t.duration,delay:t.delay,direction:"normal",loop:!0,easing:this.getTimingFunction(t.easing,t.cubicControls,t.springParameters)}):this._animation=Hc.timeline({duration:t.duration,delay:t.delay,direction:"normal",easing:this.getTimingFunction(t.easing,t.cubicControls,t.springParameters)}),this._animation.finished.then(()=>{this._removeBackLayer(),this._animation=void 0,Is.isAnimating[e.uuid]=!1}),this.animateMatrix(e),this.animateGeometry(e),this.animateMaterial(e),this.animateCamera(e)}animateMatrix(e){var s,o,a,l;if(this.object.position.equals(e.position)===!1){let c=this.object.position.clone(),u={t:0};(s=this._animation)==null||s.add({targets:u,t:1,update:()=>{this.object.position.lerpVectors(c,e.position,u.t)}},0)}if(this.object.scale.equals(e.scale)===!1){let c=this.object.scale.clone(),u={t:0};(o=this._animation)==null||o.add({targets:u,t:1,update:()=>{this.object.scale.lerpVectors(c,e.scale,u.t)}},0)}if(this.object.rotation.equals(e.rotation)===!1){let c=this.object.quaternion.clone(),u={t:0},h={x:this.object.rotation.x-e.rotation.x,y:this.object.rotation.y-e.rotation.y,z:this.object.rotation.z-e.rotation.z},d=e.rotation.clone(),f=.01*Ee.DEG2RAD,p=359.99*Ee.DEG2RAD;h.x===Math.PI*2?d.x===0?d.x=f:d.x===Math.PI*2&&(d.x=p):h.x===-Math.PI*2&&(d.x===0?d.x=-f:d.x===Math.PI*2&&(d.x=-p)),h.y===Math.PI*2?d.y===0?d.y=f:d.y===Math.PI*2&&(d.y=p):h.y===-Math.PI*2&&(d.y===0?d.y=-f:d.y===Math.PI*2&&(d.y=-p)),h.z===Math.PI*2?d.z===0?d.z=f:d.z===Math.PI*2&&(d.z=p):h.z===-Math.PI*2&&(d.z===0?d.z=-f:d.z===Math.PI*2&&(d.z=-p));let m=new Tt().setFromEuler(d);(a=this._animation)==null||a.add({targets:u,t:1,update:()=>{wm(c,m,this.object.quaternion,u.t)}},0)}let t=new M,n=new Tt,i=new M;if(e.hiddenMatrix.decompose(t,n,i),"hiddenMatrix"in this.object){let c=new M,u=new Tt,h=new M;if(this.object.hiddenMatrix.decompose(c,u,h),this.object.hiddenMatrix.equals(e.hiddenMatrix)===!1){let d=new M,f=new Tt,p=new M,m={t:0},v=this.object.hiddenMatrix;(l=this._animation)==null||l.add({targets:m,t:1,update:()=>{f.slerpQuaternions(u,n,m.t),d.lerpVectors(c,t,m.t),p.lerpVectors(h,i,m.t),v.compose(d,f,p)}},0)}}}animateGeometry(e){var t;if("geometry"in this.object&&e.geometry!==void 0){let i=this.object.geometry.userData.parameters,s=e.geometry;if(s.width!==i.width||s.height!==i.height||s.depth!==i.depth){let o=this.object;(t=this._animation)==null||t.add({targets:i,width:s.width,height:s.height,depth:s.depth,update:()=>{o.updateGeometry({parameters:{width:i.width,height:i.height,depth:i.depth}})}},0)}}}animateMaterial(e){if("material"in this.object)if(this.object.material instanceof Array)for(let t=0,n=this.object.material.length;t<n;++t)this._interpolateMaterial(this.object.material[t],e.material[t]);else{if(this.object.material.userData.isAsset)return;this._interpolateMaterial(this.object.material,e.material)}}_interpolateMaterial(e,t){let n=e.layersList.head,i=0;for(;n;){if(n.isBack===!0){n=n.next;continue}let s=t.layersList[i++];if(Eh(n)){let o=n.uniforms[`f${n.id}_texture`].value,a=s.uniforms[`f${s.id}_texture`].value;o.image===a.image?this._interpolateMaterialTexture(e,n,s):this._interpolateMaterialBetweenLayers(e,n,s)}else n.type==="gradient"?n.uniforms[`f${n.id}_gl_type`].value===s.uniforms[`f${s.id}_gl_type`].value?this._interpolateMaterialGradient(e,n,s):this._interpolateMaterialBetweenLayers(e,n,s):this._interpolateMaterialBetweenValues(e,n,s);n=n.next}}animateCamera(e){var t,n;if(this.object.objectType==="CombinedCamera"&&e.camera!==void 0){let i=this.object,s=i.cameraType==="OrthographicCamera"?e.camera.zoomOrtho:e.camera.zoomPersp;i.zoom!==s&&((t=this._animation)==null||t.add({targets:i,zoom:s,update:()=>{i.updateProjectionMatrix()}},0)),i.targetOffset!==e.camera.targetOffset&&((n=this._animation)==null||n.add({targets:i,targetOffset:e.camera.targetOffset},0))}}},Ls=Is;Ls.isAnimating={};var Ld=r=>class extends r{hasEntityChild(){return this.children.some(t=>Vh(t))}attach(t,n){this.updateWorldMatrix(!0,!1);let i=new me().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),i.multiply(t.parent.matrixWorld)),Vh(t)?t.hiddenMatrix.premultiply(i):t.applyMatrix4(i),t.updateWorldMatrix(!1,!1),this.add(t),n!==void 0&&(this.children.pop(),this.children.splice(n,0,t)),this}copy(t,n=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),n===!0)for(let i=0;i<t.children.length;i++){let s=t.children[i];this.add(s.clone())}return this}toJSON(t){let n=t===void 0,i={object:{uuid:"",objectType:""}};t===void 0&&(t={geometries:{},materials:{},textures:{},images:{},interactionStates:{},nodes:{}},i.metadata={version:1.5,type:"Object",generator:"Object3D.toJSON"});let s={uuid:this.uuid,objectType:this.type};if(this.name!==""&&(s.name=this.name),s.matrix=this.matrix.toArray(),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),s.layers=this.layers.mask,JSON.stringify(this.userData)!=="{}"&&(s.userData=this.userData),this.children.length>0){s.children=[];for(let o of this.children)(Vh(o)||o instanceof vi)&&s.children.push(o.toJSON(t).object)}if(n){let o=bl(t.geometries),a=bl(t.materials),l=bl(t.textures),c=bl(t.images),u=bl(t.interactionStates),h=bS(t.nodes);o.length>0&&(i.geometries=o),a.length>0&&(i.materials=a),l.length>0&&(i.textures=l),c.length>0&&(i.images=c),u.length>0&&(i.interactionStates=u),h.length>0&&(i.nodes=h)}return i.object=s,i}fromJSON(t){return this.uuid=t.uuid,t.name!==void 0&&(this.name=t.name),t.matrix!==void 0?(this.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(this.matrixAutoUpdate=t.matrixAutoUpdate),this.matrixAutoUpdate&&this.matrix.decompose(this.position,this.quaternion,this.scale)):(t.position!==void 0&&this.position.fromArray(t.position),t.rotation!==void 0&&this.rotation.fromArray(t.rotation),t.quaternion!==void 0&&this.quaternion.fromArray(t.quaternion),t.scale!==void 0&&this.scale.fromArray(t.scale)),this.castShadow=t.castShadow!==void 0,this.receiveShadow=t.receiveShadow!==void 0,t.visible!==void 0&&(this.visible=t.visible),t.frustumCulled!==void 0&&(this.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(this.renderOrder=t.renderOrder),t.layers!==void 0&&(this.layers.mask=t.layers),t.userData!==void 0&&(this.userData=t.userData),this}};var ei=r=>"isEntity"in r,wS=r=>"isAbstractMesh"in r,Xm=r=>"objectHelper"in r,Ii=r=>class extends Ld(r){constructor(){super(...arguments);this.objectType="";this.isEntity=!0;this.raycastLock=!1;this.scaleLock=!1;this.hiddenMatrix=new me;this.interaction=new Ls(this);this.forceComputeSize=!1}set visibility(t){this.visible=t;for(let n of this.children)ei(n)&&n.traverseEntity(i=>{Xm(i)&&i.visible&&(i.objectHelper.visible=t)})}get visibility(){return this.visible}get interactionCache(){return this.interaction.cache===void 0&&this.interaction.computeCache(),this.interaction.cache}traverseEntity(t){t(this);for(let n of this.children)ei(n)&&n.traverseEntity(t)}computeSingleBoundingBox(){this.singleBoundingBox||(this.singleBoundingBox=new jh),this.singleBoundingBox.setFromObjectSize(this,!1),this.singleBoundingBox.computeVertices(),this.singleBoundingBox.computeEdges(),this.singleBoundingBox.computeFaces()}computeComplexBoundingBox(t){this.complexBoundingBox||(this.complexBoundingBox=new jh),this.complexBoundingBox.setFromObjectSize(this,t),this.complexBoundingBox.computeVertices(),this.complexBoundingBox.computeEdges(),this.complexBoundingBox.computeFaces()}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);for(let n of this.children)n.updateMatrixWorld(t)}updateWorldMatrix(t,n){let i=this.parent;if(t&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),n)for(let s of this.children)s.updateWorldMatrix(!1,!0)}shallowClone(t){return new this.constructor().shallowCopy(this,t)}shallowCopy(t,n=!0){if(super.copy(t,!1),this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),t.interaction!==void 0&&this.interaction.copy(t.interaction),n===!0)for(let i of t.children)ei(i)&&this.add(i.shallowClone());return this}clone(t){return new this.constructor().copy(this,t)}copy(t,n=!0){if(super.copy(t,!1),this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),t.interaction!==void 0&&this.interaction.copy(t.interaction),n===!0)for(let i of t.children)ei(i)&&this.add(i.clone());return this}keepChildrenMatrixWorld(){let t=new me,n=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),t.copy(this.matrixWorld).invert(),t.multiply(n);for(let i of this.children)ei(i)&&i.hiddenMatrix.premultiply(t)}toJSON(t){let n=super.toJSON(t),i=n.object;return this.raycastLock===!0&&(i.raycastLock=!0),this.scaleLock===!0&&(i.scaleLock=!0),i.hiddenMatrix=this.hiddenMatrix.toArray(),this.interaction!==void 0&&(i.interaction=this.interaction.toJSON(t)),n}fromJSON(t){return super.fromJSON(t),t.raycastLock!==void 0&&(this.raycastLock=t.raycastLock),t.scaleLock!==void 0&&(this.scaleLock=t.scaleLock),this.hiddenMatrix.fromArray(t.hiddenMatrix),this}fromObject3D(t){let n=t.children;return t.children=[],Object.assign(t,{raycastLock:!1,scaleLock:!1,hiddenMatrix:new me}),this.copy(t),t.children=n,this}};var Id=class extends Ke{constructor(e,t={}){super();this.object=e,e.computeComplexBoundingBox(!0);let n=e.complexBoundingBox.getSize(new M),i=.1;this.parameters={type:t.type!==void 0?t.type:"radial",hideBase:t.hideBase!==void 0?t.hideBase:!1,count:t.count!==void 0?t.count:3,ra_radius:t.ra_radius!==void 0?t.ra_radius:Math.max(n.x,n.y)*2,ra_startAngle:t.ra_startAngle!==void 0?t.ra_startAngle:0,ra_endAngle:t.ra_endAngle!==void 0?t.ra_endAngle:360,ra_align:t.ra_align!==void 0?t.ra_align:!1,ra_axis:t.ra_axis!==void 0?t.ra_axis:"y",ra_scale:t.ra_scale!==void 0?t.ra_scale.clone():new M,ra_rotation:t.ra_rotation!==void 0?t.ra_rotation.clone():new On,ra_position:t.ra_position!==void 0?t.ra_position.clone():new M,li_scale:t.li_scale!==void 0?t.li_scale.clone():new M,li_rotation:t.li_rotation!==void 0?t.li_rotation.clone():new On,li_position:t.li_position!==void 0?t.li_position.clone():new M(n.x+n.x*i,0,0).round(),gr_count:t.gr_count!==void 0?t.gr_count.clone():new M(2,2,2),gr_size:t.gr_size!==void 0?t.gr_size.clone():new M(n.x+n.x*i,n.y+n.y*i,n.z+n.z*i).round(),gr_fromCenter:t.gr_fromCenter!==void 0?t.gr_fromCenter:!0},this.update(),this.setHideBase(this.parameters.hideBase)}refreshMaterial(){if("material"in this.object)for(let e of this.children)e.material=this.object.material}setHideBase(e){if("material"in this.object){if(Array.isArray(this.object.material)){if(this.children.length>0){for(let t of this.object.material)t.visible=!0;if(e){let t=this.object.material.map(n=>n.clone());for(let n of this.children)n.material=t}else for(let t of this.children)t.material=this.object.material}for(let t of this.object.material)t.visible=!e}else{if(this.children.length>0)if(this.object.material.visible=!0,e){let t=this.object.material.clone();for(let n of this.children)n.material=t}else for(let t of this.children)t.material=this.object.material;this.object.material.visible=!e}this.parameters.hideBase=e}}update(){switch(this._updateCount(),this.parameters.type){case"radial":this._updateRadial(this.parameters);break;case"linear":this._updateLinear(this.parameters);break;case"grid":this._updateGrid(this.parameters)}}_updateCount(){let e=this.parameters.type==="grid"?this.parameters.gr_count.x*this.parameters.gr_count.y*this.parameters.gr_count.z:this.parameters.count;if(this.children.length!==e)if(this.children.length<e)for(let t=0,n=e-this.children.length;t<n;++t){let i=this.object.shallowClone(!1);i.visible=!0,this.add(i),this.parameters.hideBase&&this.setHideBase(!0)}else for(let t=0,n=this.children.length-e;t<n;++t)this.remove(this.children[0])}_updateRadial(e){let t=e.ra_startAngle*Ee.DEG2RAD,n=e.ra_endAngle*Ee.DEG2RAD,i=t-n,s=new On(e.ra_rotation.x*Ee.DEG2RAD,e.ra_rotation.y*Ee.DEG2RAD,e.ra_rotation.z*Ee.DEG2RAD),o;switch(e.ra_axis){case"x":o=new M(1,0,0);break;case"y":o=new M(0,1,0);break;case"z":o=new M(0,0,1);break}for(let[a,l]of this.children.entries()){l.hiddenMatrix.identity(),l.scale.x=e.ra_scale.x+1,l.scale.y=e.ra_scale.y+1,l.scale.z=e.ra_scale.z+1,l.position.setScalar(0);let c=i/e.count*a-t;switch(e.ra_axis){case"x":l.rotation.set(0,c,0);break;case"y":l.rotation.set(0,0,c);break;case"z":l.rotation.set(c,0,0);break}l.translateOnAxis(o,e.ra_radius),l.position.add(e.ra_position),e.ra_align===!0?(l.rotation.x+=s.x,l.rotation.y+=s.y,l.rotation.z+=s.z):l.rotation.copy(s)}}_updateLinear(e){if(e.type!=="linear")throw new Error;let t=new On(e.li_rotation.x*Ee.DEG2RAD,e.li_rotation.y*Ee.DEG2RAD,e.li_rotation.z*Ee.DEG2RAD);for(let[n,i]of this.children.entries())i.hiddenMatrix.identity(),i.scale.x=e.li_scale.x*n+1,i.scale.y=e.li_scale.y*n+1,i.scale.z=e.li_scale.z*n+1,i.rotation.x=t.x*n,i.rotation.y=t.y*n,i.rotation.z=t.z*n,i.position.x=e.li_position.x*n,i.position.y=e.li_position.y*n,i.position.z=e.li_position.z*n}_updateGrid(e){let t=0;if(e.gr_fromCenter===!0){let n={x:e.gr_count.x%2==0?2:1,y:e.gr_count.y%2==0?2:1,z:e.gr_count.z%2==0?2:1},i=new M(e.gr_size.x*(e.gr_count.x-n.x)*.5,e.gr_size.y*(e.gr_count.y-n.y)*.5,e.gr_size.z*(e.gr_count.z-n.z)*.5);for(let s=0;s<e.gr_count.x;s++)for(let o=0;o<e.gr_count.y;o++)for(let a=0;a<e.gr_count.z;a++){let l=this.children[t++];l.hiddenMatrix.identity(),l.scale.setScalar(1),l.rotation.set(0,0,0),l.position.x=e.gr_size.x*s-i.x,l.position.y=e.gr_size.y*o-i.y,l.position.z=e.gr_size.z*a-i.z}}else for(let n=0;n<e.gr_count.x;n++)for(let i=0;i<e.gr_count.y;i++)for(let s=0;s<e.gr_count.z;s++){let o=this.children[t++];o.hiddenMatrix.identity(),o.scale.setScalar(1),o.rotation.set(0,0,0),o.position.x=e.gr_size.x*n,o.position.y=-e.gr_size.y*i,o.position.z=-e.gr_size.z*s}}toJSON(){return{type:"Cloner",parameters:{type:this.parameters.type,hideBase:this.parameters.hideBase,count:this.parameters.count,ra_radius:this.parameters.ra_radius,ra_startAngle:this.parameters.ra_startAngle,ra_endAngle:this.parameters.ra_endAngle,ra_align:this.parameters.ra_align,ra_axis:this.parameters.ra_axis,ra_scale:this.parameters.ra_scale.toArray(),ra_rotation:this.parameters.ra_rotation.toArray(),ra_position:this.parameters.ra_position.toArray(),li_scale:this.parameters.li_scale.toArray(),li_rotation:this.parameters.li_rotation.toArray(),li_position:this.parameters.li_position.toArray(),gr_count:this.parameters.gr_count.toArray(),gr_size:this.parameters.gr_size.toArray(),gr_fromCenter:this.parameters.gr_fromCenter}}}fromJSON(e){let t=e.parameters;return this.parameters.type=t.type,this.parameters.hideBase=t.hideBase,this.parameters.count=t.count,this.parameters.ra_radius=t.ra_radius,this.parameters.ra_startAngle=t.ra_startAngle,this.parameters.ra_endAngle=t.ra_endAngle,this.parameters.ra_align=t.ra_align,this.parameters.ra_axis=t.ra_axis,this.parameters.ra_scale.fromArray(t.ra_scale),this.parameters.ra_rotation.fromArray(t.ra_rotation),this.parameters.ra_position.fromArray(t.ra_position),this.parameters.li_scale.fromArray(t.li_scale),this.parameters.li_rotation.fromArray(t.li_rotation),this.parameters.li_position.fromArray(t.li_position),this.parameters.gr_count.fromArray(t.gr_count),this.parameters.gr_size.fromArray(t.gr_size),this.parameters.gr_fromCenter=t.gr_fromCenter,this.update(),this.setHideBase(this.parameters.hideBase),this}};var Vn=class extends Ii(gt){constructor(e,t){super(e,t);this.isAbstractMesh=!0;Array.isArray(t)&&(this.selectedMaterial=0)}get cloner(){return this._cloner}set cloner(e){this._cloner&&this.remove(this._cloner),e&&this.add(e),this._cloner=e}getSelectedMaterial(e){return Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=e!=null?e:0),this.material[e!=null?e:this.selectedMaterial]):this.material}setSelectedMaterial(e,t){Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=t!=null?t:0),t=t!=null?t:this.selectedMaterial,this.material[t].dispose(),this.material[t]=e):(this.material.dispose(),this.material=e)}updateGeometry(e){let t=this.geometry,n=Uc[t.userData.type],i=this.objectType==="NonParametric"?Object.assign({},t.userData,{geometry:t}):t.userData,s=n.build(n.normalizeInputs(e,i)),o=t.uuid;this.geometry.dispose(),this.geometry=s,this.geometry.uuid=o,this.geometry.computeBoundingSphere()}resizeGeometry(e,t,n){Gc.resizeGeometry(this.geometry,{width:e,height:t,depth:n})}shallowClone(e){return new this.constructor(this.geometry,this.material).shallowCopy(this,e)}clone(e){let t=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,n=kc(t),i=Array.isArray(this.material)?this.material.map(s=>s.clone()):this.material.clone();return new this.constructor(n,i).copy(this,e)}copy(e,t=!0){return super.copy(e,t),e.cloner&&(this.cloner=new Id(e,e.cloner.parameters),this.add(this.cloner)),this}toJSON(e){let t=super.toJSON(e),n=t.object;if(this.cloner!==void 0&&(n.cloner=this.cloner.toJSON()),n.geometry=xS(e.geometries,this.geometry,this.material),Array.isArray(this.material)){let i=[];for(let s=0,o=this.material.length;s<o;s++)i.push(Yc(e.materials,this.material[s],e));n.material=i}else n.material=Yc(e.materials,this.material,e);return t}fromJSON(e){return super.fromJSON(e),e.selectedMaterial!==void 0&&(this.selectedMaterial=e.selectedMaterial),e.cloner!==void 0&&(this.cloner=new Id(this).fromJSON(e.cloner)),this}};var xr=r=>{var e;return e=class extends r{constructor(){super(...arguments);this.isObjectHelper=!0}},e.geometryHelper=new jn(30,30,30),e};var qm=new or,Ym=new ti,SS=new me,br=(r,e,t,n)=>{let i=e,s=r.matrixWorld;if(i.boundingSphere===null&&i.computeBoundingSphere(),Ym.copy(i.boundingSphere),Ym.applyMatrix4(s),t.ray.intersectsSphere(Ym)===!1||(SS.copy(s).invert(),qm.copy(t.ray).applyMatrix4(SS),i.boundingBox!==null&&qm.intersectsBox(i.boundingBox)===!1))return;let o,a,l,c,u=i.index,h=i.attributes.position,d=i.drawRange,f,p,m=Math.max(0,d.start),v=Math.min(u.count,d.start+d.count);for(f=m,p=v;f<p;f+=3)if(a=u.getX(f),l=u.getX(f+1),c=u.getX(f+2),o=g(r,t,qm,h,a,l,c),o){o.faceIndex=Math.floor(f/3),n.push(o);return}function g(y,x,b,w,_,S,A){let T=new M,L=new M,C=new M,U=new M,P=new M;if(T.fromBufferAttribute(w,_),L.fromBufferAttribute(w,S),C.fromBufferAttribute(w,A),b.intersectTriangle(T,L,C,!1,U)===null)return null;P.copy(U),P.applyMatrix4(y.matrixWorld);let G=x.ray.origin.distanceTo(P);return G<x.near||G>x.far?null:{faceIndex:1,distance:G,point:P.clone(),object:y}}};var Kc=class extends xr(xi){constructor(e){super(e);this.object=e;let t=new Ji(15,4,2),n=new dn({wireframe:!0,fog:!1,toneMapped:!1}),i=new gt(t,n);this.add(i);let s=new Ji(15,4,2),o=new dn({wireframe:!0,fog:!1,toneMapped:!1,depthTest:!1,depthWrite:!1}),a=new gt(s,o);this.add(a),this.targetHelper=a,this.object=e,this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e),this.targetHelper.position.copy(e),this.targetHelper.updateWorldMatrix(!1,!0)}raycast(e,t){br(this.object,Kc.geometryHelper,e,t)}};var Qc=class extends xr(Bp){constructor(e,t=15,n=10066329){super(e,t,n);this.object=e;this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){br(this.object,Qc.geometryHelper,e,t)}};var Zc=class extends xr(Op){constructor(e,t=15){super(t);this.object=e;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}raycast(e,t){br(this.object,Zc.geometryHelper,e,t)}update(){}};var $c=class extends xr(Rp){constructor(e,t=15,n=6710886){super(e,t,n);this.object=e;this.name=`PointLightHelper: ${e.uuid}`}raycast(e,t){br(this.object,$c.geometryHelper,e,t)}};var Dd=class extends xr(Pp){constructor(e,t=6710886){super(e,t);this.object=e;this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){br(this.object,Dd.geometryHelper,e,t)}update(){if(this.object!==void 0){let e=Dd._vector,t=this.object.distance?this.object.distance:1e3,n=t*Math.tan(this.object.angle);this.cone.scale.set(n,n,t),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let i=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let s=0,o=this.cone.material.length;s<o;s++)this.cone.material[s].color.set(i);else this.cone.material.color.set(i)}}},Pd=Dd;Pd._vector=new M;var c3=new M(0,0,1),MS=new M,AS=new M,_S=new Dt,Ps=class extends Vn{constructor(e=Pn.create({}),t=new oi({side:Xt})){super(e,t);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new cn;this._onShapeUpdate=()=>{if(this.geometry instanceof Rc){if(this.geometry.updateFromShape()){let e=this.geometry.drawCount,t=this.geometry.userData;this.updateGeometry(Object.assign(this.geometry.userData,{parameters:Object.assign(t.parameters,{surfaceMaxCount:e+1e3})}))}}else this.updateGeometry({});this.computeSingleBoundingBox(),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};var n;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=e.userData.shape,(n=this.shape.eventDispatcher)==null||n.addEventListener("update",this._onShapeUpdate)}toJSON(e){let t=super.toJSON(e);return t.object.objectType="VectorObject",t}setHelperVisibility(){}updateGeometry(e){if(super.updateGeometry(e),"userData"in this.geometry){let t=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:t})}}setShape(e){var t,n;this.shape&&((t=this.shape.eventDispatcher)==null||t.removeEventListener("update",this._onShapeUpdate)),this.shape=e,(n=this.shape.eventDispatcher)==null||n.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),_S.getNormalMatrix(this.matrixWorld),MS.copy(c3).applyMatrix3(_S).normalize(),AS.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(MS,AS)}clone(e){let t=this.shape.clone(),n=this.material.clone(),i=this.geometry.userData,s=Pn.create(Object.assign({},i,{shape:t})),o=new Ps(s,n).copy(this,e);return o.shape=t,t.update(),o}raycast(e,t){Vn.prototype.raycast.call(this,e,t)}};var wr=(r,e)=>class extends r{constructor(){super(...arguments);this.objectHelper=new e(this);this.enableHelper=!1}set visibility(n){this.visible=n,this.setHelperVisibility(n),this.setHelperChildrenVisibility(n)}get visibility(){return this.visible}get geometryHelper(){return e.geometryHelper}setHelperVisibility(n){this.objectHelper.visible=n}setHelperChildrenVisibility(n){for(let i of this.children)ei(i)&&i.traverseEntity(s=>{Xm(s)&&s.visible&&(s.objectHelper.visible=n)})}raycast(n,i){this.objectHelper.raycast(n,i)}copy(n,i=!0){return super.copy(n,i),n.enableHelper!==void 0&&(this.enableHelper=n.enableHelper),n.objectHelper!==void 0&&(this.objectHelper.visible=n.objectHelper.visible),this}toJSON(n){let i=super.toJSON(n),s=i.object;return s.enableHelper=this.enableHelper,i}fromJSON(n){return super.fromJSON(n),n.enableHelper!==void 0&&(this.enableHelper=!0),this}};var wl=new M,Km=new M,Qm=class extends wr(Ii(Dr),Kc){constructor(e=100,t=100,n=45,i=50,s=5e4){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=Qm.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=window.innerWidth,this.height=window.innerHeight,this.orthoCamera=new Rr(e*-.5,e*.5,t*.5,t*-.5,i,s),this.perspCamera=new Vt(n,e/t,i,s),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic(!0)}setDefault(){this.name="Default Camera",this.isEntity=!1,this.enableHelper=!1,this.objectHelper.visible=!1}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e){super.lookAt(e),this.getWorldPosition(wl),this.targetOffset=wl.distanceTo(e)}getTarget(e=new M){return this.getWorldDirection(Km),this.getWorldPosition(wl),Km.multiplyScalar(this.targetOffset),e.copy(wl).add(Km),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(wl),wl.distanceTo(e)}updateUp(){let e=this.getWorldQuaternion(new Tt),t=new M(0,0,1).applyQuaternion(e),n=new M().copy(Ke.DefaultUp).applyQuaternion(e),i=new M().copy(Ke.DefaultUp).projectOnPlane(t),s=new M().crossVectors(i,n).dot(t)>=0?1:-1;this.angleOffsetFromUp=i.angleTo(n)*s}getViewFrontToObject(e){let t=e.getWorldPosition(new M),i=e.getWorldDirection(new M).multiplyScalar(this.targetOffset);return{position:t.clone().add(i),target:t}}getViewToObject(e){let t=e.getWorldPosition(new M),i=this.getWorldDirection(new M).multiplyScalar(this.targetOffset);return{position:t.clone().sub(i),target:t}}setViewplaneSize(e,t){this.left=-e*.5,this.right=e*.5,this.top=t*.5,this.bottom=-t*.5,this.aspect=e/t,this.updateProjectionMatrix()}toOrthographic(e){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",(this.enableHelper===!0||e===!0)&&this.objectHelper.update()}toPerspective(e){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",(this.enableHelper===!0||e===!0)&&this.objectHelper.update()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,t,n,i,s,o){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,t,n,i,s,o):this.orthoCamera.setViewOffset(e,t,n,i,s,o)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(e){this._cameraType==="PerspectiveCamera"?this.toPerspective(e):this._cameraType==="OrthographicCamera"&&this.toOrthographic(e)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,t){return super.copy(e,t),this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}fromCameraRender(e){let t={near:this.orthoCamera.near,far:this.orthoCamera.far},n={near:this.perspCamera.near,far:this.perspCamera.far};return this.copy(e),this.name="",this.isEntity=!0,this.enableHelper=!0,this.objectHelper.visible=!0,this.orthoCamera.near=t.near,this.orthoCamera.far=t.far,this.perspCamera.near=n.near,this.perspCamera.far=n.far,this.updateProjectionMatrix(),this}toJSON(e){let t=super.toJSON(e),n=t.object;return n.objectType="CombinedCamera",n.cameraType=this.cameraType,n.targetOffset=this.targetOffset,n.isUpVectorFlipped=this.isUpVectorFlipped,n.angleOffsetFromUp=this.angleOffsetFromUp,n.left=this.left,n.right=this.right,n.top=this.top,n.bottom=this.bottom,this.view!==null&&(n.view=Object.assign({},this.view)),n.zoomOrtho=this.orthoCamera.zoom,n.nearOrtho=this.orthoCamera.near,n.far=this.far,n.aspect=this.aspect,n.fov=this.fov,n.focus=this.focus,n.filmGauge=this.filmGauge,n.filmOffset=this.filmOffset,n.zoomPersp=this.perspCamera.zoom,n.nearPersp=this.perspCamera.near,t}fromJSON(e){var t,n;if(super.fromJSON(e),this.cameraType=e.cameraType,e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.orbitControlsTarget!==void 0){let i=this.getWorldPosition(new M),s=new M().fromArray(e.orbitControlsTarget);this.targetOffset=s.distanceTo(i)}else e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset);return this.isUpVectorFlipped=(t=e.isUpVectorFlipped)!=null?t:!1,this.angleOffsetFromUp=(n=e.angleOffsetFromUp)!=null?n:0,e.left!==void 0&&(this.left=e.left),e.right!==void 0&&(this.right=e.right),e.top!==void 0&&(this.top=e.top),e.bottom!==void 0&&(this.bottom=e.bottom),e.view!==void 0&&(this.view=Object.assign({},e.view)),e.zoomOrtho!==void 0&&(this.orthoCamera.zoom=e.zoomOrtho),e.nearOrtho!==void 0&&(this.orthoCamera.near=e.nearOrtho),e.far!==void 0&&(this.far=e.far),e.aspect!==void 0&&(this.aspect=e.aspect),e.fov!==void 0&&(this.fov=e.fov),e.focus!==void 0&&(this.focus=e.focus),e.filmGauge!==void 0&&(this.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(this.filmOffset=e.filmOffset),e.zoomPersp!==void 0&&(this.perspCamera.zoom=e.zoomPersp),e.nearPersp!==void 0&&(this.perspCamera.near=e.nearPersp),this.updateProjectionMatrix(),this}},Sr=Qm;Sr.DefaultTargetOffset=1e3;var Pi=class extends wr(Ii(Jn),Zc){constructor(){super(...arguments);this.objectType="EmptyObject"}toJSON(e){let t=super.toJSON(e);return t.object.objectType="EmptyObject",t}};var Rd=class extends wr(Ii(Fr),Qc){constructor(...e){super(...e);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let n=this.shadow.camera;n.top=1250,n.bottom=-1250,n.right=1250,n.left=-1250,n.near=1,n.far=2500;let i=new xi(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof xi&&(t.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof xi&&(t.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let t=this._gizmos[e];t instanceof xi&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e),n=t.object;return n.objectType="LightDirectional",n.color=this.color.getHex(),n.intensity=this.intensity,n.shadow=this.shadow.toJSON(),t}fromJSON(e){var i;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.shadow.normalBias=(i=e.shadow.normalBias)!=null?i:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);let t=this.shadow.camera,n=e.shadow.camera;return t.near=n.near,t.far=n.far,t.zoom=n.zoom,t.left=n.left,t.right=n.right,t.top=n.top,t.bottom=n.bottom,n.view!==void 0&&(t.view=Object.assign({},n.view)),this}};var Bd=class extends wr(Ii(xo),$c){constructor(...e){super(...e);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let n=this.shadow.camera;n.fov=90,n.aspect=1,n.near=100,n.far=2500;let i=new M(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),s=new M(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z),o=new tn(i,s),a=new Da(o,new fe(16755200));a.visible=!1,this._gizmos.shadowmap=a,this.update()}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof Da&&(t.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof Da&&(t.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let e in this._gizmos){let t=this._gizmos[e];if(t instanceof Da){let n=this.shadow.camera,i=new M(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),s=new M(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z);t.box.set(i,s),t.updateMatrixWorld(!0)}}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e),n=t.object;return n.objectType="LightPoint",n.color=this.color.getHex(),n.intensity=this.intensity,n.distance=this.distance,n.decay=this.decay,n.shadow=this.shadow.toJSON(),t}fromJSON(e){var i,s;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this.shadow.normalBias=(i=e.shadow.normalBias)!=null?i:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray((s=e.shadow.mapSize)!=null?s:[512,512]);let t=this.shadow.camera,n=e.shadow.camera;return t.near=n.near,t.far=n.far,t.zoom=n.zoom,t.fov=n.fov,t.focus=n.focus,t.aspect=n.aspect,t.filmGauge=n.filmGauge,t.filmOffset=n.filmOffset,n.view!==void 0&&(t.view=Object.assign({},n.view)),this}};var TS=new M,ES=new M,NS=new Tt,Od=class extends wr(Ii(vo),Pd){constructor(...e){super(...e);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let n=this.shadow.camera;n.fov=Ee.RAD2DEG*2*this.angle,n.aspect=1,n.near=100,n.far=2500;let i=new xi(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof xi&&(t.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof xi&&(t.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let t=this._gizmos[e];t instanceof xi&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),ES.setFromMatrixPosition(this.matrixWorld),NS.setFromRotationMatrix(this.matrixWorld),TS.copy(this.up).applyQuaternion(NS).negate().multiplyScalar(this.distance),this.target.position.copy(ES).add(TS),this.target.updateMatrixWorld(),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,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}toJSON(e){let t=super.toJSON(e),n=t.object;return n.objectType="LightSpot",n.color=this.color.getHex(),n.intensity=this.intensity,n.distance=this.distance,n.angle=this.angle,n.decay=this.decay,n.penumbra=this.penumbra,n.shadow=this.shadow.toJSON(),t}fromJSON(e){var i;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.distance=e.distance,this.angle=e.angle,this.decay=e.decay,this.penumbra=e.penumbra,this.shadow.normalBias=(i=e.shadow.normalBias)!=null?i:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);let t=this.shadow.camera,n=e.shadow.camera;return t.near=n.near,t.far=n.far,t.zoom=n.zoom,t.fov=n.fov,t.focus=n.focus,t.aspect=n.aspect,t.filmGauge=n.filmGauge,t.filmOffset=n.filmOffset,n.view!==void 0&&(t.view=Object.assign({},n.view)),this}};var CS=r=>r.tagName==="VIDEO",Sl=class{static resize(e,t,n){let i=e/t,s;if(!n.image)return;let o=n.image;CS(o)?s=o.videoWidth/o.videoHeight:s=o.width/o.height,i>s&&(n.imageType=="WEBCAM"?n.repeat.set(-1,1*s/i):n.repeat.set(1,1*s/i)),i<s&&(n.imageType=="WEBCAM"?n.repeat.set(1*i/s*-1,1):n.repeat.set(1*i/s,1)),i==s&&(n.imageType=="WEBCAM"?n.repeat.set(-1,1):n.repeat.set(1,1))}static resizeTextureLayer(e,t,n){let i=e/t,s=n.image!==void 0?n.image.width/n.image.height:1,o;i>s?o={x:1,y:s/i}:i<s?o={x:i/s,y:1}:o={x:1,y:1},n.repeat.set(o.x,o.y),n.updateMatrix()}static resizeTextureLayers(e,t,n){let i=n.userData.layers,s=i.getLayers();for(let o=0;o<s.length;o++){let a=s[o];Eh(a)&&(Sl.resizeTextureLayer(e,t,a.uniforms[`f${a.id}_texture`].value),i.updateLayerUniform())}}static resizeComplex(e,t,n,i){let s=e/t,o,a=n.image;CS(a)?o=a.videoWidth/a.videoHeight:o=a.width/a.height,i.geometry.type.includes("Shape")?(s>o&&(n.imageType=="WEBCAM"?n.repeat.set(1/e*-1,1/t*o/s):n.repeat.set(1/e,1/t*o/s)),s<o&&(n.imageType=="WEBCAM"?n.repeat.set(1/e*s/o*-1,1/t):n.repeat.set(1/e*s/o,1/t)),s==o&&(n.imageType=="WEBCAM"?n.repeat.set(1/e*-1,1/t):n.repeat.set(1/e,1/t))):(s>o&&(n.imageType=="WEBCAM"?n.repeat.set(-1,1*o/s):n.repeat.set(1,1*o/s)),s<o&&(n.imageType=="WEBCAM"?n.repeat.set(1*s/o*-1,1):n.repeat.set(1*s/o,1)),s==o&&(n.imageType=="WEBCAM"?n.repeat.set(-1,1):n.repeat.set(1,1)))}};var Ml=class extends Vn{constructor(e,t=new oi){super(e,t);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(e){super.updateGeometry(e),this.material.userData.layers&&Sl.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}resizeGeometry(e,t){super.resizeGeometry(e,t,0),this.material.userData.layers&&Sl.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}toJSON(e){let t=super.toJSON(e);return t.object.objectType="Mesh2D",t}clone(){let e=super.clone();return e.updateGeometry({}),e}static fromTexture(e){let t,n;if(e instanceof ah){let o=e.image;t=o.videoWidth*.5,n=o.videoHeight*.5}else{let o=e.image;t=o.width*.5,n=o.height*.5}let i=kh.create({parameters:{width:t,height:n}}),s=new oi;return s.layersList.changeLayer(0,{type:lt.TEXTURE,texture:e}),s.layersList.moveLayer(0,1),s.dispose(),new Ml(i,s)}};var Al=class extends Vn{constructor(e,t=new Ci){super(e,t);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}toJSON(e){let t=super.toJSON(e);return t.object.objectType="Mesh3D",t}};var Fd=class extends Al{constructor(e,t=new Ci){super(e,t);this.objectType="NonParametric"}toJSON(e){let t=super.toJSON(e);return t.object.objectType="NonParametric",t}};var Ds;(function(n){n[n.TEXT=0]="TEXT",n[n.ARRAY_BUFFER=1]="ARRAY_BUFFER",n[n.BINARY_STRING=2]="BINARY_STRING"})(Ds||(Ds={}));function LS(r,e,t=1){let n=new FileReader;return new Promise((i,s)=>{let o=()=>{s({error:!0,filename:r.name}),e.itemError(r.name),e.itemEnd(r.name)};switch(n.addEventListener("loadstart",()=>{e.itemStart(r.name)}),n.addEventListener("load",a=>{var c;let l=(c=a.target)==null?void 0:c.result;l!=null?i(l):o()},!1),n.addEventListener("error",o),t){case 0:n.readAsText(r);break;case 2:n.readAsBinaryString!==void 0&&n.readAsBinaryString(r);break;case 1:default:n.readAsArrayBuffer(r)}})}var Zm=class extends fn{constructor(e){super(e);this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new DS(t)}),this.register(function(t){return new zS(t)}),this.register(function(t){return new GS(t)}),this.register(function(t){return new RS(t)}),this.register(function(t){return new BS(t)}),this.register(function(t){return new OS(t)}),this.register(function(t){return new FS(t)}),this.register(function(t){return new IS(t)}),this.register(function(t){return new US(t)})}load(e,t,n,i){let s=this,o;this.resourcePath!==""?o=this.resourcePath:this.path!==""?o=this.path:o=Ei.extractUrlBase(e),this.manager.itemStart(e);let a=function(c){i?i(c):console.error(c),s.manager.itemError(e),s.manager.itemEnd(e)},l=new Xn(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{s.parse(c,o,function(u){t(u),s.manager.itemEnd(e)},a)}catch(u){a(u)}},n,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,n,i){let s,o={},a={};if(typeof e=="string")s=e;else if(Ei.decodeText(new Uint8Array(e,0,4))===kS){try{o[dt.KHR_BINARY_GLTF]=new HS(e)}catch(h){i&&i(h);return}s=o[dt.KHR_BINARY_GLTF].content}else s=Ei.decodeText(new Uint8Array(e));let l=JSON.parse(s);if(l.asset===void 0||l.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let c=new $S(l,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){let h=this.pluginCallbacks[u](c);a[h.name]=h,o[h.name]=!0}if(l.extensionsUsed)for(let u=0;u<l.extensionsUsed.length;++u){let h=l.extensionsUsed[u],d=l.extensionsRequired||[];switch(h){case dt.KHR_MATERIALS_UNLIT:o[h]=new PS;break;case dt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:o[h]=new JS;break;case dt.KHR_DRACO_MESH_COMPRESSION:o[h]=new jS(l,this.dracoLoader);break;case dt.KHR_TEXTURE_TRANSFORM:o[h]=new WS;break;case dt.KHR_MESH_QUANTIZATION:o[h]=new XS;break;default:d.indexOf(h)>=0&&a[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(n,i)}};function u3(){let r={};return{get:function(e){return r[e]},add:function(e,t){r[e]=t},remove:function(e){delete r[e]},removeAll:function(){r={}}}}var dt={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"},IS=class{constructor(e){this.parser=e,this.name=dt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){let s=t[n];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n="light:"+e,i=t.cache.get(n);if(i)return i;let s=t.json,l=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e],c,u=new fe(16777215);l.color!==void 0&&u.fromArray(l.color);let h=l.range!==void 0?l.range:0;switch(l.type){case"directional":c=new Fr(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new xo(u),c.distance=h;break;case"spot":c=new vo(u),c.distance=h,l.spot=l.spot||{},l.spot.innerConeAngle=l.spot.innerConeAngle!==void 0?l.spot.innerConeAngle:0,l.spot.outerConeAngle=l.spot.outerConeAngle!==void 0?l.spot.outerConeAngle:Math.PI/4,c.angle=l.spot.outerConeAngle,c.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return c.position.set(0,0,0),c.decay=2,l.intensity!==void 0&&(c.intensity=l.intensity),c.name=t.createUniqueName(l.name||"light_"+e),i=Promise.resolve(c),t.cache.add(n,i),i}createNodeAttachment(e){let t=this,n=this.parser,s=n.json.nodes[e],a=(s.extensions&&s.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(l){return n._getNodeRef(t.cache,a,l)})}},PS=class{constructor(){this.name=dt.KHR_MATERIALS_UNLIT}getMaterialType(){return dn}extendParams(e,t,n){let i=[];e.color=new fe(1,1,1),e.opacity=1;let s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){let o=s.baseColorFactor;e.color.fromArray(o),e.opacity=o[3]}s.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",s.baseColorTexture))}return Promise.all(i)}},DS=class{constructor(e){this.parser=e,this.name=dt.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){let n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Or}extendMaterialParams(e,t){let n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let s=[],o=i.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&s.push(n.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(s.push(n.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){let a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new O(a,-a)}return Promise.all(s)}},RS=class{constructor(e){this.parser=e,this.name=dt.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){let n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Or}extendMaterialParams(e,t){let n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let s=[],o=i.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&s.push(n.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(s)}},BS=class{constructor(e){this.parser=e,this.name=dt.KHR_MATERIALS_VOLUME}getMaterialType(e){let n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Or}extendMaterialParams(e,t){let n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let s=[],o=i.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&s.push(n.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||0;let a=o.attenuationColor||[1,1,1];return t.attenuationTint=new fe(a[0],a[1],a[2]),Promise.all(s)}},OS=class{constructor(e){this.parser=e,this.name=dt.KHR_MATERIALS_IOR}getMaterialType(e){let n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Or}extendMaterialParams(e,t){let i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let s=i.extensions[this.name];return t.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}},FS=class{constructor(e){this.parser=e,this.name=dt.KHR_MATERIALS_SPECULAR}getMaterialType(e){let n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:Or}extendMaterialParams(e,t){let n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let s=[],o=i.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&s.push(n.assignTexture(t,"specularIntensityMap",o.specularTexture));let a=o.specularColorFactor||[1,1,1];return t.specularTint=new fe(a[0],a[1],a[2]),o.specularColorTexture!==void 0&&s.push(n.assignTexture(t,"specularTintMap",o.specularColorTexture).then(function(l){l.encoding=Fi})),Promise.all(s)}},zS=class{constructor(e){this.parser=e,this.name=dt.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;let s=i.extensions[this.name],o=n.images[s.source],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.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)}},GS=class{constructor(e){this.parser=e,this.name=dt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){let t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;let o=s.extensions[t],a=i.images[o.source],l=n.textureLoader;if(a.uri){let c=n.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return n.loadTextureImage(e,a,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}},US=class{constructor(e){this.name=dt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let i=n.extensions[this.name],s=this.parser.getDependency("buffer",i.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([s,o.ready]).then(function(a){let l=i.byteOffset||0,c=i.byteLength||0,u=i.count,h=i.byteStride,d=new ArrayBuffer(u*h),f=new Uint8Array(a[0],l,c);return o.decodeGltfBuffer(new Uint8Array(d),u,h,f,i.mode,i.filter),d})}else return null}},kS="glTF",eu=12,VS={JSON:1313821514,BIN:5130562},HS=class{constructor(e){this.name=dt.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,eu);if(this.header={magic:Ei.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==kS)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");let n=this.header.length-eu,i=new DataView(e,eu),s=0;for(;s<n;){let o=i.getUint32(s,!0);s+=4;let a=i.getUint32(s,!0);if(s+=4,a===VS.JSON){let l=new Uint8Array(e,eu+s,o);this.content=Ei.decodeText(l)}else if(a===VS.BIN){let l=eu+s;this.body=e.slice(l,l+o)}s+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}},jS=class{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=dt.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},l={},c={};for(let u in o){let h=$m[u]||u.toLowerCase();a[h]=o[u]}for(let u in e.attributes){let h=$m[u]||u.toLowerCase();if(o[u]!==void 0){let d=n.accessors[e.attributes[u]],f=tu[d.componentType];c[h]=f,l[h]=d.normalized===!0}}return t.getDependency("bufferView",s).then(function(u){return new Promise(function(h){i.decodeDracoFile(u,function(d){for(let f in d.attributes){let p=d.attributes[f],m=l[f];m!==void 0&&(p.normalized=m)}h(d)},a,c)})})}},WS=class{constructor(){this.name=dt.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return t.texCoord!==void 0&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(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),e.needsUpdate=!0),e}},zd=class extends Xi{constructor(e){super();this.isGLTFSpecularGlossinessMaterial=!0;let t=["#ifdef USE_SPECULARMAP"," uniform sampler2D specularMap;","#endif"].join(`
`),n=["#ifdef USE_GLOSSINESSMAP"," uniform sampler2D glossinessMap;","#endif"].join(`
`),i=["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(`
`),s=["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(`
`),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 );","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(`
`),a={specular:{value:new fe().setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=a,this.onBeforeCompile=function(l){for(let c in a)l.uniforms[c]=a[c];l.fragmentShader=l.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>",n).replace("#include <roughnessmap_fragment>",i).replace("#include <metalnessmap_fragment>",s).replace("#include <lights_physical_fragment>",o)},Object.defineProperties(this,{specular:{get:function(){return a.specular.value},set:function(l){a.specular.value=l}},specularMap:{get:function(){return a.specularMap.value},set:function(l){a.specularMap.value=l,l?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return a.glossiness.value},set:function(l){a.glossiness.value=l}},glossinessMap:{get:function(){return a.glossinessMap.value},set:function(l){a.glossinessMap.value=l,l?(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}},JS=class{constructor(){this.name=dt.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 zd}extendParams(e,t,n){let i=t.extensions[this.name];e.color=new fe(1,1,1),e.opacity=1;let s=[];if(Array.isArray(i.diffuseFactor)){let o=i.diffuseFactor;e.color.fromArray(o),e.opacity=o[3]}if(i.diffuseTexture!==void 0&&s.push(n.assignTexture(e,"map",i.diffuseTexture)),e.emissive=new fe(0,0,0),e.glossiness=i.glossinessFactor!==void 0?i.glossinessFactor:1,e.specular=new fe(1,1,1),Array.isArray(i.specularFactor)&&e.specular.fromArray(i.specularFactor),i.specularGlossinessTexture!==void 0){let o=i.specularGlossinessTexture;s.push(n.assignTexture(e,"glossinessMap",o)),s.push(n.assignTexture(e,"specularMap",o))}return Promise.all(s)}createMaterial(e){let t=new zd(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=Qr,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}},XS=class{constructor(){this.name=dt.KHR_MESH_QUANTIZATION}},Oo=class extends qi{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let o=0;o!==i;o++)t[o]=n[s+o];return t}};Oo.prototype.beforeStart_=Oo.prototype.copySampleValue_;Oo.prototype.afterEnd_=Oo.prototype.copySampleValue_;Oo.prototype.interpolate_=function(r,e,t,n){let i=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=o*2,l=o*3,c=n-e,u=(t-e)/c,h=u*u,d=h*u,f=r*l,p=f-l,m=-2*d+3*h,v=d-h,g=1-m,y=v-h+u;for(let x=0;x!==o;x++){let b=s[p+x+o],w=s[p+x+a]*c,_=s[f+x+o],S=s[f+x]*c;i[x]=g*b+y*w+m*_+v*S}return i};var jr={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},tu={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},qS={9728:Pt,9729:$e,9984:Xs,9985:jo,9986:qs,9987:Ai},YS={33071:Zt,33648:qr,10497:di},KS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},$m={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Rs={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},h3={CUBICSPLINE:void 0,LINEAR:Er,STEP:Yr},eg={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function QS(r,e){return typeof r!="string"||r===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(r)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(r)||/^data:.*,.*$/i.test(r)||/^blob:.*$/i.test(r)?r:e+r)}function d3(r){return r.DefaultMaterial===void 0&&(r.DefaultMaterial=new Xi({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Oi})),r.DefaultMaterial}function nu(r,e,t){for(let n in t.extensions)r[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function Fo(r,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(r.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function f3(r,e,t){let n=!1,i=!1;for(let a=0,l=e.length;a<l;a++){let c=e[a];if(c.POSITION!==void 0&&(n=!0),c.NORMAL!==void 0&&(i=!0),n&&i)break}if(!n&&!i)return Promise.resolve(r);let s=[],o=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];if(n){let u=c.POSITION!==void 0?t.getDependency("accessor",c.POSITION):r.attributes.position;s.push(u)}if(i){let u=c.NORMAL!==void 0?t.getDependency("accessor",c.NORMAL):r.attributes.normal;o.push(u)}}return Promise.all([Promise.all(s),Promise.all(o)]).then(function(a){let l=a[0],c=a[1];return n&&(r.morphAttributes.position=l),i&&(r.morphAttributes.normal=c),r.morphTargetsRelative=!0,r})}function p3(r,e){if(r.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)r.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){let t=e.extras.targetNames;if(r.morphTargetInfluences.length===t.length){r.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)r.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function m3(r){let e=r.extensions&&r.extensions[dt.KHR_DRACO_MESH_COMPRESSION],t;return e?t="draco:"+e.bufferView+":"+e.indices+":"+ZS(e.attributes):t=r.indices+":"+ZS(r.attributes)+":"+r.mode,t}function ZS(r){let e="",t=Object.keys(r).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+r[t[n]]+";";return e}function tg(r){switch(r){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.")}}var $S=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new u3,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.textureCache={},this.nodeNamesUsed={},typeof createImageBitmap!="undefined"&&/Firefox/.test(navigator.userAgent)===!1?this.textureLoader=new vh(this.options.manager):this.textureLoader=new gh(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Xn(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){let n=this,i=this.json,s=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([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(o){let a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:n,userData:{}};nu(s,a,i),Fo(a,i),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,s=t.length;i<s;i++){let o=t[i].joints;for(let a=0,l=o.length;a<l;a++)e[o[a]].isBone=!0}for(let i=0,s=e.length;i<s;i++){let o=e[i];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(n[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let i=n.clone();return i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let i=e(t[n]);if(i)return i}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let i=0;i<t.length;i++){let s=e(t[i]);s&&n.push(s)}return n}getDependency(e,t){let n=e+":"+t,i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this.loadNode(t);break;case"mesh":i=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this.loadAnimation(t);break;case"camera":i=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(s,o){return n.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=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[dt.KHR_BINARY_GLTF].body);let i=this.options;return new Promise(function(s,o){n.load(QS(t.uri,i.path),s,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){let i=t.byteLength||0,s=t.byteOffset||0;return n.slice(s,s+i)})}loadAccessor(e){let t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0)return Promise.resolve(null);let s=[];return i.bufferView!==void 0?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),i.sparse!==void 0&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then(function(o){let a=o[0],l=KS[i.type],c=tu[i.componentType],u=c.BYTES_PER_ELEMENT,h=u*l,d=i.byteOffset||0,f=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,p=i.normalized===!0,m,v;if(f&&f!==h){let g=Math.floor(d/f),y="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+g+":"+i.count,x=t.cache.get(y);x||(m=new c(a,g*f,i.count*f/u),x=new Vi(m,f/u),t.cache.add(y,x)),v=new Ti(x,l,d%f/u,p)}else a===null?m=new c(i.count*l):m=new c(a,d,i.count*l),v=new Re(m,l,p);if(i.sparse!==void 0){let g=KS.SCALAR,y=tu[i.sparse.indices.componentType],x=i.sparse.indices.byteOffset||0,b=i.sparse.values.byteOffset||0,w=new y(o[1],x,i.sparse.count*g),_=new c(o[2],b,i.sparse.count*l);a!==null&&(v=new Re(v.array.slice(),v.itemSize,v.normalized));for(let S=0,A=w.length;S<A;S++){let T=w[S];if(v.setX(T,_[S*l]),l>=2&&v.setY(T,_[S*l+1]),l>=3&&v.setZ(T,_[S*l+2]),l>=4&&v.setW(T,_[S*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return v})}loadTexture(e){let t=this.json,n=this.options,i=t.textures[e],s=t.images[i.source],o=this.textureLoader;if(s.uri){let a=n.manager.getHandler(s.uri);a!==null&&(o=a)}return this.loadTextureImage(e,s,o)}loadTextureImage(e,t,n){let i=this,s=this.json,o=this.options,a=s.textures[e],l=(t.uri||t.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];let c=self.URL||self.webkitURL,u=t.uri||"",h=!1,d=!0,f=u.search(/\.jpe?g($|\?)/i)>0||u.search(/^data\:image\/jpeg/)===0;if((t.mimeType==="image/jpeg"||f)&&(d=!1),t.bufferView!==void 0)u=i.getDependency("bufferView",t.bufferView).then(function(m){if(t.mimeType==="image/png"){let g=new DataView(m,25,1).getUint8(0,!1);d=g===6||g===4||g===3}h=!0;let v=new Blob([m],{type:t.mimeType});return u=c.createObjectURL(v),u});else if(t.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let p=Promise.resolve(u).then(function(m){return new Promise(function(v,g){let y=v;n.isImageBitmapLoader===!0&&(y=function(x){let b=new xt(x);b.needsUpdate=!0,v(b)}),n.load(QS(m,o.path),y,void 0,g)})}).then(function(m){h===!0&&c.revokeObjectURL(u),m.flipY=!1,a.name&&(m.name=a.name),d||(m.format=Nt);let g=(s.samplers||{})[a.sampler]||{};return m.magFilter=qS[g.magFilter]||$e,m.minFilter=qS[g.minFilter]||Ai,m.wrapS=YS[g.wrapS]||di,m.wrapT=YS[g.wrapT]||di,i.associations.set(m,{type:"textures",index:e}),m}).catch(function(){return console.error("THREE.GLTFLoader: Couldn't load texture",u),null});return this.textureCache[l]=p,p}assignTexture(e,t,n){let i=this;return this.getDependency("texture",n.index).then(function(s){if(n.texCoord!==void 0&&n.texCoord!=0&&!(t==="aoMap"&&n.texCoord==1)&&console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+t+" not yet supported."),i.extensions[dt.KHR_TEXTURE_TRANSFORM]){let o=n.extensions!==void 0?n.extensions[dt.KHR_TEXTURE_TRANSFORM]:void 0;if(o){let a=i.associations.get(s);s=i.extensions[dt.KHR_TEXTURE_TRANSFORM].extendTexture(s,o),i.associations.set(s,a)}}return e[t]=s,s})}assignFinalMaterial(e){let t=e.geometry,n=e.material,i=t.attributes.tangent!==void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){let a="PointsMaterial:"+n.uuid,l=this.cache.get(a);l||(l=new Ta,nn.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(a,l)),n=l}else if(e.isLine){let a="LineBasicMaterial:"+n.uuid,l=this.cache.get(a);l||(l=new Gn,nn.prototype.copy.call(l,n),l.color.copy(n.color),this.cache.add(a,l)),n=l}if(i||s||o){let a="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(a+="specular-glossiness:"),i&&(a+="vertex-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=n.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(n))),n=l}n.aoMap&&t.attributes.uv2===void 0&&t.attributes.uv!==void 0&&t.setAttribute("uv2",t.attributes.uv),e.material=n}getMaterialType(){return Xi}loadMaterial(e){let t=this,n=this.json,i=this.extensions,s=n.materials[e],o,a={},l=s.extensions||{},c=[];if(l[dt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){let h=i[dt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];o=h.getMaterialType(),c.push(h.extendParams(a,s,t))}else if(l[dt.KHR_MATERIALS_UNLIT]){let h=i[dt.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),c.push(h.extendParams(a,s,t))}else{let h=s.pbrMetallicRoughness||{};if(a.color=new fe(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){let d=h.baseColorFactor;a.color.fromArray(d),a.opacity=d[3]}h.baseColorTexture!==void 0&&c.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&&(c.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=Xt);let u=s.alphaMode||eg.OPAQUE;return u===eg.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===eg.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==dn&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new O(1,-1),s.normalTexture.scale!==void 0&&a.normalScale.set(s.normalTexture.scale,-s.normalTexture.scale)),s.occlusionTexture!==void 0&&o!==dn&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==dn&&(a.emissive=new fe().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&o!==dn&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture)),Promise.all(c).then(function(){let h;return o===zd?h=i[dt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a):h=new o(a),s.name&&(h.name=s.name),h.map&&(h.map.encoding=Fi),h.emissiveMap&&(h.emissiveMap.encoding=Fi),Fo(h,s),t.associations.set(h,{type:"materials",index:e}),s.extensions&&nu(i,h,s),h})}createUniqueName(e){let t=nt.sanitizeNodeName(e||""),n=t;for(let i=1;this.nodeNamesUsed[n];++i)n=t+"_"+i;return this.nodeNamesUsed[n]=!0,n}loadGeometries(e){let t=this,n=this.extensions,i=this.primitiveCache;function s(a){return n[dt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return tM(l,a,t)})}let o=[];for(let a=0,l=e.length;a<l;a++){let c=e[a],u=m3(c),h=i[u];if(h)o.push(h.promise);else{let d;c.extensions&&c.extensions[dt.KHR_DRACO_MESH_COMPRESSION]?d=s(c):d=tM(new we,c,t),i[u]={primitive:c,promise:d},o.push(d)}}return Promise.all(o)}loadMesh(e){let t=this,n=this.json,i=this.extensions,s=n.meshes[e],o=s.primitives,a=[];for(let l=0,c=o.length;l<c;l++){let u=o[l].material===void 0?d3(this.cache):this.getDependency("material",o[l].material);a.push(u)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(l){let c=l.slice(0,l.length-1),u=l[l.length-1],h=[];for(let f=0,p=u.length;f<p;f++){let m=u[f],v=o[f],g,y=c[f];if(v.mode===jr.TRIANGLES||v.mode===jr.TRIANGLE_STRIP||v.mode===jr.TRIANGLE_FAN||v.mode===void 0)g=s.isSkinnedMesh===!0?new Ma(m,y):new gt(m,y),g.isSkinnedMesh===!0&&!g.geometry.attributes.skinWeight.normalized&&g.normalizeSkinWeights(),v.mode===jr.TRIANGLE_STRIP?g.geometry=nM(g.geometry,Su):v.mode===jr.TRIANGLE_FAN&&(g.geometry=nM(g.geometry,Ko));else if(v.mode===jr.LINES)g=new ji(m,y);else if(v.mode===jr.LINE_STRIP)g=new Hi(m,y);else if(v.mode===jr.LINE_LOOP)g=new Yl(m,y);else if(v.mode===jr.POINTS)g=new Kl(m,y);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+v.mode);Object.keys(g.geometry.morphAttributes).length>0&&p3(g,s),g.name=t.createUniqueName(s.name||"mesh_"+e),Fo(g,s),v.extensions&&nu(i,g,v),t.assignFinalMaterial(g),h.push(g)}if(h.length===1)return h[0];let d=new Jn;for(let f=0,p=h.length;f<p;f++)d.add(h[f]);return d})}loadCamera(e){let t,n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new Vt(Ee.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new Rr(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Fo(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n={joints:t.joints};return t.inverseBindMatrices===void 0?Promise.resolve(n):this.getDependency("accessor",t.inverseBindMatrices).then(function(i){return n.inverseBindMatrices=i,n})}loadAnimation(e){let n=this.json.animations[e],i=[],s=[],o=[],a=[],l=[];for(let c=0,u=n.channels.length;c<u;c++){let h=n.channels[c],d=n.samplers[h.sampler],f=h.target,p=f.node!==void 0?f.node:f.id,m=n.parameters!==void 0?n.parameters[d.input]:d.input,v=n.parameters!==void 0?n.parameters[d.output]:d.output;i.push(this.getDependency("node",p)),s.push(this.getDependency("accessor",m)),o.push(this.getDependency("accessor",v)),a.push(d),l.push(f)}return Promise.all([Promise.all(i),Promise.all(s),Promise.all(o),Promise.all(a),Promise.all(l)]).then(function(c){let u=c[0],h=c[1],d=c[2],f=c[3],p=c[4],m=[];for(let g=0,y=u.length;g<y;g++){let x=u[g],b=h[g],w=d[g],_=f[g],S=p[g];if(x===void 0)continue;x.updateMatrix(),x.matrixAutoUpdate=!0;let A;switch(Rs[S.path]){case Rs.weights:A=po;break;case Rs.rotation:A=ms;break;case Rs.position:case Rs.scale:default:A=go;break}let T=x.name?x.name:x.uuid,L=_.interpolation!==void 0?h3[_.interpolation]:Er,C=[];Rs[S.path]===Rs.weights?x.traverse(function(P){P.isMesh===!0&&P.morphTargetInfluences&&C.push(P.name?P.name:P.uuid)}):C.push(T);let U=w.array;if(w.normalized){let P=tg(U.constructor),R=new Float32Array(U.length);for(let G=0,B=U.length;G<B;G++)R[G]=U[G]*P;U=R}for(let P=0,R=C.length;P<R;P++){let G=new A(C[P]+"."+Rs[S.path],b.array,U,L);_.interpolation==="CUBICSPLINE"&&(G.createInterpolant=function(j){return new Oo(this.times,this.values,this.getValueSize()/3,j)},G.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),m.push(G)}}let v=n.name?n.name:"animation_"+e;return new Ca(v,void 0,m)})}createNodeMesh(e){let t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(s){let o=n._getNodeRef(n.meshCache,i.mesh,s);return i.weights!==void 0&&o.traverse(function(a){if(!!a.isMesh)for(let l=0,c=i.weights.length;l<c;l++)a.morphTargetInfluences[l]=i.weights[l]}),o})}loadNode(e){let t=this.json,n=this.extensions,i=this,s=t.nodes[e],o=s.name?i.createUniqueName(s.name):"";return function(){let a=[],l=i._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&a.push(l),s.camera!==void 0&&a.push(i.getDependency("camera",s.camera).then(function(c){return i._getNodeRef(i.cameraCache,s.camera,c)})),i._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),Promise.all(a)}().then(function(a){let l;if(s.isBone===!0?l=new Aa:a.length>1?l=new Jn:a.length===1?l=a[0]:l=new Ke,l!==a[0])for(let c=0,u=a.length;c<u;c++)l.add(a[c]);if(s.name&&(l.userData.name=s.name,l.name=o),Fo(l,s),s.extensions&&nu(n,l,s),s.matrix!==void 0){let c=new me;c.fromArray(s.matrix),l.applyMatrix4(c)}else s.translation!==void 0&&l.position.fromArray(s.translation),s.rotation!==void 0&&l.quaternion.fromArray(s.rotation),s.scale!==void 0&&l.scale.fromArray(s.scale);return i.associations.set(l,{type:"nodes",index:e}),l})}loadScene(e){let t=this.json,n=this.extensions,i=this.json.scenes[e],s=this,o=new Jn;i.name&&(o.name=s.createUniqueName(i.name)),Fo(o,i),i.extensions&&nu(n,o,i);let a=i.nodes||[],l=[];for(let c=0,u=a.length;c<u;c++)l.push(eM(a[c],o,t,s));return Promise.all(l).then(function(){return o})}};function eM(r,e,t,n){let i=t.nodes[r];return n.getDependency("node",r).then(function(s){if(i.skin===void 0)return s;let o;return n.getDependency("skin",i.skin).then(function(a){o=a;let l=[];for(let c=0,u=o.joints.length;c<u;c++)l.push(n.getDependency("node",o.joints[c]));return Promise.all(l)}).then(function(a){return s.traverse(function(l){if(!l.isMesh)return;let c=[],u=[];for(let h=0,d=a.length;h<d;h++){let f=a[h];if(f){c.push(f);let p=new me;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])}l.bind(new _a(c,u),l.matrixWorld)}),s})}).then(function(s){e.add(s);let o=[];if(i.children){let a=i.children;for(let l=0,c=a.length;l<c;l++){let u=a[l];o.push(eM(u,s,t,n))}}return Promise.all(o)})}function g3(r,e,t){let n=e.attributes,i=new tn;if(n.POSITION!==void 0){let a=t.json.accessors[n.POSITION],l=a.min,c=a.max;if(l!==void 0&&c!==void 0){if(i.set(new M(l[0],l[1],l[2]),new M(c[0],c[1],c[2])),a.normalized){let u=tg(tu[a.componentType]);i.min.multiplyScalar(u),i.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let s=e.targets;if(s!==void 0){let a=new M,l=new M;for(let c=0,u=s.length;c<u;c++){let h=s[c];if(h.POSITION!==void 0){let d=t.json.accessors[h.POSITION],f=d.min,p=d.max;if(f!==void 0&&p!==void 0){if(l.setX(Math.max(Math.abs(f[0]),Math.abs(p[0]))),l.setY(Math.max(Math.abs(f[1]),Math.abs(p[1]))),l.setZ(Math.max(Math.abs(f[2]),Math.abs(p[2]))),d.normalized){let m=tg(tu[d.componentType]);l.multiplyScalar(m)}a.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(a)}r.boundingBox=i;let o=new ti;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,r.boundingSphere=o}function tM(r,e,t){let n=e.attributes,i=[];function s(o,a){return t.getDependency("accessor",o).then(function(l){r.setAttribute(a,l)})}for(let o in n){let a=$m[o]||o.toLowerCase();a in r.attributes||i.push(s(n[o],a))}if(e.indices!==void 0&&!r.index){let o=t.getDependency("accessor",e.indices).then(function(a){r.setIndex(a)});i.push(o)}return Fo(r,e),g3(r,e,t),Promise.all(i).then(function(){return e.targets!==void 0?f3(r,e.targets,t):r})}function nM(r,e){let t=r.getIndex();if(t===null){let o=[],a=r.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);r.setIndex(o),t=r.getIndex()}else return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}let n=t.count-2,i=[];if(e===Ko)for(let o=1;o<=n;o++)i.push(t.getX(0)),i.push(t.getX(o)),i.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2==0?(i.push(t.getX(o)),i.push(t.getX(o+1)),i.push(t.getX(o+2))):(i.push(t.getX(o+2)),i.push(t.getX(o+1)),i.push(t.getX(o)));i.length/3!==n&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let s=r.clone();return s.setIndex(i),s}var on=class extends gt{constructor({char:e,originalChar:t,fontFamily:n,letterSpacing:i,fontSize:s,LOD:o=16},a=new dn({color:0,opacity:1,visible:!0,transparent:!0,side:Xt})){let l=on.loadChar(e,n,o);super(l.geometry,a);this.char=e,this.originalChar=t!=null?t:e,this.fontFamily=n,this.letterSpacing=i,this.fontSize=s,this.LOD=o,this.resolution=l.resolution,this.glyphsHa=l.glyphsHa,this.localPosition=new O,this.charSize=0,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}static get FONTS_PATH(){return on._fontPath}static set FONTS_PATH(e){on._fontPath=e}updatePosition(e,t){this.localPosition.copy(e);let n=new M(this.localPosition.x,-this.localPosition.y,0);this.position.copy(n).add(t)}updateFontSize(e){let t=e/this.resolution;this.fontSize=e,this.scale.set(this.fontSize,this.fontSize,1),this.charSize=this.glyphsHa*t*this.letterSpacing}updateFontFamily(e){if(this.fontFamily===e)return;this.fontFamily=e;let t=on.loadChar(this.char,e,this.LOD);this.geometry=t.geometry,this.resolution=t.resolution,this.glyphsHa=t.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateChar(e){if(this.char===e)return;this.char=e;let t=on.loadChar(e,this.fontFamily,this.LOD);this.geometry=t.geometry,this.resolution=t.resolution,this.glyphsHa=t.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateLetterSpacing(e){this.letterSpacing!==e&&(this.letterSpacing=e,this.updateFontSize(this.fontSize))}updateLOD(e){if(this.LOD===e)return;this.LOD=e;let t=on.loadChar(this.char,this.fontFamily,this.LOD);this.geometry=t.geometry,this.resolution=t.resolution,this.glyphsHa=t.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}clone(){let e={char:this.char,originalChar:this.originalChar,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,LOD:this.LOD};return new on(e).copy(this)}static loadFont(e){return new Promise(function(t,n){on.fontCache[e]?t(on.fontCache[e]):new Tp().load(on.FONTS_PATH+e+".json",s=>{on.fontCache[e]=s,t(s)},void 0,n)})}static loadChar(e,t,n){if(on.charCache[e]){if(on.charCache[e][n]&&on.charCache[e][n].fontFamily===t)return on.charCache[e][n]}else on.charCache[e]={};let i=on.fontCache[t],s=i.generateShapes(e,1);return on.charCache[e][n]={geometry:new ps(s,n),fontFamily:t,resolution:i.data.resolution,glyphsHa:i.data.glyphs[e].ha},on.charCache[e][n]}},ui=on;ui.charCache={},ui.fontCache={},ui._fontPath="/_assets/_fonts/";var zo;(function(n){n[n.STANDARD=1]="STANDARD",n[n.UPPERCASE=2]="UPPERCASE",n[n.LOWERCASE=3]="LOWERCASE"})(zo||(zo={}));var Bs;(function(n){n[n.TOP=1]="TOP",n[n.MIDDLE=2]="MIDDLE",n[n.BOTTOM=3]="BOTTOM"})(Bs||(Bs={}));var hi;(function(i){i[i.LEFT=1]="LEFT",i[i.RIGHT=2]="RIGHT",i[i.CENTER=3]="CENTER",i[i.JUSTIFY=4]="JUSTIFY"})(hi||(hi={}));var Go;(function(t){t[t.TO_RIGHT=1]="TO_RIGHT",t[t.TO_LEFT=-1]="TO_LEFT"})(Go||(Go={}));var Gd=new O,_l=class{constructor(e,t,n){this.message=[];this.endLine=!0;this.yLinePos=e,this.lineHeight=t,this.maxCharSize=n,this.nextChar3DPos=new O(0,this.yLinePos+this.maxCharSize*this.lineHeight),this.align=hi.LEFT}addChar3D(e,t,n=this.message.length){this.message.splice(n,0,e),e.fontSize>this.maxCharSize?(this.maxCharSize=e.fontSize,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight,this.fullUpdate(t)):(e.updatePosition(this.nextChar3DPos,t),this.nextChar3DPos.x+=e.charSize)}deleteChar3D(e=this.message.length-1){let t=this.message[e];if(t)return this.message.splice(e,1),this.nextChar3DPos.x-=t.charSize,t}isEndLine(e){this.endLine=e}fullUpdate(e,t=0){this.nextChar3DPos.x=0;for(let n=t,i=this.message.length;n<i;n+=1)this.message[n].updatePosition(this.nextChar3DPos,e),this.nextChar3DPos.x+=this.message[n].charSize}checkOverFlow(e){let t,n=this.message.length-1;if(n<=0)return!1;for(;n>=0;){if(this.message[n].char!==" "){t=this.message[n];break}n-=1}return!!(n>=0&&t&&t.localPosition.x+t.charSize>e)}containSpaceOverFlow(e=this.message.length-1){for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}containSpace(e=this.message.length-1){if(this.endLine)return!0;for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}popWord(e=this.message.length-1){let t=[],n=!0,i;for(i=e;i>=0;i-=1)if(this.message[i].char===" "){n=!1,t.length===0&&(i-=1,t.splice(0,0,this.message[i]));break}else t.splice(0,0,this.message[i]);return n?t=[]:this.message.splice(i+1,t.length),t}getWord(e=0,t=1){let n=[],i=e;for(i=e;;i+=t){if(!this.message[i]||this.message[i].char===" "){n.length===0&&this.message[i]&&(n.push(this.message[i]),this.message.splice(i,1));break}t>0?(n.push(this.message[i]),this.message.splice(i,1),i-=t):(n.splice(0,0,this.message[i]),this.message.splice(i,1))}return n}getWordAtIndex(e){let t=[];for(let n=e;n<this.message.length&&this.message[n].char!==" ";n++)t.push(this.message[n]);for(let n=e-1;n>=0&&this.message[n].char!==" ";n--)t.splice(0,0,this.message[n]);return t}wordSize(e=0,t=-1){let n=0,i=e;for(;i>=0&&i<this.message.length;){if(this.message[i].char===" "){n===0&&(n=this.message[i].charSize);break}n+=this.message[i].charSize,i+=t}return(i<0||i>=this.message.length)&&!this.endLine?this.message[e]?this.message[e].charSize:999999999:n===0?999999999:n}spaceLeft(e){return e-this.nextChar3DPos.x}popChar(e=this.message.length-1){return this.nextChar3DPos.x-=this.message[e].charSize,this.message.splice(e,1)}isEmpty(){return!this.message.length}updateNextCharPosY(){this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}updateYLinePos(e){this.yLinePos=e,this.updateNextCharPosY()}updatelineHeight(e){this.lineHeight=e,this.updateNextCharPosY()}updateFontSize(e,t=0,n=this.message.length-1){for(let i=t;i<=n;i+=1)this.message[i].updateFontSize(e);this.maxCharSize=e,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}countSpaces(){let e=0;for(let t=0;t<this.message.length;t++)this.message[t].char===" "&&(e+=1);return e}alignText(e,t,n,i,s){switch(n){case hi.LEFT:this.leftAlign(e,s);break;case hi.CENTER:this.centerAlign(this.spaceLeft(t),e,s);break;case hi.RIGHT:this.rightAlign(this.spaceLeft(t),e,s);break;case hi.JUSTIFY:this.justifyAlign(this.spaceLeft(t),e,s);break}}offsetCharacters(e,t,n){Gd.set(t,n);let i=this.message.length;for(let s=0;s<i;s++)this.message[s].updatePosition(this.message[s].localPosition.add(Gd),e)}leftAlign(e,t){this.align=hi.LEFT,this.offsetCharacters(e,0,t)}centerAlign(e,t,n){this.align=hi.CENTER,this.offsetCharacters(t,e/2,n)}rightAlign(e,t,n){this.align=hi.RIGHT,this.offsetCharacters(t,e,n)}justifyAlign(e,t,n){if(this.align=hi.JUSTIFY,this.endLine){this.offsetCharacters(t,0,n);return}let i=this.countSpaces();if(i===0){this.offsetCharacters(t,0,n);return}let s=e/i,o=0;for(let a=0;a<this.message.length;a++)this.message[a].char===" "&&(o+=s),Gd.set(o,n),this.message[a].updatePosition(this.message[a].localPosition.add(Gd),t)}clone(){let e=new _l(this.yLinePos,this.lineHeight,this.maxCharSize);e.nextChar3DPos=this.nextChar3DPos.clone(),e.align=this.align,e.endLine=this.endLine;for(let t=0;t<this.message.length;t++)e.message.push(this.message[t].clone());return e}};var Os=class extends Vn{constructor(e,t=new oi({transparent:!0,opacity:1,visible:!1,side:Xt})){super(e,t);this.objectType="TextFrame";this.material.visible=!1,this._geometryUserData=e.userData,this.userData.textFrame={hexColor:6974058,opacity:1,visible:!0,fontSize:16,lineHeight:1.5,letterSpacing:1,fontFamily:"roboto_regular",textTransform:zo.STANDARD,horizontalAlignment:1,verticalAlignment:Bs.TOP,LOD:16,maxLineSize:this._geometryUserData.parameters.width,textOrigin:new M(this._geometryUserData.parameters.width*-.5,this._geometryUserData.parameters.height*.5,0),textLines:[]},this.createTextLine()}raycast(e,t){let n=[];if(super.raycast(e,n),n.length>0){t.push(n[0]);return}let i=[];for(let s=0,o=this.children.length;s<o;++s)if(this.children[s]instanceof ui&&(e.intersectObject(this.children[s],!1,i),i.length>0)){i[0].object=this,t.push(i[0]);return}}updateGeometry(e){var c,u;let t=this.userData,n=this.geometry.userData,i=n.parameters.width,s=(c=e.parameters)==null?void 0:c.width,o=(u=e.parameters)==null?void 0:u.height,a=n.parameters.height,l=t.textFrame;super.updateGeometry(e),l.maxLineSize=n.parameters.width,l.textOrigin.set(n.parameters.width*-.5,n.parameters.height*.5,0),o!==void 0&&a!==o?(this.checkOverFlow(),this.checkCapacity()):s!==void 0&&(i<s?this.checkCapacity():i>s&&this.checkOverFlow())}checkOverFlow(e=0){let t=this.userData,n=t.textFrame.textOrigin,i=t.textFrame.textLines;for(let s=e;s<i.length;s++){i[s].updateYLinePos(this.getNewLinePosition(s)),i[s].fullUpdate(n);let o=[];for(;i[s].checkOverFlow(t.textFrame.maxLineSize);)i[s].containSpaceOverFlow()?o.splice(0,0,i[s].getWord(i[s].message.length-1,Go.TO_LEFT)):o.splice(0,0,i[s].popChar());if(o.length>0){i[s+1]===void 0&&(i[s].isEndLine(!1),this.createTextLine());let a=0;for(let l=0;l<o.length;l+=1)for(let c=0;c<o[l].length;c+=1)i[s+1].addChar3D(o[l][c],n,a),a+=1;i[s+1].fullUpdate(n)}i[s].fullUpdate(n)}this.textFullUpdate(e)}checkCapacity(e=0){let t=this.userData,n=t.textFrame.textOrigin,i=t.textFrame.maxLineSize,s=t.textFrame.textLines;for(let o=e;o<s.length;o+=1)if(s[o].updateYLinePos(this.getNewLinePosition(o)),s[o].fullUpdate(n),!!s[o-1])for(;!s[o-1].endLine;){let a,l=s[o-1].spaceLeft(i);if(s[o].wordSize(0,Go.TO_RIGHT)<=l){s[o].containSpace()?a=s[o].getWord(0,Go.TO_RIGHT):a=s[o].popChar(0);for(let c=0;c<a.length;c+=1)a[c]&&s[o-1].addChar3D(a[c],n)}else{s[o].isEmpty()?(s[o].endLine&&s[o-1].isEndLine(!0),s.splice(o,1),o-=1):(s[o].updateYLinePos(this.getNewLinePosition(o)),s[o].fullUpdate(n));break}}this.textFullUpdate(e)}createTextLine(e=this.userData.textFrame.textLines.length){let n=this.userData.textFrame;n.textLines.splice(e,0,new _l(this.getNewLinePosition(e),n.lineHeight,n.fontSize))}textFullUpdate(e=0){let n=this.userData.textFrame,i=n.textLines,s=this.getVerticalAlignmentOffSet();for(let o=e;o<i.length;o++)i[o].updateYLinePos(this.getNewLinePosition(o)),i[o].fullUpdate(n.textOrigin),i[o].alignText(n.textOrigin,n.maxLineSize,n.horizontalAlignment,n.verticalAlignment,s)}getVerticalAlignmentOffSet(){switch(this.userData.textFrame.verticalAlignment){case Bs.TOP:return 0;case Bs.MIDDLE:return this.getRemainingVerticalSpace()/2;case Bs.BOTTOM:return this.getRemainingVerticalSpace();default:return 0}}getRemainingVerticalSpace(){let t=this.userData.textFrame.textLines;return this.geometry.userData.parameters.height-this.getNewLinePosition(t.length)}getNewLinePosition(e){let n=this.userData.textFrame.textLines,i=0;for(let s=0;s<e;s+=1)i+=n[s].maxCharSize*n[s].lineHeight;return i}updateColor(e){var i;let t=this.userData;t.textFrame.hexColor=e;let n=t.textFrame.textLines;for(let s=0;s<n.length;s++){let o=n[s].message;for(let a=0;a<o.length;a++){let l=o[a].material;((i=l.color)==null?void 0:i.isColor)&&l.color.setHex(e)}}}updateOpacity(e){let t=this.userData;t.textFrame.opacity=e;let n=t.textFrame.textLines;for(let i=0;i<n.length;i++){let s=n[i].message;for(let o=0;o<s.length;o++){let a=s[o].material;a.opacity=e}}}updateVisible(e){let t=this.userData;t.textFrame.visible=e;let n=t.textFrame.textLines;for(let i=0;i<n.length;i++){let s=n[i].message;for(let o=0;o<s.length;o++){let a=s[o].material;a.visible=e}}}async updateFontFamily(e){await ui.loadFont(e);let n=this.userData.textFrame,i=n.textLines;n.fontFamily=e;for(let s=0;s<i.length;s++){let o=i[s].message;for(let a=0;a<o.length;a++)o[a].updateFontFamily(e)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateFontSize(e){let n=this.userData.textFrame,i=n.textLines,s=n.fontSize;n.fontSize=e;for(let o=0;o<i.length;o++)i[o].updateFontSize(e);this.textFullUpdate(),e>s?this.checkOverFlow():e<s&&this.checkCapacity()}async updateTextTransform(e){let n=this.userData.textFrame;await ui.loadFont(n.fontFamily);let i=n.textLines;switch(n.textTransform=e,e){case zo.UPPERCASE:for(let s=0;s<i.length;s++){let o=i[s].message;for(let a=0;a<o.length;a++)i[s].message[a].updateChar(o[a].char.toUpperCase())}break;case zo.LOWERCASE:for(let s=0;s<i.length;s++){let o=i[s].message;for(let a=0;a<o.length;a++)i[s].message[a].updateChar(o[a].char.toLowerCase())}break;default:for(let s=0;s<i.length;s++){let o=i[s].message;for(let a=0;a<o.length;a++)i[s].message[a].updateChar(o[a].originalChar)}}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLetterSpacing(e){let t=this.userData,n=t.textFrame.textLines;t.textFrame.letterSpacing=e;for(let i=0;i<n.length;i++){let s=n[i].message;for(let o=0;o<s.length;o++)s[o].updateLetterSpacing(e)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLOD(e){let t=this.userData;t.textFrame.LOD=e;let n=t.textFrame.textLines;for(let i=0;i<n.length;i++);this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLineHeight(e){let t=this.userData,n=t.textFrame.textLines;t.textFrame.lineHeight=e;for(let i=0;i<n.length;i++)n[i].updatelineHeight(e);this.textFullUpdate()}updateVerticalAlignment(e){let t=this.userData;t.textFrame.verticalAlignment=e,this.textFullUpdate()}updateHorizontalAlignment(e){let t=this.userData;t.textFrame.horizontalAlignment=e,this.textFullUpdate()}copy(e,t){super.copy(e,t);let n=this.userData,i=e.userData,s=this.geometry.userData;n.textFrame.textOrigin=new M(s.parameters.width*-.5,s.parameters.height*.5,0);let o=i.textFrame.textLines;n.textFrame.textLines=[];for(let a=0;a<o.length;a++){let l=o[a].clone(),c=l.message;n.textFrame.textLines.push(l);for(let u=0;u<c.length;u++)this.add(c[u])}return this.textFullUpdate(),this.updateColor(i.textFrame.hexColor),this}toJSON(e){let t=super.toJSON(e),n=t.object;n.objectType="TextFrame";let s=this.userData.textFrame.textLines.map(o=>{let a=o.message.map(l=>({char:l.char,originalChar:l.originalChar,fontFamily:l.fontFamily,letterSpacing:l.letterSpacing,fontSize:l.fontSize,LOD:l.LOD}));return{align:o.align,endLine:o.endLine,lineHeight:o.lineHeight,maxCharSize:o.maxCharSize,yLinePos:o.yLinePos,message:a}});return n.userData.textFrame.textLinesData=s,t}async fromJSONasync(e){if(super.fromJSON(e),e.userData!==void 0){let t=e.userData.textFrame;await ui.loadFont(t.fontFamily),t.textOrigin=new M(t.textOrigin.x,t.textOrigin.y,t.textOrigin.z);let n=new dn({color:t.hexColor,opacity:t.opacity,visible:t.visible,transparent:!0,side:Xt});t.textLinesData&&(t.textLines=t.textLinesData.map((i,s)=>{let o=new _l(Number(i.yLinePos),Number(i.lineHeight),Number(i.maxCharSize)),a=i.message.map((l,c)=>{if(l.char===void 0){let d=t.textLines[s].message[c];if("geometries"in d){let f=d.geometries[0].userData.parameters;Object.assign(l,{LOD:f.lod,char:f.char,fontFamily:f.fontFamily,fontSize:f.fontSize,letterSpacing:f.letterSpacing,originalChar:f.char})}}let u={char:l.char,fontFamily:l.fontFamily,letterSpacing:Number(l.letterSpacing),fontSize:Number(l.fontSize),LOD:l.LOD},h=new ui(u,n.clone());return o.addChar3D(h,t.textOrigin),this.add(h),h});return o.message=a,o}),this.userData.textFrame=t),this.textFullUpdate()}return this}convertToVector(){let{fontFamily:e,hexColor:t}=this.userData.textFrame,n=new Pi;n.name="Text Shape";let i=ui.fontCache[e];for(let s of this.children)s instanceof ui&&i.generateShapes(s.char,1).forEach(o=>{var h;let a=new Lt().fromShape(o);a.applyScale(s.scale.x,s.scale.y);let l=Pn.create({shape:a}),c=new oi({side:Xt});(h=c.color)==null||h.value.setHex(t);let u=new Ps(l,c);u.name=s.char,u.position.copy(s.position),u.rotation.copy(s.rotation),n.attach(u)});return n}};Os.VERTICAL_ALIGN=Bs,Os.HORIZONTAL_ALIGN=hi,Os.TEXT_TRANSFORM=zo,Os.TRAVEL_DIRECTION=Go;var iM={RED:0,GREEN:1,BLUE:2,ALPHA:3};var iu="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}";var y3=`#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
uniform lowp sampler2D cocBuffer;uniform vec2 texelSize;uniform float scale;
#if PASS == 1
uniform vec4 kernel64[32];
#else
uniform vec4 kernel16[8];
#endif
varying vec2 vUv;void main(){
#ifdef FOREGROUND
vec2 CoCNearFar=texture2D(cocBuffer,vUv).rg;float CoC=CoCNearFar.r*scale;
#else
float CoC=texture2D(cocBuffer,vUv).g*scale;
#endif
if(CoC==0.0){gl_FragColor=texture2D(inputBuffer,vUv);}else{
#ifdef FOREGROUND
vec2 step=texelSize*max(CoC,CoCNearFar.g*scale);
#else
vec2 step=texelSize*CoC;
#endif
#if PASS == 1
vec4 acc=vec4(0.0);for(int i=0;i<32;++i){vec4 kernel=kernel64[i];vec2 uv=step*kernel.xy+vUv;acc+=texture2D(inputBuffer,uv);uv=step*kernel.zw+vUv;acc+=texture2D(inputBuffer,uv);}gl_FragColor=acc/64.0;
#else
vec4 maxValue=texture2D(inputBuffer,vUv);for(int i=0;i<8;++i){vec4 kernel=kernel16[i];vec2 uv=step*kernel.xy+vUv;maxValue=max(texture2D(inputBuffer,uv),maxValue);uv=step*kernel.zw+vUv;maxValue=max(texture2D(inputBuffer,uv),maxValue);}gl_FragColor=maxValue;
#endif
}}`,Ud=class extends _t{constructor(r=!1,e=!1){super({type:"BokehMaterial",defines:{PASS:r?"2":"1"},uniforms:{kernel64:new Ae(null),kernel16:new Ae(null),inputBuffer:new Ae(null),cocBuffer:new Ae(null),texelSize:new Ae(new O),scale:new Ae(1)},fragmentShader:y3,vertexShader:iu,blending:It,depthWrite:!1,depthTest:!1});this.toneMapped=!1,e&&(this.defines.FOREGROUND="1"),this.generateKernel()}generateKernel(){let r=2.39996323,e=new Float32Array(128),t=new Float32Array(32),n=0,i=0;for(let a=0;a<80;++a){let l=a*r,c=Math.sqrt(a)/Math.sqrt(80),u=c*Math.cos(l),h=c*Math.sin(l);a%5==0?(t[i++]=u,t[i++]=h):(e[n++]=u,e[n++]=h)}let s=[],o=[];for(let a=0;a<128;)s.push(new Qe(e[a++],e[a++],e[a++],e[a++]));for(let a=0;a<32;)o.push(new Qe(t[a++],t[a++],t[a++],t[a++]));this.uniforms.kernel64.value=s,this.uniforms.kernel16.value=o}setTexelSize(r,e){this.uniforms.texelSize.value.set(r,e)}},v3=`#include <common>
#include <packing>
#ifdef GL_FRAGMENT_PRECISION_HIGH
uniform highp sampler2D depthBuffer;
#else
uniform mediump sampler2D depthBuffer;
#endif
uniform float focusDistance;uniform float focalLength;uniform float cameraNear;uniform float cameraFar;varying vec2 vUv;float readDepth(const in vec2 uv){
#if DEPTH_PACKING == 3201
return unpackRGBAToDepth(texture2D(depthBuffer,uv));
#else
return texture2D(depthBuffer,uv).r;
#endif
}void main(){float depth=readDepth(vUv);
#ifdef PERSPECTIVE_CAMERA
float viewZ=perspectiveDepthToViewZ(depth,cameraNear,cameraFar);float linearDepth=viewZToOrthographicDepth(viewZ,cameraNear,cameraFar);
#else
float linearDepth=depth;
#endif
float signedDistance=linearDepth-focusDistance;float magnitude=smoothstep(0.0,focalLength,abs(signedDistance));gl_FragColor.rg=vec2(step(signedDistance,0.0)*magnitude,step(0.0,signedDistance)*magnitude);}`,x3=class extends _t{constructor(r){super({type:"CircleOfConfusionMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new Ae(null),focusDistance:new Ae(0),focalLength:new Ae(0),cameraNear:new Ae(.3),cameraFar:new Ae(1e3)},fragmentShader:v3,vertexShader:iu,blending:It,depthWrite:!1,depthTest:!1});this.toneMapped=!1,this.adoptCameraSettings(r)}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(r){this.defines.DEPTH_PACKING=r.toFixed(0),this.needsUpdate=!0}adoptCameraSettings(r=null){r!==null&&(this.uniforms.cameraNear.value=r.near,this.uniforms.cameraFar.value=r.far,r instanceof Vt?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},b3=`varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;
#if EDGE_DETECTION_MODE != 0
varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;
#endif
#if EDGE_DETECTION_MODE == 1
#include <common>
#endif
#if EDGE_DETECTION_MODE == 0 || PREDICATION_MODE == 1
#ifdef GL_FRAGMENT_PRECISION_HIGH
uniform highp sampler2D depthBuffer;
#else
uniform mediump sampler2D depthBuffer;
#endif
float readDepth(const in vec2 uv){
#if DEPTH_PACKING == 3201
return unpackRGBAToDepth(texture2D(depthBuffer,uv));
#else
return texture2D(depthBuffer,uv).r;
#endif
}vec3 gatherNeighbors(){float p=readDepth(vUv);float pLeft=readDepth(vUv0);float pTop=readDepth(vUv1);return vec3(p,pLeft,pTop);}
#elif PREDICATION_MODE == 2
uniform sampler2D predicationBuffer;vec3 gatherNeighbors(){float p=texture2D(predicationBuffer,vUv).r;float pLeft=texture2D(predicationBuffer,vUv0).r;float pTop=texture2D(predicationBuffer,vUv1).r;return vec3(p,pLeft,pTop);}
#endif
#if PREDICATION_MODE != 0
vec2 calculatePredicatedThreshold(){vec3 neighbours=gatherNeighbors();vec2 delta=abs(neighbours.xx-neighbours.yz);vec2 edges=step(PREDICATION_THRESHOLD,delta);return PREDICATION_SCALE*EDGE_THRESHOLD*(1.0-PREDICATION_STRENGTH*edges);}
#endif
#if EDGE_DETECTION_MODE != 0
uniform sampler2D inputBuffer;
#endif
void main(){
#if EDGE_DETECTION_MODE == 0
const vec2 threshold=vec2(DEPTH_THRESHOLD);
#elif PREDICATION_MODE != 0
vec2 threshold=calculatePredicatedThreshold();
#else
const vec2 threshold=vec2(EDGE_THRESHOLD);
#endif
#if EDGE_DETECTION_MODE == 0
vec3 neighbors=gatherNeighbors();vec2 delta=abs(neighbors.xx-vec2(neighbors.y,neighbors.z));vec2 edges=step(threshold,delta);if(dot(edges,vec2(1.0))==0.0){discard;}gl_FragColor=vec4(edges,0.0,1.0);
#elif EDGE_DETECTION_MODE == 1
float l=linearToRelativeLuminance(texture2D(inputBuffer,vUv).rgb);float lLeft=linearToRelativeLuminance(texture2D(inputBuffer,vUv0).rgb);float lTop=linearToRelativeLuminance(texture2D(inputBuffer,vUv1).rgb);vec4 delta;delta.xy=abs(l-vec2(lLeft,lTop));vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}float lRight=linearToRelativeLuminance(texture2D(inputBuffer,vUv2).rgb);float lBottom=linearToRelativeLuminance(texture2D(inputBuffer,vUv3).rgb);delta.zw=abs(l-vec2(lRight,lBottom));vec2 maxDelta=max(delta.xy,delta.zw);float lLeftLeft=linearToRelativeLuminance(texture2D(inputBuffer,vUv4).rgb);float lTopTop=linearToRelativeLuminance(texture2D(inputBuffer,vUv5).rgb);delta.zw=abs(vec2(lLeft,lTop)-vec2(lLeftLeft,lTopTop));maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges.xy*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);
#elif EDGE_DETECTION_MODE == 2
vec4 delta;vec3 c=texture2D(inputBuffer,vUv).rgb;vec3 cLeft=texture2D(inputBuffer,vUv0).rgb;vec3 t=abs(c-cLeft);delta.x=max(max(t.r,t.g),t.b);vec3 cTop=texture2D(inputBuffer,vUv1).rgb;t=abs(c-cTop);delta.y=max(max(t.r,t.g),t.b);vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}vec3 cRight=texture2D(inputBuffer,vUv2).rgb;t=abs(c-cRight);delta.z=max(max(t.r,t.g),t.b);vec3 cBottom=texture2D(inputBuffer,vUv3).rgb;t=abs(c-cBottom);delta.w=max(max(t.r,t.g),t.b);vec2 maxDelta=max(delta.xy,delta.zw);vec3 cLeftLeft=texture2D(inputBuffer,vUv4).rgb;t=abs(c-cLeftLeft);delta.z=max(max(t.r,t.g),t.b);vec3 cTopTop=texture2D(inputBuffer,vUv5).rgb;t=abs(c-cTopTop);delta.w=max(max(t.r,t.g),t.b);maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0);
#endif
}`,w3=`uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;
#if EDGE_DETECTION_MODE != 0
varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;
#endif
void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,0.0);vUv1=vUv+texelSize*vec2(0.0,-1.0);
#if EDGE_DETECTION_MODE != 0
vUv2=vUv+texelSize*vec2(1.0,0.0);vUv3=vUv+texelSize*vec2(0.0,1.0);vUv4=vUv+texelSize*vec2(-2.0,0.0);vUv5=vUv+texelSize*vec2(0.0,-2.0);
#endif
gl_Position=vec4(position.xy,1.0,1.0);}`;var S3=`#include <common>
#include <dithering_pars_fragment>
#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25;
#include <dithering_fragment>
}`,M3="uniform vec2 texelSize;uniform vec2 halfTexelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize*vec2(kernel)+halfTexelSize)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}",rM=class extends _t{constructor(r=new O){super({type:"ConvolutionMaterial",uniforms:{inputBuffer:new Ae(null),texelSize:new Ae(new O),halfTexelSize:new Ae(new O),kernel:new Ae(0),scale:new Ae(1)},fragmentShader:S3,vertexShader:M3,blending:It,depthWrite:!1,depthTest:!1});this.toneMapped=!1,this.setTexelSize(r.x,r.y),this.kernelSize=kd.LARGE}getKernel(){return A3[this.kernelSize]}setTexelSize(r,e){this.uniforms.texelSize.value.set(r,e),this.uniforms.halfTexelSize.value.set(r,e).multiplyScalar(.5)}},A3=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],kd={VERY_SMALL:0,SMALL:1,MEDIUM:2,LARGE:3,VERY_LARGE:4,HUGE:5},_3=`#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel;
#include <encodings_fragment>
}`,sM=class extends _t{constructor(){super({type:"CopyMaterial",uniforms:{inputBuffer:new Ae(null),opacity:new Ae(1)},fragmentShader:_3,vertexShader:iu,blending:It,depthWrite:!1,depthTest:!1});this.toneMapped=!1}};var T3=class extends _t{constructor(r=new O,e=Vd.COLOR){super({type:"EdgeDetectionMaterial",defines:{LOCAL_CONTRAST_ADAPTATION_FACTOR:"2.0",EDGE_THRESHOLD:"0.1",DEPTH_THRESHOLD:"0.01",PREDICATION_MODE:"0",PREDICATION_THRESHOLD:"0.01",PREDICATION_SCALE:"2.0",PREDICATION_STRENGTH:"1.0",DEPTH_PACKING:"0"},uniforms:{inputBuffer:new Ae(null),depthBuffer:new Ae(null),predicationBuffer:new Ae(null),texelSize:new Ae(r)},fragmentShader:b3,vertexShader:w3,blending:It,depthWrite:!1,depthTest:!1});this.toneMapped=!1,this.setEdgeDetectionMode(e)}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(r){this.defines.DEPTH_PACKING=r.toFixed(0),this.needsUpdate=!0}setEdgeDetectionMode(r){this.defines.EDGE_DETECTION_MODE=r.toFixed(0),this.needsUpdate=!0}setLocalContrastAdaptationFactor(r){this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR=r.toFixed("6"),this.needsUpdate=!0}setEdgeDetectionThreshold(r){this.defines.EDGE_THRESHOLD=r.toFixed("6"),this.defines.DEPTH_THRESHOLD=(r*.1).toFixed("6"),this.needsUpdate=!0}setPredicationMode(r){this.defines.PREDICATION_MODE=r.toFixed(0),this.needsUpdate=!0}setPredicationBuffer(r){this.uniforms.predicationBuffer.value=r}setPredicationThreshold(r){this.defines.PREDICATION_THRESHOLD=r.toFixed("6"),this.needsUpdate=!0}setPredicationScale(r){this.defines.PREDICATION_SCALE=r.toFixed("6"),this.needsUpdate=!0}setPredicationStrength(r){this.defines.PREDICATION_STRENGTH=r.toFixed("6"),this.needsUpdate=!0}},Vd={DEPTH:0,LUMA:1,COLOR:2},oM={DISABLED:0,DEPTH:1,CUSTOM:2},E3=`#include <common>
#include <packing>
#include <dithering_pars_fragment>
#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
#ifdef GL_FRAGMENT_PRECISION_HIGH
uniform highp sampler2D depthBuffer;
#else
uniform mediump sampler2D depthBuffer;
#endif
uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;float readDepth(const in vec2 uv){
#if DEPTH_PACKING == 3201
return unpackRGBAToDepth(texture2D(depthBuffer,uv));
#else
return texture2D(depthBuffer,uv).r;
#endif
}float getViewZ(const in float depth){
#ifdef PERSPECTIVE_CAMERA
return perspectiveDepthToViewZ(depth,cameraNear,cameraFar);
#else
return orthographicDepthToViewZ(depth,cameraNear,cameraFar);
#endif
}FRAGMENT_HEADvoid main(){FRAGMENT_MAIN_UVvec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGEgl_FragColor=color0;
#ifdef ENCODE_OUTPUT
#include <encodings_fragment>
#endif
#include <dithering_fragment>
}`,N3="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEADvoid main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORTgl_Position=vec4(position.xy,1.0,1.0);}",C3=class extends _t{constructor(r=null,e=null,t=null,n,i=!1){super({type:"EffectMaterial",defines:{DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new Ae(null),depthBuffer:new Ae(null),resolution:new Ae(new O),texelSize:new Ae(new O),cameraNear:new Ae(.3),cameraFar:new Ae(1e3),aspect:new Ae(1),time:new Ae(0)},blending:It,depthWrite:!1,depthTest:!1,dithering:i});this.toneMapped=!1,r!==null&&this.setShaderParts(r),e!==null&&this.setDefines(e),t!==null&&this.setUniforms(t),this.adoptCameraSettings(n)}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(r){this.defines.DEPTH_PACKING=r.toFixed(0),this.needsUpdate=!0}setShaderParts(r){return this.fragmentShader=E3.replace(pt.FRAGMENT_HEAD,r.get(pt.FRAGMENT_HEAD)).replace(pt.FRAGMENT_MAIN_UV,r.get(pt.FRAGMENT_MAIN_UV)).replace(pt.FRAGMENT_MAIN_IMAGE,r.get(pt.FRAGMENT_MAIN_IMAGE)),this.vertexShader=N3.replace(pt.VERTEX_HEAD,r.get(pt.VERTEX_HEAD)).replace(pt.VERTEX_MAIN_SUPPORT,r.get(pt.VERTEX_MAIN_SUPPORT)),this.needsUpdate=!0,this}setDefines(r){for(let e of r.entries())this.defines[e[0]]=e[1];return this.needsUpdate=!0,this}setUniforms(r){for(let e of r.entries())this.uniforms[e[0]]=e[1];return this}adoptCameraSettings(r=null){r!==null&&(this.uniforms.cameraNear.value=r.near,this.uniforms.cameraFar.value=r.far,r instanceof Vt?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(r,e){let t=Math.max(r,1),n=Math.max(e,1);this.uniforms.resolution.value.set(t,n),this.uniforms.texelSize.value.set(1/t,1/n),this.uniforms.aspect.value=t/n}},pt={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"};var L3=`#include <common>
#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
#ifdef RANGE
uniform vec2 range;
#elif defined(THRESHOLD)
uniform float threshold;uniform float smoothing;
#endif
varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=linearToRelativeLuminance(texel.rgb);
#ifdef RANGE
float low=step(range.x,l);float high=step(l,range.y);l*=low*high;
#elif defined(THRESHOLD)
l=smoothstep(threshold,threshold+smoothing,l);
#endif
#ifdef COLOR
gl_FragColor=vec4(texel.rgb*l,l);
#else
gl_FragColor=vec4(l);
#endif
}`,I3=class extends _t{constructor(r=!1,e=null){let t=e!==null;super({type:"LuminanceMaterial",uniforms:{inputBuffer:new Ae(null),threshold:new Ae(0),smoothing:new Ae(1),range:new Ae(t?e:new O)},fragmentShader:L3,vertexShader:iu,blending:It,depthWrite:!1,depthTest:!1});this.toneMapped=!1,this.colorOutput=r,this.useThreshold=!0,this.useRange=t}get threshold(){return this.uniforms.threshold.value}set threshold(r){this.uniforms.threshold.value=r}get smoothing(){return this.uniforms.smoothing.value}set smoothing(r){this.uniforms.smoothing.value=r}get useThreshold(){return this.defines.THRESHOLD!==void 0}set useThreshold(r){r?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.needsUpdate=!0}get colorOutput(){return this.defines.COLOR!==void 0}set colorOutput(r){r?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}setColorOutputEnabled(r){this.colorOutput=r}get useRange(){return this.defines.RANGE!==void 0}set useRange(r){r?this.defines.RANGE="1":delete this.defines.RANGE,this.needsUpdate=!0}get luminanceRange(){return this.useRange}set luminanceRange(r){this.useRange=r}setLuminanceRangeEnabled(r){this.useRange=r}},P3=`#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
#ifdef MASK_PRECISION_HIGH
uniform mediump sampler2D maskTexture;
#else
uniform lowp sampler2D maskTexture;
#endif
#if MASK_FUNCTION != 0
uniform float strength;
#endif
varying vec2 vUv;void main(){
#if COLOR_CHANNEL == 0
float mask=texture2D(maskTexture,vUv).r;
#elif COLOR_CHANNEL == 1
float mask=texture2D(maskTexture,vUv).g;
#elif COLOR_CHANNEL == 2
float mask=texture2D(maskTexture,vUv).b;
#else
float mask=texture2D(maskTexture,vUv).a;
#endif
#if MASK_FUNCTION == 0
#ifdef INVERTED
mask=step(mask,0.0);
#else
mask=1.0-step(mask,0.0);
#endif
#else
mask=clamp(mask*strength,0.0,1.0);
#ifdef INVERTED
mask=1.0-mask;
#endif
#endif
#if MASK_FUNCTION == 2
gl_FragColor=vec4(mask*texture2D(inputBuffer,vUv).rgb,mask);
#else
gl_FragColor=mask*texture2D(inputBuffer,vUv);
#endif
}`,D3=class extends _t{constructor(r=null){super({type:"MaskMaterial",uniforms:{maskTexture:new Ae(r),inputBuffer:new Ae(null),strength:new Ae(1)},fragmentShader:P3,vertexShader:iu,blending:It,depthWrite:!1,depthTest:!1});this.toneMapped=!1,this.colorChannel=iM.RED,this.maskFunction=aM.DISCARD}set maskTexture(r){this.uniforms.maskTexture.value=r,delete this.defines.MASK_PRECISION_HIGH,r.type!==At&&(this.defines.MASK_PRECISION_HIGH="1"),this.needsUpdate=!0}set colorChannel(r){this.defines.COLOR_CHANNEL=r.toFixed(0),this.needsUpdate=!0}set maskFunction(r){this.defines.MASK_FUNCTION=r.toFixed(0),this.needsUpdate=!0}get inverted(){return this.defines.INVERTED!==void 0}set inverted(r){this.inverted&&!r?delete this.defines.INVERTED:r&&(this.defines.INVERTED="1"),this.needsUpdate=!0}get strength(){return this.uniforms.strength.value}set strength(r){this.uniforms.strength.value=r}},aM={DISCARD:0,MULTIPLY:1,MULTIPLY_RGB_SET_ALPHA:2};var R3=`#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + offset * texelSize)
#if __VERSION__ < 300
#define round(v) floor(v + 0.5)
#endif
#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
uniform lowp sampler2D areaTexture;uniform lowp sampler2D searchTexture;uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}vec2 decodeDiagBilinearAccess(in vec2 e){e.r=e.r*abs(5.0*e.r-5.0*0.75);return round(e);}vec4 decodeDiagBilinearAccess(in vec4 e){e.rb=e.rb*abs(5.0*e.rb-5.0*0.75);return round(e);}vec2 searchDiag1(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);vec3 t=vec3(texelSize,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(coord.z<float(MAX_SEARCH_STEPS_DIAG_INT-1)&&coord.w>0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 searchDiag2(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);coord.x+=0.25*texelSize.x;vec3 t=vec3(texelSize,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(coord.z<float(MAX_SEARCH_STEPS_DIAG_INT-1)&&coord.w>0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;e=decodeDiagBilinearAccess(e);coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 areaDiag(const in vec2 dist,const in vec2 e,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE_DIAG,AREATEX_MAX_DISTANCE_DIAG)*e+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.x+=0.5;texCoord.y+=AREATEX_SUBTEX_SIZE*offset;return texture2D(areaTexture,texCoord).rg;}vec2 calculateDiagWeights(const in vec2 texCoord,const in vec2 e,const in vec4 subsampleIndices){vec2 weights=vec2(0.0);vec4 d;vec2 end;if(e.r>0.0){d.xz=searchDiag1(texCoord,vec2(-1.0,1.0),end);d.x+=float(end.y>0.9);}else{d.xz=vec2(0.0);}d.yw=searchDiag1(texCoord,vec2(1.0,-1.0),end);if(d.x+d.y>2.0){vec4 coords=vec4(-d.x+0.25,d.x,d.y,-d.y-0.25)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.xy=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).rg;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).rg;c.yxwz=decodeDiagBilinearAccess(c.xyzw);vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.z);}d.xz=searchDiag2(texCoord,vec2(-1.0,-1.0),end);if(sampleLevelZeroOffset(inputBuffer,texCoord,vec2(1,0)).r>0.0){d.yw=searchDiag2(texCoord,vec2(1.0),end);d.y+=float(end.y>0.9);}else{d.yw=vec2(0.0);}if(d.x+d.y>2.0){vec4 coords=vec4(-d.x,-d.x,d.y,d.y)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.x=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).g;c.y=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(0,-1)).r;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).gr;vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.w).gr;}return weights;}float searchLength(const in vec2 e,const in float offset){vec2 scale=SEARCHTEX_SIZE*vec2(0.5,-1.0);vec2 bias=SEARCHTEX_SIZE*vec2(offset,1.0);scale+=vec2(-1.0,1.0);bias+=vec2(0.5,-0.5);scale*=1.0/SEARCHTEX_PACKED_SIZE;bias*=1.0/SEARCHTEX_PACKED_SIZE;return texture2D(searchTexture,scale*e+bias).r;}float searchXLeft(in vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.x>end&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(-2.0,0.0)*texelSize+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.0)+3.25;return texelSize.x*offset+texCoord.x;}float searchXRight(vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.x<end&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(2.0,0.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.5)+3.25;return-texelSize.x*offset+texCoord.x;}float searchYUp(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.y>end&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=-vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.0)+3.25;return texelSize.y*offset+texCoord.y;}float searchYDown(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;i++){if(!(texCoord.y<end&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.5)+3.25;return-texelSize.y*offset+texCoord.y;}vec2 area(const in vec2 dist,const in float e1,const in float e2,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE)*round(4.0*vec2(e1,e2))+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.y=AREATEX_SUBTEX_SIZE*offset+texCoord.y;return texture2D(areaTexture,texCoord).rg;}void detectHorizontalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){
#if !defined(DISABLE_CORNER_DETECTION)
vec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,1)).r;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).r;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,-2)).r;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,-2)).r;weights*=clamp(factor,0.0,1.0);
#endif
}void detectVerticalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){
#if !defined(DISABLE_CORNER_DETECTION)
vec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(1,0)).g;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).g;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(-2,0)).g;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(-2,1)).g;weights*=clamp(factor,0.0,1.0);
#endif
}void main(){vec4 weights=vec4(0.0);vec4 subsampleIndices=vec4(0.0);vec2 e=texture2D(inputBuffer,vUv).rg;if(e.g>0.0){
#if !defined(DISABLE_DIAG_DETECTION)
weights.rg=calculateDiagWeights(vUv,e,subsampleIndices);if(weights.r==-weights.g){
#endif
vec2 d;vec3 coords;coords.x=searchXLeft(vOffset[0].xy,vOffset[2].x);coords.y=vOffset[1].y;d.x=coords.x;float e1=texture2D(inputBuffer,coords.xy).r;coords.z=searchXRight(vOffset[0].zw,vOffset[2].y);d.y=coords.z;d=round(resolution.xx*d+-vPixCoord.xx);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.zy,vec2(1,0)).r;weights.rg=area(sqrtD,e1,e2,subsampleIndices.y);coords.y=vUv.y;detectHorizontalCornerPattern(weights.rg,coords.xyzy,d);
#if !defined(DISABLE_DIAG_DETECTION)
}else{e.r=0.0;}
#endif
}if(e.r>0.0){vec2 d;vec3 coords;coords.y=searchYUp(vOffset[1].xy,vOffset[2].z);coords.x=vOffset[0].x;d.x=coords.y;float e1=texture2D(inputBuffer,coords.xy).g;coords.z=searchYDown(vOffset[1].zw,vOffset[2].w);d.y=coords.z;d=round(resolution.yy*d-vPixCoord.yy);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.xz,vec2(0,1)).g;weights.ba=area(sqrtD,e1,e2,subsampleIndices.x);coords.x=vUv.x;detectVerticalCornerPattern(weights.ba,coords.xyxz,d);}gl_FragColor=weights;}`,B3="uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void main(){vUv=position.xy*0.5+0.5;vPixCoord=vUv*resolution;vOffset[0]=vUv.xyxy+texelSize.xyxy*vec4(-0.25,-0.125,1.25,-0.125);vOffset[1]=vUv.xyxy+texelSize.xyxy*vec4(-0.125,-0.25,-0.125,1.25);vOffset[2]=vec4(vOffset[0].xz,vOffset[1].yw)+vec4(-2.0,2.0,-2.0,2.0)*texelSize.xxyy*MAX_SEARCH_STEPS_FLOAT;gl_Position=vec4(position.xy,1.0,1.0);}",O3=class extends _t{constructor(r=new O,e=new O){super({type:"SMAAWeightsMaterial",defines:{MAX_SEARCH_STEPS_INT:"16",MAX_SEARCH_STEPS_FLOAT:"16.0",MAX_SEARCH_STEPS_DIAG_INT:"8",MAX_SEARCH_STEPS_DIAG_FLOAT:"8.0",CORNER_ROUNDING:"25",CORNER_ROUNDING_NORM:"0.25",AREATEX_MAX_DISTANCE:"16.0",AREATEX_MAX_DISTANCE_DIAG:"20.0",AREATEX_PIXEL_SIZE:"(1.0 / vec2(160.0, 560.0))",AREATEX_SUBTEX_SIZE:"(1.0 / 7.0)",SEARCHTEX_SIZE:"vec2(66.0, 33.0)",SEARCHTEX_PACKED_SIZE:"vec2(64.0, 16.0)"},uniforms:{inputBuffer:new Ae(null),areaTexture:new Ae(null),searchTexture:new Ae(null),texelSize:new Ae(r),resolution:new Ae(e)},fragmentShader:R3,vertexShader:B3,blending:It,depthWrite:!1,depthTest:!1});this.toneMapped=!1}setOrthogonalSearchSteps(r){let e=Math.min(Math.max(r,0),112);this.defines.MAX_SEARCH_STEPS_INT=e.toFixed("0"),this.defines.MAX_SEARCH_STEPS_FLOAT=e.toFixed("1"),this.needsUpdate=!0}setDiagonalSearchSteps(r){let e=Math.min(Math.max(r,0),20);this.defines.MAX_SEARCH_STEPS_DIAG_INT=e.toFixed("0"),this.defines.MAX_SEARCH_STEPS_DIAG_FLOAT=e.toFixed("1"),this.needsUpdate=!0}setCornerRounding(r){let e=Math.min(Math.max(r,0),100);this.defines.CORNER_ROUNDING=e.toFixed("4"),this.defines.CORNER_ROUNDING_NORM=(e/100).toFixed("4"),this.needsUpdate=!0}get diagonalDetection(){return this.defines.DISABLE_DIAG_DETECTION===void 0}set diagonalDetection(r){r?delete this.defines.DISABLE_DIAG_DETECTION:this.defines.DISABLE_DIAG_DETECTION="1",this.needsUpdate=!0}get cornerRounding(){return this.defines.DISABLE_CORNER_DETECTION===void 0}set cornerRounding(r){r?delete this.defines.DISABLE_CORNER_DETECTION:this.defines.DISABLE_CORNER_DETECTION="1",this.needsUpdate=!0}};var F3=new Dr,Fs=null;function z3(){if(Fs===null){let r=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),e=new Float32Array([0,0,2,0,0,2]);Fs=new we,Fs.setAttribute!==void 0?(Fs.setAttribute("position",new Re(r,3)),Fs.setAttribute("uv",new Re(e,2))):(Fs.addAttribute("position",new Re(r,3)),Fs.addAttribute("uv",new Re(e,2)))}return Fs}var Wr=class{constructor(r="Pass",e=new An,t=F3){this.name=r,this.scene=e,this.camera=t,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(r){if(this.rtt===r){let e=this.getFullscreenMaterial();e!==null&&(e.needsUpdate=!0),this.rtt=!r}}getFullscreenMaterial(){return this.screen!==null?this.screen.material:null}setFullscreenMaterial(r){let e=this.screen;e!==null?e.material=r:(e=new gt(z3(),r),e.frustumCulled=!1,this.scene===null&&(this.scene=new An),this.scene.add(e),this.screen=e)}getDepthTexture(){return null}setDepthTexture(r,e=0){}render(r,e,t,n,i){throw new Error("Render method not implemented!")}setSize(r,e){}initialize(r,e,t){}dispose(){let r=this.getFullscreenMaterial();r!==null&&r.dispose();for(let e of Object.keys(this)){let t=this[e];if(t!==null&&typeof t.dispose=="function"){if(t instanceof An)continue;this[e].dispose()}}}},lM=class extends Wr{constructor(r,e=!0){super("SavePass");this.setFullscreenMaterial(new sM),this.needsSwap=!1,this.renderTarget=r,r===void 0&&(this.renderTarget=new bt(1,1,{minFilter:$e,magFilter:$e,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="SavePass.Target"),this.resize=e}get texture(){return this.renderTarget.texture}render(r,e,t,n,i){this.getFullscreenMaterial().uniforms.inputBuffer.value=e.texture,r.setRenderTarget(this.renderToScreen?null:this.renderTarget),r.render(this.scene,this.camera)}setSize(r,e){if(this.resize){let t=Math.max(r,1),n=Math.max(e,1);this.renderTarget.setSize(t,n)}}initialize(r,e,t){if(!e&&t===At&&(this.renderTarget.texture.format=Nt),t!==void 0&&(this.renderTarget.texture.type=t,t!==At)){let n=this.getFullscreenMaterial();n.defines.FRAMEBUFFER_PRECISION_HIGH="1"}}};var Jr=-1,nr=class{constructor(r,e=Jr,t=Jr,n=1){this.resizable=r,this.base=new O(1,1),this.target=new O(e,t),this.s=n}get scale(){return this.s}set scale(r){this.s=r,this.target.x=Jr,this.target.y=Jr,this.resizable.setSize(this.base.x,this.base.y)}get width(){let r=this.base,e=this.target,t;return e.x!==Jr?t=e.x:e.y!==Jr?t=Math.round(e.y*(r.x/r.y)):t=Math.round(r.x*this.s),t}set width(r){this.target.x=r,this.resizable.setSize(this.base.x,this.base.y)}get height(){let r=this.base,e=this.target,t;return e.y!==Jr?t=e.y:e.x!==Jr?t=Math.round(e.x/(r.x/r.y)):t=Math.round(r.y*this.s),t}set height(r){this.target.y=r,this.resizable.setSize(this.base.x,this.base.y)}static get AUTO_SIZE(){return Jr}},cM=class extends Wr{constructor({resolutionScale:r=.5,width:e=nr.AUTO_SIZE,height:t=nr.AUTO_SIZE,kernelSize:n=kd.LARGE}={}){super("BlurPass");this.renderTargetA=new bt(1,1,{minFilter:$e,magFilter:$e,stencilBuffer:!1,depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B",this.resolution=new nr(this,e,t,r),this.convolutionMaterial=new rM,this.ditheredConvolutionMaterial=new rM,this.ditheredConvolutionMaterial.dithering=!0,this.dithering=!1,this.kernelSize=n}get width(){return this.resolution.width}set width(r){this.resolution.width=r}get height(){return this.resolution.height}set height(r){this.resolution.height=r}get scale(){return this.convolutionMaterial.uniforms.scale.value}set scale(r){this.convolutionMaterial.uniforms.scale.value=r,this.ditheredConvolutionMaterial.uniforms.scale.value=r}get kernelSize(){return this.convolutionMaterial.kernelSize}set kernelSize(r){this.convolutionMaterial.kernelSize=r,this.ditheredConvolutionMaterial.kernelSize=r}getResolutionScale(){return this.resolution.scale}setResolutionScale(r){this.resolution.scale=r}render(r,e,t,n,i){let s=this.scene,o=this.camera,a=this.renderTargetA,l=this.renderTargetB,c=this.convolutionMaterial,u=c.uniforms,h=c.getKernel(),d=e,f,p,m;for(this.setFullscreenMaterial(c),p=0,m=h.length-1;p<m;++p)f=(p&1)==0?a:l,u.kernel.value=h[p],u.inputBuffer.value=d.texture,r.setRenderTarget(f),r.render(s,o),d=f;this.dithering&&(c=this.ditheredConvolutionMaterial,u=c.uniforms,this.setFullscreenMaterial(c)),u.kernel.value=h[p],u.inputBuffer.value=d.texture,r.setRenderTarget(this.renderToScreen?null:t),r.render(s,o)}setSize(r,e){let t=this.resolution;t.base.set(r,e);let n=t.width,i=t.height;this.renderTargetA.setSize(n,i),this.renderTargetB.setSize(n,i),this.convolutionMaterial.setTexelSize(1/n,1/i),this.ditheredConvolutionMaterial.setTexelSize(1/n,1/i)}initialize(r,e,t){if(!e&&t===At&&(this.renderTargetA.texture.format=Nt,this.renderTargetB.texture.format=Nt),t!==void 0&&(this.renderTargetA.texture.type=t,this.renderTargetB.texture.type=t,t!==At)){let n=this.convolutionMaterial,i=this.ditheredConvolutionMaterial;n.defines.FRAMEBUFFER_PRECISION_HIGH="1",i.defines.FRAMEBUFFER_PRECISION_HIGH="1"}}static get AUTO_SIZE(){return nr.AUTO_SIZE}},G3=class extends Wr{constructor(){super("ClearMaskPass",null,null);this.needsSwap=!1}render(r,e,t,n,i){let s=r.state.buffers.stencil;s.setLocked(!1),s.setTest(!1)}},ng=new fe,ig=class extends Wr{constructor(r=!0,e=!0,t=!1){super("ClearPass",null,null);this.needsSwap=!1,this.color=r,this.depth=e,this.stencil=t,this.overrideClearColor=null,this.overrideClearAlpha=-1}render(r,e,t,n,i){let s=this.overrideClearColor,o=this.overrideClearAlpha,a=r.getClearAlpha(),l=s!==null,c=o>=0;l?(ng.copy(r.getClearColor(ng)),r.setClearColor(s,c?o:a)):c&&r.setClearAlpha(o),r.setRenderTarget(this.renderToScreen?null:e),r.clear(this.color,this.depth,this.stencil),l?r.setClearColor(ng,a):c&&r.setClearAlpha(a)}},rg=!1,uM=class{constructor(r=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(r),this.meshCount=0,this.replaceMaterial=e=>{if(e.isMesh){let t;if(e.material.flatShading)switch(e.material.side){case Xt:t=this.materialsFlatShadedDoubleSide;break;case kt:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded;break}else switch(e.material.side){case Xt:t=this.materialsDoubleSide;break;case kt:t=this.materialsBackSide;break;default:t=this.materials;break}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=t[2]:e.isInstancedMesh?e.material=t[1]:e.material=t[0],++this.meshCount}}}setMaterial(r){if(this.disposeMaterials(),this.material=r,r!==null){let e=this.materials=[r.clone(),r.clone(),r.clone()];for(let t of e)t.uniforms=Object.assign({},r.uniforms),t.side=Oi;e[2].skinning=!0,this.materialsBackSide=e.map(t=>{let n=t.clone();return n.uniforms=Object.assign({},r.uniforms),n.side=kt,n}),this.materialsDoubleSide=e.map(t=>{let n=t.clone();return n.uniforms=Object.assign({},r.uniforms),n.side=Xt,n}),this.materialsFlatShaded=e.map(t=>{let n=t.clone();return n.uniforms=Object.assign({},r.uniforms),n.flatShading=!0,n}),this.materialsFlatShadedBackSide=e.map(t=>{let n=t.clone();return n.uniforms=Object.assign({},r.uniforms),n.flatShading=!0,n.side=kt,n}),this.materialsFlatShadedDoubleSide=e.map(t=>{let n=t.clone();return n.uniforms=Object.assign({},r.uniforms),n.flatShading=!0,n.side=Xt,n})}}render(r,e,t){let n=r.shadowMap.enabled;if(r.shadowMap.enabled=!1,rg){let i=this.originalMaterials;this.meshCount=0,e.traverse(this.replaceMaterial),r.render(e,t);for(let s of i)s[0].material=s[1];this.meshCount!==i.size&&i.clear()}else{let i=e.overrideMaterial;e.overrideMaterial=this.material,r.render(e,t),e.overrideMaterial=i}r.shadowMap.enabled=n}disposeMaterials(){if(this.material!==null){let r=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(let e of r)e.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return rg}static set workaroundEnabled(r){rg=r}},sg=class extends Wr{constructor(r,e,t=null){super("RenderPass",r,e);this.needsSwap=!1,this.clearPass=new ig,this.overrideMaterialManager=t===null?null:new uM(t)}get renderToScreen(){return super.renderToScreen}set renderToScreen(r){super.renderToScreen=r,this.clearPass.renderToScreen=r}get overrideMaterial(){let r=this.overrideMaterialManager;return r!==null?r.material:null}set overrideMaterial(r){let e=this.overrideMaterialManager;r!==null?e!==null?e.setMaterial(r):this.overrideMaterialManager=new uM(r):e!==null&&(e.dispose(),this.overrideMaterialManager=null)}get clear(){return this.clearPass.enabled}set clear(r){this.clearPass.enabled=r}getClearPass(){return this.clearPass}render(r,e,t,n,i){let s=this.scene,o=this.camera,a=s.background,l=this.renderToScreen?null:e;this.clear&&(this.clearPass.overrideClearColor!==null&&(s.background=null),this.clearPass.render(r,e)),r.setRenderTarget(l),this.overrideMaterialManager!==null?this.overrideMaterialManager.render(r,s,o):r.render(s,o),s.background!==a&&(s.background=a)}};var w$=new Float32Array([255/256/256**3,255/256/256**2,255/256/256,255/256]);var ut={SKIP:0,ADD:1,ALPHA:2,AVERAGE:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,EXCLUSION:8,LIGHTEN:9,MULTIPLY:10,DIVIDE:11,NEGATION:12,NORMAL:13,OVERLAY:14,REFLECT:15,SCREEN:16,SOFT_LIGHT:17,SUBTRACT:18},U3="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x+y,1.0)*opacity+x*(1.0-opacity);}",k3="vec3 blend(const in vec3 x,const in vec3 y,const in float opacity){return y*opacity+x*(1.0-opacity);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){float a=min(y.a,opacity);return vec4(blend(x.rgb,y.rgb,a),max(x.a,a));}",V3="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y)*0.5*opacity+x*(1.0-opacity);}",H3="float blend(const in float x,const in float y){return(y==0.0)? y : max(1.0-(1.0-x)/y,0.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",j3="float blend(const in float x,const in float y){return(y==1.0)? y : min(x/(1.0-y),1.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",W3="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x,y)*opacity+x*(1.0-opacity);}",J3="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return abs(x-y)*opacity+x*(1.0-opacity);}",X3="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y-2.0*x*y)*opacity+x*(1.0-opacity);}",q3="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x,y)*opacity+x*(1.0-opacity);}",Y3="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return x*y*opacity+x*(1.0-opacity);}",K3="float blend(const in float x,const in float y){return(y>0.0)? min(x/y,1.0): 1.0;}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",Q3="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(1.0-abs(1.0-x-y))*opacity+x*(1.0-opacity);}",Z3="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y*opacity+x*(1.0-opacity);}",$3="float blend(const in float x,const in float y){return(x<0.5)?(2.0*x*y):(1.0-2.0*(1.0-x)*(1.0-y));}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",eF="float blend(const in float x,const in float y){return(y==1.0)? y : min(x*x/(1.0-y),1.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",tF="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(1.0-(1.0-x)*(1.0-y))*opacity+x*(1.0-opacity);}",nF="float blend(const in float x,const in float y){return(y<0.5)?(2.0*x*y+x*x*(1.0-2.0*y)):(sqrt(x)*(2.0*y-1.0)+2.0*x*(1.0-y));}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",iF="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x+y-1.0,0.0)*opacity+x*(1.0-opacity);}",rF=new Map([[ut.SKIP,null],[ut.ADD,U3],[ut.ALPHA,k3],[ut.AVERAGE,V3],[ut.COLOR_BURN,H3],[ut.COLOR_DODGE,j3],[ut.DARKEN,W3],[ut.DIFFERENCE,J3],[ut.EXCLUSION,X3],[ut.LIGHTEN,q3],[ut.MULTIPLY,Y3],[ut.DIVIDE,K3],[ut.NEGATION,Q3],[ut.NORMAL,Z3],[ut.OVERLAY,$3],[ut.REFLECT,eF],[ut.SCREEN,tF],[ut.SOFT_LIGHT,nF],[ut.SUBTRACT,iF]]),sF=class extends cn{constructor(r,e=1){super();this.blendFunction=r,this.opacity=new Ae(e)}getBlendFunction(){return this.blendFunction}setBlendFunction(r){this.blendFunction=r,this.dispatchEvent({type:"change"})}getShaderCode(){return rF.get(this.blendFunction)}},Mr=class extends cn{constructor(r,e,{attributes:t=ir.NONE,blendFunction:n=ut.SCREEN,defines:i=new Map,uniforms:s=new Map,extensions:o=null,vertexShader:a=null}={}){super();this.name=r,this.attributes=t,this.fragmentShader=e,this.vertexShader=a,this.defines=i,this.uniforms=s,this.extensions=o,this.blendMode=new sF(n),this.blendMode.addEventListener("change",l=>this.setChanged())}setChanged(){this.dispatchEvent({type:"change"})}getAttributes(){return this.attributes}setAttributes(r){this.attributes=r,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(r){this.fragmentShader=r,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(r){this.vertexShader=r,this.setChanged()}setDepthTexture(r,e=0){}update(r,e,t){}setSize(r,e){}initialize(r,e,t){}dispose(){for(let r of Object.keys(this)){let e=this[r];if(e!==null&&typeof e.dispose=="function"){if(e instanceof An)continue;this[r].dispose()}}}},ir={NONE:0,DEPTH:1,CONVOLUTION:2};function og(r,e){let t=[],n;for(;(n=r.exec(e))!==null;)t.push(n[1]);return t}function hM(r,e,t){let n,i;for(let s of e){n="$1"+r+s.charAt(0).toUpperCase()+s.slice(1),i=new RegExp("([^\\.])(\\b"+s+"\\b)","g");for(let o of t.entries())o[1]!==null&&t.set(o[0],o[1].replace(i,n))}}function oF(r,e,t,n,i,s,o){let a=/(?:\w+\s+(\w+)\([\w\s,]*\)\s*{[^}]+})/g,l=/(?:varying\s+\w+\s+(\w*))/g,c=e.blendMode,u=new Map([["fragment",e.getFragmentShader()],["vertex",e.getVertexShader()]]),h=u.get("fragment")!==void 0&&/mainImage/.test(u.get("fragment")),d=u.get("fragment")!==void 0&&/mainUv/.test(u.get("fragment")),f=[],p=[],m=!1,v=!1;if(u.get("fragment")===void 0)console.error("Missing fragment shader",e);else if(d&&(o&ir.CONVOLUTION)!=0)console.error("Effects that transform UV coordinates are incompatible with convolution effects",e);else if(!h&&!d)console.error("The fragment shader contains neither a mainImage nor a mainUv function",e);else{if(d&&(t.set(pt.FRAGMENT_MAIN_UV,t.get(pt.FRAGMENT_MAIN_UV)+" "+r+`MainUv(UV);
`),m=!0),u.get("vertex")!==null&&/mainSupport/.test(u.get("vertex"))){let g=" "+r+"MainSupport(";/mainSupport *\([\w\s]*?uv\s*?\)/.test(u.get("vertex"))&&(g+="vUv"),g+=`);
`,t.set(pt.VERTEX_MAIN_SUPPORT,t.get(pt.VERTEX_MAIN_SUPPORT)+g),f=f.concat(og(l,u.get("vertex"))),p=p.concat(f).concat(og(a,u.get("vertex")))}if(p=p.concat(og(a,u.get("fragment"))).concat(Array.from(e.defines.keys()).map(g=>g.replace(/\([\w\s,]*\)/g,""))).concat(Array.from(e.uniforms.keys())),e.uniforms.forEach((g,y)=>s.set(r+y.charAt(0).toUpperCase()+y.slice(1),g)),e.defines.forEach((g,y)=>i.set(r+y.charAt(0).toUpperCase()+y.slice(1),g)),hM(r,p,i),hM(r,p,u),n.set(c.blendFunction,c),h){let g=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/,y=r+"MainImage(color0, UV, ";(o&ir.DEPTH)!=0&&g.test(u.get("fragment"))&&(y+="depth, ",v=!0),y+=`color1);
`;let x=r+"BlendOpacity";s.set(x,c.opacity),y+="color0 = blend"+c.getBlendFunction()+"(color0, color1, "+x+`);
`,t.set(pt.FRAGMENT_MAIN_IMAGE,t.get(pt.FRAGMENT_MAIN_IMAGE)+y),t.set(pt.FRAGMENT_HEAD,t.get(pt.FRAGMENT_HEAD)+"uniform float "+x+`;
`)}t.set(pt.FRAGMENT_HEAD,t.get(pt.FRAGMENT_HEAD)+u.get("fragment")+`
`),u.get("vertex")!==null&&t.set(pt.VERTEX_HEAD,t.get(pt.VERTEX_HEAD)+u.get("vertex")+`
`)}return{varyings:f,transformedUv:m,readDepth:v}}var Hd=class extends Wr{constructor(r,...e){super("EffectPass");this.setFullscreenMaterial(new C3(null,null,null,r)),this.effects=e.sort((t,n)=>n.attributes-t.attributes),this.skipRendering=!1,this.uniforms=0,this.varyings=0,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY}get encodeOutput(){return this.getFullscreenMaterial().defines.ENCODE_OUTPUT!==void 0}set encodeOutput(r){if(this.encodeOutput!==r){let e=this.getFullscreenMaterial();e.needsUpdate=!0,r?e.defines.ENCODE_OUTPUT="1":delete e.defines.ENCODE_OUTPUT}}get dithering(){return this.getFullscreenMaterial().dithering}set dithering(r){let e=this.getFullscreenMaterial();e.dithering!==r&&(e.dithering=r,e.needsUpdate=!0)}verifyResources(r){let e=r.capabilities,t=Math.min(e.maxFragmentUniforms,e.maxVertexUniforms);this.uniforms>t&&console.warn("The current rendering context doesn't support more than "+t+" uniforms, but "+this.uniforms+" were defined"),t=e.maxVaryings,this.varyings>t&&console.warn("The current rendering context doesn't support more than "+t+" varyings, but "+this.varyings+" were defined")}updateMaterial(){let r=/\bblend\b/g,e=new Map([[pt.FRAGMENT_HEAD,""],[pt.FRAGMENT_MAIN_UV,""],[pt.FRAGMENT_MAIN_IMAGE,""],[pt.VERTEX_HEAD,""],[pt.VERTEX_MAIN_SUPPORT,""]]),t=new Map,n=new Map,i=new Map,s=new Set,o=0,a=0,l=0,c=!1,u=!1,h;for(let f of this.effects)if(f.blendMode.getBlendFunction()===ut.SKIP)l|=f.getAttributes()&ir.DEPTH;else if((l&ir.CONVOLUTION)!=0&&(f.getAttributes()&ir.CONVOLUTION)!=0)console.error("Convolution effects cannot be merged",f);else if(l|=f.getAttributes(),h=oF("e"+o++,f,e,t,n,i,l),a+=h.varyings.length,c=c||h.transformedUv,u=u||h.readDepth,f.extensions!==null)for(let p of f.extensions)s.add(p);for(let f of t.values())e.set(pt.FRAGMENT_HEAD,e.get(pt.FRAGMENT_HEAD)+f.getShaderCode().replace(r,"blend"+f.getBlendFunction())+`
`);(l&ir.DEPTH)!=0?(u&&e.set(pt.FRAGMENT_MAIN_IMAGE,`float depth = readDepth(UV);
`+e.get(pt.FRAGMENT_MAIN_IMAGE)),this.needsDepthTexture=this.getDepthTexture()===null):this.needsDepthTexture=!1,c?(e.set(pt.FRAGMENT_MAIN_UV,`vec2 transformedUv = vUv;
`+e.get(pt.FRAGMENT_MAIN_UV)),n.set("UV","transformedUv")):n.set("UV","vUv"),e.forEach((f,p,m)=>m.set(p,f.trim().replace(/^#/,`
#`))),this.uniforms=i.size,this.varyings=a,this.skipRendering=o===0,this.needsSwap=!this.skipRendering;let d=this.getFullscreenMaterial();if(d.setShaderParts(e).setDefines(n).setUniforms(i),d.extensions={},s.size>0)for(let f of s)d.extensions[f]=!0;this.needsUpdate=!1}recompile(r){this.updateMaterial(),r!==void 0&&this.verifyResources(r)}getDepthTexture(){return this.getFullscreenMaterial().uniforms.depthBuffer.value}setDepthTexture(r,e=Kr){let t=this.getFullscreenMaterial();t.uniforms.depthBuffer.value=r,t.depthPacking=e,t.needsUpdate=!0;for(let n of this.effects)n.setDepthTexture(r,e)}render(r,e,t,n,i){let s=this.getFullscreenMaterial(),o=s.uniforms.time.value+n;this.needsUpdate&&this.recompile(r);for(let a of this.effects)a.update(r,e,n);(!this.skipRendering||this.renderToScreen)&&(s.uniforms.inputBuffer.value=e.texture,s.uniforms.time.value=o<=this.maxTime?o:this.minTime,r.setRenderTarget(this.renderToScreen?null:t),r.render(this.scene,this.camera))}setSize(r,e){this.getFullscreenMaterial().setSize(r,e);for(let t of this.effects)t.setSize(r,e)}initialize(r,e,t){for(let n of this.effects)n.initialize(r,e,t),n.addEventListener("change",i=>this.handleEvent(i));if(this.updateMaterial(),this.verifyResources(r),t!==void 0&&t!==At){let n=this.getFullscreenMaterial();n.defines.FRAMEBUFFER_PRECISION_HIGH="1"}}dispose(){super.dispose();for(let r of this.effects)r.dispose()}handleEvent(r){switch(r.type){case"change":this.needsUpdate=!0;break}}};var aF=class extends Wr{constructor({width:r=nr.AUTO_SIZE,height:e=nr.AUTO_SIZE,renderTarget:t,luminanceRange:n,colorOutput:i}={}){super("LuminancePass");this.setFullscreenMaterial(new I3(i,n)),this.needsSwap=!1,this.renderTarget=t,this.renderTarget===void 0&&(this.renderTarget=new bt(1,1,{minFilter:$e,magFilter:$e,format:i?zt:Qd,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target",this.renderTarget.texture.generateMipmaps=!1),this.resolution=new nr(this,r,e)}get texture(){return this.renderTarget.texture}render(r,e,t,n,i){let s=this.getFullscreenMaterial();s.uniforms.inputBuffer.value=e.texture,r.setRenderTarget(this.renderToScreen?null:this.renderTarget),r.render(this.scene,this.camera)}setSize(r,e){let t=this.resolution;t.base.set(r,e),this.renderTarget.setSize(t.width,t.height)}initialize(r,e,t){if(t!==void 0&&t!==At){let n=this.getFullscreenMaterial();n.defines.FRAMEBUFFER_PRECISION_HIGH="1"}}},lF=class extends Wr{constructor(r,e){super("MaskPass",r,e);this.needsSwap=!1,this.clearPass=new ig(!1,!1,!0),this.inverse=!1}get clear(){return this.clearPass.enabled}set clear(r){this.clearPass.enabled=r}render(r,e,t,n,i){let s=r.getContext(),o=r.state.buffers,a=this.scene,l=this.camera,c=this.clearPass,u=this.inverse?0:1,h=1-u;o.color.setMask(!1),o.depth.setMask(!1),o.color.setLocked(!0),o.depth.setLocked(!0),o.stencil.setTest(!0),o.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),o.stencil.setFunc(s.ALWAYS,u,4294967295),o.stencil.setClear(h),o.stencil.setLocked(!0),this.clear&&(this.renderToScreen?c.render(r,null):(c.render(r,e),c.render(r,t))),this.renderToScreen?(r.setRenderTarget(null),r.render(a,l)):(r.setRenderTarget(e),r.render(a,l),r.setRenderTarget(t),r.render(a,l)),o.color.setLocked(!1),o.depth.setLocked(!1),o.stencil.setLocked(!1),o.stencil.setFunc(s.EQUAL,1,4294967295),o.stencil.setOp(s.KEEP,s.KEEP,s.KEEP),o.stencil.setLocked(!0)}};var Xr=class extends Wr{constructor(r,e="inputBuffer"){super("ShaderPass");this.setFullscreenMaterial(r),this.uniform=null,this.setInput(e)}setInput(r){let e=this.getFullscreenMaterial();if(this.uniform=null,e!==null){let t=e.uniforms;t!==void 0&&t[r]!==void 0&&(this.uniform=t[r])}}render(r,e,t,n,i){this.uniform!==null&&e!==null&&(this.uniform.value=e.texture),r.setRenderTarget(this.renderToScreen?null:t),r.render(this.scene,this.camera)}initialize(r,e,t){if(t!==void 0&&t!==At){let n=this.getFullscreenMaterial();n.defines.FRAMEBUFFER_PRECISION_HIGH="1"}}},dM=class{constructor(r=null,{depthBuffer:e=!0,stencilBuffer:t=!1,alpha:n=!1,multisampling:i=0,frameBufferType:s}={}){this.renderer=r,this.inputBuffer=null,this.outputBuffer=null,this.renderer!==null&&(this.renderer.autoClear=!1,this.inputBuffer=this.createBuffer(e,t,s,i),this.outputBuffer=this.inputBuffer.clone()),this.copyPass=new Xr(new sM),this.alpha=n,this.depthTexture=null,this.passes=[],this.autoRenderToScreen=!0}get multisampling(){return this.inputBuffer instanceof Zr?this.inputBuffer.samples:0}set multisampling(r){let e=this.inputBuffer,t=this.multisampling;t>0&&r>0?(this.inputBuffer.samples=r,this.outputBuffer.samples=r):t!==r&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(e.depthBuffer,e.stencilBuffer,e.texture.type,r),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getRenderer(){return this.renderer}replaceRenderer(r,e=!0){let t=this.renderer;if(t!==null&&t!==r){let n=t.getSize(new O),i=r.getSize(new O),s=t.domElement.parentNode;this.renderer=r,this.renderer.autoClear=!1,n.equals(i)||this.setSize(),e&&s!==null&&(s.removeChild(t.domElement),s.appendChild(r.domElement))}return t}createDepthTexture(){let r=this.depthTexture=new so;return this.inputBuffer.depthTexture=r,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(r.format=Ks,r.type=Ys):r.type=Wo,r}deleteDepthTexture(){if(this.depthTexture!==null){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(let r of this.passes)r.setDepthTexture(null)}}createBuffer(r,e,t,n){let i=this.renderer,s=i.getContext(),o=i.getDrawingBufferSize(new O),l={format:!(this.alpha||s.getContextAttributes().alpha)&&t===At?Nt:zt,minFilter:$e,magFilter:$e,stencilBuffer:e,depthBuffer:r,type:t},c=n>0?new Zr(o.width,o.height,l):new bt(o.width,o.height,l);return n>0&&(c.samples=n),c.texture.name="EffectComposer.Buffer",c.texture.generateMipmaps=!1,c}addPass(r,e){let t=this.passes,n=this.renderer,i=n.getDrawingBufferSize(new O),s=n.getContext().getContextAttributes().alpha,o=this.inputBuffer.texture.type;if(r.setSize(i.width,i.height),r.initialize(n,s,o),this.autoRenderToScreen&&(t.length>0&&(t[t.length-1].renderToScreen=!1),r.renderToScreen&&(this.autoRenderToScreen=!1)),e!==void 0?t.splice(e,0,r):t.push(r),this.autoRenderToScreen&&(t[t.length-1].renderToScreen=!0),r.needsDepthTexture||this.depthTexture!==null)if(this.depthTexture===null){let a=this.createDepthTexture();for(r of t)r.setDepthTexture(a)}else r.setDepthTexture(this.depthTexture)}removePass(r){let e=this.passes,t=e.indexOf(r);if(t!==-1&&e.splice(t,1).length>0){if(this.depthTexture!==null){let s=(a,l)=>a||l.needsDepthTexture;e.reduce(s,!1)||(r.getDepthTexture()===this.depthTexture&&r.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&t===e.length&&(r.renderToScreen=!1,e.length>0&&(e[e.length-1].renderToScreen=!0))}}removeAllPasses(){let r=this.passes;this.deleteDepthTexture(),r.length>0&&(this.autoRenderToScreen&&(r[r.length-1].renderToScreen=!1),this.passes=[])}render(r){let e=this.renderer,t=this.copyPass,n=this.inputBuffer,i=this.outputBuffer,s=!1,o,a,l;for(let c of this.passes)c.enabled&&(c.render(e,n,i,r,s),c.needsSwap&&(s&&(t.renderToScreen=c.renderToScreen,o=e.getContext(),a=e.state.buffers.stencil,a.setFunc(o.NOTEQUAL,1,4294967295),t.render(e,n,i,r,s),a.setFunc(o.EQUAL,1,4294967295)),l=n,n=i,i=l),c instanceof lF?s=!0:c instanceof G3&&(s=!1))}setSize(r,e,t){let n=this.renderer;if(r===void 0||e===void 0){let s=n.getSize(new O);r=s.width,e=s.height}else n.setSize(r,e,t);let i=n.getDrawingBufferSize(new O);this.inputBuffer.setSize(i.width,i.height),this.outputBuffer.setSize(i.width,i.height);for(let s of this.passes)s.setSize(i.width,i.height)}reset(){this.dispose(),this.autoRenderToScreen=!0}dispose(){for(let r of this.passes)r.dispose();this.passes=[],this.inputBuffer!==null&&this.inputBuffer.dispose(),this.outputBuffer!==null&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose()}};var cF=`#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D map;
#else
uniform lowp sampler2D map;
#endif
uniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=clamp(texture2D(map,uv)*intensity,0.0,1.0);}`,fM=class extends Mr{constructor({blendFunction:r=ut.SCREEN,luminanceThreshold:e=.9,luminanceSmoothing:t=.025,resolutionScale:n=.5,intensity:i=1,width:s=nr.AUTO_SIZE,height:o=nr.AUTO_SIZE,kernelSize:a=kd.LARGE}={}){super("BloomEffect",cF,{blendFunction:r,uniforms:new Map([["map",new Ae(null)],["intensity",new Ae(i)]])});this.renderTarget=new bt(1,1,{minFilter:$e,magFilter:$e,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.renderTarget.texture.generateMipmaps=!1,this.uniforms.get("map").value=this.renderTarget.texture,this.blurPass=new cM({resolutionScale:n,width:s,height:o,kernelSize:a}),this.blurPass.resolution.resizable=this,this.luminancePass=new aF({renderTarget:this.renderTarget,colorOutput:!0}),this.luminancePass.resolution=this.resolution,this.luminanceMaterial.threshold=e,this.luminanceMaterial.smoothing=t}get texture(){return this.renderTarget.texture}get luminanceMaterial(){return this.luminancePass.getFullscreenMaterial()}get resolution(){return this.blurPass.resolution}get width(){return this.resolution.width}set width(r){this.resolution.width=r}get height(){return this.resolution.height}set height(r){this.resolution.height=r}get dithering(){return this.blurPass.dithering}set dithering(r){this.blurPass.dithering=r}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(r){this.blurPass.kernelSize=r}get distinction(){return console.warn(this.name,"The distinction field has been removed, use luminanceMaterial.threshold and luminanceMaterial.smoothing instead."),1}set distinction(r){console.warn(this.name,"The distinction field has been removed, use luminanceMaterial.threshold and luminanceMaterial.smoothing instead.")}get intensity(){return this.uniforms.get("intensity").value}set intensity(r){this.uniforms.get("intensity").value=r}getResolutionScale(){return this.resolution.scale}setResolutionScale(r){this.resolution.scale=r}update(r,e,t){let n=this.renderTarget;this.luminancePass.enabled?(this.luminancePass.render(r,e,n),this.blurPass.render(r,n,n)):this.blurPass.render(r,e,n)}setSize(r,e){this.blurPass.setSize(r,e),this.renderTarget.setSize(this.resolution.width,this.resolution.height)}initialize(r,e,t){this.blurPass.initialize(r,e,t),!e&&t===At&&(this.renderTarget.texture.format=Nt),t!==void 0&&(this.renderTarget.texture.type=t)}};var uF="uniform float brightness;uniform float contrast;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=inputColor.rgb+vec3(brightness-0.5);if(contrast>0.0){color/=vec3(1.0-contrast);}else{color*=vec3(1.0+contrast);}outputColor=vec4(min(color+vec3(0.5),1.0),inputColor.a);}",pM=class extends Mr{constructor({blendFunction:r=ut.NORMAL,brightness:e=0,contrast:t=0}={}){super("BrightnessContrastEffect",uF,{blendFunction:r,uniforms:new Map([["brightness",new Ae(e)],["contrast",new Ae(t)]])})}},hF="void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){float sum=inputColor.r+inputColor.g+inputColor.b;outputColor=vec4(vec3(sum/3.0),inputColor.a);}",mM=class extends Mr{constructor(r=ut.NORMAL){super("ColorAverageEffect",hF,{blendFunction:r})}};var dF=`varying vec2 vUvR;varying vec2 vUvB;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 color=inputColor;
#ifdef ALPHA
vec2 ra=texture2D(inputBuffer,vUvR).ra;vec2 ba=texture2D(inputBuffer,vUvB).ba;color.r=ra.x;color.b=ba.x;color.a=max(max(ra.y,ba.y),inputColor.a);
#else
color.r=texture2D(inputBuffer,vUvR).r;color.b=texture2D(inputBuffer,vUvB).b;
#endif
outputColor=color;}`,fF="uniform vec2 offset;varying vec2 vUvR;varying vec2 vUvB;void mainSupport(const in vec2 uv){vUvR=uv+offset;vUvB=uv-offset;}",gM=class extends Mr{constructor({blendFunction:r=ut.NORMAL,offset:e=new O(.001,5e-4)}={}){super("ChromaticAberrationEffect",dF,{vertexShader:fF,blendFunction:r,attributes:ir.CONVOLUTION,uniforms:new Map([["offset",new Ae(e)]])})}get offset(){return this.uniforms.get("offset").value}set offset(r){this.uniforms.get("offset").value=r}initialize(r,e,t){e?this.defines.set("ALPHA","1"):this.defines.delete("ALPHA")}};var pF=`#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D nearColorBuffer;uniform mediump sampler2D farColorBuffer;
#else
uniform lowp sampler2D nearColorBuffer;uniform lowp sampler2D farColorBuffer;
#endif
uniform lowp sampler2D nearCoCBuffer;uniform float scale;void mainImage(const in vec4 inputColor,const in vec2 uv,const in float depth,out vec4 outputColor){vec4 colorNear=texture2D(nearColorBuffer,uv);vec4 colorFar=texture2D(farColorBuffer,uv);float CoCNear=texture2D(nearCoCBuffer,uv).r;CoCNear=min(CoCNear*scale,1.0);vec4 result=inputColor*(1.0-colorFar.a)+colorFar;result=mix(result,colorNear,CoCNear);outputColor=result;}`,yM=class extends Mr{constructor(r,{blendFunction:e=ut.NORMAL,focusDistance:t=0,focalLength:n=.1,bokehScale:i=1,width:s=nr.AUTO_SIZE,height:o=nr.AUTO_SIZE}={}){super("DepthOfFieldEffect",pF,{blendFunction:e,attributes:ir.DEPTH,uniforms:new Map([["nearColorBuffer",new Ae(null)],["farColorBuffer",new Ae(null)],["nearCoCBuffer",new Ae(null)],["scale",new Ae(1)]])});this.camera=r,this.renderTarget=new bt(1,1,{minFilter:$e,magFilter:$e,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="DoF.Intermediate",this.renderTarget.texture.generateMipmaps=!1,this.renderTargetMasked=this.renderTarget.clone(),this.renderTargetMasked.texture.name="DoF.Masked.Far",this.renderTargetNear=this.renderTarget.clone(),this.renderTargetNear.texture.name="DoF.Bokeh.Near",this.uniforms.get("nearColorBuffer").value=this.renderTargetNear.texture,this.renderTargetFar=this.renderTarget.clone(),this.renderTargetFar.texture.name="DoF.Bokeh.Far",this.uniforms.get("farColorBuffer").value=this.renderTargetFar.texture,this.renderTargetCoC=this.renderTarget.clone(),this.renderTargetCoC.texture.format=Nt,this.renderTargetCoC.texture.name="DoF.CoC",this.renderTargetCoCBlurred=this.renderTargetCoC.clone(),this.renderTargetCoCBlurred.texture.name="DoF.CoC.Blurred",this.uniforms.get("nearCoCBuffer").value=this.renderTargetCoCBlurred.texture,this.cocPass=new Xr(new x3(r));let a=this.circleOfConfusionMaterial;a.uniforms.focusDistance.value=t,a.uniforms.focalLength.value=n,this.blurPass=new cM({width:s,height:o,kernelSize:kd.MEDIUM}),this.blurPass.resolution.resizable=this,this.maskPass=new Xr(new D3(this.renderTargetCoC.texture));let l=this.maskPass.getFullscreenMaterial();l.maskFunction=aM.MULTIPLY,l.colorChannel=iM.GREEN,this.bokehNearBasePass=new Xr(new Ud(!1,!0)),this.bokehNearFillPass=new Xr(new Ud(!0,!0)),this.bokehFarBasePass=new Xr(new Ud(!1,!1)),this.bokehFarFillPass=new Xr(new Ud(!0,!1)),this.bokehScale=i,this.target=null}get circleOfConfusionMaterial(){return this.cocPass.getFullscreenMaterial()}get resolution(){return this.blurPass.resolution}get bokehScale(){return this.uniforms.get("scale").value}set bokehScale(r){[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].map(t=>t.getFullscreenMaterial().uniforms.scale).forEach(t=>{t.value=r}),this.maskPass.getFullscreenMaterial().uniforms.strength.value=r,this.uniforms.get("scale").value=r}calculateFocusDistance(r){let e=this.camera,t=e.far-e.near,n=e.position.distanceTo(r);return Math.min(Math.max(n/t,0),1)}setDepthTexture(r,e=Kr){let t=this.circleOfConfusionMaterial;t.uniforms.depthBuffer.value=r,t.depthPacking=e}update(r,e,t){let n=this.renderTarget,i=this.renderTargetCoC,s=this.renderTargetCoCBlurred,o=this.renderTargetMasked,a=this.bokehFarBasePass,l=this.bokehFarFillPass,c=a.getFullscreenMaterial().uniforms,u=l.getFullscreenMaterial().uniforms,h=this.bokehNearBasePass,d=this.bokehNearFillPass,f=h.getFullscreenMaterial().uniforms,p=d.getFullscreenMaterial().uniforms;if(this.target!==null){let m=this.calculateFocusDistance(this.target);this.circleOfConfusionMaterial.uniforms.focusDistance.value=m}this.cocPass.render(r,null,i),this.blurPass.render(r,i,s),this.maskPass.render(r,e,o),c.cocBuffer.value=u.cocBuffer.value=i.texture,a.render(r,o,n),l.render(r,n,this.renderTargetFar),f.cocBuffer.value=p.cocBuffer.value=s.texture,h.render(r,e,n),d.render(r,n,this.renderTargetNear)}setSize(r,e){let t=this.resolution,n=[this.cocPass,this.blurPass,this.maskPass,this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass];n.push(this.renderTargetCoC,this.renderTargetMasked),n.forEach(a=>a.setSize(r,e));let i=t.width,s=t.height;n=[this.renderTarget,this.renderTargetNear,this.renderTargetFar,this.renderTargetCoCBlurred],n.forEach(a=>a.setSize(i,s)),[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach(a=>a.getFullscreenMaterial().setTexelSize(1/i,1/s))}initialize(r,e,t){[this.cocPass,this.maskPass,this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach(i=>i.initialize(r,e,t)),this.blurPass.initialize(r,e,At),!e&&t===At&&(this.renderTargetNear.texture.type=Nt),t!==void 0&&(this.renderTarget.texture.type=t,this.renderTargetNear.texture.type=t,this.renderTargetFar.texture.type=t,this.renderTargetMasked.texture.type=t)}};var P$=new M,D$=new me;var mF="uniform vec3 hue;uniform float saturation;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=vec3(dot(inputColor.rgb,hue.xyz),dot(inputColor.rgb,hue.zxy),dot(inputColor.rgb,hue.yzx));float average=(color.r+color.g+color.b)/3.0;vec3 diff=average-color;if(saturation>0.0){color+=diff*(1.0-1.0/(1.001-saturation));}else{color+=diff*-saturation;}outputColor=vec4(min(color,1.0),inputColor.a);}",vM=class extends Mr{constructor({blendFunction:r=ut.NORMAL,hue:e=0,saturation:t=0}={}){super("HueSaturationEffect",mF,{blendFunction:r,uniforms:new Map([["hue",new Ae(new M)],["saturation",new Ae(t)]])});this.setHue(e)}setHue(r){let e=Math.sin(r),t=Math.cos(r);this.uniforms.get("hue").value.set(2*t,-Math.sqrt(3)*e-t,Math.sqrt(3)*e-t).addScalar(1).divideScalar(3)}};var O$=new fe;var gF=`void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 noise=vec3(rand(uv*time));
#ifdef PREMULTIPLY
outputColor=vec4(min(inputColor.rgb*noise,vec3(1.0)),inputColor.a);
#else
outputColor=vec4(noise,inputColor.a);
#endif
}`,xM=class extends Mr{constructor({blendFunction:r=ut.SCREEN,premultiply:e=!1}={}){super("NoiseEffect",gF,{blendFunction:r});this.premultiply=e}get premultiply(){return this.defines.has("PREMULTIPLY")}set premultiply(r){this.premultiply!==r&&(r?this.defines.set("PREMULTIPLY","1"):this.defines.delete("PREMULTIPLY"),this.setChanged())}};var yF="uniform bool active;uniform vec2 d;void mainUv(inout vec2 uv){if(active){uv=vec2(d.x*(floor(uv.x/d.x)+0.5),d.y*(floor(uv.y/d.y)+0.5));}}",bM=class extends Mr{constructor(r=30){super("PixelationEffect",yF,{uniforms:new Map([["active",new Ae(!1)],["d",new Ae(new O)]])});this.resolution=new O,this.granularity=r}getGranularity(){return this.granularity}setGranularity(r){r=Math.floor(r),r%2>0&&(r+=1);let e=this.uniforms;e.get("active").value=r>0,e.get("d").value.set(r,r).divide(this.resolution),this.granularity=r}setSize(r,e){this.resolution.set(r,e),this.setGranularity(this.granularity)}};var G$=Math.PI*.5,U$=new M,k$=new M;var wM="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAYAAACm53kpAAAAeElEQVRYR+2XSwqAMAxEJ168ePEqwRSKhIIiuHjJqiU0gWE+1CQdApcVAMUAuARaMGCX1MIL/Ow13++9lW2s3mW9MWvsnWc/2fvGygwPAN4E8QzAA4CXAB6AHjG4JTHYI1ey3pcx6FHnEfhLDOIBKAmUBK6/ANUDTlROXAHd9EC1AAAAAElFTkSuQmCC",SM="data:image/png;base64,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",vF="uniform sampler2D weightMap;varying vec2 vOffset0;varying vec2 vOffset1;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 a;a.x=texture2D(weightMap,vOffset0).a;a.y=texture2D(weightMap,vOffset1).g;a.wz=texture2D(weightMap,uv).rb;vec4 color=inputColor;if(dot(a,vec4(1.0))>=1e-5){bool h=max(a.x,a.z)>max(a.y,a.w);vec4 blendingOffset=vec4(0.0,a.y,0.0,a.w);vec2 blendingWeight=a.yw;movec(bvec4(h),blendingOffset,vec4(a.x,0.0,a.z,0.0));movec(bvec2(h),blendingWeight,a.xz);blendingWeight/=dot(blendingWeight,vec2(1.0));vec4 blendingCoord=blendingOffset*vec4(texelSize,-texelSize)+uv.xyxy;color=blendingWeight.x*texture2D(inputBuffer,blendingCoord.xy);color+=blendingWeight.y*texture2D(inputBuffer,blendingCoord.zw);}outputColor=color;}",xF="varying vec2 vOffset0;varying vec2 vOffset1;void mainSupport(const in vec2 uv){vOffset0=uv+texelSize*vec2(1.0,0.0);vOffset1=uv+texelSize*vec2(0.0,1.0);}",MM=class extends Mr{constructor(r,e,t=Uo.HIGH,n=Vd.COLOR){super("SMAAEffect",vF,{vertexShader:xF,blendFunction:ut.NORMAL,attributes:ir.CONVOLUTION|ir.DEPTH,uniforms:new Map([["weightMap",new Ae(null)]])});this.renderTargetEdges=new bt(1,1,{minFilter:$e,stencilBuffer:!1,depthBuffer:!1,format:Nt}),this.renderTargetEdges.texture.name="SMAA.Edges",this.renderTargetWeights=this.renderTargetEdges.clone(),this.renderTargetWeights.texture.name="SMAA.Weights",this.renderTargetWeights.texture.format=zt,this.uniforms.get("weightMap").value=this.renderTargetWeights.texture,this.clearPass=new ig(!0,!1,!1),this.clearPass.overrideClearColor=new fe(0),this.clearPass.overrideClearAlpha=1,this.edgeDetectionPass=new Xr(new T3(new O,n)),this.weightsPass=new Xr(new O3);let i=new xt(r);i.name="SMAA.Search",i.magFilter=Pt,i.minFilter=Pt,i.format=zt,i.generateMipmaps=!1,i.needsUpdate=!0,i.flipY=!0;let s=new xt(e);s.name="SMAA.Area",s.magFilter=$e,s.minFilter=$e,s.format=zt,s.generateMipmaps=!1,s.needsUpdate=!0,s.flipY=!1;let o=this.weightsPass.getFullscreenMaterial();o.uniforms.searchTexture.value=i,o.uniforms.areaTexture.value=s,this.applyPreset(t)}get edgeDetectionMaterial(){return this.edgeDetectionPass.getFullscreenMaterial()}get colorEdgesMaterial(){return this.edgeDetectionMaterial}get weightsMaterial(){return this.weightsPass.getFullscreenMaterial()}setEdgeDetectionThreshold(r){this.edgeDetectionPass.getFullscreenMaterial().setEdgeDetectionThreshold(r)}setOrthogonalSearchSteps(r){this.weightsPass.getFullscreenMaterial().setOrthogonalSearchSteps(r)}applyPreset(r){let e=this.edgeDetectionMaterial,t=this.weightsMaterial;switch(r){case Uo.LOW:e.setEdgeDetectionThreshold(.15),t.setOrthogonalSearchSteps(4),t.diagonalDetection=!1,t.cornerRounding=!1;break;case Uo.MEDIUM:e.setEdgeDetectionThreshold(.1),t.setOrthogonalSearchSteps(8),t.diagonalDetection=!1,t.cornerRounding=!1;break;case Uo.HIGH:e.setEdgeDetectionThreshold(.1),t.setOrthogonalSearchSteps(16),t.setDiagonalSearchSteps(8),t.setCornerRounding(25),t.diagonalDetection=!0,t.cornerRounding=!0;break;case Uo.ULTRA:e.setEdgeDetectionThreshold(.05),t.setOrthogonalSearchSteps(32),t.setDiagonalSearchSteps(16),t.setCornerRounding(25),t.diagonalDetection=!0,t.cornerRounding=!0;break}}setDepthTexture(r,e=Kr){let t=this.edgeDetectionMaterial;t.uniforms.depthBuffer.value=r,t.depthPacking=e}update(r,e,t){this.clearPass.render(r,this.renderTargetEdges),this.edgeDetectionPass.render(r,e,this.renderTargetEdges),this.weightsPass.render(r,this.renderTargetEdges,this.renderTargetWeights)}setSize(r,e){let t=this.edgeDetectionPass.getFullscreenMaterial(),n=this.weightsPass.getFullscreenMaterial();this.renderTargetEdges.setSize(r,e),this.renderTargetWeights.setSize(r,e),n.uniforms.resolution.value.set(r,e),n.uniforms.texelSize.value.set(1/r,1/e),t.uniforms.texelSize.value.copy(n.uniforms.texelSize.value)}dispose(){let r=this.weightsPass.getFullscreenMaterial().uniforms;r.searchTexture.value.dispose(),r.areaTexture.value.dispose(),super.dispose()}static get searchImageDataURL(){return wM}static get areaImageDataURL(){return SM}},Uo={LOW:0,MEDIUM:1,HIGH:2,ULTRA:3};var bF=`uniform float offset;uniform float darkness;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){const vec2 center=vec2(0.5);vec3 color=inputColor.rgb;
#ifdef ESKIL
vec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord));
#else
float d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offset));
#endif
outputColor=vec4(color,inputColor.a);}`,AM=class extends Mr{constructor(r={}){let e=Object.assign({blendFunction:ut.NORMAL,eskil:!1,offset:.5,darkness:.5},r);super("VignetteEffect",bF,{blendFunction:e.blendFunction,uniforms:new Map([["offset",new Ae(e.offset)],["darkness",new Ae(e.darkness)]])});this.eskil=e.eskil}get eskil(){return this.defines.has("ESKIL")}set eskil(r){this.eskil!==r&&(r?this.defines.set("ESKIL","1"):this.defines.delete("ESKIL"),this.setChanged())}},j$=[new Float32Array(3),new Float32Array(3)],W$=[new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3)],J$=[[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1])]];var X$=[new Float32Array(2),new Float32Array(2)];var q$=new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),Y$=[new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125])],K$=[new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4])],Q$=[new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3])];var Z$=new Map([[Hn(0,0,0,0),new Float32Array([0,0,0,0])],[Hn(0,0,0,1),new Float32Array([0,0,0,1])],[Hn(0,0,1,0),new Float32Array([0,0,1,0])],[Hn(0,0,1,1),new Float32Array([0,0,1,1])],[Hn(0,1,0,0),new Float32Array([0,1,0,0])],[Hn(0,1,0,1),new Float32Array([0,1,0,1])],[Hn(0,1,1,0),new Float32Array([0,1,1,0])],[Hn(0,1,1,1),new Float32Array([0,1,1,1])],[Hn(1,0,0,0),new Float32Array([1,0,0,0])],[Hn(1,0,0,1),new Float32Array([1,0,0,1])],[Hn(1,0,1,0),new Float32Array([1,0,1,0])],[Hn(1,0,1,1),new Float32Array([1,0,1,1])],[Hn(1,1,0,0),new Float32Array([1,1,0,0])],[Hn(1,1,0,1),new Float32Array([1,1,0,1])],[Hn(1,1,1,0),new Float32Array([1,1,1,0])],[Hn(1,1,1,1),new Float32Array([1,1,1,1])]]);function ag(r,e,t){return r+(e-r)*t}function Hn(r,e,t,n){let i=ag(r,e,1-.25),s=ag(t,n,1-.25);return ag(i,s,1-.125)}var _M=class extends fn{load(r=()=>{},e=null){arguments.length===4?(r=arguments[1],e=arguments[3]):(arguments.length===3||typeof arguments[0]!="function")&&(r=arguments[1],e=null);let t=this.manager,n=new yo;return new Promise((i,s)=>{let o=new Image,a=new Image;n.onError=l=>{t.itemError(l),e!==null?(e(`Failed to load ${l}`),i()):s(`Failed to load ${l}`)},n.onLoad=()=>{let l=[o,a];r(l),i(l)},o.addEventListener("error",l=>{n.itemError("smaa-search")}),a.addEventListener("error",l=>{n.itemError("smaa-area")}),o.addEventListener("load",()=>{t.itemEnd("smaa-search"),n.itemEnd("smaa-search")}),a.addEventListener("load",()=>{t.itemEnd("smaa-area"),n.itemEnd("smaa-area")}),t.itemStart("smaa-search"),t.itemStart("smaa-area"),n.itemStart("smaa-search"),n.itemStart("smaa-area"),o.src=wM,a.src=SM})}};var hn=class{constructor(e,t){this.enabled=!1;this.effect=new e(t),Object.defineProperty(this,"opacity",{enumerable:!0,set(n){this.effect.blendMode.opacity.value=n},get(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set(n){this.effect.blendMode.setBlendFunction(Number(n))},get(){return this.effect.blendMode.blendFunction}}),this.blendFunction=ut.NORMAL}toJSON(){let e=["constructor","effect","subscriptions"],t=Ue({},this),n=Object.getPrototypeOf(this),i=Object.getOwnPropertyNames(n);for(let s of i){let o=Object.getOwnPropertyDescriptor(n,s);o&&typeof o.get=="function"&&(t[s]=this[s])}return e.forEach(s=>delete t[s]),t}};var ru=class extends hn{constructor(){super(fM);this.blendFunction=ut.SCREEN}set intensity(e){this.effect.intensity=e}get intensity(){return this.effect.intensity}set luminanceThreshold(e){this.effect.luminanceMaterial.threshold=e}get luminanceThreshold(){return this.effect.luminanceMaterial.threshold}set luminanceSmoothing(e){this.effect.luminanceMaterial.smoothing=e}get luminanceSmoothing(){return this.effect.luminanceMaterial.smoothing}set blurScale(e){this.effect.blurPass.scale=e}get blurScale(){return this.effect.blurPass.scale}set kernelSize(e){this.effect.blurPass.kernelSize=e}get kernelSize(){return this.effect.blurPass.kernelSize}};var su=class extends hn{constructor(){super(pM)}set contrast(e){this.effect.uniforms.get("contrast").value=e}get contrast(){return this.effect.uniforms.get("contrast").value}set brightness(e){this.effect.uniforms.get("brightness").value=e}get brightness(){return this.effect.uniforms.get("brightness").value}};var ou=class extends hn{constructor(){super(gM);this.effect.offset=new O(.01,.01)}set offset(e){this.effect.offset.set(e[0]/1e3,e[1]/1e3)}get offset(){return[this.effect.offset.x*1e3,this.effect.offset.y*1e3]}};var au=class extends hn{constructor(){super(mM)}};var lu=class extends hn{constructor(){super(vM);this._hue=0}set hue(e){this._hue=e,this.effect.setHue(e)}get hue(){return this._hue}set saturation(e){this.effect.uniforms.get("saturation").value=e}get saturation(){return this.effect.uniforms.get("saturation").value}};var cu=class extends hn{constructor(){super(xM);this.blendFunction=ut.OVERLAY}};var uu=class extends hn{constructor(){super(AM)}get eskil(){return this.effect.eskil}set eskil(e){this.effect.eskil=e}get darkness(){return this.effect.uniforms.get("darkness").value}set darkness(e){this.effect.uniforms.get("darkness").value=e}get offset(){return this.effect.uniforms.get("offset").value}set offset(e){this.effect.uniforms.get("offset").value=e}};var hu=class extends hn{constructor(e){super(yM,e)}set focalLength(e){this.effect.circleOfConfusionMaterial.uniforms.focalLength.value=e}get focalLength(){return this.effect.circleOfConfusionMaterial.uniforms.focalLength.value}set focusDistance(e){this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value=e}get focusDistance(){return this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value}get bokehScale(){return this.effect.bokehScale}set bokehScale(e){this.effect.bokehScale=e}};var du=class extends hn{constructor(){super(bM)}get granularity(){return this.effect.getGranularity()}set granularity(e){this.effect.setGranularity(e)}};function TM(r,e){return e&&e.enabled&&r.push(e.effect),r}var fu=class{constructor(){this._scene=new An;this._camera=new Sr;this.effects=new Map;this.loadingManager=new yo;this.smaaImageLoader=new _M(this.loadingManager);this.renderPass=new sg;this._renderToScreen=!0;this.clock=new Ep,this.enabled=!1,this.debug=!1,this.effects.set("bloom",new ru),this.effects.set("chromaticAberration",new ou),this.effects.set("vignette",new uu),this.effects.set("noise",new cu),this.effects.set("colorAverage",new au),this.effects.set("hueSaturation",new lu),this.effects.set("brightnessContrast",new su),this.effects.set("depthOfField",new hu),this.effects.set("pixelation",new du)}get scene(){return this._scene}set scene(e){this._scene=e,this._initPasses()}get camera(){return this._camera}set camera(e){this._camera=e,this._initPasses()}_initSmaa(){let e=this.effectComposer.passes.length;this.smaaImageLoader.load(([t,n])=>{if(!this.effectComposer)return;let i=new MM(t,n,Uo.ULTRA,Vd.COLOR);i.edgeDetectionMaterial.setPredicationMode(oM.DEPTH),i.edgeDetectionMaterial.setEdgeDetectionThreshold(.05),i.edgeDetectionMaterial.setPredicationThreshold(.002),i.edgeDetectionMaterial.setPredicationScale(1),this.effectComposer.addPass(new Hd(this.camera,i),e)})}_initPasses(){if(!(!this.effectComposer||!this.renderer))if(this.effectComposer.removeAllPasses(),this.renderPass=new sg(this.scene,this.camera),this.enabled){this.effectComposer.addPass(this.renderPass),this._initSmaa();let e=[this.effects.get("chromaticAberration"),this.effects.get("bloom"),this.effects.get("colorAverage"),this.effects.get("hueSaturation"),this.effects.get("brightnessContrast"),this.effects.get("vignette"),this.effects.get("noise")].reduce(TM,[]),t=[this.effects.get("pixelation")].reduce(TM,[]);t.length>0&&this.effectComposer.addPass(new Hd(this.camera,...t)),this.effectComposer.addPass(new Hd(this.camera,...e))}else this.effectComposer.addPass(this.renderPass)}reinit(){!this.renderer||(this.effectComposer=new dM(this.renderer),this._initPasses())}init({renderer:e,camera:t,scene:n}){this.renderer=e,this.scene=n,this.camera=t,this._initSavePass(),this.reinit()}_initSavePass(){if(this._savePass)return;let e=new O;this.renderer.getDrawingBufferSize(e);let t=this.renderer.capabilities.isWebGL2?Zr:bt;this._rt=new t(e.x,e.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:di,wrapT:di}),this._savePass=new lM(this._rt,!1),this._savePass.renderToScreen=!1}get renderToScreen(){return this._renderToScreen}set renderToScreen(e){var n,i;let t=this.effectComposer;!t||(e===!0?(((n=this.renderer)==null?void 0:n.capabilities.isWebGL2)&&(t.multisampling=0),t.removePass(this._savePass),t.passes[t.passes.length-1].renderToScreen=!0,t.autoRenderToScreen=!0):(((i=this.renderer)==null?void 0:i.capabilities.isWebGL2)&&(t.multisampling=4),t.autoRenderToScreen=!1,t.passes[t.passes.length-1].renderToScreen=!1,this._savePass.renderToScreen=!1,t.addPass(this._savePass)),this._renderToScreen=e)}get texture(){return this._rt&&this._rt.texture}get renderTarget(){return this._rt}fromJSON(e){e&&(Object.keys(e).forEach(t=>{let n=e[t],i=this.effects.get(t);Object.keys(n).forEach(s=>{i[s]=n[s]})}),this.enabled=e.enabled)}toJSON(){let e={};return this.effects.forEach((t,n)=>{e[n]=t.toJSON()},e),Ue({enabled:this.enabled},e)}render(){var e;(e=this.effectComposer)==null||e.render(this.clock.getDelta())}setScissor(e,t,n,i){if(!this.effectComposer||!this.renderer)return;e instanceof Qe?(this.effectComposer.inputBuffer.scissor.set(e.x,e.y,e.z,e.w),this.effectComposer.outputBuffer.scissor.set(e.x,e.y,e.z,e.w)):(this.effectComposer.inputBuffer.scissor.set(e,t,n,i),this.effectComposer.outputBuffer.scissor.set(e,t,n,i));let s=this.renderer.getPixelRatio();this.effectComposer.inputBuffer.scissor.multiplyScalar(s),this.effectComposer.outputBuffer.scissor.multiplyScalar(s),this.renderer.setScissor(e,t,n,i)}setScissorTest(e){!this.effectComposer||!this.renderer||(this.effectComposer.inputBuffer.scissorTest=e,this.effectComposer.outputBuffer.scissorTest=e,this.renderer.setScissorTest(e))}setViewport(e,t,n,i){!this.effectComposer||(e instanceof Qe?(this.effectComposer.inputBuffer.viewport.copy(e),this.effectComposer.outputBuffer.viewport.copy(e)):(this.effectComposer.inputBuffer.viewport.set(e,t,n,i),this.effectComposer.outputBuffer.viewport.set(e,t,n,i)))}resize(e,t){var n,i;if((n=this.effectComposer)==null||n.setSize(e,t),this._rt){let s=((i=this.renderer)==null?void 0:i.getPixelRatio())||window.devicePixelRatio;this._rt.setSize(e*s,t*s)}}};var EM;(function(e){function r(t){new Qe(t.r/255,t.g/255,t.b/255,t.a)}e.getThreeVector4=r})(EM||(EM={}));var jd;(function(t){function r(n,i){n.setRGB(i.r/255,i.g/255,i.b/255)}t.setThreeColor=r;function e(n){return new fe(n.r/255,n.g/255,n.b/255).getHex()}t.getHex=e})(jd||(jd={}));var zs=class extends Ld(An){constructor(){super();this.objectType="Scene";this.alpha=1;this.backupFog=new hs(16777215,.1,2e3);this.fogUseBGColor=!1;this.directionalLightState=!0;this.ambientLightState=!0;this.wireframeState=!1;this._color=new fe(1644825);this.canvas={mode:1,preset:"fullscreen",size:{width:512,height:512},editorSize:{width:1,height:1},color:[0,0,0,.5]};this.name="Untitled",this.postprocessing=new fu}get color(){return this._color}set color(e){this.fogUseBGColor===!0&&this.backupFog.color.copy(e),this._color.copy(e)}get enableFog(){return this.fog!==null}set enableFog(e){this.fog=e===!0?this.backupFog:null}init(e,t){this.camera=new Sr(e,t),this.camera.setDefault(),this.camera.orthoCamera.near=-5e4,this.camera.perspCamera.near=50,this.camera.orthoCamera.far=1e5,this.camera.perspCamera.far=1e5,this.camera.updateProjectionMatrix(),this.camera.position.set(0,0,Sr.DefaultTargetOffset),this.camera.lookAt(new M(0,0,-1)),this.add(this.camera),this.canvas.size.width=e,this.canvas.size.height=t,this.ambientLight=new uc(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.add(this.ambientLight),this.directionalLight=new Fr(16777215,.75),this.directionalLight.name="Default Directional Light",this.directionalLight.position.set(85e4,13e5,1e6),this.activeCamera=this.camera,this.activeCamera.add(this.directionalLight)}initFromObjectLoader(e){return this.traverse(t=>{t.uuid===e.ambientLight?this.ambientLight=t:t.uuid===e.directionalLight?this.directionalLight=t:(t.uuid===e.activeCamera&&(this.activeCamera=t),t.uuid===e.camera&&(this.camera=t,this.camera.setDefault()))}),this}raycast(e){let t=[],n=i=>{for(let s of i.children)ei(s)&&!s.raycastLock&&s.visible&&((ai(s)||Hh(s)&&s.enableHelper&&s.objectHelper.parent)&&e.intersectObject(s,!1,t),n(s))};return n(this),t}traverseEntity(e){for(let t of this.children)ei(t)&&this.camera!==t&&t.traverseEntity(e)}updateFog(e){this.enableFog=e.enabled,this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.color):jd.setThreeColor(this.backupFog.color,e.color),this.backupFog.near=e.near,this.backupFog.far=e.far}toJSON(e){var i,s,o,a,l;let t=super.toJSON(e),n=t.object;return n.objectType="Scene",n.activeCamera=(i=this.activeCamera)==null?void 0:i.uuid,n.camera=(s=this.camera)==null?void 0:s.uuid,n.directionalLight=(o=this.directionalLight)==null?void 0:o.uuid,n.ambientLight=(a=this.ambientLight)==null?void 0:a.uuid,n.color=this.color.toArray(),n.alpha=this.alpha,this.background instanceof xt?n.background=this.background.toJSON(e):this.background instanceof fe&&(n.background=this.background.toArray()),this.environment!==null&&(n.environment=this.environment.toJSON(e)),this.enableFog===!0&&(n.enableFog=!0,this.fogUseBGColor===!0&&(n.fogUseBGColor=!0),this.fog!==null&&(n.fog=this.fog.toJSON())),this.directionalLightState===!0&&(n.directionalLightState=!0),this.ambientLightState===!0&&(n.ambientLightState=!0),this.wireframeState===!0&&(n.wireframeState=!0),n.canvas={mode:this.canvas.mode,preset:this.canvas.preset,editorSize:{width:window.innerWidth,height:window.innerHeight},color:this.canvas.color},this.canvas.mode!==1&&(n.canvas.size={width:this.canvas.size.width,height:this.canvas.size.height}),n.postprocessing=(l=this.postprocessing)==null?void 0:l.toJSON(),t}fromJSON(e){var n,i,s,o,a;super.fromJSON(e),this.postprocessing=new fu,this.color.fromArray(e.color),this.alpha=e.alpha,e.background!==void 0&&Array.isArray(e.background)&&(this.background=new fe().fromArray(e.background)),e.fog!==void 0&&(e.fog.type==="FogExp2"?this.backupFog=new io(e.fog.color,e.fog.density):this.backupFog=new hs(e.fog.color,e.fog.near,e.fog.far)),this.fogUseBGColor=(n=e.fogUseBGColor)!=null?n:!1,this.enableFog=(i=e.enableFog)!=null?i:!1,this.directionalLightState=(s=e.directionalLightState)!=null?s:!1,this.ambientLightState=(o=e.ambientLightState)!=null?o:!1,this.wireframeState=(a=e.wireframeState)!=null?a:!1;let t=e.canvas;return this.canvas.mode=t.mode,this.canvas.preset=t.preset,t.size&&(this.canvas.size={width:t.size.width,height:t.size.height}),this.canvas.editorSize=t.editorSize?{width:t.editorSize.width,height:t.editorSize.height}:{width:window.innerWidth,height:window.innerHeight},t.color&&(this.canvas.color=[...t.color]),this.postprocessing.fromJSON(e.postprocessing),this}dispose(){this.traverseEntity(e=>{"geometry"in e&&e.geometry.dispose(),"material"in e&&(e.material instanceof Array?e.material.forEach(t=>t.dispose()):e.material.dispose())})}};var lg=class extends je{constructor(e="",t){super(t);this.nodeType="Attribute";this.name=e}getAttributeType(e){return typeof this.type=="number"?e.getConstructorFromLength(this.type):this.type}getType(e){let t=this.getAttributeType(e);return e.getTypeByFormat(t)}generate(e,t,n,i,s){i=this.getAttributeType(e);let o=e.getAttribute(this.name,i),a=e.isShader("vertex")?this.name:o.varying.name;return e.format(a,this.getType(e),t)}toJSON(e){let t=super.toJSON(e);return t.nodeType=this.nodeType,t.name=this.name,t}fromJSON(e,t){return super.fromJSON(e,t),e.scope&&(this.scope=e.scope),e.name&&(this.name=e.name),this}};var cg=class extends ze{constructor(e="",t=0){super(e);this.nodeType="Varying";this.value=t}getType(e){return e.getTypeByFormat(this.type)}generate(e,t,n,i,s){let o=e.getVar(this.uuid,this.type);return this.value&&e.isShader("vertex")&&e.addNodeCode(o.name+" = "+this.value.build(e,this.getType(e))+";"),e.format(o.name,this.getType(e),t)}copy(e){return super.copy(e),this.value=e.value,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.value&&(t.value=this.value)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=e.value),this}};var ug=class extends Ct{constructor(e){super("m4");this.nodeType="Matrix4";this.value=e!=null?e:new me}generateReadonly(e,t,n,i,s,o){return e.format("mat4("+this.value.elements.join(", ")+")",i,t)}copy(e){return super.copy(e),this.elements=e.elements,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.elements=this.value.elements.concat()),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.elements&&(this.elements=e.elements),this}get elements(){return this.value.elements}set elements(e){this.value.fromArray(e)}};var Ar;(function(l){l.EQUAL="==",l.NOT_EQUAL="!=",l.GREATER=">",l.GREATER_EQUAL=">=",l.LESS="<",l.LESS_EQUAL="<=",l.AND="&&",l.OR="||"})(Ar||(Ar={}));var hg=class extends je{constructor(e=new ze,t=new ze,n=hg.GREATER,i=new ze,s=new ze){super();this.nodeType="Cond";this.a=e,this.b=t,this.op=n,this.ifNode=i,this.elseNode=s}getType(e){if(this.ifNode){let t=this.ifNode.getType(e),n=this.elseNode.getType(e);return e.getTypeLength(n)>e.getTypeLength(t)?n:t}return"b"}getCondType(e){return e.getTypeLength(this.b.getType(e))>e.getTypeLength(this.a.getType(e))?this.b.getType(e):this.a.getType(e)}generate(e,t){let n=this.getType(e),i=this.getCondType(e),s=this.a.build(e,i),o=this.b.build(e,i),a;if(this.type=n,this.ifNode){let l=this.ifNode.build(e,n),c=this.elseNode.build(e,n);a="( "+[s,this.op,o,"?",l,":",c].join(" ")+" )"}else a="( "+s+" "+this.op+" "+o+" )";return e.format(a,this.getType(e),t)}copy(e){return super.copy(e),this.a.copy(e.a),this.b.copy(e.b),this.op=e.op,this.ifNode.copy(e.ifNode),this.elseNode.copy(e.elseNode),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.a=this.a.toJSON(e).uuid,t.b=this.b.toJSON(e).uuid,t.op=this.op,this.ifNode&&(t.ifNode=this.ifNode.toJSON(e).uuid),this.elseNode&&(t.elseNode=this.elseNode.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.a&&(this.a=t.getNode(e.a)),e.b&&(this.b=t.getNode(e.b)),e.op&&(this.op=e.op),e.ifNode&&(this.ifNode=t.getNode(e.ifNode)),e.elseNode&&(this.elseNode=t.getNode(e.elseNode)),this}},rr=hg;rr.EQUAL=Ar.EQUAL,rr.NOT_EQUAL=Ar.NOT_EQUAL,rr.GREATER=Ar.GREATER,rr.GREATER_EQUAL=Ar.GREATER_EQUAL,rr.LESS=Ar.LESS,rr.LESS_EQUAL=Ar.LESS_EQUAL,rr.AND=Ar.AND,rr.OR=Ar.OR;var Tl=class extends Te{constructor(e){super();this.nodeType="MaxMIPLevel";this.texture=e,this.maxMIPLevel=0}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.texture&&(t.texture=this.texture.toJSON(e).uuid),t.maxMIPLevel=this.maxMIPLevel),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.texture&&(this.texture=t.getNode(e.texture)),e.maxMIPLevel!==void 0&&(this.maxMIPLevel=e.maxMIPLevel),this}};Object.defineProperties(Tl.prototype,{value:{get:function(){if(this.maxMIPLevel===0){let r=this.texture.value.image;Array.isArray(r)&&(r=r[0]),this.maxMIPLevel=r!==void 0?Math.log(Math.max(r.width,r.height))*Math.LOG2E:0}return this.maxMIPLevel},set:function(){}}});var dg=class extends je{constructor(e=new ze,t){super("f");this.nodeType="SpecularMIPLevel";this.roughness=e,this.texture=t}setTexture(e){return this.texture=e,this}generate(e,t){var n;if(e.isShader("fragment")){this.maxMIPLevel=(n=this.maxMIPLevel)!=null?n:new Tl,this.maxMIPLevel.texture=this.texture;let i=e.include(dg.Nodes.getSpecularMIPLevel);return e.format(i+"( "+this.roughness.build(e,"f")+", "+this.maxMIPLevel.build(e,"f")+" )",this.type,t)}else return console.warn("SpecularMIPLevelNode is not compatible with "+e.shader+" shader."),e.format("0.0",this.type,t)}copy(e){return super.copy(e),this.roughness=e.roughness,e.texture?this.texture?this.texture.copy(e.texture):this.texture=e.texture.clone():this.texture=void 0,e.maxMIPLevel?this.maxMIPLevel?this.maxMIPLevel.copy(e.maxMIPLevel):this.maxMIPLevel=e.maxMIPLevel.clone():this.maxMIPLevel=void 0,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.texture&&(t.texture=this.texture.toJSON(e).uuid),this.roughness&&(t.roughness=this.roughness.toJSON(e).uuid),this.maxMIPLevel&&(t.maxMIPLevel=this.maxMIPLevel.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.roughness&&(this.roughness=t.getNode(e.roughness)),e.texture&&(this.texture=t.getNode(e.texture)),e.maxMIPLevel&&(this.maxMIPLevel=t.getNode(e.maxMIPLevel)),this}},Wd=dg;Wd.Nodes=function(){return{getSpecularMIPLevel:new Le(["float getSpecularMIPLevel( const in float roughness, const in float maxMIPLevelScalar ) {"," float sigma = PI * roughness * roughness / ( 1.0 + roughness );"," float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );"," return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );","}"].join(`
`))}}();var NM={Int:it,Float:Te,Bool:mc,Vector2:In,Vector3:Un,Vector4:yc,Matrix3:zr,Matrix4:ug,FloatArray:Ba,Vector4Array:Ra,Normal:mn,Position:_n,Reflect:Qi,UV:bo,Attribute:lg,Const:rt,Struct:Ao,Varying:cg,SpecularMIPLevel:Wd,MaxMIPLevel:Tl,ColorSpace:Bt,Noise:Wa,TextureCubeUV:_o,TextureCube:vc,Operator:Yn,Math:Ye,Cond:rr,Fresnel:Ga,Rainbow:ka,Transmission:Va,Depth:qa,Blend:Xa,Raw:Qa,CubeTexture:xc,Texture:kn,CustomTexture:za,VertexDisplacement:Mo,CustomNormal:Ha,Gradient:ja,Matcap:Ya,Expression:yt,Color:ct,Phong:wc,Basic:bc,Lambert:Sc,Standard:Tc,Toon:Ac};var Jd=class{constructor(){this._nodes={};this._dataNodes={};this._textures={};this.uuid=Ee.generateUUID()}init(e,t){this._dataNodes=e,this._textures=t}clear(){this._nodes={},this._dataNodes={},this._textures={}}getNode(e){let t=this._nodes[e];return t||(t=this.createNode(e)),t}getNodeData(e){return this._dataNodes[e]}getTexture(e){let t=this._textures[e];return t||new bi}createNode(e){let t=this._dataNodes[e];if(!t)throw new Error("Failed to create Node from uuid: "+e+", its data does not seem to exist");let n=NM[t.nodeType];if(!n)throw new Error("Failed to create Node from uuid: "+e+" and nodeType: "+t.nodeType+", constructor for this not is not registered");let i=new n().fromJSON(t,this);return this._nodes[e]=i,i}};function CM(r){wF(r.geometries),SF(r.interactionStates),LM(r.object),MF(r.materials)}function wF(r){var e;if(r!==void 0){for(let t of r)if(((e=t.userData)==null?void 0:e.type)!==void 0){let n=t.userData.parameters;"extrudeDepth"in n||Object.assign(n,{extrudeDepth:0}),"extrudeBevelSize"in n||Object.assign(n,{extrudeBevelSize:0}),"extrudeBevelSegments"in n||Object.assign(n,{extrudeBevelSegments:1})}}}function SF(r){if(r!==void 0){for(let e of r)if(e.quaternion!==void 0){let t=new Tt().fromArray(e.quaternion);Object.assign(e,{rotation:new On().setFromQuaternion(t).toArray()})}}}function LM(r){var e,t,n,i;if(((e=r.userData)==null?void 0:e.type)===void 0)if(r.type==="OrthographicCamera"||r.type==="PerspectiveCamera"){let s=r;Object.assign(r,{objectType:"CombinedCamera",cameraType:s.type,isDefaultCamera:!0,hiddenMatrix:new me().toArray(),name:"Default Camera",far:1e5,zoomOrtho:s.zoom,zoomPersp:1,nearOrtho:-5e4,nearPersp:50}),delete r.type,s.typeCamera!==void 0&&(Object.assign(r,{cameraType:s.typeCamera}),delete r.typeCamera)}else r.type==="Scene"?(Object.assign(r,{objectType:r.type}),delete r.type):r.type==="HemisphereLight"?Object.assign(r,{isDefaultAmbientLight:!0}):r.type==="DirectionalLight"&&Object.assign(r,{isDefaultDirectionalLight:!0});if(r.userData!==void 0){let s=r.userData;s.type!==void 0&&(Object.assign(r,{objectType:s.type}),delete s.type),s.interaction!==void 0&&(Object.assign(r,{interaction:s.interaction}),delete s.interaction),s.isDefaultAmbientLight===!0?(Object.assign(r,{isDefaultAmbientLight:!0}),delete s.isDefaultAmbientLight):s.isDefaultDirectionalLight===!0?(Object.assign(r,{isDefaultDirectionalLight:!0}),delete s.isDefaultDirectionalLight):s.isDefaultCamera===!0&&(Object.assign(r,{isDefaultCamera:!0}),delete s.isDefaultCamera),Object.assign(r,{raycastLock:s.lock,scaleLock:s.scaleLock,hiddenMatrix:(n=(t=s.hiddenMatrix)==null?void 0:t.elements)!=null?n:new me().toArray()}),delete s.lock,delete s.scaleLock,delete s.hiddenMatrix,delete s.isEntity}if(((i=r.interaction)==null?void 0:i.events)!==void 0){for(let s of r.interaction.events)if(s.targets!==void 0)for(let o of s.targets)o.springControls!==void 0&&(Object.assign(o,{springParameters:{mass:o.springControls[0],stiffness:o.springControls[1],damping:o.springControls[2],velocity:o.springControls[3]}}),delete o.springControls)}if(r.children!==void 0)for(let s of r.children)LM(s)}function MF(r){if(r!==void 0)for(let e of r){let n=e.userData.layers.head;for(;n;){for(let i in n.uniforms){let s=`f${n.id}_tex`,o=`f${n.id}_texture`;i===s&&(n.uniforms[o]=n.uniforms[s],delete n.uniforms[s])}n=n.next}}}function IM(r){PM(r.object,r.object)}function PM(r,e){var t;if(r.type==="HemisphereLight"||r.isDefaultAmbientLight===!0?e.ambientLight=r.uuid:((t=r.userData)==null?void 0:t.isDefaultDirectionalLight)===!0||r.isDefaultDirectionalLight===!0?e.directionalLight=r.uuid:r.isDefaultCamera===!0&&(e.camera=r.uuid,e.activeCamera=r.uuid,Object.assign(r,{name:"Default Camera"})),r.children!==void 0)for(let n of r.children)PM(n,e)}function DM(r){AF(r.object)}function AF(r){var e,t,n,i,s,o,a;if(r.objectType==="Scene"){let l=r.userData,c=(e=l.rgb)!=null?e:{r:25,g:25,b:25},u=(t=l.fogColor)!=null?t:{r:25,g:25,b:25};Object.assign(r,{color:[c.r/255,c.g/255,c.b/255],alpha:l.alpha,enableFog:l.fogEnable,fogUseBGColor:l.fogUseBGColor,fog:{color:new fe().setRGB(u.r/255,u.g/255,u.b/255).getHex(),near:l.fogNear,far:l.fogFar},directionalLightState:l.directionalLightState,ambientLightState:l.ambientLightState,shadowsState:l.shadowsState,wireframeState:l.wireframeState,canvas:{mode:(n=l.canvasMode)!=null?n:1,size:{width:(s=(i=l.canvasCustomSize)==null?void 0:i.width)!=null?s:512,height:(a=(o=l.canvasCustomSize)==null?void 0:o.height)!=null?a:512}}}),delete l.rgb,delete l.alpha,delete l.fogEnable,delete l.fogUseBGColor,delete l.fogColor,delete l.fogNear,delete l.fogFar,delete l.directionalLightState,delete l.ambientLightState,delete l.shadowsState,delete l.wireframeState,delete l.canvasMode,delete l.canvasFullScreen,delete l.canvasCustomSize}}function RM(r){return{uuid:Ee.generateUUID(),type:"b",value:r,nodeType:"Bool"}}function Si(r,e){let t=new fe().set(r);return{uuid:Ee.generateUUID(),type:"c",r:t.r,g:t.g,b:t.b,value:r,alpha:e==null?void 0:e.uuid,nodeType:"Color"}}function BM(r,e){return{uuid:Ee.generateUUID(),type:"f[]",size:r,value:e,nodeType:"FloatArray"}}function mt(r){return{uuid:Ee.generateUUID(),type:"f",value:r,nodeType:"Float"}}function an(r){return{uuid:Ee.generateUUID(),type:"i",value:r,nodeType:"Int"}}function El(r){let{x:e,y:t}=r;return{uuid:Ee.generateUUID(),type:"v2",x:e,y:t,nodeType:"Vector2"}}function fg(r){let{x:e,y:t,z:n}=r;return{uuid:Ee.generateUUID(),type:"v3",x:e,y:t,z:n,nodeType:"Vector3"}}function OM(r,e){return{uuid:Ee.generateUUID(),type:"v4[]",size:r,value:e,nodeType:"Vector4Array"}}function FM(r){return{uuid:Ee.generateUUID(),type:"m3",elements:r.elements,nodeType:"Matrix3"}}function zM(r,e){return{uuid:Ee.generateUUID(),type:"v4",value:r,uv:e.uuid,project:!1,nodeType:"Texture"}}function GM(r){return{uuid:Ee.generateUUID(),type:"v2",index:r,nodeType:"UV"}}function pg(r,e){let t={uuid:Ee.generateUUID(),type:"v3",nodeType:"Blend",a:r==null?void 0:r.uuid,b:e.uuid};return"mode"in e&&(t.mode=e.mode),t}function UM(r,e){let t=r.uniforms,n=r.id,i=mt(t[`f${n}_alpha`].value),s=an(t[`f${n}_mode`].value);return[i,s].forEach(o=>e[o.uuid]=o),Object.assign(r,{uniforms:{[`f${n}_alpha`]:i.uuid,[`f${n}_mode`]:s.uuid}}),{uuid:Ee.generateUUID(),type:"v3",nodeType:"CustomTexture",alpha:i.uuid,mode:s.uuid}}function mg(r,e){let t=r.uniforms,n=r.id,i=an(t[`f${n}_mode`].value),s=mt(t[`f${n}_alpha`].value),o=Si(t[`f${n}_color`].value,s);return[o,s,i].forEach(a=>e[a.uuid]=a),Object.assign(r,{uniforms:{[`f${n}_color`]:o.uuid,[`f${n}_alpha`]:s.uuid,[`f${n}_mode`]:i.uuid}}),o}function kM(r,e){let t=r.uniforms,n=r.id,i=an(t[`f${n}_mode`].value),s=mt(t[`f${n}_alpha`].value),o=fg(t[`f${n}_cnormal`].value);return[o,s,i].forEach(a=>e[a.uuid]=a),Object.assign(r,{uniforms:{[`f${n}_cnormal`]:o.uuid,[`f${n}_alpha`]:s.uuid,[`f${n}_mode`]:i.uuid}}),{uuid:Ee.generateUUID(),type:"v3",nodeType:"CustomNormal",cnormal:o.uuid,alpha:s.uuid,mode:i.uuid}}function VM(r,e){let t=r.uniforms,n=r.id,i=an(t[`f${n}_mode`].value),s=mt(t[`f${n}_alpha`].value),o=mt(t[`f${n}_near`].value),a=mt(t[`f${n}_far`].value),l=mt(t[`f${n}_isVector`].value),c=fg(t[`f${n}_origin`].value),u=Si(t[`f${n}_colorA`].value),h=Si(t[`f${n}_colorB`].value);return[o,a,l,c,u,h,s,i].forEach(d=>e[d.uuid]=d),Object.assign(r,{uniforms:{[`f${n}_near`]:o.uuid,[`f${n}_far`]:a.uuid,[`f${n}_isVector`]:l.uuid,[`f${n}_origin`]:c.uuid,[`f${n}_colorA`]:u.uuid,[`f${n}_colorB`]:h.uuid,[`f${n}_alpha`]:s.uuid,[`f${n}_mode`]:i.uuid}}),{uuid:Ee.generateUUID(),type:"v3",nodeType:"Depth",near:o.uuid,far:a.uuid,isVector:l.uuid,origin:c.uuid,colorA:u.uuid,colorB:h.uuid,alpha:s.uuid,mode:i.uuid}}function HM(r,e){let t=r.uniforms,n=r.id,i=an(t[`f${n}_mode`].value),s=mt(t[`f${n}_alpha`].value),o=Si(t[`f${n}_color`].value),a=mt(t[`f${n}_bias`].value),l=mt(t[`f${n}_scale`].value),c=mt(t[`f${n}_intensity`].value),u=mt(t[`f${n}_factor`].value);return[o,a,l,c,u,s,i].forEach(h=>e[h.uuid]=h),Object.assign(r,{uniforms:{[`f${n}_color`]:o.uuid,[`f${n}_bias`]:a.uuid,[`f${n}_scale`]:l.uuid,[`f${n}_intensity`]:c.uuid,[`f${n}_factor`]:u.uuid,[`f${n}_alpha`]:s.uuid,[`f${n}_mode`]:i.uuid}}),{uuid:Ee.generateUUID(),type:"v3",nodeType:"Fresnel",color:o.uuid,bias:a.uuid,scale:l.uuid,intensity:c.uuid,factor:u.uuid,alpha:s.uuid,mode:i.uuid}}function jM(r,e){let t=r.uniforms,n=r.id,i=an(t[`f${n}_mode`].value),s=mt(t[`f${n}_alpha`].value),o=an(t[`f${n}_gl_type`].value),a=an(t[`f${n}_num`].value),l=RM(t[`f${n}_smooth`].value),c=OM(10,t[`f${n}_colors`].value),u=BM(10,t[`f${n}_steps`].value),h=El(t[`f${n}_offset`].value),d=El(t[`f${n}_morph`].value),f=mt(t[`f${n}_angle`].value);return[o,a,l,c,u,h,d,f,s,i].forEach(p=>e[p.uuid]=p),Object.assign(r,{uniforms:{[`f${n}_gl_type`]:o.uuid,[`f${n}_num`]:a.uuid,[`f${n}_smooth`]:l.uuid,[`f${n}_colors`]:c.uuid,[`f${n}_steps`]:u.uuid,[`f${n}_offset`]:h.uuid,[`f${n}_morph`]:d.uuid,[`f${n}_angle`]:f.uuid,[`f${n}_alpha`]:s.uuid,[`f${n}_mode`]:i.uuid}}),{uuid:Ee.generateUUID(),type:"v3",nodeType:"Gradient",gl_type:o.uuid,num:a.uuid,smooth:l.uuid,colors:c.uuid,steps:u.uuid,offset:h.uuid,morph:d.uuid,angle:f.uuid,alpha:s.uuid,mode:i.uuid}}function WM(r,e){let t=r.uniforms,n=r.id,i=Ee.generateUUID(),s=an(t[`f${n}_mode`].value),o=mt(t[`f${n}_alpha`].value),a=mt(t[`f${n}_crop`].value),l=GM(0),c=zM(t[`f${n}_texture`].value,l),u=FM(t[`f${n}_mat`].value);return[c,l,u,a,o,s].forEach(h=>e[h.uuid]=h),Object.assign(r,{uniforms:{[`f${n}_texture`]:c.uuid,[`f${n}_mat`]:u.uuid,[`f${n}_crop`]:a.uuid,[`f${n}_alpha`]:o.uuid,[`f${n}_mode`]:s.uuid}}),{uuid:i,type:"v3",nodeType:"CustomTexture",texture:c.uuid,crop:a.uuid,alpha:o.uuid,mode:s.uuid}}function JM(r,e){let t=r.uniforms,n=r.id,i=an(t[`f${n}_mode`].value),s=mt(t[`f${n}_alpha`].value),o=mt(t[`f${n}_scale`].value),a=mt(t[`f${n}_move`].value),l=El(t[`f${n}_fA`].value),c=El(t[`f${n}_fB`].value),u=El(t[`f${n}_distortion`].value),h=Si(t[`f${n}_colorA`].value),d=Si(t[`f${n}_colorB`].value),f=Si(t[`f${n}_colorC`].value),p=Si(t[`f${n}_colorD`].value),m=an(t[`f${n}_intA`].value),v=an(t[`f${n}_intB`].value),g=an(t[`f${n}_intC`].value),y=an(t[`f${n}_intD`].value);return[o,a,l,c,u,h,d,f,p,m,v,g,y,s,i].forEach(x=>e[x.uuid]=x),Object.assign(r,{uniforms:{[`f${n}_scale`]:o.uuid,[`f${n}_move`]:a.uuid,[`f${n}_fA`]:l.uuid,[`f${n}_fB`]:c.uuid,[`f${n}_distortion`]:u.uuid,[`f${n}_colorA`]:h.uuid,[`f${n}_colorB`]:d.uuid,[`f${n}_colorC`]:f.uuid,[`f${n}_colorD`]:p.uuid,[`f${n}_intA`]:m.uuid,[`f${n}_intB`]:v.uuid,[`f${n}_intC`]:g.uuid,[`f${n}_intD`]:y.uuid,[`f${n}_alpha`]:s.uuid,[`f${n}_mode`]:i.uuid}}),{uuid:Ee.generateUUID(),type:"v3",nodeType:"Noise",scale:o.uuid,move:a.uuid,fA:l.uuid,fB:c.uuid,distortion:u.uuid,colorA:h.uuid,colorB:d.uuid,colorC:f.uuid,colorD:p.uuid,intA:m.uuid,intB:v.uuid,intC:g.uuid,intD:y.uuid,alpha:s.uuid,mode:i.uuid}}function gg(r,e,t){let n=e.uniforms,i=e.id,s=mt(n[`f${i}_alpha`].value),o=an(n[`f${i}_mode`].value);return[s,o].forEach(a=>t[a.uuid]=a),Object.assign(e,{uniforms:{[`f${i}_alpha`]:s.uuid,[`f${i}_mode`]:o.uuid}}),{uuid:Ee.generateUUID(),type:"basic",nodeType:"Basic",shadingAlpha:s.uuid,shadingBlend:o.uuid}}function XM(r,e,t){var c,u;let n=e.uniforms,i=e.id,s=Si((c=r.specular)!=null?c:69905),o=mt((u=r.shininess)!=null?u:30),a=mt(n[`f${i}_alpha`].value),l=an(n[`f${i}_mode`].value);return[s,o,a,l].forEach(h=>t[h.uuid]=h),Object.assign(e,{uniforms:{[`f${i}_alpha`]:a.uuid,[`f${i}_mode`]:l.uuid}}),{uuid:Ee.generateUUID(),type:"phong",nodeType:"Phong",specular:s.uuid,shininess:o.uuid,shadingAlpha:a.uuid,shadingBlend:l.uuid}}function qM(r,e,t){var c,u;let n=e.uniforms,i=e.id,s=Si((c=r.emissive)!=null?c:0),o=mt((u=r.emissiveIntensity)!=null?u:1),a=mt(n[`f${i}_alpha`].value),l=an(n[`f${i}_mode`].value);return[o,s,a,l].forEach(h=>t[h.uuid]=h),Object.assign(e,{uniforms:{[`f${i}_alpha`]:a.uuid,[`f${i}_mode`]:l.uuid}}),{uuid:Ee.generateUUID(),type:"lambert",nodeType:"Lambert",emissiveIntensity:o.uuid,emissive:s.uuid,shadingAlpha:a.uuid,shadingBlend:l.uuid}}function YM(r,e,t){var c,u;let n=e.uniforms,i=e.id,s=Si((c=r.specular)!=null?c:69905),o=mt((u=r.shininess)!=null?u:30),a=mt(n[`f${i}_alpha`].value),l=an(n[`f${i}_mode`].value);return[s,o,a,l].forEach(h=>t[h.uuid]=h),Object.assign(e,{uniforms:{[`f${i}_alpha`]:a.uuid,[`f${i}_mode`]:l.uuid}}),{uuid:Ee.generateUUID(),type:"toon",nodeType:"Toon",specular:s.uuid,shininess:o.uuid,shadingAlpha:a.uuid,shadingBlend:l.uuid}}function KM(r,e,t){var u,h,d;let n=e.uniforms,i=e.id,s=mt((u=r.roughness)!=null?u:.3),o=mt((h=r.metalness)!=null?h:0),a=mt((d=r.reflectivity)!=null?d:.5),l=mt(n[`f${i}_alpha`].value),c=an(n[`f${i}_mode`].value);return[s,o,a,l,c].forEach(f=>t[f.uuid]=f),Object.assign(e,{uniforms:{[`f${i}_alpha`]:l.uuid,[`f${i}_mode`]:c.uuid}}),{uuid:Ee.generateUUID(),type:"standard",nodeType:"Standard",roughness:s.uuid,metalness:o.uuid,reflectivity:a.uuid,shadingAlpha:l.uuid,shadingBlend:c.uuid}}var QM=new me,_F=["RectangleGeometry","TriangleGeometry","PolygonGeometry","StarGeometry"];function ZM(r){let e={};NF(r.materials,e),EF(r.interactionStates,e),TF(r.geometries,r.object),Object.keys(e).length&&(r.nodes=IF(e))}function $M(r,e){let t=r.geometry;if(t&&t===e)return r;let n=r.children;if(n)for(let i=0,s=n.length;i<s;i++){let o=n[i],a=$M(o,e);if(a!==void 0)return a}}function TF(r,e){var t;if(r!==void 0){for(let n of r)if(n.userData&&_F.includes((t=n.userData)==null?void 0:t.type)){let i=n.userData.parameters,s=i.extrudeBevelSize;if(s>0){i.width+=s*2,i.height+=s*2,i.extrudeDepth+=s*2;let o=$M(e,n.uuid);if(o!==void 0){let a=new Ke;QM.fromArray(o.matrix),a.applyMatrix4(QM),a.position.z-=s,a.updateMatrix(),o.matrix=a.matrix.toArray()}}}}}function EF(r,e){if(r!==void 0){for(let t of r)if(t.material)if(Array.isArray(t.material))for(let n of t.material)for(let i of n.layersList)pu(i,e);else for(let n of t.material.layersList)pu(n,e)}}function NF(r,e){if(r!==void 0)for(let t of r){let{beforeLayers:n,lightingLayer:i,afterLayers:s}=CF(t.userData.layers);if(!i){console.error("Material upgrade: could not find a ligthing layer");continue}let o=LF(t,i,e);if(e[o.uuid]=o,n.length>0){let a=pu(n[0],e);e[a.uuid]=a;for(let l=1,c=n.length;l<c;++l){let u=n[l],h=pu(u,e),d=pg(a,h);e[d.uuid]=d,e[h.uuid]=h,a=d}o.color=a.uuid}if(s.length>0){let a;for(let l of s){let c=pu(l,e),u=pg(a,c);e[u.uuid]=u,e[c.uuid]=c,a=u}o.afterColor=a==null?void 0:a.uuid}Object.assign(t,{type:"ShaderMaterial",wireframeLinecap:"",wireframeLinejoin:"",vertex:o==null?void 0:o.uuid,fragment:o==null?void 0:o.uuid}),delete t.color,delete t.emissive,delete t.specular,delete t.shininess,delete t.roughness,delete t.metalness}}function CF(r){let e=[],t=[],n,i=r.head;for(;i;){if(i.type==="light"){n=i,i=i.next;break}e.push(i),i=i.next}for(;i;)t.unshift(i),i=i.next;return{beforeLayers:e,lightingLayer:n,afterLayers:t}}function LF(r,e,t){let n,i;switch(r.userData.type){case"BasicMaterial":n=gg(r,e,t),i="BasicNodeMaterial";break;case"PhongMaterial":n=XM(r,e,t),i="PhongNodeMaterial";break;case"LambertMaterial":n=qM(r,e,t),i="LambertNodeMaterial";break;case"ToonMaterial":n=YM(r,e,t),i="ToonNodeMaterial";break;case"PhysicalMaterial":n=KM(r,e,t),i="StandardNodeMaterial";break;default:console.warn(`Material upgrade: could not find a properly material node to ${r.userData.type}`),n=gg(r,e,t),i="BasicNodeMaterial"}return Object.assign(r.userData,{nodeType:i}),n}function pu(r,e){switch(r.type){case"light":return UM(r,e);case"color":return mg(r,e);case"depth":return VM(r,e);case"fresnel":return HM(r,e);case"gradient":return jM(r,e);case"noise":return JM(r,e);case"normal":return kM(r,e);case"texture":return WM(r,e);default:return console.warn(`Material upgrade: could not find a properly "layer" node to ${r.type}`),mg(r,e)}}function IF(r){let e=[];for(let t in r)e.push(r[t]);return e}function yg(r){let e=r.metadata;return console.info(`File format version ${e==null?void 0:e.version}`),(e==null?void 0:e.version)===void 0?(console.warn("Unknow file version"),!1):((e.version<=1.1||e.version===4.5)&&(CM(r),e.version=1.2,console.warn("File upgraded from v1.1 or inferior to v1.2")),e.version===1.2&&(IM(r),e.version=1.3,console.warn("File upgraded from v1.2 to v1.3")),e.version===1.3&&(DM(r),e.version=1.4,console.warn("File upgraded from v1.3 to v1.4")),e.version===1.4&&(ZM(r),e.version=1.5,console.warn("File upgraded from v1.4 to v1.5")),!0)}var nA=Cg(tA()),iA=new me,PF=new me,DF=new me,RF=new me,Nl=class extends Vn{constructor(e=Qn.create({}),t=new Ci){super(e,t);this.objectType="SubdivObject";this.resized=!1;this.newlyPasted=!1;this.matrixWorldRigid=new me;this.scaleMatrix=new me;this.hiddenMatrixOld=new me;this.isNegativeDeterminant=!1;this.isUniformScaling=!0;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1,this.subdivPointer=Qn.activeSubdivPtr}toJSON(e){let t=super.toJSON(e);return t.object.objectType="SubdivObject",t}updateGeometry(e){let t=this.geometry,n=Uc[t.userData.type],i=this.objectType==="SubdivObject"?Object.assign({},t.userData,{geometry:t,subdivPointer:this.subdivPointer,smoothShading:this.smoothShading}):t.userData,s=n.build(n.normalizeInputs(e,i));this.geometry.dispose(),this.geometry=s}clone(e){var a,l;if(this.resized){this.resized=!1;let c;this.geometry.userData.parameters.subdivisions>0?c=this.geometry.originalGeometry:c=this.geometry,Qn.allocate(c),this.subdivPointer=Qn.activeSubdivPtr}let t=this.material.clone(),n=Qn.clone(Ue({},this.geometry.userData.parameters),this.subdivPointer,this.smoothShading),i=(a=this.geometry.originalGeometry)!=null?a:this.geometry,s=(l=n.originalGeometry)!=null?l:n;s.boundingSphere=i.boundingSphere.clone();let o=new Nl(n,t).copy(this,e);return o.subdivPointer=Qn.activeSubdivPtr,o}raycast(e,t){let n=this.geometry.originalGeometry;if(n){let i=this.geometry;this.geometry=n,Vn.prototype.raycast.call(this,e,t),this.geometry=i}else Vn.prototype.raycast.call(this,e,t)}applySVDScaling(){let e=this.matrixWorld.elements,t=[[e[0],e[4],e[8]],[e[1],e[5],e[9]],[e[2],e[6],e[10]]],{u:n,v:i,q:s}=(0,nA.SVD)(t);this.isNegativeDeterminant=this.matrixWorld.determinant()<0,this.isUniformScaling=s.every(h=>Math.abs(s[0]-h)<.01);let o,a,l=iA.set(n[0][0],n[0][1],n[0][2],0,n[1][0],n[1][1],n[1][2],0,n[2][0],n[2][1],n[2][2],0,0,0,0,1),c=PF.set(i[0][0],i[0][1],i[0][2],0,i[1][0],i[1][1],i[1][2],0,i[2][0],i[2][1],i[2][2],0,0,0,0,1),u=DF.copy(c).transpose();if(o=RF.makeScale(s[0],s[1],s[2]).multiply(u).premultiply(c),a=l.multiply(u),!this.isUniformScaling){this.geometry.applyMatrix4(o);let h=this.geometry.originalGeometry;h?(h.applyMatrix4(o),h.getAttribute("positionWASM").applyMatrix4(o)):this.geometry.getAttribute("positionWASM").applyMatrix4(o),this.resized=!0}return{scaleMatrix:o,matrixWorldRigid:a}}revertSVDScaling(e){let t=this.geometry.originalGeometry;t?Qn.getTopologicalMesh(t):Qn.getTopologicalMesh(this.geometry);let n=e.elements,i=[n[0],n[5],n[10]];if(!i.every(o=>Math.abs(i[0]-o)<.01)){let o=iA.copy(this.scaleMatrix).invert();this.geometry.applyMatrix4(o),t?(t.applyMatrix4(o),t.getAttribute("positionWASM").applyMatrix4(o)):this.geometry.getAttribute("positionWASM").applyMatrix4(o),this.resized=!0}}};var vg=class{constructor(){this._buffers=[]}parse(e){var n;let t=new we;if(this._vertexData=e.vertexData,this._loadBuffers(this._vertexData.buffers),t.uuid=e.uuid,this._vertexData.accessors)for(let i=0,s=this._vertexData.accessors.length;i<s;++i){let o=this._vertexData.accessors[i].attributeName;o==="indices"?t.setIndex(this._loadAccessor(i)):t.setAttribute(o,this._loadAccessor(i))}if((n=e.data)==null?void 0:n.groups)for(let i of e.data.groups)t.addGroup(i.start,i.count,i.materialIndex);return t}_loadAccessor(e){let t=this._vertexData.accessors[e],n=this._loadBufferView(t.bufferView),i=OF[t.type],s=BF[t.componentType],o=new s(n.buffer);return new Re(o,i)}_loadBufferView(e){let t=this._vertexData.bufferViews[e],n=this._buffers[t.buffer],i=t.byteLength||0,s=t.byteOffset||0;return n.slice(s,s+i)}_loadBuffers(e){for(let t of e){if(!t.uri)continue;let n=t.uri.slice(t.uri.indexOf("base64")+7),i=atob(n),s=new Uint8Array(i.length);for(let o=0;o<i.length;o++)s[o]=i.charCodeAt(o);this._buffers.push(s)}}},BF={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},OF={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var xg=new WeakMap,bg=class extends fn{constructor(e){super(e);this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,i){let s=new Xn(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,o=>{let a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,a).then(t).catch(i)},n,i)}decodeDracoFile(e,t,n,i){let s={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,s).then(t)}decodeGeometry(e,t){for(let l in t.attributeTypes){let c=t.attributeTypes[l];c.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=c.name)}let n=JSON.stringify(t);if(xg.has(e)){let l=xg.get(e);if(l.key===n)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i,s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(i=l,new Promise((c,u)=>{i._callbacks[s]={resolve:c,reject:u},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{i&&s&&this._releaseTask(i,s)}),xg.set(e,{key:n,promise:a}),a}_createGeometry(e){let t=new we;e.index&&t.setIndex(new Re(e.index.array,1));for(let n=0;n<e.attributes.length;n++){let i=e.attributes[n],s=i.name,o=i.array,a=i.itemSize;t.setAttribute(s,new Re(o,a))}return t}_loadLibrary(e,t){let n=new Xn(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((i,s)=>{n.load(e,i,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(n=>{let i=n[0];e||(this.decoderConfig.wasmBinary=n[1]);let s=FF.toString(),o=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(s){let o=s.data;switch(o.type){case"decode":i._callbacks[o.id].resolve(o);break;case"error":i._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,s){return i._taskLoad>s._taskLoad?-1:1});let n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}};function FF(){let r,e;onmessage=function(o){let a=o.data;switch(a.type){case"init":r=a.decoderConfig,e=new Promise(function(u){r.onModuleLoaded=function(h){u({draco:h})},DracoDecoderModule(r)});break;case"decode":let l=a.buffer,c=a.taskConfig;e.then(u=>{let h=u.draco,d=new h.Decoder,f=new h.DecoderBuffer;f.Init(new Int8Array(l),l.byteLength);try{let p=t(h,d,f,c),m=p.attributes.map(v=>v.array.buffer);p.index&&m.push(p.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:p},m)}catch(p){console.error(p),self.postMessage({type:"error",id:a.id,error:p.message})}finally{h.destroy(f),h.destroy(d)}});break}};function t(o,a,l,c){let u=c.attributeIDs,h=c.attributeTypes,d,f,p=a.GetEncodedGeometryType(l);if(p===o.TRIANGULAR_MESH)d=new o.Mesh,f=a.DecodeBufferToMesh(l,d);else if(p===o.POINT_CLOUD)d=new o.PointCloud,f=a.DecodeBufferToPointCloud(l,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());let m={index:null,attributes:[]};for(let v in u){let g=self[h[v]],y,x;if(c.useUniqueIDs)x=u[v],y=a.GetAttributeByUniqueId(d,x);else{if(x=a.GetAttributeId(d,o[u[v]]),x===-1)continue;y=a.GetAttribute(d,x)}m.attributes.push(i(o,a,d,v,g,y))}return p===o.TRIANGULAR_MESH&&(m.index=n(o,a,d)),o.destroy(d),m}function n(o,a,l){let u=l.num_faces()*3,h=u*4,d=o._malloc(h);a.GetTrianglesUInt32Array(l,h,d);let f=new Uint32Array(o.HEAPF32.buffer,d,u).slice();return o._free(d),{array:f,itemSize:1}}function i(o,a,l,c,u,h){let d=h.num_components(),p=l.num_points()*d,m=p*u.BYTES_PER_ELEMENT,v=s(o,u),g=o._malloc(m);a.GetAttributeDataArrayForAllPoints(l,h,v,m,g);let y=new u(o.HEAPF32.buffer,g,p).slice();return o._free(g),{name:c,array:y,itemSize:d}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}function Cl(r){let e;return r instanceof Array?(e={},r.forEach(t=>{e[t.uuid]=t})):e=r,e}function rA(r,e){return r[e]===void 0&&console.warn("ObjectLoader > getGeometry: undefined geometry",e),r[e]}function sA(r,e){if(e!==void 0){if(e instanceof Array){let t=[];for(let n=0,i=e.length;n<i;n++){let s=e[n];r[s]===void 0&&console.warn("ObjectLoader > getMaterial: undefined material",s),t.push(r[s])}return t}return r[e]===void 0&&console.warn("ObjectLoader > getMaterial: undefined material",e),r[e]}}var wg=class extends gx(Ap){constructor(){super(...arguments);this.path="";this.resourcePath=""}async loadFromFile(e){var s;let t=await LS(e,this.manager,Ds.TEXT),{object:n,materials:i}=this.parse(JSON.parse(t));return n.name=(s=e.name.split(".").shift())!=null?s:e.name,this.manager.itemEnd(e.name),{scene:n,materials:i}}load(e,t,n,i){let s=this.path===""?Ei.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||s;let o=new Xn(this.manager);o.setPath(this.path),o.load(e,a=>{let l=null;try{l=JSON.parse(a)}catch(u){i!==void 0&&i(u),console.warn(`ObjectLoader > load: can't parse ${e}.`),console.error(u);return}let c=l.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry"){console.error("ObjectLoader: Can't load "+e);return}this.parse(l,t)},n,i)}parse(e,t){var d;if(yg(e)===!1)return console.error("File can not be parser"),{object:new zs,materials:{}};let n={},i=this.parseGeometries(e.geometries),s=this.loader.parseImages(e.images,()=>{t!==void 0&&t(u)}),o=this.parseTextures(e.textures,s),a=new Jd;a.init(Cl((d=e.nodes)!=null?d:[]),Cl(o));let l=Cl(this.loader.parseMaterials(e.materials,o)),c=this.customParseMaterials(l,e.materials,a),u=this.parseObject(e.object,i,c,n);this.upgradeNoise(u);let h=this.parseInteractionStates(e.interactionStates,a);return this.parseInteractions(e.object,n,h),(e.images===void 0||e.images.length===0)&&t!==void 0&&t(u),{object:u,materials:c}}upgradeNoise(e){e.traverseEntity(t=>{var n;if(t.type==="Mesh"){let i=t,s=i.material;if(!s.userData)return;let o=(n=s.userData.layers)==null?void 0:n.head;for(;o;){if(o.type===lt.NOISE&&o.uniforms[`f${o.id}_size`].value.equals(new M(-1,-1,-1))&&(i.geometry.boundingBox||i.geometry.computeBoundingBox(),i.geometry.boundingBox)){let a=o.uniforms[`f${o.id}_scale`].value,{x:l,y:c,z:u}=i.geometry.boundingBox.max,h=Math.max(l,Math.max(c,u))/(a*a);o.uniforms[`f${o.id}_size`].value.x=h,o.uniforms[`f${o.id}_size`].value.y=h,o.uniforms[`f${o.id}_size`].value.z=h}o=o.next}}})}parseGeometries(e){var n,i;let t={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){let a=e[s],l;try{switch((n=a.userData)==null?void 0:n.type){case void 0:l=this.loader.parseGeometries([a])[a.uuid];break;case"NonParametricGeometry":a.vertexData?l=new vg().parse(a):l=this.loader.parseGeometries([a])[a.uuid],l.userData={};let c=Object.assign({},a.userData,{geometry:l});l=Lo.create(c);break;case"SubdivGeometry":l=this.loader.parseGeometries([a])[a.uuid],l=Qn.create({parameters:a.userData.parameters,geometry:l}),Qn.activeSubdivPtr=void 0;break;default:l=kc(a.userData)}l.uuid=a.uuid,a.name!==void 0&&(l.name=a.name),t[a.uuid]=l}catch(c){console.warn("ObjectLoader > parseGeometries: error parsing geometry of type .",(i=a.userData)==null?void 0:i.type),console.error(c)}}return t}async parseAsync(e){var h;if(yg(e)===!1)return console.error("File can not be parser"),new zs;let t=new Jd,n={},i=await this.parseGeometriesAsync(e.geometries),s=this.loader.parseImages(e.images,()=>{}),o=this.parseTextures(e.textures,s);t.init(Cl((h=e.nodes)!=null?h:[]),Cl(o));let a=Cl(this.loader.parseMaterials(e.materials,o)),l=this.customParseMaterials(a,e.materials,t),c=await this.parseObjectAsync(e.object,i,l,n),u=this.parseInteractionStates(e.interactionStates,t);return this.parseInteractions(e.object,n,u),c}async parseGeometriesAsync(e){var n,i;let t={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){let a=e[s],l;try{switch((n=a.userData)==null?void 0:n.type){case void 0:l=this.loader.parseGeometries([a])[a.uuid];break;case"NonParametricGeometry":if(a.gltf){if(!this.gltfLoader){this.gltfLoader=new Zm;let d=new bg;d.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.4.2/"),this.gltfLoader.setDRACOLoader(d)}let u=await new Promise(d=>{this.gltfLoader.parse(JSON.stringify(a.gltf),"",d)}),h=[];u.scene.traverse(d=>{let f=d;f.isMesh&&h.push(f.geometry)}),h.length===1?l=h[0]:(h=Jm(h,d=>d.userData.groupIndex),l=tl.mergeBufferGeometries(h,!0),l.groups.forEach((d,f)=>{d.materialIndex=h[f].userData.materialIndex}))}else l=this.loader.parseGeometries([a])[a.uuid];l.userData={};let c=Object.assign({},a.userData,{geometry:l});l=Lo.create(c);break;default:l=kc(a.userData)}l.uuid=a.uuid,a.name!==void 0&&(l.name=a.name),t[a.uuid]=l}catch(c){console.warn("ObjectLoader > parseGeometries: error parsing geometry of type .",(i=a.userData)==null?void 0:i.type),console.error(c)}}return t}parseTextures(e,t){let n=this.loader.parseTextures(e,t);return Object.keys(n).forEach(i=>{let s=new bi().copy(n[i]);s.uuid=i,n[i]=s}),n}customParseMaterials(e,t,n){let i={};if(t!==void 0)for(let s=0,o=t.length;s<o;s++){let a=t[s],l=e[a.uuid],c=l.userData;if(c.type!==void 0){let u=wx[c.type];i[a.uuid]=u.fromJSON(l,a,n)}}return i}parseObject(e,t,n,i){let s;if(e.geometry!==void 0){let o=rA(t,e.geometry),a=sA(n,e.material);if(o){switch(e.objectType){case"Mesh2D":s=new Ml(o,a).fromJSON(e);break;case"Mesh3D":s=new Al(o,a).fromJSON(e);break;case"NonParametric":s=new Fd(o,a).fromJSON(e);break;case"TextFrame":s=new Os(o,a),s.fromJSONasync(e).then(()=>{}).catch(()=>{});break;case"VectorObject":s=new Ps(o,a).fromJSON(e);break;case"SubdivObject":s=new Nl(o,a).fromJSON(e),s.subdivPointer=o.subdivPointer;break;default:console.warn("ObjectLoader > parseObject: unsupported object type",e.objectType);return}a||(s.name+=" (Recovered)")}else s=new Pi().fromJSON(e),s.name+=" (Recovered)",console.warn("An empty object is created instead")}else switch(e.objectType){case"Scene":s=new zs().fromJSON(e);break;case"CombinedCamera":s=new Sr().fromJSON(e);break;case"LightDirectional":s=new Rd().fromJSON(e);break;case"LightPoint":s=new Bd().fromJSON(e);break;case"LightSpot":s=new Od().fromJSON(e);break;case"EmptyObject":s=new Pi().fromJSON(e);break;default:if(e.type==="HemisphereLight"||e.type==="DirectionalLight")s=this.loader.parseObject(e,t,n);else{console.warn("ObjectLoader > parseObject: unsupported object type",e.objectType);return}}if(ei(s)&&(i[e.uuid]=s),e.children!==void 0)for(let o of e.children){let a=this.parseObject(o,t,n,i);a!==void 0&&s.add(a)}return s instanceof zs&&s.initFromObjectLoader(e),s}async parseObjectAsync(e,t,n,i){let s;if(e.geometry!==void 0){let o=rA(t,e.geometry),a=sA(n,e.material);if(o){switch(e.objectType){case"Mesh2D":s=new Ml(o,a).fromJSON(e);break;case"Mesh3D":s=new Al(o,a).fromJSON(e);break;case"NonParametric":s=new Fd(o,a).fromJSON(e);break;case"TextFrame":s=new Os(o,a);try{await s.fromJSONasync(e)}catch(l){console.log(l)}break;case"VectorObject":s=new Ps(o,a).fromJSON(e);break;case"SubdivObject":s=new Nl(o,a).fromJSON(e),s.subdivPointer=o.subdivPointer;break;default:console.warn("ObjectLoader > parseObject: unsupported object type",e.objectType);return}a||(s.name+=" (Recovered)")}else s=new Pi().fromJSON(e),s.name+=" (Recovered)",console.warn("An empty object is created instead")}else switch(e.objectType){case"Scene":s=new zs().fromJSON(e);break;case"CombinedCamera":s=new Sr().fromJSON(e);break;case"LightDirectional":s=new Rd().fromJSON(e);break;case"LightPoint":s=new Bd().fromJSON(e);break;case"LightSpot":s=new Od().fromJSON(e);break;case"EmptyObject":s=new Pi().fromJSON(e);break;default:if(e.type==="HemisphereLight"||e.type==="DirectionalLight")s=this.loader.parseObject(e,t,n);else{console.warn("ObjectLoader > parseObject: unsupported object type",e.objectType);return}}if(ei(s)&&(i[e.uuid]=s),e.children!==void 0)for(let o of e.children){let a=await this.parseObjectAsync(o,t,n,i);a!==void 0&&s.add(a)}return s instanceof zs&&s.initFromObjectLoader(e),s}parseInteractionStates(e,t){let n={};if(e!==void 0)for(let i=0,s=e.length;i<s;i++){let o=new bs().fromJSON(e[i],t);n[o.uuid]=o}return n}parseInteractions(e,t,n){let i=t[e.uuid];if(e.interaction!==void 0&&i!==void 0&&(i.interaction=new Ls(i).fromJSON(e.interaction,t,n)),e.children!==void 0)for(let s of e.children)this.parseInteractions(s,t,n)}};var Sg=class{constructor(e,t,n,i){this.isEnable=!1;this._enableEvent={};this._map={};this._prevAncestors=[];this._raycaster=new Up;this._intersection=new M;this._plane=new ni;this._normal=new M;this._position=new M;this._onMouseDown=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._handleMouseDownEvent()};this._onMouseUp=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._handleMouseUpEvent()};this._onMouseMove=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent()};this._onTouchStart=e=>{e.touches.length===1&&(e.preventDefault(),this._raycaster.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseDownEvent(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent())};this._onTouchEnd=()=>{this._handleMouseUpEvent(),this._handleMouseHoverEvent(!0)};this._onTouchMove=e=>{e.touches.length===1&&(e.preventDefault(),e.stopPropagation(),this._raycaster.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent())};this._onKeyDown=e=>{this._handleKeyDownEvent(e.key)};this._onKeyUp=e=>{this._handleKeyUpEvent(e.key)};this._domElement=e,this._scene=t,this._camera=n,this._app=i}activate(){this.isEnable=!0,this._scene.traverseEntity(e=>{if(e.interaction!==void 0){e.interaction.start();for(let t of e.interaction.events){let n=t.type;this._enableEvent[n]=!0,(n===Ze.KEY_DOWN||n===Ze.KEY_UP||n===Ze.START||n===Ze.LOOK_AT||n===Ze.FOLLOW)&&(this._map[n]===void 0&&(this._map[n]=[]),this._map[n].push(e))}}}),this._enableEvent[Ze.START]!==void 0&&this._handleStartEvent(),this._enableEvent[Ze.MOUSE_DOWN]!==void 0&&(this._domElement.addEventListener("pointerdown",this._onMouseDown,!1),this._domElement.addEventListener("touchstart",this._onTouchStart,!1)),this._enableEvent[Ze.MOUSE_UP]!==void 0&&(this._domElement.addEventListener("pointerup",this._onMouseUp,!1),this._domElement.addEventListener("touchend",this._onTouchEnd,!1)),(this._enableEvent[Ze.MOUSE_HOVER]!==void 0||this._enableEvent[Ze.LOOK_AT]!==void 0||this._enableEvent[Ze.FOLLOW]!==void 0)&&(this._domElement.addEventListener("pointermove",this._onMouseMove,!1),this._domElement.addEventListener("touchstart",this._onTouchStart,!1),this._domElement.addEventListener("touchend",this._onTouchEnd,!1),this._domElement.addEventListener("touchmove",this._onTouchMove,!1)),this._enableEvent[Ze.KEY_DOWN]!==void 0&&document.addEventListener("keydown",this._onKeyDown,!1),this._enableEvent[Ze.KEY_UP]!==void 0&&document.addEventListener("keyup",this._onKeyUp,!1)}deactivate(){this._scene.traverseEntity(e=>{e.interaction!==void 0&&e.interaction.end(),e.interaction.cache=void 0}),this._domElement.removeEventListener("pointerdown",this._onMouseDown),this._domElement.removeEventListener("pointerup",this._onMouseUp),this._domElement.removeEventListener("pointermove",this._onMouseMove),this._domElement.removeEventListener("touchstart",this._onTouchStart),this._domElement.removeEventListener("touchend",this._onTouchEnd),this._domElement.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("keyup",this._onKeyUp),this._enableEvent={},this._map={},this.isEnable=!1}reset(){this._scene.traverseEntity(e=>{e.interaction.start()}),this._handleStartEvent()}_getPointer(e,t){let n=this._domElement.getBoundingClientRect();return{x:(e-n.left)/n.width*2-1,y:-((t-n.top)/n.height)*2+1}}_handleStartEvent(){var e;(e=this._map[Ze.START])==null||e.forEach(t=>{var n;(n=t.interactionCache.start)==null||n.dispatch()})}_handleMouseDownEvent(){var t;let e=this._raycastMesh(this._raycaster);for(let n=0,i=e.length;n<i;++n){let s=e[n].object;if((t=s.interactionCache.mouseDown)==null||t.dispatch(),s.traverseAncestors(o=>{var a;o instanceof Pi&&((a=o.interactionCache.mouseDown)==null||a.dispatch())}),!s.interactionCache.follow)break}}_handleMouseUpEvent(){var t;let e=this._raycastMesh(this._raycaster);for(let n=0,i=e.length;n<i;++n){let s=e[n].object;if((t=s.interactionCache.mouseUp)==null||t.dispatch(),s.traverseAncestors(o=>{var a;o instanceof Pi&&((a=o.interactionCache.mouseUp)==null||a.dispatch())}),!s.interactionCache.follow)break}}_handleMouseHoverEvent(e=!1){var t,n;if(this._enableEvent[Ze.MOUSE_HOVER]!==void 0){let i;if(!e){let o=this._raycastMesh(this._raycaster).find(a=>!a.object.interactionCache.follow);i=o?o.object:void 0}if(this._prevObject!==i){this._prevObject!==void 0&&((t=this._prevObject.interactionCache.mouseHover)==null||t.dispatchReverse()),i!==void 0&&((n=i.interactionCache.mouseHover)==null||n.dispatch());let s=[];i==null||i.traverseAncestors(l=>{l instanceof Pi&&l.interactionCache.mouseHover&&s.push(l)}),this._prevAncestors.filter(l=>{var c;return s.includes(l)?!1:((c=l.interactionCache.mouseHover)==null||c.dispatchReverse(),!0)});let o=s.filter(l=>{var c;return this._prevAncestors.includes(l)?!1:((c=l.interactionCache.mouseHover)==null||c.dispatch(),!0)}),a=this._prevAncestors.filter(l=>s.includes(l));this._prevAncestors=[...a,...o]}this._prevObject=i}}_handleLookAtEvent(){var e;(e=this._map[Ze.LOOK_AT])==null||e.forEach(t=>{var i;let n=(i=t.interactionCache.lookAt)==null?void 0:i.distance;n!==void 0&&(this._plane.set(this._normal,-n),this._raycaster.ray.intersectPlane(this._plane,this._intersection),t.interaction.lookAt(this._intersection))}),this._app.skipRender=!1}_handleFollowEvent(){var e;(e=this._map[Ze.FOLLOW])==null||e.forEach(t=>{this._plane.setFromNormalAndCoplanarPoint(this._normal,t.getWorldPosition(this._position)),this._raycaster.ray.intersectPlane(this._plane,this._intersection),t.interaction.follow(this._intersection)}),this._app.skipRender=!1}_handleKeyDownEvent(e){var t;(t=this._map[Ze.KEY_DOWN])==null||t.forEach(n=>{var s;let i=(s=n.interactionCache.keyDown)==null?void 0:s.find(o=>o.key===e);i==null||i.dispatch()})}_handleKeyUpEvent(e){var t;(t=this._map[Ze.KEY_UP])==null||t.forEach(n=>{var s;let i=(s=n.interactionCache.keyUp)==null?void 0:s.find(o=>o.key===e);i==null||i.dispatch()})}_raycastMesh(e){let t=[],n=i=>{for(let s of i.children)ei(s)&&!s.raycastLock&&s.visible&&(wS(s)&&e.intersectObject(s,!1,t),n(s))};return n(this._scene),t}};var Mg=class{constructor(e,t,n,i,s){this._aspect=1;this._renderer=e,this._camera=t,this._frameSize=new O().copy(n),this._editorSize=new O().copy(i),this._aspect=t.aspect,this._fov=s!=null?s:t.fov}set frameSize(e){this._frameSize.copy(e)}updateRenderer(){!this._renderer||this._renderer.setSize(this._frameSize.x,this._frameSize.y)}updateViewport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,n=this._editorSize.x,i=this._editorSize.y,s=0,o=0,a=e,l=t;e<n&&(s=(n-e)*.5,s=-s,a=n),t<i&&(o=(i-t)*.5,o=-o,l=i),this._aspect=a/l,this._renderer.setViewport(s,o,a,l)}updateCamera(){if(!!this._camera)if(this._camera.cameraType==="PerspectiveCamera"){let e=this._frameSize.y,t=this._editorSize.y,n=this._fov;if(e>t){let i=zF(e,1080,2160,1,15)/100;n*=e/t,n*=1-i}this._camera.aspect=this._aspect,this._camera.fov=n,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y)}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t),this._camera.updateProjectionMatrix())}};function zF(r,e,t,n,i){return(r-e)/(t-e)*(i-n)+n}var ko;(function(t){t[t.FULLSCREEN=1]="FULLSCREEN",t[t.CUSTOM=2]="CUSTOM"})(ko||(ko={}));var GF=class{constructor(){this._needsTransmission=!0;this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this.skipRender=!0;this.render=()=>{var t;requestAnimationFrame(this.render);let e=Ls.isAllAnimationsEnded;if(!(this.skipRender&&(e===void 0||e))){if(!this._renderer){console.error("Application::render >>> tried to renderer without a renderer");return}this._controls&&(this._controls.enableDamping||this._controls.autoRotate)?this.skipRender=!this._controls.update():this.skipRender=!0,this._playmode&&!this._playmode.isEnable&&this._playmode.activate(),this._scene&&this._camera&&(this._renderer.autoClear=!1,this._needsTransmission&&this.renderTransmissionTarget(),((t=this._scene.postprocessing)==null?void 0:t.enabled)?(this._renderer.autoClear=!1,this._scene.postprocessing.render()):(this._renderer.autoClear=!0,this._renderer.render(this._scene,this._camera)))}};this.resize=()=>{var e,t,n,i;this.skipRender=!1,!!this._renderer&&(this._viewportMode===1&&(this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._frameView&&(this._frameView.frameSize=new O(this._viewportWidth,this._viewportHeight))),(e=this._frameView)==null||e.updateRenderer(),((t=this._scene)==null?void 0:t.postprocessing)&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight),this._viewportMode!==1&&((n=this._frameView)==null||n.updateViewport()),this._camera&&((i=this._frameView)==null||i.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&this._viewportMode===1&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()))};window.addEventListener("resize",Wm(this.resize,200))}async load(e){let n=await(await fetch(e,{credentials:"include",mode:"no-cors"})).json();await this.start(n)}async start(e){this._editorData=e.editor,this._needsTransmission=e.needsTransmission!==void 0?e.needsTransmission:!0;let n=await new wg().parseAsync(e);this._scene=n,this._camera=this._scene.activeCamera,this.init(),this.resize(),this.render()}renderTransmissionTarget(){!this._renderer||!this._transmissionRenderTarget||!this._scene||!this._camera||(this._renderer.setRenderTarget(this._transmissionRenderTarget),this._renderer.clear(),this._camera.layers.enable(0),this._camera.layers.disable(3),this._renderer.render(this._scene,this._camera),this._renderer.setRenderTarget(null),this._camera.layers.enable(3))}init(){var n,i,s,o;let e=document.getElementById("canvas3d");if(!this._scene||!this._camera)return;((n=this._scene.postprocessing)==null?void 0:n.enabled)?(this._renderer=new wt({canvas:e,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"}),this._scene.postprocessing.init({renderer:this._renderer,camera:this._camera,scene:this._scene})):this._renderer=new wt({canvas:e,antialias:!0,alpha:!0,stencil:!0,depth:!0,powerPreference:"high-performance"}),this._needsTransmission&&(this._transmissionRenderTarget=new bt(2048,2048,{generateMipmaps:!0,minFilter:Ai,magFilter:$e,wrapS:Zt,wrapT:Zt}),this._transmissionRenderTarget.depthTexture=new so(2048,2048),this._scene.traverseEntity(a=>{if(!(!(a instanceof Vn)||!this._transmissionRenderTarget)&&!Array.isArray(a.material)){let l=a.material.userData.layers.getLayersOfType(lt.TRANSMISSION);for(let c of l)c.uniforms[`f${c.id}_transmissionSamplerMap`].value=this._transmissionRenderTarget.texture,c.uniforms[`f${c.id}_transmissionDepthMap`].value=this._transmissionRenderTarget.depthTexture}})),this._viewportMode=(i=this._scene.canvas.mode)!=null?i:1,this._viewportWidth=(s=this._scene.canvas.size.width)!=null?s:window.innerWidth,this._viewportHeight=(o=this._scene.canvas.size.height)!=null?o:window.innerHeight,this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(this._viewportWidth,this._viewportHeight),this._scene.postprocessing&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight),this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=qd,this._renderer.setClearColor(this._scene.color,this._scene.alpha),this._frameView=new Mg(this._renderer,this._camera,new O(this._viewportWidth,this._viewportHeight),new O(this._scene.canvas.editorSize.width,this._scene.canvas.editorSize.height)),!0&&(this._controls=new Gp(this._camera,this._renderer.domElement),this._editorData&&(this._controls.fromJSON(this._editorData.orbitControls),this._controls.useKeyEvents=!1),this._controls.addEventListener("change",()=>this.skipRender=!1),this._controls.addEventListener("start",()=>this.skipRender=!1)),this._playmode=new Sg(this._renderer.domElement,this._scene,this._camera,this)}};ui.FONTS_PATH="_assets/_fonts/";export{GF as Application};