@splinetool/runtime 0.9.36 → 0.9.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/runtime.js +35 -35
- package/package.json +1 -1
package/build/runtime.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var oT=Object.create;var Mh=Object.defineProperty,aT=Object.defineProperties,lT=Object.getOwnPropertyDescriptor,cT=Object.getOwnPropertyDescriptors,uT=Object.getOwnPropertyNames,Sh=Object.getOwnPropertySymbols,hT=Object.getPrototypeOf,pm=Object.prototype.hasOwnProperty,dx=Object.prototype.propertyIsEnumerable;var fx=(i,e,t)=>e in i?Mh(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,se=(i,e)=>{for(var t in e||(e={}))pm.call(e,t)&&fx(i,t,e[t]);if(Sh)for(var t of Sh(e))dx.call(e,t)&&fx(i,t,e[t]);return i},be=(i,e)=>aT(i,cT(e));var px=(i,e)=>{var t={};for(var r in i)pm.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&Sh)for(var r of Sh(i))e.indexOf(r)<0&&dx.call(i,r)&&(t[r]=i[r]);return t};var fT=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),dT=(i,e)=>{for(var t in e)Mh(i,t,{get:e[t],enumerable:!0})},pT=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of uT(e))!pm.call(i,n)&&n!==t&&Mh(i,n,{get:()=>e[n],enumerable:!(r=lT(e,n))||r.enumerable});return i};var mT=(i,e,t)=>(t=i!=null?oT(hT(i)):{},pT(e||!i||!i.__esModule?Mh(t,"default",{value:i,enumerable:!0}):t,i));var V1=fT((Vp,k1)=>{(function(i,e){typeof Vp=="object"&&typeof k1<"u"?e(Vp):typeof define=="function"&&define.amd?define(["exports"],e):e((i=typeof globalThis<"u"?globalThis:i||self).SVDJS={})})(Vp,function(i){"use strict";i.SVD=function(e,t,r,n,s){if(t=t===void 0||t,r=r===void 0||r,s=1e-64/(n=n||Math.pow(2,-52)),!e)throw new TypeError("Matrix a is not defined");var o,a,l,c,u,h,f,d,m,p,g,y,v=e[0].length,b=e.length;if(b<v)throw new TypeError("Invalid matrix: m < n");for(var w=[],x=[],E=[],T=t==="f"?b:v,S=p=f=0;S<b;S++)x[S]=new Array(T).fill(0);for(S=0;S<v;S++)E[S]=new Array(v).fill(0);var I,C=new Array(v).fill(0);for(S=0;S<b;S++)for(o=0;o<v;o++)x[S][o]=e[S][o];for(S=0;S<v;S++){for(w[S]=f,m=0,l=S+1,o=S;o<b;o++)m+=Math.pow(x[o][S],2);if(m<s)f=0;else for(d=(h=x[S][S])*(f=h<0?Math.sqrt(m):-Math.sqrt(m))-m,x[S][S]=h-f,o=l;o<v;o++){for(m=0,a=S;a<b;a++)m+=x[a][S]*x[a][o];for(h=m/d,a=S;a<b;a++)x[a][o]=x[a][o]+h*x[a][S]}for(C[S]=f,m=0,o=l;o<v;o++)m+=Math.pow(x[S][o],2);if(m<s)f=0;else{for(d=(h=x[S][S+1])*(f=h<0?Math.sqrt(m):-Math.sqrt(m))-m,x[S][S+1]=h-f,o=l;o<v;o++)w[o]=x[S][o]/d;for(o=l;o<b;o++){for(m=0,a=l;a<v;a++)m+=x[o][a]*x[S][a];for(a=l;a<v;a++)x[o][a]=x[o][a]+m*w[a]}}p<(g=Math.abs(C[S])+Math.abs(w[S]))&&(p=g)}if(r)for(S=v-1;0<=S;S--){if(f!==0){for(d=x[S][S+1]*f,o=l;o<v;o++)E[o][S]=x[S][o]/d;for(o=l;o<v;o++){for(m=0,a=l;a<v;a++)m+=x[S][a]*E[a][o];for(a=l;a<v;a++)E[a][o]=E[a][o]+m*E[a][S]}}for(o=l;o<v;o++)E[S][o]=0,E[o][S]=0;E[S][S]=1,f=w[S],l=S}if(t){if(t==="f")for(S=v;S<b;S++){for(o=v;o<b;o++)x[S][o]=0;x[S][S]=1}for(S=v-1;0<=S;S--){for(l=S+1,f=C[S],o=l;o<T;o++)x[S][o]=0;if(f!==0){for(d=x[S][S]*f,o=l;o<T;o++){for(m=0,a=l;a<b;a++)m+=x[a][S]*x[a][o];for(h=m/d,a=S;a<b;a++)x[a][o]=x[a][o]+h*x[a][S]}for(o=S;o<b;o++)x[o][S]=x[o][S]/f}else for(o=S;o<b;o++)x[o][S]=0;x[S][S]=x[S][S]+1}}for(n*=p,a=v-1;0<=a;a--)for(var M=0;M<50;M++){for(I=!1,l=a;0<=l;l--){if(Math.abs(w[l])<=n){I=!0;break}if(Math.abs(C[l-1])<=n)break}if(!I){for(u=0,c=l-(m=1),S=l;S<a+1&&(h=m*w[S],w[S]=u*w[S],!(Math.abs(h)<=n));S++)if(f=C[S],C[S]=Math.sqrt(h*h+f*f),u=f/(d=C[S]),m=-h/d,t)for(o=0;o<b;o++)g=x[o][c],y=x[o][S],x[o][c]=g*u+y*m,x[o][S]=-g*m+y*u}if(y=C[a],l===a){if(y<0&&(C[a]=-y,r))for(o=0;o<v;o++)E[o][a]=-E[o][a];break}for(p=C[l],h=(((g=C[a-1])-y)*(g+y)+((f=w[a-1])-(d=w[a]))*(f+d))/(2*d*g),f=Math.sqrt(h*h+1),h=((p-y)*(p+y)+d*(g/(h<0?h-f:h+f)-d))/p,S=l+(m=u=1);S<a+1;S++){if(f=w[S],g=C[S],d=m*f,f*=u,y=Math.sqrt(h*h+d*d),h=p*(u=h/(w[S-1]=y))+f*(m=d/y),f=-p*m+f*u,d=g*m,g*=u,r)for(o=0;o<v;o++)p=E[o][S-1],y=E[o][S],E[o][S-1]=p*u+y*m,E[o][S]=-p*m+y*u;if(y=Math.sqrt(h*h+d*d),h=(u=h/(C[S-1]=y))*f+(m=d/y)*g,p=-m*f+u*g,t)for(o=0;o<b;o++)g=x[o][S-1],y=x[o][S],x[o][S-1]=g*u+y*m,x[o][S]=-g*m+y*u}w[l]=0,w[a]=h,C[a]=p}for(S=0;S<v;S++)C[S]<n&&(C[S]=0);return{u:x,q:C,v:E}},i.VERSION="1.1.1",Object.defineProperty(i,"__esModule",{value:!0})})});var Oo="139";var En={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},gT=0,mx=1,yT=2;var eb=1,Qg=2,Nc=3,ii=0,Cr=1,ir=2,tb=1;var kt=0,Es=1,gx=2,yx=3,vx=4,vT=5,Ma=100,xT=101,bT=102,xx=103,bx=104,wT=200,ST=201,MT=202,AT=203,rb=204,nb=205,TT=206,ET=207,_T=208,CT=209,LT=210,DT=0,PT=1,IT=2,$m=3,RT=4,BT=5,NT=6,OT=7,Qf=0,FT=1,UT=2,$i=0,zT=1,GT=2,kT=3,VT=4,HT=5,ib=300,Ls=301,Ds=302,eg=303,tg=304,ja=306,Da=1e3,_r=1001,rg=1002,lr=1003,wx=1004;var Sx=1005;var ct=1006,WT=1007;var ks=1008;var Wt=1009,jT=1010,qT=1011,Vc=1012,XT=1013,Ca=1014,Ts=1015,La=1016,YT=1017,JT=1018,_s=1020,QT=1021,KT=1022,On=1023,ZT=1024,$T=1025,Ao=1026,Ps=1027,eE=1028,tE=1029,rE=1030,nE=1031,iE=1033,mm=33776,gm=33777,ym=33778,vm=33779,Mx=35840,Ax=35841,Tx=35842,Ex=35843,sE=36196,_x=37492,Cx=37496,Lx=37808,Dx=37809,Px=37810,Ix=37811,Rx=37812,Bx=37813,Nx=37814,Ox=37815,Fx=37816,Ux=37817,zx=37818,Gx=37819,kx=37820,Vx=37821,Hx=36492,oE=2200,aE=2201,lE=2202,lf=2300,cf=2301,xm=2302,Aa=2400,Ta=2401,uf=2402,Kg=2500,sb=2501,ob=0;var rn=3e3,je=3001,Lr=3200,cE=3201,qa=0,uE=1;var Ki="srgb",Mo="srgb-linear";var bm=7680;var hE=519,Hc=35044,hf=35048;var Wx="300 es",ng=1035,jt=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let n=this._listeners[e];if(n!==void 0){let s=n.indexOf(t);s!==-1&&n.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let r=this._listeners[e.type];if(r!==void 0){e.target=this;let n=r.slice(0);for(let s=0,o=n.length;s<o;s++)n[s].call(this,e);e.target=null}}},Or=[];for(let i=0;i<256;i++)Or[i]=(i<16?"0":"")+i.toString(16);var jx=1234567,Fc=Math.PI/180,Wc=180/Math.PI;function Fn(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Or[i&255]+Or[i>>8&255]+Or[i>>16&255]+Or[i>>24&255]+"-"+Or[e&255]+Or[e>>8&255]+"-"+Or[e>>16&15|64]+Or[e>>24&255]+"-"+Or[t&63|128]+Or[t>>8&255]+"-"+Or[t>>16&255]+Or[t>>24&255]+Or[r&255]+Or[r>>8&255]+Or[r>>16&255]+Or[r>>24&255]).toLowerCase()}function yr(i,e,t){return Math.max(e,Math.min(t,i))}function Zg(i,e){return(i%e+e)%e}function fE(i,e,t,r,n){return r+(i-e)*(n-r)/(t-e)}function dE(i,e,t){return i!==e?(t-i)/(e-i):0}function Uc(i,e,t){return(1-t)*i+t*e}function pE(i,e,t,r){return Uc(i,e,1-Math.exp(-t*r))}function mE(i,e=1){return e-Math.abs(Zg(i,e*2)-e)}function gE(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function yE(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function vE(i,e){return i+Math.floor(Math.random()*(e-i+1))}function xE(i,e){return i+Math.random()*(e-i)}function bE(i){return i*(.5-Math.random())}function wE(i){i!==void 0&&(jx=i);let e=jx+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function SE(i){return i*Fc}function ME(i){return i*Wc}function ig(i){return(i&i-1)===0&&i!==0}function AE(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function ff(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function TE(i,e,t,r,n){let s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+r)/2),u=o((e+r)/2),h=s((e-r)/2),f=o((e-r)/2),d=s((r-e)/2),m=o((r-e)/2);switch(n){case"XYX":i.set(a*u,l*h,l*f,a*c);break;case"YZY":i.set(l*f,a*u,l*h,a*c);break;case"ZXZ":i.set(l*h,l*f,a*u,a*c);break;case"XZX":i.set(a*u,l*m,l*d,a*c);break;case"YXY":i.set(l*d,a*u,l*m,a*c);break;case"ZYZ":i.set(l*m,l*d,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+n)}}function EE(i,e){switch(e.constructor){case Float32Array:return i;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function _E(i,e){switch(e.constructor){case Float32Array:return i;case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}var et=Object.freeze({__proto__:null,DEG2RAD:Fc,RAD2DEG:Wc,generateUUID:Fn,clamp:yr,euclideanModulo:Zg,mapLinear:fE,inverseLerp:dE,lerp:Uc,damp:pE,pingpong:mE,smoothstep:gE,smootherstep:yE,randInt:vE,randFloat:xE,randFloatSpread:bE,seededRandom:wE,degToRad:SE,radToDeg:ME,isPowerOfTwo:ig,ceilPowerOfTwo:AE,floorPowerOfTwo:ff,setQuaternionFromProperEuler:TE,normalize:_E,denormalize:EE}),N=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,r=this.y,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6],this.y=n[1]*t+n[4]*r+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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,r=this.y-e.y;return t*t+r*r}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,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,r){return r!==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 r=Math.cos(t),n=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*n+e.x,this.y=s*n+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};N.prototype.isVector2=!0;var Nt=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,r,n,s,o,a,l,c){let u=this.elements;return u[0]=e,u[1]=n,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=r,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,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.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 r=e.elements,n=t.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],u=r[4],h=r[7],f=r[2],d=r[5],m=r[8],p=n[0],g=n[3],y=n[6],v=n[1],b=n[4],w=n[7],x=n[2],E=n[5],T=n[8];return s[0]=o*p+a*v+l*x,s[3]=o*g+a*b+l*E,s[6]=o*y+a*w+l*T,s[1]=c*p+u*v+h*x,s[4]=c*g+u*b+h*E,s[7]=c*y+u*w+h*T,s[2]=f*p+d*v+m*x,s[5]=f*g+d*b+m*E,s[8]=f*y+d*w+m*T,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],r=e[1],n=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-r*s*u+r*a*l+n*s*c-n*o*l}invert(){let e=this.elements,t=e[0],r=e[1],n=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,f=a*l-u*s,d=c*s-o*l,m=t*h+r*f+n*d;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);let p=1/m;return e[0]=h*p,e[1]=(n*c-u*r)*p,e[2]=(a*r-n*o)*p,e[3]=f*p,e[4]=(u*t-n*l)*p,e[5]=(n*s-a*t)*p,e[6]=d*p,e[7]=(r*l-c*t)*p,e[8]=(o*t-r*s)*p,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,n,s,o,a){let l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-n*c,n*l,-n*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){let r=this.elements;return r[0]*=e,r[3]*=e,r[6]*=e,r[1]*=t,r[4]*=t,r[7]*=t,this}rotate(e){let t=Math.cos(e),r=Math.sin(e),n=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],u=n[7];return n[0]=t*s+r*l,n[3]=t*o+r*c,n[6]=t*a+r*u,n[1]=-r*s+t*l,n[4]=-r*o+t*c,n[7]=-r*a+t*u,this}translate(e,t){let r=this.elements;return r[0]+=e*r[2],r[3]+=e*r[5],r[6]+=e*r[8],r[1]+=t*r[2],r[4]+=t*r[5],r[7]+=t*r[8],this}equals(e){let t=this.elements,r=e.elements;for(let n=0;n<9;n++)if(t[n]!==r[n])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){let r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Nt.prototype.isMatrix3=!0;function ab(i){for(let e=i.length-1;e>=0;--e)if(i[e]>65535)return!0;return!1}var CE={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Ah(i,e){return new CE[i](e)}function jc(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function To(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function af(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var wm={[Ki]:{[Mo]:To},[Mo]:{[Ki]:af}},$n={legacyMode:!0,get workingColorSpace(){return Mo},set workingColorSpace(i){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(i,e,t){if(this.legacyMode||e===t||!e||!t)return i;if(wm[e]&&wm[e][t]!==void 0){let r=wm[e][t];return i.r=r(i.r),i.g=r(i.g),i.b=r(i.b),i}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(i,e){return this.convert(i,this.workingColorSpace,e)},toWorkingColorSpace:function(i,e){return this.convert(i,e,this.workingColorSpace)}},lb={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},wr={r:0,g:0,b:0},ei={h:0,s:0,l:0},Th={h:0,s:0,l:0};function Sm(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}function Eh(i,e){return e.r=i.r,e.g=i.g,e.b=i.b,e}var xe=class{constructor(e,t,r){return t===void 0&&r===void 0?this.set(e):this.setRGB(e,t,r)}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,t=Ki){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,$n.toWorkingColorSpace(this,t),this}setRGB(e,t,r,n=Mo){return this.r=e,this.g=t,this.b=r,$n.toWorkingColorSpace(this,n),this}setHSL(e,t,r,n=Mo){if(e=Zg(e,1),t=yr(t,0,1),r=yr(r,0,1),t===0)this.r=this.g=this.b=r;else{let s=r<=.5?r*(1+t):r+t-r*t,o=2*r-s;this.r=Sm(o,s,e+1/3),this.g=Sm(o,s,e),this.b=Sm(o,s,e-1/3)}return $n.toWorkingColorSpace(this,n),this}setStyle(e,t=Ki){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let s,o=n[1],a=n[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,$n.toWorkingColorSpace(this,t),r(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,$n.toWorkingColorSpace(this,t),r(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){let l=parseFloat(s[1])/360,c=parseInt(s[2],10)/100,u=parseInt(s[3],10)/100;return r(s[4]),this.setHSL(l,c,u,t)}break}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=n[1],o=s.length;if(o===3)return this.r=parseInt(s.charAt(0)+s.charAt(0),16)/255,this.g=parseInt(s.charAt(1)+s.charAt(1),16)/255,this.b=parseInt(s.charAt(2)+s.charAt(2),16)/255,$n.toWorkingColorSpace(this,t),this;if(o===6)return this.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,this.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,this.b=parseInt(s.charAt(4)+s.charAt(5),16)/255,$n.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=Ki){let r=lb[e.toLowerCase()];return r!==void 0?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=To(e.r),this.g=To(e.g),this.b=To(e.b),this}copyLinearToSRGB(e){return this.r=af(e.r),this.g=af(e.g),this.b=af(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ki){return $n.fromWorkingColorSpace(Eh(this,wr),e),yr(wr.r*255,0,255)<<16^yr(wr.g*255,0,255)<<8^yr(wr.b*255,0,255)<<0}getHexString(e=Ki){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Mo){$n.fromWorkingColorSpace(Eh(this,wr),t);let r=wr.r,n=wr.g,s=wr.b,o=Math.max(r,n,s),a=Math.min(r,n,s),l,c,u=(a+o)/2;if(a===o)l=0,c=0;else{let h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case r:l=(n-s)/h+(n<s?6:0);break;case n:l=(s-r)/h+2;break;case s:l=(r-n)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=Mo){return $n.fromWorkingColorSpace(Eh(this,wr),t),e.r=wr.r,e.g=wr.g,e.b=wr.b,e}getStyle(e=Ki){return $n.fromWorkingColorSpace(Eh(this,wr),e),e!==Ki?`color(${e} ${wr.r} ${wr.g} ${wr.b})`:`rgb(${wr.r*255|0},${wr.g*255|0},${wr.b*255|0})`}offsetHSL(e,t,r){return this.getHSL(ei),ei.h+=e,ei.s+=t,ei.l+=r,this.setHSL(ei.h,ei.s,ei.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,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(ei),e.getHSL(Th);let r=Uc(ei.h,Th.h,t),n=Uc(ei.s,Th.s,t),s=Uc(ei.l,Th.l,t);return this.setHSL(r,n,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()}};xe.NAMES=lb;xe.prototype.isColor=!0;xe.prototype.r=1;xe.prototype.g=1;xe.prototype.b=1;var sa,es=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{sa===void 0&&(sa=jc("canvas")),sa.width=e.width,sa.height=e.height;let r=sa.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=sa}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")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=jc("canvas");t.width=e.width,t.height=e.height;let r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);let n=r.getImageData(0,0,e.width,e.height),s=n.data;for(let o=0;o<s.length;o++)s[o]=To(s[o]/255)*255;return r.putImageData(n,0,0),t}else if(e.data){let t=e.data.slice(0);for(let r=0;r<t.length;r++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[r]=Math.floor(To(t[r]/255)*255):t[r]=To(t[r]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},df=class{constructor(e=null){this.uuid=Fn(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let r={uuid:this.uuid,url:""},n=this.data;if(n!==null){let s;if(Array.isArray(n)){s=[];for(let o=0,a=n.length;o<a;o++)n[o].isDataTexture?s.push(Mm(n[o].image)):s.push(Mm(n[o]))}else s=Mm(n);r.url=s}return t||(e.images[this.uuid]=r),r}};function Mm(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?es.getDataURL(i):i.data?{data:Array.prototype.slice.call(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}df.prototype.isSource=!0;var LE=0,_t=class extends jt{constructor(e=_t.DEFAULT_IMAGE,t=_t.DEFAULT_MAPPING,r=_r,n=_r,s=ct,o=ks,a=On,l=Wt,c=1,u=rn){super(),Object.defineProperty(this,"id",{value:LE++}),this.uuid=Fn(),this.name="",this.source=new df(e),this.mipmaps=[],this.mapping=t,this.wrapS=r,this.wrapT=n,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new N(0,0),this.repeat=new N(1,1),this.center=new N(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Nt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.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.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,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 r={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,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};return JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ib)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Da:e.x=e.x-Math.floor(e.x);break;case _r:e.x=e.x<0?0:1;break;case rg: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 Da:e.y=e.y-Math.floor(e.y);break;case _r:e.y=e.y<0?0:1;break;case rg:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}};_t.DEFAULT_IMAGE=null;_t.DEFAULT_MAPPING=ib;_t.prototype.isTexture=!0;var Qe=class{constructor(e=0,t=0,r=0,n=1){this.x=e,this.y=t,this.z=r,this.w=n}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,n){return this.x=e,this.y=t,this.z=r,this.w=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e,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,r=this.y,n=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*n+o[12]*s,this.y=o[1]*t+o[5]*r+o[9]*n+o[13]*s,this.z=o[2]*t+o[6]*r+o[10]*n+o[14]*s,this.w=o[3]*t+o[7]*r+o[11]*n+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,r,n,s,l=e.elements,c=l[0],u=l[4],h=l[8],f=l[1],d=l[5],m=l[9],p=l[2],g=l[6],y=l[10];if(Math.abs(u-f)<.01&&Math.abs(h-p)<.01&&Math.abs(m-g)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+p)<.1&&Math.abs(m+g)<.1&&Math.abs(c+d+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let b=(c+1)/2,w=(d+1)/2,x=(y+1)/2,E=(u+f)/4,T=(h+p)/4,S=(m+g)/4;return b>w&&b>x?b<.01?(r=0,n=.707106781,s=.707106781):(r=Math.sqrt(b),n=E/r,s=T/r):w>x?w<.01?(r=.707106781,n=0,s=.707106781):(n=Math.sqrt(w),r=E/n,s=S/n):x<.01?(r=.707106781,n=.707106781,s=0):(s=Math.sqrt(x),r=T/s,n=S/s),this.set(r,n,s,t),this}let v=Math.sqrt((g-m)*(g-m)+(h-p)*(h-p)+(f-u)*(f-u));return Math.abs(v)<.001&&(v=1),this.x=(g-m)/v,this.y=(h-p)/v,this.z=(f-u)/v,this.w=Math.acos((c+d+y-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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,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,r){return r!==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}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Qe.prototype.isVector4=!0;var mt=class extends jt{constructor(e,t,r={}){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);let n={width:e,height:t,depth:1};this.texture=new _t(n,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=r.generateMipmaps!==void 0?r.generateMipmaps:!1,this.texture.internalFormat=r.internalFormat!==void 0?r.internalFormat:null,this.texture.minFilter=r.minFilter!==void 0?r.minFilter:ct,this.depthBuffer=r.depthBuffer!==void 0?r.depthBuffer:!0,this.stencilBuffer=r.stencilBuffer!==void 0?r.stencilBuffer:!1,this.depthTexture=r.depthTexture!==void 0?r.depthTexture:null,this.samples=r.samples!==void 0?r.samples:0}setSize(e,t,r=1){(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,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.isRenderTargetTexture=!0,this.texture.image=Object.assign({},e.texture.image),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}};mt.prototype.isWebGLRenderTarget=!0;var Pa=class extends _t{constructor(e=null,t=1,r=1,n=1){super(null),this.image={data:e,width:t,height:r,depth:n},this.magFilter=lr,this.minFilter=lr,this.wrapR=_r,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};Pa.prototype.isDataArrayTexture=!0;var sg=class extends mt{constructor(e,t,r){super(e,t),this.depth=r,this.texture=new Pa(null,e,t,r),this.texture.isRenderTargetTexture=!0}};sg.prototype.isWebGLArrayRenderTarget=!0;var qc=class extends _t{constructor(e=null,t=1,r=1,n=1){super(null),this.image={data:e,width:t,height:r,depth:n},this.magFilter=lr,this.minFilter=lr,this.wrapR=_r,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};qc.prototype.isData3DTexture=!0;var og=class extends mt{constructor(e,t,r){super(e,t),this.depth=r,this.texture=new qc(null,e,t,r),this.texture.isRenderTargetTexture=!0}};og.prototype.isWebGL3DRenderTarget=!0;var ag=class extends mt{constructor(e,t,r,n={}){super(e,t,n);let s=this.texture;this.texture=[];for(let o=0;o<r;o++)this.texture[o]=s.clone(),this.texture[o].isRenderTargetTexture=!0}setSize(e,t,r=1){if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(let n=0,s=this.texture.length;n<s;n++)this.texture[n].image.width=e,this.texture[n].image.height=t,this.texture[n].image.depth=r;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,r=e.texture.length;t<r;t++)this.texture[t]=e.texture[t].clone();return this}};ag.prototype.isWebGLMultipleRenderTargets=!0;var Ut=class{constructor(e=0,t=0,r=0,n=1){this._x=e,this._y=t,this._z=r,this._w=n}static slerp(e,t,r,n){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),r.slerpQuaternions(e,t,n)}static slerpFlat(e,t,r,n,s,o,a){let l=r[n+0],c=r[n+1],u=r[n+2],h=r[n+3],f=s[o+0],d=s[o+1],m=s[o+2],p=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]=f,e[t+1]=d,e[t+2]=m,e[t+3]=p;return}if(h!==p||l!==f||c!==d||u!==m){let g=1-a,y=l*f+c*d+u*m+h*p,v=y>=0?1:-1,b=1-y*y;if(b>Number.EPSILON){let x=Math.sqrt(b),E=Math.atan2(x,y*v);g=Math.sin(g*E)/x,a=Math.sin(a*E)/x}let w=a*v;if(l=l*g+f*w,c=c*g+d*w,u=u*g+m*w,h=h*g+p*w,g===1-a){let x=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=x,c*=x,u*=x,h*=x}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,r,n,s,o){let a=r[n],l=r[n+1],c=r[n+2],u=r[n+3],h=s[o],f=s[o+1],d=s[o+2],m=s[o+3];return e[t]=a*m+u*h+l*d-c*f,e[t+1]=l*m+u*f+c*h-a*d,e[t+2]=c*m+u*d+a*f-l*h,e[t+3]=u*m-a*h-l*f-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,n){return this._x=e,this._y=t,this._z=r,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");let r=e._x,n=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),u=a(n/2),h=a(s/2),f=l(r/2),d=l(n/2),m=l(s/2);switch(o){case"XYZ":this._x=f*u*h+c*d*m,this._y=c*d*h-f*u*m,this._z=c*u*m+f*d*h,this._w=c*u*h-f*d*m;break;case"YXZ":this._x=f*u*h+c*d*m,this._y=c*d*h-f*u*m,this._z=c*u*m-f*d*h,this._w=c*u*h+f*d*m;break;case"ZXY":this._x=f*u*h-c*d*m,this._y=c*d*h+f*u*m,this._z=c*u*m+f*d*h,this._w=c*u*h-f*d*m;break;case"ZYX":this._x=f*u*h-c*d*m,this._y=c*d*h+f*u*m,this._z=c*u*m-f*d*h,this._w=c*u*h+f*d*m;break;case"YZX":this._x=f*u*h+c*d*m,this._y=c*d*h+f*u*m,this._z=c*u*m-f*d*h,this._w=c*u*h-f*d*m;break;case"XZY":this._x=f*u*h-c*d*m,this._y=c*d*h-f*u*m,this._z=c*u*m+f*d*h,this._w=c*u*h+f*d*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let r=t/2,n=Math.sin(r);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,r=t[0],n=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],f=r+a+h;if(f>0){let d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(u-l)*d,this._y=(s-c)*d,this._z=(o-n)*d}else if(r>a&&r>h){let d=2*Math.sqrt(1+r-a-h);this._w=(u-l)/d,this._x=.25*d,this._y=(n+o)/d,this._z=(s+c)/d}else if(a>h){let d=2*Math.sqrt(1+a-r-h);this._w=(s-c)/d,this._x=(n+o)/d,this._y=.25*d,this._z=(l+u)/d}else{let d=2*Math.sqrt(1+h-r-a);this._w=(o-n)/d,this._x=(s+c)/d,this._y=(l+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(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=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(yr(this.dot(e),-1,1)))}rotateTowards(e,t){let r=this.angleTo(e);if(r===0)return this;let n=Math.min(1,t/r);return this.slerp(e,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,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 r=e._x,n=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=r*u+o*a+n*c-s*l,this._y=n*u+o*l+s*a-r*c,this._z=s*u+o*c+r*l-n*a,this._w=o*u-r*a-n*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let r=this._x,n=this._y,s=this._z,o=this._w,a=o*e._w+r*e._x+n*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=r,this._y=n,this._z=s,this;let l=1-a*a;if(l<=Number.EPSILON){let d=1-t;return this._w=d*o+t*this._w,this._x=d*r+t*this._x,this._y=d*n+t*this._y,this._z=d*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,f=Math.sin(t*u)/c;return this._w=o*h+this._w*f,this._x=r*h+this._x*f,this._y=n*h+this._y*f,this._z=s*h+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){let e=Math.random(),t=Math.sqrt(1-e),r=Math.sqrt(e),n=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(n),r*Math.sin(s),r*Math.cos(s),t*Math.sin(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(){}};Ut.prototype.isQuaternion=!0;var A=class{constructor(e=0,t=0,r=0){this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,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(qx.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(qx.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,r=this.y,n=this.z,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6]*n,this.y=s[1]*t+s[4]*r+s[7]*n,this.z=s[2]*t+s[5]*r+s[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,r=this.y,n=this.z,s=e.elements,o=1/(s[3]*t+s[7]*r+s[11]*n+s[15]);return this.x=(s[0]*t+s[4]*r+s[8]*n+s[12])*o,this.y=(s[1]*t+s[5]*r+s[9]*n+s[13])*o,this.z=(s[2]*t+s[6]*r+s[10]*n+s[14])*o,this}applyQuaternion(e){let t=this.x,r=this.y,n=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*n-a*r,u=l*r+a*t-s*n,h=l*n+s*r-o*t,f=-s*t-o*r-a*n;return this.x=c*l+f*-s+u*-a-h*-o,this.y=u*l+f*-o+h*-s-c*-a,this.z=h*l+f*-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,r=this.y,n=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*n,this.y=s[1]*t+s[5]*r+s[9]*n,this.z=s[2]*t+s[6]*r+s[10]*n,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,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 r=e.x,n=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=n*l-s*a,this.y=s*o-r*l,this.z=r*a-n*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return Am.copy(this).projectOnVector(e),this.sub(Am)}reflect(e){return this.sub(Am.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 r=this.dot(e)/t;return Math.acos(yr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,r=this.y-e.y,n=this.z-e.z;return t*t+r*r+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){let n=Math.sin(t)*e;return this.x=n*Math.sin(r),this.y=Math.cos(t)*e,this.z=n*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,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(),r=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}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,r){return r!==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}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(t),this.y=r*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};A.prototype.isVector3=!0;var Am=new A,qx=new Ut,Qt=class{constructor(e=new A(1/0,1/0,1/0),t=new A(-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,r=1/0,n=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],f=e[l+2];u<t&&(t=u),h<r&&(r=h),f<n&&(n=f),u>s&&(s=u),h>o&&(o=h),f>a&&(a=f)}return this.min.set(t,r,n),this.max.set(s,o,a),this}setFromBufferAttribute(e){let t=1/0,r=1/0,n=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),f=e.getZ(l);u<t&&(t=u),h<r&&(r=h),f<n&&(n=f),u>s&&(s=u),h>o&&(o=h),f>a&&(a=f)}return this.min.set(t,r,n),this.max.set(s,o,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=vo.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let r=e.geometry;if(r!==void 0)if(t&&r.attributes!=null&&r.attributes.position!==void 0){let s=r.attributes.position;for(let o=0,a=s.count;o<a;o++)vo.fromBufferAttribute(s,o).applyMatrix4(e.matrixWorld),this.expandByPoint(vo)}else r.boundingBox===null&&r.computeBoundingBox(),Tm.copy(r.boundingBox),Tm.applyMatrix4(e.matrixWorld),this.union(Tm);let n=e.children;for(let s=0,o=n.length;s<o;s++)this.expandByObject(n[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,vo),vo.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(_c),_h.subVectors(this.max,_c),oa.subVectors(e.a,_c),aa.subVectors(e.b,_c),la.subVectors(e.c,_c),ys.subVectors(aa,oa),vs.subVectors(la,aa),xo.subVectors(oa,la);let t=[0,-ys.z,ys.y,0,-vs.z,vs.y,0,-xo.z,xo.y,ys.z,0,-ys.x,vs.z,0,-vs.x,xo.z,0,-xo.x,-ys.y,ys.x,0,-vs.y,vs.x,0,-xo.y,xo.x,0];return!Em(t,oa,aa,la,_h)||(t=[1,0,0,0,1,0,0,0,1],!Em(t,oa,aa,la,_h))?!1:(Ch.crossVectors(ys,vs),t=[Ch.x,Ch.y,Ch.z],Em(t,oa,aa,la,_h))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return vo.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(vo).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:(ji[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ji[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ji[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ji[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ji[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ji[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ji[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ji[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ji),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)}};Qt.prototype.isBox3=!0;var ji=[new A,new A,new A,new A,new A,new A,new A,new A],vo=new A,Tm=new Qt,oa=new A,aa=new A,la=new A,ys=new A,vs=new A,xo=new A,_c=new A,_h=new A,Ch=new A,bo=new A;function Em(i,e,t,r,n){for(let s=0,o=i.length-3;s<=o;s+=3){bo.fromArray(i,s);let a=n.x*Math.abs(bo.x)+n.y*Math.abs(bo.y)+n.z*Math.abs(bo.z),l=e.dot(bo),c=t.dot(bo),u=r.dot(bo);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var DE=new Qt,Xx=new A,Lh=new A,_m=new A,Yr=class{constructor(e=new A,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let r=this.center;t!==void 0?r.copy(t):DE.setFromPoints(e).getCenter(r);let n=0;for(let s=0,o=e.length;s<o;s++)n=Math.max(n,r.distanceToSquared(e[s]));return this.radius=Math.sqrt(n),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){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 r=this.center.distanceToSquared(e);return t.copy(e),r>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){_m.subVectors(e,this.center);let t=_m.lengthSq();if(t>this.radius*this.radius){let r=Math.sqrt(t),n=(r-this.radius)*.5;this.center.add(_m.multiplyScalar(n/r)),this.radius+=n}return this}union(e){return this.center.equals(e.center)===!0?Lh.set(0,0,1).multiplyScalar(e.radius):Lh.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Xx.copy(e.center).add(Lh)),this.expandByPoint(Xx.copy(e.center).sub(Lh)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},qi=new A,Cm=new A,Dh=new A,xs=new A,Lm=new A,Ph=new A,Dm=new A,si=class{constructor(e=new A,t=new A(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,qi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(r).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=qi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(qi.copy(this.direction).multiplyScalar(t).add(this.origin),qi.distanceToSquared(e))}distanceSqToSegment(e,t,r,n){Cm.copy(e).add(t).multiplyScalar(.5),Dh.copy(t).sub(e).normalize(),xs.copy(this.origin).sub(Cm);let s=e.distanceTo(t)*.5,o=-this.direction.dot(Dh),a=xs.dot(this.direction),l=-xs.dot(Dh),c=xs.lengthSq(),u=Math.abs(1-o*o),h,f,d,m;if(u>0)if(h=o*l-a,f=o*a-l,m=s*u,h>=0)if(f>=-m)if(f<=m){let p=1/u;h*=p,f*=p,d=h*(h+o*f+2*a)+f*(o*h+f+2*l)+c}else f=s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;else f<=-m?(h=Math.max(0,-(-o*s+a)),f=h>0?-s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c):f<=m?(h=0,f=Math.min(Math.max(-s,-l),s),d=f*(f+2*l)+c):(h=Math.max(0,-(o*s+a)),f=h>0?s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c);else f=o>0?-s:s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;return r&&r.copy(this.direction).multiplyScalar(h).add(this.origin),n&&n.copy(Dh).multiplyScalar(f).add(Cm),d}intersectSphere(e,t){qi.subVectors(e.center,this.origin);let r=qi.dot(this.direction),n=qi.dot(qi)-r*r,s=e.radius*e.radius;if(n>s)return null;let o=Math.sqrt(s-n),a=r-o,l=r+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 r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){let r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,n,s,o,a,l,c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(r=(e.min.x-f.x)*c,n=(e.max.x-f.x)*c):(r=(e.max.x-f.x)*c,n=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,o=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,o=(e.min.y-f.y)*u),r>o||s>n||((s>r||r!==r)&&(r=s),(o<n||n!==n)&&(n=o),h>=0?(a=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(a=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),r>l||a>n)||((a>r||r!==r)&&(r=a),(l<n||n!==n)&&(n=l),n<0)?null:this.at(r>=0?r:n,t)}intersectsBox(e){return this.intersectBox(e,qi)!==null}intersectTriangle(e,t,r,n,s){Lm.subVectors(t,e),Ph.subVectors(r,e),Dm.crossVectors(Lm,Ph);let o=this.direction.dot(Dm),a;if(o>0){if(n)return null;a=1}else if(o<0)a=-1,o=-o;else return null;xs.subVectors(this.origin,e);let l=a*this.direction.dot(Ph.crossVectors(xs,Ph));if(l<0)return null;let c=a*this.direction.dot(Lm.cross(xs));if(c<0||l+c>o)return null;let u=-a*xs.dot(Dm);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)}},Ee=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,r,n,s,o,a,l,c,u,h,f,d,m,p,g){let y=this.elements;return y[0]=e,y[4]=t,y[8]=r,y[12]=n,y[1]=s,y[5]=o,y[9]=a,y[13]=l,y[2]=c,y[6]=u,y[10]=h,y[14]=f,y[3]=d,y[7]=m,y[11]=p,y[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ee().fromArray(this.elements)}copy(e){let t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){let t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[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,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,r=e.elements,n=1/ca.setFromMatrixColumn(e,0).length(),s=1/ca.setFromMatrixColumn(e,1).length(),o=1/ca.setFromMatrixColumn(e,2).length();return t[0]=r[0]*n,t[1]=r[1]*n,t[2]=r[2]*n,t[3]=0,t[4]=r[4]*s,t[5]=r[5]*s,t[6]=r[6]*s,t[7]=0,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[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,r=e.x,n=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(n),c=Math.sin(n),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){let f=o*u,d=o*h,m=a*u,p=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=d+m*c,t[5]=f-p*c,t[9]=-a*l,t[2]=p-f*c,t[6]=m+d*c,t[10]=o*l}else if(e.order==="YXZ"){let f=l*u,d=l*h,m=c*u,p=c*h;t[0]=f+p*a,t[4]=m*a-d,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=d*a-m,t[6]=p+f*a,t[10]=o*l}else if(e.order==="ZXY"){let f=l*u,d=l*h,m=c*u,p=c*h;t[0]=f-p*a,t[4]=-o*h,t[8]=m+d*a,t[1]=d+m*a,t[5]=o*u,t[9]=p-f*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){let f=o*u,d=o*h,m=a*u,p=a*h;t[0]=l*u,t[4]=m*c-d,t[8]=f*c+p,t[1]=l*h,t[5]=p*c+f,t[9]=d*c-m,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let f=o*l,d=o*c,m=a*l,p=a*c;t[0]=l*u,t[4]=p-f*h,t[8]=m*h+d,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=d*h+m,t[10]=f-p*h}else if(e.order==="XZY"){let f=o*l,d=o*c,m=a*l,p=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=f*h+p,t[5]=o*u,t[9]=d*h-m,t[2]=m*h-d,t[6]=a*u,t[10]=p*h+f}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(PE,e,IE)}lookAt(e,t,r){let n=this.elements;return An.subVectors(e,t),An.lengthSq()===0&&(An.z=1),An.normalize(),bs.crossVectors(r,An),bs.lengthSq()===0&&(Math.abs(r.z)===1?An.x+=1e-4:An.z+=1e-4,An.normalize(),bs.crossVectors(r,An)),bs.normalize(),Ih.crossVectors(An,bs),n[0]=bs.x,n[4]=Ih.x,n[8]=An.x,n[1]=bs.y,n[5]=Ih.y,n[9]=An.y,n[2]=bs.z,n[6]=Ih.z,n[10]=An.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 r=e.elements,n=t.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],u=r[1],h=r[5],f=r[9],d=r[13],m=r[2],p=r[6],g=r[10],y=r[14],v=r[3],b=r[7],w=r[11],x=r[15],E=n[0],T=n[4],S=n[8],I=n[12],C=n[1],M=n[5],_=n[9],R=n[13],B=n[2],O=n[6],z=n[10],q=n[14],F=n[3],ee=n[7],k=n[11],V=n[15];return s[0]=o*E+a*C+l*B+c*F,s[4]=o*T+a*M+l*O+c*ee,s[8]=o*S+a*_+l*z+c*k,s[12]=o*I+a*R+l*q+c*V,s[1]=u*E+h*C+f*B+d*F,s[5]=u*T+h*M+f*O+d*ee,s[9]=u*S+h*_+f*z+d*k,s[13]=u*I+h*R+f*q+d*V,s[2]=m*E+p*C+g*B+y*F,s[6]=m*T+p*M+g*O+y*ee,s[10]=m*S+p*_+g*z+y*k,s[14]=m*I+p*R+g*q+y*V,s[3]=v*E+b*C+w*B+x*F,s[7]=v*T+b*M+w*O+x*ee,s[11]=v*S+b*_+w*z+x*k,s[15]=v*I+b*R+w*q+x*V,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],r=e[4],n=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],f=e[10],d=e[14],m=e[3],p=e[7],g=e[11],y=e[15];return m*(+s*l*h-n*c*h-s*a*f+r*c*f+n*a*d-r*l*d)+p*(+t*l*d-t*c*f+s*o*f-n*o*d+n*c*u-s*l*u)+g*(+t*c*h-t*a*d-s*o*h+r*o*d+s*a*u-r*c*u)+y*(-n*a*u-t*l*h+t*a*f+n*o*h-r*o*f+r*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,r){let n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=r),this}invert(){let e=this.elements,t=e[0],r=e[1],n=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],m=e[12],p=e[13],g=e[14],y=e[15],v=h*g*c-p*f*c+p*l*d-a*g*d-h*l*y+a*f*y,b=m*f*c-u*g*c-m*l*d+o*g*d+u*l*y-o*f*y,w=u*p*c-m*h*c+m*a*d-o*p*d-u*a*y+o*h*y,x=m*h*l-u*p*l-m*a*f+o*p*f+u*a*g-o*h*g,E=t*v+r*b+n*w+s*x;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let T=1/E;return e[0]=v*T,e[1]=(p*f*s-h*g*s-p*n*d+r*g*d+h*n*y-r*f*y)*T,e[2]=(a*g*s-p*l*s+p*n*c-r*g*c-a*n*y+r*l*y)*T,e[3]=(h*l*s-a*f*s-h*n*c+r*f*c+a*n*d-r*l*d)*T,e[4]=b*T,e[5]=(u*g*s-m*f*s+m*n*d-t*g*d-u*n*y+t*f*y)*T,e[6]=(m*l*s-o*g*s-m*n*c+t*g*c+o*n*y-t*l*y)*T,e[7]=(o*f*s-u*l*s+u*n*c-t*f*c-o*n*d+t*l*d)*T,e[8]=w*T,e[9]=(m*h*s-u*p*s-m*r*d+t*p*d+u*r*y-t*h*y)*T,e[10]=(o*p*s-m*a*s+m*r*c-t*p*c-o*r*y+t*a*y)*T,e[11]=(u*a*s-o*h*s-u*r*c+t*h*c+o*r*d-t*a*d)*T,e[12]=x*T,e[13]=(u*p*n-m*h*n+m*r*f-t*p*f-u*r*g+t*h*g)*T,e[14]=(m*a*n-o*p*n-m*r*l+t*p*l+o*r*g-t*a*g)*T,e[15]=(o*h*n-u*a*n+u*r*l-t*h*l-o*r*f+t*a*f)*T,this}scale(e){let t=this.elements,r=e.x,n=e.y,s=e.z;return t[0]*=r,t[4]*=n,t[8]*=s,t[1]*=r,t[5]*=n,t[9]*=s,t[2]*=r,t[6]*=n,t[10]*=s,t[3]*=r,t[7]*=n,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,n))}makeTranslation(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let r=Math.cos(t),n=Math.sin(t),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+r,c*a-n*l,c*l+n*a,0,c*a+n*l,u*a+r,u*l-n*o,0,c*l-n*a,u*l+n*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,n,s,o){return this.set(1,r,s,0,e,1,o,0,t,n,1,0,0,0,0,1),this}compose(e,t,r){let n=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,h=a+a,f=s*c,d=s*u,m=s*h,p=o*u,g=o*h,y=a*h,v=l*c,b=l*u,w=l*h,x=r.x,E=r.y,T=r.z;return n[0]=(1-(p+y))*x,n[1]=(d+w)*x,n[2]=(m-b)*x,n[3]=0,n[4]=(d-w)*E,n[5]=(1-(f+y))*E,n[6]=(g+v)*E,n[7]=0,n[8]=(m+b)*T,n[9]=(g-v)*T,n[10]=(1-(f+p))*T,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,r){let n=this.elements,s=ca.set(n[0],n[1],n[2]).length(),o=ca.set(n[4],n[5],n[6]).length(),a=ca.set(n[8],n[9],n[10]).length();this.determinant()<0&&(s=-s),e.x=n[12],e.y=n[13],e.z=n[14],ti.copy(this);let c=1/s,u=1/o,h=1/a;return ti.elements[0]*=c,ti.elements[1]*=c,ti.elements[2]*=c,ti.elements[4]*=u,ti.elements[5]*=u,ti.elements[6]*=u,ti.elements[8]*=h,ti.elements[9]*=h,ti.elements[10]*=h,t.setFromRotationMatrix(ti),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,n,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/(r-n),u=(t+e)/(t-e),h=(r+n)/(r-n),f=-(o+s)/(o-s),d=-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]=f,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,r,n,s,o){let a=this.elements,l=1/(t-e),c=1/(r-n),u=1/(o-s),h=(t+e)*l,f=(r+n)*c,d=(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]=-f,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){let t=this.elements,r=e.elements;for(let n=0;n<16;n++)if(t[n]!==r[n])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){let r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}};Ee.prototype.isMatrix4=!0;var ca=new A,ti=new Ee,PE=new A(0,0,0),IE=new A(1,1,1),bs=new A,Ih=new A,An=new A,Yx=new Ee,Jx=new Ut,pn=class{constructor(e=0,t=0,r=0,n=pn.DefaultOrder){this._x=e,this._y=t,this._z=r,this._order=n}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,n=this._order){return this._x=e,this._y=t,this._z=r,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){let n=e.elements,s=n[0],o=n[4],a=n[8],l=n[1],c=n[5],u=n[9],h=n[2],f=n[6],d=n[10];switch(t){case"XYZ":this._y=Math.asin(yr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-yr(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(yr(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-yr(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(yr(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,d));break;case"XZY":this._z=Math.asin(-yr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return Yx.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Yx,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Jx.setFromEuler(this),this.setFromQuaternion(Jx,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}};pn.prototype.isEuler=!0;pn.DefaultOrder="XYZ";pn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var Xc=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},RE=0,Qx=new A,ua=new Ut,Xi=new Ee,Rh=new A,Cc=new A,BE=new A,NE=new Ut,Kx=new A(1,0,0),Zx=new A(0,1,0),$x=new A(0,0,1),OE={type:"added"},e0={type:"removed"},ot=class extends jt{constructor(){super(),Object.defineProperty(this,"id",{value:RE++}),this.uuid=Fn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ot.DefaultUp.clone();let e=new A,t=new pn,r=new Ut,n=new A(1,1,1);function s(){r.setFromEuler(t,!1)}function o(){t.setFromQuaternion(r,void 0,!1)}t._onChange(s),r._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:r},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Ee},normalMatrix:{value:new Nt}}),this.matrix=new Ee,this.matrixWorld=new Ee,this.matrixAutoUpdate=ot.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Xc,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 ua.setFromAxisAngle(e,t),this.quaternion.multiply(ua),this}rotateOnWorldAxis(e,t){return ua.setFromAxisAngle(e,t),this.quaternion.premultiply(ua),this}rotateX(e){return this.rotateOnAxis(Kx,e)}rotateY(e){return this.rotateOnAxis(Zx,e)}rotateZ(e){return this.rotateOnAxis($x,e)}translateOnAxis(e,t){return Qx.copy(e).applyQuaternion(this.quaternion),this.position.add(Qx.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Kx,e)}translateY(e){return this.translateOnAxis(Zx,e)}translateZ(e){return this.translateOnAxis($x,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(Xi.copy(this.matrixWorld).invert())}lookAt(e,t,r){e.isVector3?Rh.copy(e):Rh.set(e,t,r);let n=this.parent;this.updateWorldMatrix(!0,!1),Cc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Xi.lookAt(Cc,Rh,this.up):Xi.lookAt(Rh,Cc,this.up),this.quaternion.setFromRotationMatrix(Xi),n&&(Xi.extractRotation(n.matrixWorld),ua.setFromRotationMatrix(Xi),this.quaternion.premultiply(ua.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(OE)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(e0)),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(e0)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),Xi.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Xi.multiply(e.parent.matrixWorld)),e.applyMatrix4(Xi),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 r=0,n=this.children.length;r<n;r++){let o=this.children[r].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(Cc,e,BE),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Cc,NE,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 r=0,n=t.length;r<n;r++)t[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let r=0,n=t.length;r<n;r++)t[r].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 r=0,n=t.length;r<n;r++)t[r].updateMatrixWorld(e)}updateWorldMatrix(e,t){let r=this.parent;if(e===!0&&r!==null&&r.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 n=this.children;for(let s=0,o=n.length;s<o;s++)n[s].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e=="string",r={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let n={};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.castShadow===!0&&(n.castShadow=!0),this.receiveShadow===!0&&(n.receiveShadow=!0),this.visible===!1&&(n.visible=!1),this.frustumCulled===!1&&(n.frustumCulled=!1),this.renderOrder!==0&&(n.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(n.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?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(n.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.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&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));n.material=a}else n.material=s(e.materials,this.material);if(this.children.length>0){n.children=[];for(let a=0;a<this.children.length;a++)n.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){n.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];n.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),f=o(e.skeletons),d=o(e.animations),m=o(e.nodes);a.length>0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),u.length>0&&(r.images=u),h.length>0&&(r.shapes=h),f.length>0&&(r.skeletons=f),d.length>0&&(r.animations=d),m.length>0&&(r.nodes=m)}return r.object=n,r;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 r=0;r<e.children.length;r++){let n=e.children[r];this.add(n.clone())}return this}};ot.DefaultUp=new A(0,1,0);ot.DefaultMatrixAutoUpdate=!0;ot.prototype.isObject3D=!0;var ri=new A,Yi=new A,Pm=new A,Ji=new A,ha=new A,fa=new A,t0=new A,Im=new A,Rm=new A,Bm=new A,Jt=class{constructor(e=new A,t=new A,r=new A){this.a=e,this.b=t,this.c=r}static getNormal(e,t,r,n){n.subVectors(r,t),ri.subVectors(e,t),n.cross(ri);let s=n.lengthSq();return s>0?n.multiplyScalar(1/Math.sqrt(s)):n.set(0,0,0)}static getBarycoord(e,t,r,n,s){ri.subVectors(n,t),Yi.subVectors(r,t),Pm.subVectors(e,t);let o=ri.dot(ri),a=ri.dot(Yi),l=ri.dot(Pm),c=Yi.dot(Yi),u=Yi.dot(Pm),h=o*c-a*a;if(h===0)return s.set(-2,-1,-1);let f=1/h,d=(c*l-a*u)*f,m=(o*u-a*l)*f;return s.set(1-d-m,m,d)}static containsPoint(e,t,r,n){return this.getBarycoord(e,t,r,n,Ji),Ji.x>=0&&Ji.y>=0&&Ji.x+Ji.y<=1}static getUV(e,t,r,n,s,o,a,l){return this.getBarycoord(e,t,r,n,Ji),l.set(0,0),l.addScaledVector(s,Ji.x),l.addScaledVector(o,Ji.y),l.addScaledVector(a,Ji.z),l}static isFrontFacing(e,t,r,n){return ri.subVectors(r,t),Yi.subVectors(e,t),ri.cross(Yi).dot(n)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,n){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,r,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ri.subVectors(this.c,this.b),Yi.subVectors(this.a,this.b),ri.cross(Yi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Jt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Jt.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,n,s){return Jt.getUV(e,this.a,this.b,this.c,t,r,n,s)}containsPoint(e){return Jt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Jt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let r=this.a,n=this.b,s=this.c,o,a;ha.subVectors(n,r),fa.subVectors(s,r),Im.subVectors(e,r);let l=ha.dot(Im),c=fa.dot(Im);if(l<=0&&c<=0)return t.copy(r);Rm.subVectors(e,n);let u=ha.dot(Rm),h=fa.dot(Rm);if(u>=0&&h<=u)return t.copy(n);let f=l*h-u*c;if(f<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(r).addScaledVector(ha,o);Bm.subVectors(e,s);let d=ha.dot(Bm),m=fa.dot(Bm);if(m>=0&&d<=m)return t.copy(s);let p=d*c-l*m;if(p<=0&&c>=0&&m<=0)return a=c/(c-m),t.copy(r).addScaledVector(fa,a);let g=u*m-d*h;if(g<=0&&h-u>=0&&d-m>=0)return t0.subVectors(s,n),a=(h-u)/(h-u+(d-m)),t.copy(n).addScaledVector(t0,a);let y=1/(g+p+f);return o=p*y,a=f*y,t.copy(r).addScaledVector(ha,o).addScaledVector(fa,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},FE=0,cr=class extends jt{constructor(){super(),Object.defineProperty(this,"id",{value:FE++}),this.uuid=Fn(),this.name="",this.type="Material",this.fog=!0,this.blending=Es,this.side=ii,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=rb,this.blendDst=nb,this.blendEquation=Ma,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=$m,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=hE,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=bm,this.stencilZFail=bm,this.stencilZPass=bm,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let r=e[t];if(r===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=r===tb;continue}let n=this[t];if(n===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}n&&n.isColor?n.set(r):n&&n.isVector3&&r&&r.isVector3?n.copy(r):this[t]=r}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let r={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Es&&(r.blending=this.blending),this.side!==ii&&(r.side=this.side),this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,r.colorWrite=this.colorWrite,r.stencilWrite=this.stencilWrite,r.stencilWriteMask=this.stencilWriteMask,r.stencilFunc=this.stencilFunc,r.stencilRef=this.stencilRef,r.stencilFuncMask=this.stencilFuncMask,r.stencilFail=this.stencilFail,r.stencilZFail=this.stencilZFail,r.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(r.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=this.flatShading),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData);function n(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=n(e.textures),o=n(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}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,r=null;if(t!==null){let n=t.length;r=new Array(n);for(let s=0;s!==n;++s)r[s]=t[s].clone()}return this.clippingPlanes=r,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++}};cr.prototype.isMaterial=!0;cr.fromType=function(){return null};var Un=class extends cr{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new xe(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=Qf,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}};Un.prototype.isMeshBasicMaterial=!0;var gr=new A,Bh=new N,Ue=class{constructor(e,t,r){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=r===!0,this.usage=Hc,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,r){e*=this.itemSize,r*=t.itemSize;for(let n=0,s=this.itemSize;n<s;n++)this.array[e+n]=t.array[r+n];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){let t=this.array,r=0;for(let n=0,s=e.length;n<s;n++){let o=e[n];o===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),o=new xe),t[r++]=o.r,t[r++]=o.g,t[r++]=o.b}return this}copyVector2sArray(e){let t=this.array,r=0;for(let n=0,s=e.length;n<s;n++){let o=e[n];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),o=new N),t[r++]=o.x,t[r++]=o.y}return this}copyVector3sArray(e){let t=this.array,r=0;for(let n=0,s=e.length;n<s;n++){let o=e[n];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),o=new A),t[r++]=o.x,t[r++]=o.y,t[r++]=o.z}return this}copyVector4sArray(e){let t=this.array,r=0;for(let n=0,s=e.length;n<s;n++){let o=e[n];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),o=new Qe),t[r++]=o.x,t[r++]=o.y,t[r++]=o.z,t[r++]=o.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,r=this.count;t<r;t++)Bh.fromBufferAttribute(this,t),Bh.applyMatrix3(e),this.setXY(t,Bh.x,Bh.y);else if(this.itemSize===3)for(let t=0,r=this.count;t<r;t++)gr.fromBufferAttribute(this,t),gr.applyMatrix3(e),this.setXYZ(t,gr.x,gr.y,gr.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)gr.fromBufferAttribute(this,t),gr.applyMatrix4(e),this.setXYZ(t,gr.x,gr.y,gr.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)gr.fromBufferAttribute(this,t),gr.applyNormalMatrix(e),this.setXYZ(t,gr.x,gr.y,gr.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)gr.fromBufferAttribute(this,t),gr.transformDirection(e),this.setXYZ(t,gr.x,gr.y,gr.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,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=n,this}setXYZW(e,t,r,n,s){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=n,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){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!==Hc&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}};Ue.prototype.isBufferAttribute=!0;var pf=class extends Ue{constructor(e,t,r){super(new Uint16Array(e),t,r)}};var Is=class extends Ue{constructor(e,t,r){super(new Uint32Array(e),t,r)}},lg=class extends Ue{constructor(e,t,r){super(new Uint16Array(e),t,r)}};lg.prototype.isFloat16BufferAttribute=!0;var Le=class extends Ue{constructor(e,t,r){super(new Float32Array(e),t,r)}};var UE=0,Nn=new Ee,Nm=new ot,da=new A,Tn=new Qt,Lc=new Qt,Er=new A,Ie=class extends jt{constructor(){super(),Object.defineProperty(this,"id",{value:UE++}),this.uuid=Fn(),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(ab(e)?Is:pf)(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,r=0){this.groups.push({start:e,count:t,materialIndex:r})}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 r=this.attributes.normal;if(r!==void 0){let s=new Nt().getNormalMatrix(e);r.applyNormalMatrix(s),r.needsUpdate=!0}let n=this.attributes.tangent;return n!==void 0&&(n.transformDirection(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Nn.makeRotationFromQuaternion(e),this.applyMatrix4(Nn),this}rotateX(e){return Nn.makeRotationX(e),this.applyMatrix4(Nn),this}rotateY(e){return Nn.makeRotationY(e),this.applyMatrix4(Nn),this}rotateZ(e){return Nn.makeRotationZ(e),this.applyMatrix4(Nn),this}translate(e,t,r){return Nn.makeTranslation(e,t,r),this.applyMatrix4(Nn),this}scale(e,t,r){return Nn.makeScale(e,t,r),this.applyMatrix4(Nn),this}lookAt(e){return Nm.lookAt(e),Nm.updateMatrix(),this.applyMatrix4(Nm.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(da).negate(),this.translate(da.x,da.y,da.z),this}setFromPoints(e){let t=[];for(let r=0,n=e.length;r<n;r++){let s=e[r];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Le(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qt);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 A(-1/0,-1/0,-1/0),new A(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let r=0,n=t.length;r<n;r++){let s=t[r];Tn.setFromBufferAttribute(s),this.morphTargetsRelative?(Er.addVectors(this.boundingBox.min,Tn.min),this.boundingBox.expandByPoint(Er),Er.addVectors(this.boundingBox.max,Tn.max),this.boundingBox.expandByPoint(Er)):(this.boundingBox.expandByPoint(Tn.min),this.boundingBox.expandByPoint(Tn.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 Yr);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 A,1/0);return}if(e){let r=this.boundingSphere.center;if(Tn.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];Lc.setFromBufferAttribute(a),this.morphTargetsRelative?(Er.addVectors(Tn.min,Lc.min),Tn.expandByPoint(Er),Er.addVectors(Tn.max,Lc.max),Tn.expandByPoint(Er)):(Tn.expandByPoint(Lc.min),Tn.expandByPoint(Lc.max))}Tn.getCenter(r);let n=0;for(let s=0,o=e.count;s<o;s++)Er.fromBufferAttribute(e,s),n=Math.max(n,r.distanceToSquared(Er));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++)Er.fromBufferAttribute(a,c),l&&(da.fromBufferAttribute(e,c),Er.add(da)),n=Math.max(n,r.distanceToSquared(Er))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(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 r=e.array,n=t.position.array,s=t.normal.array,o=t.uv.array,a=n.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ue(new Float32Array(4*a),4));let l=this.getAttribute("tangent").array,c=[],u=[];for(let C=0;C<a;C++)c[C]=new A,u[C]=new A;let h=new A,f=new A,d=new A,m=new N,p=new N,g=new N,y=new A,v=new A;function b(C,M,_){h.fromArray(n,C*3),f.fromArray(n,M*3),d.fromArray(n,_*3),m.fromArray(o,C*2),p.fromArray(o,M*2),g.fromArray(o,_*2),f.sub(h),d.sub(h),p.sub(m),g.sub(m);let R=1/(p.x*g.y-g.x*p.y);!isFinite(R)||(y.copy(f).multiplyScalar(g.y).addScaledVector(d,-p.y).multiplyScalar(R),v.copy(d).multiplyScalar(p.x).addScaledVector(f,-g.x).multiplyScalar(R),c[C].add(y),c[M].add(y),c[_].add(y),u[C].add(v),u[M].add(v),u[_].add(v))}let w=this.groups;w.length===0&&(w=[{start:0,count:r.length}]);for(let C=0,M=w.length;C<M;++C){let _=w[C],R=_.start,B=_.count;for(let O=R,z=R+B;O<z;O+=3)b(r[O+0],r[O+1],r[O+2])}let x=new A,E=new A,T=new A,S=new A;function I(C){T.fromArray(s,C*3),S.copy(T);let M=c[C];x.copy(M),x.sub(T.multiplyScalar(T.dot(M))).normalize(),E.crossVectors(S,M);let R=E.dot(u[C])<0?-1:1;l[C*4]=x.x,l[C*4+1]=x.y,l[C*4+2]=x.z,l[C*4+3]=R}for(let C=0,M=w.length;C<M;++C){let _=w[C],R=_.start,B=_.count;for(let O=R,z=R+B;O<z;O+=3)I(r[O+0]),I(r[O+1]),I(r[O+2])}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new Ue(new Float32Array(t.count*3),3),this.setAttribute("normal",r);else for(let f=0,d=r.count;f<d;f++)r.setXYZ(f,0,0,0);let n=new A,s=new A,o=new A,a=new A,l=new A,c=new A,u=new A,h=new A;if(e)for(let f=0,d=e.count;f<d;f+=3){let m=e.getX(f+0),p=e.getX(f+1),g=e.getX(f+2);n.fromBufferAttribute(t,m),s.fromBufferAttribute(t,p),o.fromBufferAttribute(t,g),u.subVectors(o,s),h.subVectors(n,s),u.cross(h),a.fromBufferAttribute(r,m),l.fromBufferAttribute(r,p),c.fromBufferAttribute(r,g),a.add(u),l.add(u),c.add(u),r.setXYZ(m,a.x,a.y,a.z),r.setXYZ(p,l.x,l.y,l.z),r.setXYZ(g,c.x,c.y,c.z)}else for(let f=0,d=t.count;f<d;f+=3)n.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),o.fromBufferAttribute(t,f+2),u.subVectors(o,s),h.subVectors(n,s),u.cross(h),r.setXYZ(f+0,u.x,u.y,u.z),r.setXYZ(f+1,u.x,u.y,u.z),r.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),r.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 r=this.attributes;for(let n in r){if(e.attributes[n]===void 0)continue;let o=r[n].array,a=e.attributes[n],l=a.array,c=a.itemSize*t,u=Math.min(l.length,o.length-c);for(let h=0,f=c;h<u;h++,f++)o[f]=l[h]}return this}normalizeNormals(){let e=this.attributes.normal;for(let t=0,r=e.count;t<r;t++)Er.fromBufferAttribute(e,t),Er.normalize(),e.setXYZ(t,Er.x,Er.y,Er.z)}toNonIndexed(){function e(a,l){let c=a.array,u=a.itemSize,h=a.normalized,f=new c.constructor(l.length*u),d=0,m=0;for(let p=0,g=l.length;p<g;p++){a.isInterleavedBufferAttribute?d=l[p]*a.data.stride+a.offset:d=l[p]*u;for(let y=0;y<u;y++)f[m++]=c[d++]}return new Ue(f,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new Ie,r=this.index.array,n=this.attributes;for(let a in n){let l=n[a],c=e(l,r);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 f=c[u],d=e(f,r);l.push(d)}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 r=this.attributes;for(let l in r){let c=r[l];e.data.attributes[l]=c.toJSON(e.data)}let n={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let h=0,f=c.length;h<f;h++){let d=c[h];u.push(d.toJSON(e.data))}u.length>0&&(n[l]=u,s=!0)}s&&(e.data.morphAttributes=n,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 this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let r=e.index;r!==null&&this.setIndex(r.clone(t));let n=e.attributes;for(let c in n){let u=n[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],h=s[c];for(let f=0,d=h.length;f<d;f++)u.push(h[f].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,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}};Ie.prototype.isBufferGeometry=!0;var r0=new Ee,pa=new si,Om=new Yr,ws=new A,Ss=new A,Ms=new A,Fm=new A,Um=new A,zm=new A,Nh=new A,Oh=new A,Fh=new A,Uh=new N,zh=new N,Gh=new N,Gm=new A,kh=new A,Gt=class extends ot{constructor(e=new Ie,t=new Un){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,r=Object.keys(t);if(r.length>0){let n=t[r[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=n.length;s<o;s++){let a=n[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 r=this.geometry,n=this.material,s=this.matrixWorld;if(n===void 0||(r.boundingSphere===null&&r.computeBoundingSphere(),Om.copy(r.boundingSphere),Om.applyMatrix4(s),e.ray.intersectsSphere(Om)===!1)||(r0.copy(s).invert(),pa.copy(e.ray).applyMatrix4(r0),r.boundingBox!==null&&pa.intersectsBox(r.boundingBox)===!1))return;let o;if(r.isBufferGeometry){let a=r.index,l=r.attributes.position,c=r.morphAttributes.position,u=r.morphTargetsRelative,h=r.attributes.uv,f=r.attributes.uv2,d=r.groups,m=r.drawRange;if(a!==null)if(Array.isArray(n))for(let p=0,g=d.length;p<g;p++){let y=d[p],v=n[y.materialIndex],b=Math.max(y.start,m.start),w=Math.min(a.count,Math.min(y.start+y.count,m.start+m.count));for(let x=b,E=w;x<E;x+=3){let T=a.getX(x),S=a.getX(x+1),I=a.getX(x+2);o=Vh(this,v,e,pa,l,c,u,h,f,T,S,I),o&&(o.faceIndex=Math.floor(x/3),o.face.materialIndex=y.materialIndex,t.push(o))}}else{let p=Math.max(0,m.start),g=Math.min(a.count,m.start+m.count);for(let y=p,v=g;y<v;y+=3){let b=a.getX(y),w=a.getX(y+1),x=a.getX(y+2);o=Vh(this,n,e,pa,l,c,u,h,f,b,w,x),o&&(o.faceIndex=Math.floor(y/3),t.push(o))}}else if(l!==void 0)if(Array.isArray(n))for(let p=0,g=d.length;p<g;p++){let y=d[p],v=n[y.materialIndex],b=Math.max(y.start,m.start),w=Math.min(l.count,Math.min(y.start+y.count,m.start+m.count));for(let x=b,E=w;x<E;x+=3){let T=x,S=x+1,I=x+2;o=Vh(this,v,e,pa,l,c,u,h,f,T,S,I),o&&(o.faceIndex=Math.floor(x/3),o.face.materialIndex=y.materialIndex,t.push(o))}}else{let p=Math.max(0,m.start),g=Math.min(l.count,m.start+m.count);for(let y=p,v=g;y<v;y+=3){let b=y,w=y+1,x=y+2;o=Vh(this,n,e,pa,l,c,u,h,f,b,w,x),o&&(o.faceIndex=Math.floor(y/3),t.push(o))}}}else r.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}};Gt.prototype.isMesh=!0;function zE(i,e,t,r,n,s,o,a){let l;if(e.side===Cr?l=r.intersectTriangle(o,s,n,!0,a):l=r.intersectTriangle(n,s,o,e.side!==ir,a),l===null)return null;kh.copy(a),kh.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(kh);return c<t.near||c>t.far?null:{distance:c,point:kh.clone(),object:i}}function Vh(i,e,t,r,n,s,o,a,l,c,u,h){ws.fromBufferAttribute(n,c),Ss.fromBufferAttribute(n,u),Ms.fromBufferAttribute(n,h);let f=i.morphTargetInfluences;if(s&&f){Nh.set(0,0,0),Oh.set(0,0,0),Fh.set(0,0,0);for(let m=0,p=s.length;m<p;m++){let g=f[m],y=s[m];g!==0&&(Fm.fromBufferAttribute(y,c),Um.fromBufferAttribute(y,u),zm.fromBufferAttribute(y,h),o?(Nh.addScaledVector(Fm,g),Oh.addScaledVector(Um,g),Fh.addScaledVector(zm,g)):(Nh.addScaledVector(Fm.sub(ws),g),Oh.addScaledVector(Um.sub(Ss),g),Fh.addScaledVector(zm.sub(Ms),g)))}ws.add(Nh),Ss.add(Oh),Ms.add(Fh)}i.isSkinnedMesh&&(i.boneTransform(c,ws),i.boneTransform(u,Ss),i.boneTransform(h,Ms));let d=zE(i,e,t,r,ws,Ss,Ms,Gm);if(d){a&&(Uh.fromBufferAttribute(a,c),zh.fromBufferAttribute(a,u),Gh.fromBufferAttribute(a,h),d.uv=Jt.getUV(Gm,ws,Ss,Ms,Uh,zh,Gh,new N)),l&&(Uh.fromBufferAttribute(l,c),zh.fromBufferAttribute(l,u),Gh.fromBufferAttribute(l,h),d.uv2=Jt.getUV(Gm,ws,Ss,Ms,Uh,zh,Gh,new N));let m={a:c,b:u,c:h,normal:new A,materialIndex:0};Jt.getNormal(ws,Ss,Ms,m.normal),d.face=m}return d}var mn=class extends Ie{constructor(e=1,t=1,r=1,n=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:s,depthSegments:o};let a=this;n=Math.floor(n),s=Math.floor(s),o=Math.floor(o);let l=[],c=[],u=[],h=[],f=0,d=0;m("z","y","x",-1,-1,r,t,e,o,s,0),m("z","y","x",1,-1,r,t,-e,o,s,1),m("x","z","y",1,1,e,r,t,n,o,2),m("x","z","y",1,-1,e,r,-t,n,o,3),m("x","y","z",1,-1,e,t,r,n,s,4),m("x","y","z",-1,-1,e,t,-r,n,s,5),this.setIndex(l),this.setAttribute("position",new Le(c,3)),this.setAttribute("normal",new Le(u,3)),this.setAttribute("uv",new Le(h,2));function m(p,g,y,v,b,w,x,E,T,S,I){let C=w/T,M=x/S,_=w/2,R=x/2,B=E/2,O=T+1,z=S+1,q=0,F=0,ee=new A;for(let k=0;k<z;k++){let V=k*M-R;for(let U=0;U<O;U++){let J=U*C-_;ee[p]=J*v,ee[g]=V*b,ee[y]=B,c.push(ee.x,ee.y,ee.z),ee[p]=0,ee[g]=0,ee[y]=E>0?1:-1,u.push(ee.x,ee.y,ee.z),h.push(U/T),h.push(1-k/S),q+=1}}for(let k=0;k<S;k++)for(let V=0;V<T;V++){let U=f+V+O*k,J=f+V+O*(k+1),K=f+(V+1)+O*(k+1),$=f+(V+1)+O*k;l.push(U,J,$),l.push(J,K,$),F+=6}a.addGroup(d,F,I),d+=F,f+=q}}static fromJSON(e){return new mn(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function Ia(i){let e={};for(let t in i){e[t]={};for(let r in i[t]){let n=i[t][r];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)?e[t][r]=n.clone():Array.isArray(n)?e[t][r]=n.slice():e[t][r]=n}}return e}function Xr(i){let e={};for(let t=0;t<i.length;t++){let r=Ia(i[t]);for(let n in r)e[n]=r[n]}return e}var li={clone:Ia,merge:Xr},GE=`void main() {
|
|
1
|
+
var oT=Object.create;var Ah=Object.defineProperty,aT=Object.defineProperties,lT=Object.getOwnPropertyDescriptor,cT=Object.getOwnPropertyDescriptors,uT=Object.getOwnPropertyNames,Mh=Object.getOwnPropertySymbols,hT=Object.getPrototypeOf,pm=Object.prototype.hasOwnProperty,dx=Object.prototype.propertyIsEnumerable;var fx=(i,e,t)=>e in i?Ah(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,se=(i,e)=>{for(var t in e||(e={}))pm.call(e,t)&&fx(i,t,e[t]);if(Mh)for(var t of Mh(e))dx.call(e,t)&&fx(i,t,e[t]);return i},be=(i,e)=>aT(i,cT(e));var px=(i,e)=>{var t={};for(var r in i)pm.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&Mh)for(var r of Mh(i))e.indexOf(r)<0&&dx.call(i,r)&&(t[r]=i[r]);return t};var fT=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),dT=(i,e)=>{for(var t in e)Ah(i,t,{get:e[t],enumerable:!0})},pT=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of uT(e))!pm.call(i,n)&&n!==t&&Ah(i,n,{get:()=>e[n],enumerable:!(r=lT(e,n))||r.enumerable});return i};var mT=(i,e,t)=>(t=i!=null?oT(hT(i)):{},pT(e||!i||!i.__esModule?Ah(t,"default",{value:i,enumerable:!0}):t,i));var V1=fT((Vp,k1)=>{(function(i,e){typeof Vp=="object"&&typeof k1<"u"?e(Vp):typeof define=="function"&&define.amd?define(["exports"],e):e((i=typeof globalThis<"u"?globalThis:i||self).SVDJS={})})(Vp,function(i){"use strict";i.SVD=function(e,t,r,n,s){if(t=t===void 0||t,r=r===void 0||r,s=1e-64/(n=n||Math.pow(2,-52)),!e)throw new TypeError("Matrix a is not defined");var o,a,l,c,u,h,f,d,m,p,g,y,v=e[0].length,b=e.length;if(b<v)throw new TypeError("Invalid matrix: m < n");for(var w=[],x=[],E=[],T=t==="f"?b:v,S=p=f=0;S<b;S++)x[S]=new Array(T).fill(0);for(S=0;S<v;S++)E[S]=new Array(v).fill(0);var I,C=new Array(v).fill(0);for(S=0;S<b;S++)for(o=0;o<v;o++)x[S][o]=e[S][o];for(S=0;S<v;S++){for(w[S]=f,m=0,l=S+1,o=S;o<b;o++)m+=Math.pow(x[o][S],2);if(m<s)f=0;else for(d=(h=x[S][S])*(f=h<0?Math.sqrt(m):-Math.sqrt(m))-m,x[S][S]=h-f,o=l;o<v;o++){for(m=0,a=S;a<b;a++)m+=x[a][S]*x[a][o];for(h=m/d,a=S;a<b;a++)x[a][o]=x[a][o]+h*x[a][S]}for(C[S]=f,m=0,o=l;o<v;o++)m+=Math.pow(x[S][o],2);if(m<s)f=0;else{for(d=(h=x[S][S+1])*(f=h<0?Math.sqrt(m):-Math.sqrt(m))-m,x[S][S+1]=h-f,o=l;o<v;o++)w[o]=x[S][o]/d;for(o=l;o<b;o++){for(m=0,a=l;a<v;a++)m+=x[o][a]*x[S][a];for(a=l;a<v;a++)x[o][a]=x[o][a]+m*w[a]}}p<(g=Math.abs(C[S])+Math.abs(w[S]))&&(p=g)}if(r)for(S=v-1;0<=S;S--){if(f!==0){for(d=x[S][S+1]*f,o=l;o<v;o++)E[o][S]=x[S][o]/d;for(o=l;o<v;o++){for(m=0,a=l;a<v;a++)m+=x[S][a]*E[a][o];for(a=l;a<v;a++)E[a][o]=E[a][o]+m*E[a][S]}}for(o=l;o<v;o++)E[S][o]=0,E[o][S]=0;E[S][S]=1,f=w[S],l=S}if(t){if(t==="f")for(S=v;S<b;S++){for(o=v;o<b;o++)x[S][o]=0;x[S][S]=1}for(S=v-1;0<=S;S--){for(l=S+1,f=C[S],o=l;o<T;o++)x[S][o]=0;if(f!==0){for(d=x[S][S]*f,o=l;o<T;o++){for(m=0,a=l;a<b;a++)m+=x[a][S]*x[a][o];for(h=m/d,a=S;a<b;a++)x[a][o]=x[a][o]+h*x[a][S]}for(o=S;o<b;o++)x[o][S]=x[o][S]/f}else for(o=S;o<b;o++)x[o][S]=0;x[S][S]=x[S][S]+1}}for(n*=p,a=v-1;0<=a;a--)for(var M=0;M<50;M++){for(I=!1,l=a;0<=l;l--){if(Math.abs(w[l])<=n){I=!0;break}if(Math.abs(C[l-1])<=n)break}if(!I){for(u=0,c=l-(m=1),S=l;S<a+1&&(h=m*w[S],w[S]=u*w[S],!(Math.abs(h)<=n));S++)if(f=C[S],C[S]=Math.sqrt(h*h+f*f),u=f/(d=C[S]),m=-h/d,t)for(o=0;o<b;o++)g=x[o][c],y=x[o][S],x[o][c]=g*u+y*m,x[o][S]=-g*m+y*u}if(y=C[a],l===a){if(y<0&&(C[a]=-y,r))for(o=0;o<v;o++)E[o][a]=-E[o][a];break}for(p=C[l],h=(((g=C[a-1])-y)*(g+y)+((f=w[a-1])-(d=w[a]))*(f+d))/(2*d*g),f=Math.sqrt(h*h+1),h=((p-y)*(p+y)+d*(g/(h<0?h-f:h+f)-d))/p,S=l+(m=u=1);S<a+1;S++){if(f=w[S],g=C[S],d=m*f,f*=u,y=Math.sqrt(h*h+d*d),h=p*(u=h/(w[S-1]=y))+f*(m=d/y),f=-p*m+f*u,d=g*m,g*=u,r)for(o=0;o<v;o++)p=E[o][S-1],y=E[o][S],E[o][S-1]=p*u+y*m,E[o][S]=-p*m+y*u;if(y=Math.sqrt(h*h+d*d),h=(u=h/(C[S-1]=y))*f+(m=d/y)*g,p=-m*f+u*g,t)for(o=0;o<b;o++)g=x[o][S-1],y=x[o][S],x[o][S-1]=g*u+y*m,x[o][S]=-g*m+y*u}w[l]=0,w[a]=h,C[a]=p}for(S=0;S<v;S++)C[S]<n&&(C[S]=0);return{u:x,q:C,v:E}},i.VERSION="1.1.1",Object.defineProperty(i,"__esModule",{value:!0})})});var Oo="139";var En={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},gT=0,mx=1,yT=2;var eb=1,Qg=2,Nc=3,ii=0,Cr=1,ir=2,tb=1;var kt=0,Es=1,gx=2,yx=3,vx=4,vT=5,Ma=100,xT=101,bT=102,xx=103,bx=104,wT=200,ST=201,MT=202,AT=203,rb=204,nb=205,TT=206,ET=207,_T=208,CT=209,LT=210,DT=0,PT=1,IT=2,$m=3,RT=4,BT=5,NT=6,OT=7,Kf=0,FT=1,UT=2,$i=0,zT=1,GT=2,kT=3,VT=4,HT=5,ib=300,Ls=301,Ds=302,eg=303,tg=304,ja=306,Da=1e3,_r=1001,rg=1002,lr=1003,wx=1004;var Sx=1005;var ct=1006,WT=1007;var ks=1008;var Wt=1009,jT=1010,qT=1011,Vc=1012,XT=1013,Ca=1014,Ts=1015,La=1016,YT=1017,JT=1018,_s=1020,QT=1021,KT=1022,On=1023,ZT=1024,$T=1025,Ao=1026,Ps=1027,eE=1028,tE=1029,rE=1030,nE=1031,iE=1033,mm=33776,gm=33777,ym=33778,vm=33779,Mx=35840,Ax=35841,Tx=35842,Ex=35843,sE=36196,_x=37492,Cx=37496,Lx=37808,Dx=37809,Px=37810,Ix=37811,Rx=37812,Bx=37813,Nx=37814,Ox=37815,Fx=37816,Ux=37817,zx=37818,Gx=37819,kx=37820,Vx=37821,Hx=36492,oE=2200,aE=2201,lE=2202,cf=2300,uf=2301,xm=2302,Aa=2400,Ta=2401,hf=2402,Kg=2500,sb=2501,ob=0;var rn=3e3,je=3001,Lr=3200,cE=3201,qa=0,uE=1;var Ki="srgb",Mo="srgb-linear";var bm=7680;var hE=519,Hc=35044,ff=35048;var Wx="300 es",ng=1035,jt=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let n=this._listeners[e];if(n!==void 0){let s=n.indexOf(t);s!==-1&&n.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let r=this._listeners[e.type];if(r!==void 0){e.target=this;let n=r.slice(0);for(let s=0,o=n.length;s<o;s++)n[s].call(this,e);e.target=null}}},Or=[];for(let i=0;i<256;i++)Or[i]=(i<16?"0":"")+i.toString(16);var jx=1234567,Fc=Math.PI/180,Wc=180/Math.PI;function Fn(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Or[i&255]+Or[i>>8&255]+Or[i>>16&255]+Or[i>>24&255]+"-"+Or[e&255]+Or[e>>8&255]+"-"+Or[e>>16&15|64]+Or[e>>24&255]+"-"+Or[t&63|128]+Or[t>>8&255]+"-"+Or[t>>16&255]+Or[t>>24&255]+Or[r&255]+Or[r>>8&255]+Or[r>>16&255]+Or[r>>24&255]).toLowerCase()}function yr(i,e,t){return Math.max(e,Math.min(t,i))}function Zg(i,e){return(i%e+e)%e}function fE(i,e,t,r,n){return r+(i-e)*(n-r)/(t-e)}function dE(i,e,t){return i!==e?(t-i)/(e-i):0}function Uc(i,e,t){return(1-t)*i+t*e}function pE(i,e,t,r){return Uc(i,e,1-Math.exp(-t*r))}function mE(i,e=1){return e-Math.abs(Zg(i,e*2)-e)}function gE(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function yE(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function vE(i,e){return i+Math.floor(Math.random()*(e-i+1))}function xE(i,e){return i+Math.random()*(e-i)}function bE(i){return i*(.5-Math.random())}function wE(i){i!==void 0&&(jx=i);let e=jx+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function SE(i){return i*Fc}function ME(i){return i*Wc}function ig(i){return(i&i-1)===0&&i!==0}function AE(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function df(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function TE(i,e,t,r,n){let s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+r)/2),u=o((e+r)/2),h=s((e-r)/2),f=o((e-r)/2),d=s((r-e)/2),m=o((r-e)/2);switch(n){case"XYX":i.set(a*u,l*h,l*f,a*c);break;case"YZY":i.set(l*f,a*u,l*h,a*c);break;case"ZXZ":i.set(l*h,l*f,a*u,a*c);break;case"XZX":i.set(a*u,l*m,l*d,a*c);break;case"YXY":i.set(l*d,a*u,l*m,a*c);break;case"ZYZ":i.set(l*m,l*d,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+n)}}function EE(i,e){switch(e.constructor){case Float32Array:return i;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function _E(i,e){switch(e.constructor){case Float32Array:return i;case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}var et=Object.freeze({__proto__:null,DEG2RAD:Fc,RAD2DEG:Wc,generateUUID:Fn,clamp:yr,euclideanModulo:Zg,mapLinear:fE,inverseLerp:dE,lerp:Uc,damp:pE,pingpong:mE,smoothstep:gE,smootherstep:yE,randInt:vE,randFloat:xE,randFloatSpread:bE,seededRandom:wE,degToRad:SE,radToDeg:ME,isPowerOfTwo:ig,ceilPowerOfTwo:AE,floorPowerOfTwo:df,setQuaternionFromProperEuler:TE,normalize:_E,denormalize:EE}),N=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,r=this.y,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6],this.y=n[1]*t+n[4]*r+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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,r=this.y-e.y;return t*t+r*r}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,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,r){return r!==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 r=Math.cos(t),n=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*n+e.x,this.y=s*n+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};N.prototype.isVector2=!0;var Nt=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,r,n,s,o,a,l,c){let u=this.elements;return u[0]=e,u[1]=n,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=r,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,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.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 r=e.elements,n=t.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],u=r[4],h=r[7],f=r[2],d=r[5],m=r[8],p=n[0],g=n[3],y=n[6],v=n[1],b=n[4],w=n[7],x=n[2],E=n[5],T=n[8];return s[0]=o*p+a*v+l*x,s[3]=o*g+a*b+l*E,s[6]=o*y+a*w+l*T,s[1]=c*p+u*v+h*x,s[4]=c*g+u*b+h*E,s[7]=c*y+u*w+h*T,s[2]=f*p+d*v+m*x,s[5]=f*g+d*b+m*E,s[8]=f*y+d*w+m*T,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],r=e[1],n=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-r*s*u+r*a*l+n*s*c-n*o*l}invert(){let e=this.elements,t=e[0],r=e[1],n=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,f=a*l-u*s,d=c*s-o*l,m=t*h+r*f+n*d;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);let p=1/m;return e[0]=h*p,e[1]=(n*c-u*r)*p,e[2]=(a*r-n*o)*p,e[3]=f*p,e[4]=(u*t-n*l)*p,e[5]=(n*s-a*t)*p,e[6]=d*p,e[7]=(r*l-c*t)*p,e[8]=(o*t-r*s)*p,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,n,s,o,a){let l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-n*c,n*l,-n*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){let r=this.elements;return r[0]*=e,r[3]*=e,r[6]*=e,r[1]*=t,r[4]*=t,r[7]*=t,this}rotate(e){let t=Math.cos(e),r=Math.sin(e),n=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],u=n[7];return n[0]=t*s+r*l,n[3]=t*o+r*c,n[6]=t*a+r*u,n[1]=-r*s+t*l,n[4]=-r*o+t*c,n[7]=-r*a+t*u,this}translate(e,t){let r=this.elements;return r[0]+=e*r[2],r[3]+=e*r[5],r[6]+=e*r[8],r[1]+=t*r[2],r[4]+=t*r[5],r[7]+=t*r[8],this}equals(e){let t=this.elements,r=e.elements;for(let n=0;n<9;n++)if(t[n]!==r[n])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){let r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Nt.prototype.isMatrix3=!0;function ab(i){for(let e=i.length-1;e>=0;--e)if(i[e]>65535)return!0;return!1}var CE={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Th(i,e){return new CE[i](e)}function jc(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function To(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function lf(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var wm={[Ki]:{[Mo]:To},[Mo]:{[Ki]:lf}},$n={legacyMode:!0,get workingColorSpace(){return Mo},set workingColorSpace(i){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(i,e,t){if(this.legacyMode||e===t||!e||!t)return i;if(wm[e]&&wm[e][t]!==void 0){let r=wm[e][t];return i.r=r(i.r),i.g=r(i.g),i.b=r(i.b),i}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(i,e){return this.convert(i,this.workingColorSpace,e)},toWorkingColorSpace:function(i,e){return this.convert(i,e,this.workingColorSpace)}},lb={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},wr={r:0,g:0,b:0},ei={h:0,s:0,l:0},Eh={h:0,s:0,l:0};function Sm(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}function _h(i,e){return e.r=i.r,e.g=i.g,e.b=i.b,e}var xe=class{constructor(e,t,r){return t===void 0&&r===void 0?this.set(e):this.setRGB(e,t,r)}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,t=Ki){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,$n.toWorkingColorSpace(this,t),this}setRGB(e,t,r,n=Mo){return this.r=e,this.g=t,this.b=r,$n.toWorkingColorSpace(this,n),this}setHSL(e,t,r,n=Mo){if(e=Zg(e,1),t=yr(t,0,1),r=yr(r,0,1),t===0)this.r=this.g=this.b=r;else{let s=r<=.5?r*(1+t):r+t-r*t,o=2*r-s;this.r=Sm(o,s,e+1/3),this.g=Sm(o,s,e),this.b=Sm(o,s,e-1/3)}return $n.toWorkingColorSpace(this,n),this}setStyle(e,t=Ki){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let s,o=n[1],a=n[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,$n.toWorkingColorSpace(this,t),r(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,$n.toWorkingColorSpace(this,t),r(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){let l=parseFloat(s[1])/360,c=parseInt(s[2],10)/100,u=parseInt(s[3],10)/100;return r(s[4]),this.setHSL(l,c,u,t)}break}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=n[1],o=s.length;if(o===3)return this.r=parseInt(s.charAt(0)+s.charAt(0),16)/255,this.g=parseInt(s.charAt(1)+s.charAt(1),16)/255,this.b=parseInt(s.charAt(2)+s.charAt(2),16)/255,$n.toWorkingColorSpace(this,t),this;if(o===6)return this.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,this.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,this.b=parseInt(s.charAt(4)+s.charAt(5),16)/255,$n.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=Ki){let r=lb[e.toLowerCase()];return r!==void 0?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=To(e.r),this.g=To(e.g),this.b=To(e.b),this}copyLinearToSRGB(e){return this.r=lf(e.r),this.g=lf(e.g),this.b=lf(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ki){return $n.fromWorkingColorSpace(_h(this,wr),e),yr(wr.r*255,0,255)<<16^yr(wr.g*255,0,255)<<8^yr(wr.b*255,0,255)<<0}getHexString(e=Ki){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Mo){$n.fromWorkingColorSpace(_h(this,wr),t);let r=wr.r,n=wr.g,s=wr.b,o=Math.max(r,n,s),a=Math.min(r,n,s),l,c,u=(a+o)/2;if(a===o)l=0,c=0;else{let h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case r:l=(n-s)/h+(n<s?6:0);break;case n:l=(s-r)/h+2;break;case s:l=(r-n)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=Mo){return $n.fromWorkingColorSpace(_h(this,wr),t),e.r=wr.r,e.g=wr.g,e.b=wr.b,e}getStyle(e=Ki){return $n.fromWorkingColorSpace(_h(this,wr),e),e!==Ki?`color(${e} ${wr.r} ${wr.g} ${wr.b})`:`rgb(${wr.r*255|0},${wr.g*255|0},${wr.b*255|0})`}offsetHSL(e,t,r){return this.getHSL(ei),ei.h+=e,ei.s+=t,ei.l+=r,this.setHSL(ei.h,ei.s,ei.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,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(ei),e.getHSL(Eh);let r=Uc(ei.h,Eh.h,t),n=Uc(ei.s,Eh.s,t),s=Uc(ei.l,Eh.l,t);return this.setHSL(r,n,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()}};xe.NAMES=lb;xe.prototype.isColor=!0;xe.prototype.r=1;xe.prototype.g=1;xe.prototype.b=1;var sa,es=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{sa===void 0&&(sa=jc("canvas")),sa.width=e.width,sa.height=e.height;let r=sa.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=sa}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")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=jc("canvas");t.width=e.width,t.height=e.height;let r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);let n=r.getImageData(0,0,e.width,e.height),s=n.data;for(let o=0;o<s.length;o++)s[o]=To(s[o]/255)*255;return r.putImageData(n,0,0),t}else if(e.data){let t=e.data.slice(0);for(let r=0;r<t.length;r++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[r]=Math.floor(To(t[r]/255)*255):t[r]=To(t[r]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},pf=class{constructor(e=null){this.uuid=Fn(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let r={uuid:this.uuid,url:""},n=this.data;if(n!==null){let s;if(Array.isArray(n)){s=[];for(let o=0,a=n.length;o<a;o++)n[o].isDataTexture?s.push(Mm(n[o].image)):s.push(Mm(n[o]))}else s=Mm(n);r.url=s}return t||(e.images[this.uuid]=r),r}};function Mm(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?es.getDataURL(i):i.data?{data:Array.prototype.slice.call(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}pf.prototype.isSource=!0;var LE=0,_t=class extends jt{constructor(e=_t.DEFAULT_IMAGE,t=_t.DEFAULT_MAPPING,r=_r,n=_r,s=ct,o=ks,a=On,l=Wt,c=1,u=rn){super(),Object.defineProperty(this,"id",{value:LE++}),this.uuid=Fn(),this.name="",this.source=new pf(e),this.mipmaps=[],this.mapping=t,this.wrapS=r,this.wrapT=n,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new N(0,0),this.repeat=new N(1,1),this.center=new N(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Nt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.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.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,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 r={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,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};return JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ib)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Da:e.x=e.x-Math.floor(e.x);break;case _r:e.x=e.x<0?0:1;break;case rg: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 Da:e.y=e.y-Math.floor(e.y);break;case _r:e.y=e.y<0?0:1;break;case rg:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}};_t.DEFAULT_IMAGE=null;_t.DEFAULT_MAPPING=ib;_t.prototype.isTexture=!0;var Qe=class{constructor(e=0,t=0,r=0,n=1){this.x=e,this.y=t,this.z=r,this.w=n}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,n){return this.x=e,this.y=t,this.z=r,this.w=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e,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,r=this.y,n=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*n+o[12]*s,this.y=o[1]*t+o[5]*r+o[9]*n+o[13]*s,this.z=o[2]*t+o[6]*r+o[10]*n+o[14]*s,this.w=o[3]*t+o[7]*r+o[11]*n+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,r,n,s,l=e.elements,c=l[0],u=l[4],h=l[8],f=l[1],d=l[5],m=l[9],p=l[2],g=l[6],y=l[10];if(Math.abs(u-f)<.01&&Math.abs(h-p)<.01&&Math.abs(m-g)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+p)<.1&&Math.abs(m+g)<.1&&Math.abs(c+d+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let b=(c+1)/2,w=(d+1)/2,x=(y+1)/2,E=(u+f)/4,T=(h+p)/4,S=(m+g)/4;return b>w&&b>x?b<.01?(r=0,n=.707106781,s=.707106781):(r=Math.sqrt(b),n=E/r,s=T/r):w>x?w<.01?(r=.707106781,n=0,s=.707106781):(n=Math.sqrt(w),r=E/n,s=S/n):x<.01?(r=.707106781,n=.707106781,s=0):(s=Math.sqrt(x),r=T/s,n=S/s),this.set(r,n,s,t),this}let v=Math.sqrt((g-m)*(g-m)+(h-p)*(h-p)+(f-u)*(f-u));return Math.abs(v)<.001&&(v=1),this.x=(g-m)/v,this.y=(h-p)/v,this.z=(f-u)/v,this.w=Math.acos((c+d+y-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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,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,r){return r!==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}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};Qe.prototype.isVector4=!0;var mt=class extends jt{constructor(e,t,r={}){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);let n={width:e,height:t,depth:1};this.texture=new _t(n,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=r.generateMipmaps!==void 0?r.generateMipmaps:!1,this.texture.internalFormat=r.internalFormat!==void 0?r.internalFormat:null,this.texture.minFilter=r.minFilter!==void 0?r.minFilter:ct,this.depthBuffer=r.depthBuffer!==void 0?r.depthBuffer:!0,this.stencilBuffer=r.stencilBuffer!==void 0?r.stencilBuffer:!1,this.depthTexture=r.depthTexture!==void 0?r.depthTexture:null,this.samples=r.samples!==void 0?r.samples:0}setSize(e,t,r=1){(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,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.isRenderTargetTexture=!0,this.texture.image=Object.assign({},e.texture.image),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}};mt.prototype.isWebGLRenderTarget=!0;var Pa=class extends _t{constructor(e=null,t=1,r=1,n=1){super(null),this.image={data:e,width:t,height:r,depth:n},this.magFilter=lr,this.minFilter=lr,this.wrapR=_r,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};Pa.prototype.isDataArrayTexture=!0;var sg=class extends mt{constructor(e,t,r){super(e,t),this.depth=r,this.texture=new Pa(null,e,t,r),this.texture.isRenderTargetTexture=!0}};sg.prototype.isWebGLArrayRenderTarget=!0;var qc=class extends _t{constructor(e=null,t=1,r=1,n=1){super(null),this.image={data:e,width:t,height:r,depth:n},this.magFilter=lr,this.minFilter=lr,this.wrapR=_r,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};qc.prototype.isData3DTexture=!0;var og=class extends mt{constructor(e,t,r){super(e,t),this.depth=r,this.texture=new qc(null,e,t,r),this.texture.isRenderTargetTexture=!0}};og.prototype.isWebGL3DRenderTarget=!0;var ag=class extends mt{constructor(e,t,r,n={}){super(e,t,n);let s=this.texture;this.texture=[];for(let o=0;o<r;o++)this.texture[o]=s.clone(),this.texture[o].isRenderTargetTexture=!0}setSize(e,t,r=1){if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(let n=0,s=this.texture.length;n<s;n++)this.texture[n].image.width=e,this.texture[n].image.height=t,this.texture[n].image.depth=r;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,r=e.texture.length;t<r;t++)this.texture[t]=e.texture[t].clone();return this}};ag.prototype.isWebGLMultipleRenderTargets=!0;var Ut=class{constructor(e=0,t=0,r=0,n=1){this._x=e,this._y=t,this._z=r,this._w=n}static slerp(e,t,r,n){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),r.slerpQuaternions(e,t,n)}static slerpFlat(e,t,r,n,s,o,a){let l=r[n+0],c=r[n+1],u=r[n+2],h=r[n+3],f=s[o+0],d=s[o+1],m=s[o+2],p=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]=f,e[t+1]=d,e[t+2]=m,e[t+3]=p;return}if(h!==p||l!==f||c!==d||u!==m){let g=1-a,y=l*f+c*d+u*m+h*p,v=y>=0?1:-1,b=1-y*y;if(b>Number.EPSILON){let x=Math.sqrt(b),E=Math.atan2(x,y*v);g=Math.sin(g*E)/x,a=Math.sin(a*E)/x}let w=a*v;if(l=l*g+f*w,c=c*g+d*w,u=u*g+m*w,h=h*g+p*w,g===1-a){let x=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=x,c*=x,u*=x,h*=x}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,r,n,s,o){let a=r[n],l=r[n+1],c=r[n+2],u=r[n+3],h=s[o],f=s[o+1],d=s[o+2],m=s[o+3];return e[t]=a*m+u*h+l*d-c*f,e[t+1]=l*m+u*f+c*h-a*d,e[t+2]=c*m+u*d+a*f-l*h,e[t+3]=u*m-a*h-l*f-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,n){return this._x=e,this._y=t,this._z=r,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");let r=e._x,n=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),u=a(n/2),h=a(s/2),f=l(r/2),d=l(n/2),m=l(s/2);switch(o){case"XYZ":this._x=f*u*h+c*d*m,this._y=c*d*h-f*u*m,this._z=c*u*m+f*d*h,this._w=c*u*h-f*d*m;break;case"YXZ":this._x=f*u*h+c*d*m,this._y=c*d*h-f*u*m,this._z=c*u*m-f*d*h,this._w=c*u*h+f*d*m;break;case"ZXY":this._x=f*u*h-c*d*m,this._y=c*d*h+f*u*m,this._z=c*u*m+f*d*h,this._w=c*u*h-f*d*m;break;case"ZYX":this._x=f*u*h-c*d*m,this._y=c*d*h+f*u*m,this._z=c*u*m-f*d*h,this._w=c*u*h+f*d*m;break;case"YZX":this._x=f*u*h+c*d*m,this._y=c*d*h+f*u*m,this._z=c*u*m-f*d*h,this._w=c*u*h-f*d*m;break;case"XZY":this._x=f*u*h-c*d*m,this._y=c*d*h-f*u*m,this._z=c*u*m+f*d*h,this._w=c*u*h+f*d*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let r=t/2,n=Math.sin(r);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,r=t[0],n=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],f=r+a+h;if(f>0){let d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(u-l)*d,this._y=(s-c)*d,this._z=(o-n)*d}else if(r>a&&r>h){let d=2*Math.sqrt(1+r-a-h);this._w=(u-l)/d,this._x=.25*d,this._y=(n+o)/d,this._z=(s+c)/d}else if(a>h){let d=2*Math.sqrt(1+a-r-h);this._w=(s-c)/d,this._x=(n+o)/d,this._y=.25*d,this._z=(l+u)/d}else{let d=2*Math.sqrt(1+h-r-a);this._w=(o-n)/d,this._x=(s+c)/d,this._y=(l+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(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=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(yr(this.dot(e),-1,1)))}rotateTowards(e,t){let r=this.angleTo(e);if(r===0)return this;let n=Math.min(1,t/r);return this.slerp(e,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,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 r=e._x,n=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=r*u+o*a+n*c-s*l,this._y=n*u+o*l+s*a-r*c,this._z=s*u+o*c+r*l-n*a,this._w=o*u-r*a-n*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let r=this._x,n=this._y,s=this._z,o=this._w,a=o*e._w+r*e._x+n*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=r,this._y=n,this._z=s,this;let l=1-a*a;if(l<=Number.EPSILON){let d=1-t;return this._w=d*o+t*this._w,this._x=d*r+t*this._x,this._y=d*n+t*this._y,this._z=d*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,f=Math.sin(t*u)/c;return this._w=o*h+this._w*f,this._x=r*h+this._x*f,this._y=n*h+this._y*f,this._z=s*h+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){let e=Math.random(),t=Math.sqrt(1-e),r=Math.sqrt(e),n=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(n),r*Math.sin(s),r*Math.cos(s),t*Math.sin(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(){}};Ut.prototype.isQuaternion=!0;var A=class{constructor(e=0,t=0,r=0){this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,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(qx.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(qx.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,r=this.y,n=this.z,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6]*n,this.y=s[1]*t+s[4]*r+s[7]*n,this.z=s[2]*t+s[5]*r+s[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,r=this.y,n=this.z,s=e.elements,o=1/(s[3]*t+s[7]*r+s[11]*n+s[15]);return this.x=(s[0]*t+s[4]*r+s[8]*n+s[12])*o,this.y=(s[1]*t+s[5]*r+s[9]*n+s[13])*o,this.z=(s[2]*t+s[6]*r+s[10]*n+s[14])*o,this}applyQuaternion(e){let t=this.x,r=this.y,n=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*n-a*r,u=l*r+a*t-s*n,h=l*n+s*r-o*t,f=-s*t-o*r-a*n;return this.x=c*l+f*-s+u*-a-h*-o,this.y=u*l+f*-o+h*-s-c*-a,this.z=h*l+f*-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,r=this.y,n=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*n,this.y=s[1]*t+s[5]*r+s[9]*n,this.z=s[2]*t+s[6]*r+s[10]*n,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,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 r=e.x,n=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=n*l-s*a,this.y=s*o-r*l,this.z=r*a-n*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return Am.copy(this).projectOnVector(e),this.sub(Am)}reflect(e){return this.sub(Am.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 r=this.dot(e)/t;return Math.acos(yr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,r=this.y-e.y,n=this.z-e.z;return t*t+r*r+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){let n=Math.sin(t)*e;return this.x=n*Math.sin(r),this.y=Math.cos(t)*e,this.z=n*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,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(),r=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}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,r){return r!==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}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(t),this.y=r*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};A.prototype.isVector3=!0;var Am=new A,qx=new Ut,Qt=class{constructor(e=new A(1/0,1/0,1/0),t=new A(-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,r=1/0,n=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],f=e[l+2];u<t&&(t=u),h<r&&(r=h),f<n&&(n=f),u>s&&(s=u),h>o&&(o=h),f>a&&(a=f)}return this.min.set(t,r,n),this.max.set(s,o,a),this}setFromBufferAttribute(e){let t=1/0,r=1/0,n=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),f=e.getZ(l);u<t&&(t=u),h<r&&(r=h),f<n&&(n=f),u>s&&(s=u),h>o&&(o=h),f>a&&(a=f)}return this.min.set(t,r,n),this.max.set(s,o,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=vo.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let r=e.geometry;if(r!==void 0)if(t&&r.attributes!=null&&r.attributes.position!==void 0){let s=r.attributes.position;for(let o=0,a=s.count;o<a;o++)vo.fromBufferAttribute(s,o).applyMatrix4(e.matrixWorld),this.expandByPoint(vo)}else r.boundingBox===null&&r.computeBoundingBox(),Tm.copy(r.boundingBox),Tm.applyMatrix4(e.matrixWorld),this.union(Tm);let n=e.children;for(let s=0,o=n.length;s<o;s++)this.expandByObject(n[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,vo),vo.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(_c),Ch.subVectors(this.max,_c),oa.subVectors(e.a,_c),aa.subVectors(e.b,_c),la.subVectors(e.c,_c),ys.subVectors(aa,oa),vs.subVectors(la,aa),xo.subVectors(oa,la);let t=[0,-ys.z,ys.y,0,-vs.z,vs.y,0,-xo.z,xo.y,ys.z,0,-ys.x,vs.z,0,-vs.x,xo.z,0,-xo.x,-ys.y,ys.x,0,-vs.y,vs.x,0,-xo.y,xo.x,0];return!Em(t,oa,aa,la,Ch)||(t=[1,0,0,0,1,0,0,0,1],!Em(t,oa,aa,la,Ch))?!1:(Lh.crossVectors(ys,vs),t=[Lh.x,Lh.y,Lh.z],Em(t,oa,aa,la,Ch))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return vo.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(vo).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:(ji[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ji[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ji[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ji[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ji[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ji[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ji[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ji[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ji),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)}};Qt.prototype.isBox3=!0;var ji=[new A,new A,new A,new A,new A,new A,new A,new A],vo=new A,Tm=new Qt,oa=new A,aa=new A,la=new A,ys=new A,vs=new A,xo=new A,_c=new A,Ch=new A,Lh=new A,bo=new A;function Em(i,e,t,r,n){for(let s=0,o=i.length-3;s<=o;s+=3){bo.fromArray(i,s);let a=n.x*Math.abs(bo.x)+n.y*Math.abs(bo.y)+n.z*Math.abs(bo.z),l=e.dot(bo),c=t.dot(bo),u=r.dot(bo);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var DE=new Qt,Xx=new A,Dh=new A,_m=new A,Yr=class{constructor(e=new A,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let r=this.center;t!==void 0?r.copy(t):DE.setFromPoints(e).getCenter(r);let n=0;for(let s=0,o=e.length;s<o;s++)n=Math.max(n,r.distanceToSquared(e[s]));return this.radius=Math.sqrt(n),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){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 r=this.center.distanceToSquared(e);return t.copy(e),r>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){_m.subVectors(e,this.center);let t=_m.lengthSq();if(t>this.radius*this.radius){let r=Math.sqrt(t),n=(r-this.radius)*.5;this.center.add(_m.multiplyScalar(n/r)),this.radius+=n}return this}union(e){return this.center.equals(e.center)===!0?Dh.set(0,0,1).multiplyScalar(e.radius):Dh.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Xx.copy(e.center).add(Dh)),this.expandByPoint(Xx.copy(e.center).sub(Dh)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},qi=new A,Cm=new A,Ph=new A,xs=new A,Lm=new A,Ih=new A,Dm=new A,si=class{constructor(e=new A,t=new A(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,qi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(r).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=qi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(qi.copy(this.direction).multiplyScalar(t).add(this.origin),qi.distanceToSquared(e))}distanceSqToSegment(e,t,r,n){Cm.copy(e).add(t).multiplyScalar(.5),Ph.copy(t).sub(e).normalize(),xs.copy(this.origin).sub(Cm);let s=e.distanceTo(t)*.5,o=-this.direction.dot(Ph),a=xs.dot(this.direction),l=-xs.dot(Ph),c=xs.lengthSq(),u=Math.abs(1-o*o),h,f,d,m;if(u>0)if(h=o*l-a,f=o*a-l,m=s*u,h>=0)if(f>=-m)if(f<=m){let p=1/u;h*=p,f*=p,d=h*(h+o*f+2*a)+f*(o*h+f+2*l)+c}else f=s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;else f<=-m?(h=Math.max(0,-(-o*s+a)),f=h>0?-s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c):f<=m?(h=0,f=Math.min(Math.max(-s,-l),s),d=f*(f+2*l)+c):(h=Math.max(0,-(o*s+a)),f=h>0?s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c);else f=o>0?-s:s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*l)+c;return r&&r.copy(this.direction).multiplyScalar(h).add(this.origin),n&&n.copy(Ph).multiplyScalar(f).add(Cm),d}intersectSphere(e,t){qi.subVectors(e.center,this.origin);let r=qi.dot(this.direction),n=qi.dot(qi)-r*r,s=e.radius*e.radius;if(n>s)return null;let o=Math.sqrt(s-n),a=r-o,l=r+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 r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){let r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,n,s,o,a,l,c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(r=(e.min.x-f.x)*c,n=(e.max.x-f.x)*c):(r=(e.max.x-f.x)*c,n=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,o=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,o=(e.min.y-f.y)*u),r>o||s>n||((s>r||r!==r)&&(r=s),(o<n||n!==n)&&(n=o),h>=0?(a=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(a=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),r>l||a>n)||((a>r||r!==r)&&(r=a),(l<n||n!==n)&&(n=l),n<0)?null:this.at(r>=0?r:n,t)}intersectsBox(e){return this.intersectBox(e,qi)!==null}intersectTriangle(e,t,r,n,s){Lm.subVectors(t,e),Ih.subVectors(r,e),Dm.crossVectors(Lm,Ih);let o=this.direction.dot(Dm),a;if(o>0){if(n)return null;a=1}else if(o<0)a=-1,o=-o;else return null;xs.subVectors(this.origin,e);let l=a*this.direction.dot(Ih.crossVectors(xs,Ih));if(l<0)return null;let c=a*this.direction.dot(Lm.cross(xs));if(c<0||l+c>o)return null;let u=-a*xs.dot(Dm);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)}},Ee=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,r,n,s,o,a,l,c,u,h,f,d,m,p,g){let y=this.elements;return y[0]=e,y[4]=t,y[8]=r,y[12]=n,y[1]=s,y[5]=o,y[9]=a,y[13]=l,y[2]=c,y[6]=u,y[10]=h,y[14]=f,y[3]=d,y[7]=m,y[11]=p,y[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ee().fromArray(this.elements)}copy(e){let t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){let t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[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,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,r=e.elements,n=1/ca.setFromMatrixColumn(e,0).length(),s=1/ca.setFromMatrixColumn(e,1).length(),o=1/ca.setFromMatrixColumn(e,2).length();return t[0]=r[0]*n,t[1]=r[1]*n,t[2]=r[2]*n,t[3]=0,t[4]=r[4]*s,t[5]=r[5]*s,t[6]=r[6]*s,t[7]=0,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[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,r=e.x,n=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(n),c=Math.sin(n),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){let f=o*u,d=o*h,m=a*u,p=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=d+m*c,t[5]=f-p*c,t[9]=-a*l,t[2]=p-f*c,t[6]=m+d*c,t[10]=o*l}else if(e.order==="YXZ"){let f=l*u,d=l*h,m=c*u,p=c*h;t[0]=f+p*a,t[4]=m*a-d,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=d*a-m,t[6]=p+f*a,t[10]=o*l}else if(e.order==="ZXY"){let f=l*u,d=l*h,m=c*u,p=c*h;t[0]=f-p*a,t[4]=-o*h,t[8]=m+d*a,t[1]=d+m*a,t[5]=o*u,t[9]=p-f*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){let f=o*u,d=o*h,m=a*u,p=a*h;t[0]=l*u,t[4]=m*c-d,t[8]=f*c+p,t[1]=l*h,t[5]=p*c+f,t[9]=d*c-m,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let f=o*l,d=o*c,m=a*l,p=a*c;t[0]=l*u,t[4]=p-f*h,t[8]=m*h+d,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=d*h+m,t[10]=f-p*h}else if(e.order==="XZY"){let f=o*l,d=o*c,m=a*l,p=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=f*h+p,t[5]=o*u,t[9]=d*h-m,t[2]=m*h-d,t[6]=a*u,t[10]=p*h+f}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(PE,e,IE)}lookAt(e,t,r){let n=this.elements;return An.subVectors(e,t),An.lengthSq()===0&&(An.z=1),An.normalize(),bs.crossVectors(r,An),bs.lengthSq()===0&&(Math.abs(r.z)===1?An.x+=1e-4:An.z+=1e-4,An.normalize(),bs.crossVectors(r,An)),bs.normalize(),Rh.crossVectors(An,bs),n[0]=bs.x,n[4]=Rh.x,n[8]=An.x,n[1]=bs.y,n[5]=Rh.y,n[9]=An.y,n[2]=bs.z,n[6]=Rh.z,n[10]=An.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 r=e.elements,n=t.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],u=r[1],h=r[5],f=r[9],d=r[13],m=r[2],p=r[6],g=r[10],y=r[14],v=r[3],b=r[7],w=r[11],x=r[15],E=n[0],T=n[4],S=n[8],I=n[12],C=n[1],M=n[5],_=n[9],R=n[13],B=n[2],O=n[6],z=n[10],q=n[14],F=n[3],ee=n[7],k=n[11],V=n[15];return s[0]=o*E+a*C+l*B+c*F,s[4]=o*T+a*M+l*O+c*ee,s[8]=o*S+a*_+l*z+c*k,s[12]=o*I+a*R+l*q+c*V,s[1]=u*E+h*C+f*B+d*F,s[5]=u*T+h*M+f*O+d*ee,s[9]=u*S+h*_+f*z+d*k,s[13]=u*I+h*R+f*q+d*V,s[2]=m*E+p*C+g*B+y*F,s[6]=m*T+p*M+g*O+y*ee,s[10]=m*S+p*_+g*z+y*k,s[14]=m*I+p*R+g*q+y*V,s[3]=v*E+b*C+w*B+x*F,s[7]=v*T+b*M+w*O+x*ee,s[11]=v*S+b*_+w*z+x*k,s[15]=v*I+b*R+w*q+x*V,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],r=e[4],n=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],f=e[10],d=e[14],m=e[3],p=e[7],g=e[11],y=e[15];return m*(+s*l*h-n*c*h-s*a*f+r*c*f+n*a*d-r*l*d)+p*(+t*l*d-t*c*f+s*o*f-n*o*d+n*c*u-s*l*u)+g*(+t*c*h-t*a*d-s*o*h+r*o*d+s*a*u-r*c*u)+y*(-n*a*u-t*l*h+t*a*f+n*o*h-r*o*f+r*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,r){let n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=r),this}invert(){let e=this.elements,t=e[0],r=e[1],n=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],m=e[12],p=e[13],g=e[14],y=e[15],v=h*g*c-p*f*c+p*l*d-a*g*d-h*l*y+a*f*y,b=m*f*c-u*g*c-m*l*d+o*g*d+u*l*y-o*f*y,w=u*p*c-m*h*c+m*a*d-o*p*d-u*a*y+o*h*y,x=m*h*l-u*p*l-m*a*f+o*p*f+u*a*g-o*h*g,E=t*v+r*b+n*w+s*x;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let T=1/E;return e[0]=v*T,e[1]=(p*f*s-h*g*s-p*n*d+r*g*d+h*n*y-r*f*y)*T,e[2]=(a*g*s-p*l*s+p*n*c-r*g*c-a*n*y+r*l*y)*T,e[3]=(h*l*s-a*f*s-h*n*c+r*f*c+a*n*d-r*l*d)*T,e[4]=b*T,e[5]=(u*g*s-m*f*s+m*n*d-t*g*d-u*n*y+t*f*y)*T,e[6]=(m*l*s-o*g*s-m*n*c+t*g*c+o*n*y-t*l*y)*T,e[7]=(o*f*s-u*l*s+u*n*c-t*f*c-o*n*d+t*l*d)*T,e[8]=w*T,e[9]=(m*h*s-u*p*s-m*r*d+t*p*d+u*r*y-t*h*y)*T,e[10]=(o*p*s-m*a*s+m*r*c-t*p*c-o*r*y+t*a*y)*T,e[11]=(u*a*s-o*h*s-u*r*c+t*h*c+o*r*d-t*a*d)*T,e[12]=x*T,e[13]=(u*p*n-m*h*n+m*r*f-t*p*f-u*r*g+t*h*g)*T,e[14]=(m*a*n-o*p*n-m*r*l+t*p*l+o*r*g-t*a*g)*T,e[15]=(o*h*n-u*a*n+u*r*l-t*h*l-o*r*f+t*a*f)*T,this}scale(e){let t=this.elements,r=e.x,n=e.y,s=e.z;return t[0]*=r,t[4]*=n,t[8]*=s,t[1]*=r,t[5]*=n,t[9]*=s,t[2]*=r,t[6]*=n,t[10]*=s,t[3]*=r,t[7]*=n,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,n))}makeTranslation(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let r=Math.cos(t),n=Math.sin(t),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+r,c*a-n*l,c*l+n*a,0,c*a+n*l,u*a+r,u*l-n*o,0,c*l-n*a,u*l+n*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,n,s,o){return this.set(1,r,s,0,e,1,o,0,t,n,1,0,0,0,0,1),this}compose(e,t,r){let n=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,h=a+a,f=s*c,d=s*u,m=s*h,p=o*u,g=o*h,y=a*h,v=l*c,b=l*u,w=l*h,x=r.x,E=r.y,T=r.z;return n[0]=(1-(p+y))*x,n[1]=(d+w)*x,n[2]=(m-b)*x,n[3]=0,n[4]=(d-w)*E,n[5]=(1-(f+y))*E,n[6]=(g+v)*E,n[7]=0,n[8]=(m+b)*T,n[9]=(g-v)*T,n[10]=(1-(f+p))*T,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,r){let n=this.elements,s=ca.set(n[0],n[1],n[2]).length(),o=ca.set(n[4],n[5],n[6]).length(),a=ca.set(n[8],n[9],n[10]).length();this.determinant()<0&&(s=-s),e.x=n[12],e.y=n[13],e.z=n[14],ti.copy(this);let c=1/s,u=1/o,h=1/a;return ti.elements[0]*=c,ti.elements[1]*=c,ti.elements[2]*=c,ti.elements[4]*=u,ti.elements[5]*=u,ti.elements[6]*=u,ti.elements[8]*=h,ti.elements[9]*=h,ti.elements[10]*=h,t.setFromRotationMatrix(ti),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,n,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/(r-n),u=(t+e)/(t-e),h=(r+n)/(r-n),f=-(o+s)/(o-s),d=-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]=f,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,r,n,s,o){let a=this.elements,l=1/(t-e),c=1/(r-n),u=1/(o-s),h=(t+e)*l,f=(r+n)*c,d=(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]=-f,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){let t=this.elements,r=e.elements;for(let n=0;n<16;n++)if(t[n]!==r[n])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){let r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}};Ee.prototype.isMatrix4=!0;var ca=new A,ti=new Ee,PE=new A(0,0,0),IE=new A(1,1,1),bs=new A,Rh=new A,An=new A,Yx=new Ee,Jx=new Ut,pn=class{constructor(e=0,t=0,r=0,n=pn.DefaultOrder){this._x=e,this._y=t,this._z=r,this._order=n}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,n=this._order){return this._x=e,this._y=t,this._z=r,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){let n=e.elements,s=n[0],o=n[4],a=n[8],l=n[1],c=n[5],u=n[9],h=n[2],f=n[6],d=n[10];switch(t){case"XYZ":this._y=Math.asin(yr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-yr(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(yr(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-yr(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(yr(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,d));break;case"XZY":this._z=Math.asin(-yr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return Yx.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Yx,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Jx.setFromEuler(this),this.setFromQuaternion(Jx,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}};pn.prototype.isEuler=!0;pn.DefaultOrder="XYZ";pn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var Xc=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},RE=0,Qx=new A,ua=new Ut,Xi=new Ee,Bh=new A,Cc=new A,BE=new A,NE=new Ut,Kx=new A(1,0,0),Zx=new A(0,1,0),$x=new A(0,0,1),OE={type:"added"},e0={type:"removed"},ot=class extends jt{constructor(){super(),Object.defineProperty(this,"id",{value:RE++}),this.uuid=Fn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ot.DefaultUp.clone();let e=new A,t=new pn,r=new Ut,n=new A(1,1,1);function s(){r.setFromEuler(t,!1)}function o(){t.setFromQuaternion(r,void 0,!1)}t._onChange(s),r._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:r},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Ee},normalMatrix:{value:new Nt}}),this.matrix=new Ee,this.matrixWorld=new Ee,this.matrixAutoUpdate=ot.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Xc,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 ua.setFromAxisAngle(e,t),this.quaternion.multiply(ua),this}rotateOnWorldAxis(e,t){return ua.setFromAxisAngle(e,t),this.quaternion.premultiply(ua),this}rotateX(e){return this.rotateOnAxis(Kx,e)}rotateY(e){return this.rotateOnAxis(Zx,e)}rotateZ(e){return this.rotateOnAxis($x,e)}translateOnAxis(e,t){return Qx.copy(e).applyQuaternion(this.quaternion),this.position.add(Qx.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Kx,e)}translateY(e){return this.translateOnAxis(Zx,e)}translateZ(e){return this.translateOnAxis($x,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(Xi.copy(this.matrixWorld).invert())}lookAt(e,t,r){e.isVector3?Bh.copy(e):Bh.set(e,t,r);let n=this.parent;this.updateWorldMatrix(!0,!1),Cc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Xi.lookAt(Cc,Bh,this.up):Xi.lookAt(Bh,Cc,this.up),this.quaternion.setFromRotationMatrix(Xi),n&&(Xi.extractRotation(n.matrixWorld),ua.setFromRotationMatrix(Xi),this.quaternion.premultiply(ua.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(OE)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(e0)),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(e0)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),Xi.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Xi.multiply(e.parent.matrixWorld)),e.applyMatrix4(Xi),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 r=0,n=this.children.length;r<n;r++){let o=this.children[r].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(Cc,e,BE),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Cc,NE,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 r=0,n=t.length;r<n;r++)t[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let r=0,n=t.length;r<n;r++)t[r].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 r=0,n=t.length;r<n;r++)t[r].updateMatrixWorld(e)}updateWorldMatrix(e,t){let r=this.parent;if(e===!0&&r!==null&&r.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 n=this.children;for(let s=0,o=n.length;s<o;s++)n[s].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e=="string",r={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let n={};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.castShadow===!0&&(n.castShadow=!0),this.receiveShadow===!0&&(n.receiveShadow=!0),this.visible===!1&&(n.visible=!1),this.frustumCulled===!1&&(n.frustumCulled=!1),this.renderOrder!==0&&(n.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(n.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?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(n.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.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&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));n.material=a}else n.material=s(e.materials,this.material);if(this.children.length>0){n.children=[];for(let a=0;a<this.children.length;a++)n.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){n.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];n.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),f=o(e.skeletons),d=o(e.animations),m=o(e.nodes);a.length>0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),u.length>0&&(r.images=u),h.length>0&&(r.shapes=h),f.length>0&&(r.skeletons=f),d.length>0&&(r.animations=d),m.length>0&&(r.nodes=m)}return r.object=n,r;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 r=0;r<e.children.length;r++){let n=e.children[r];this.add(n.clone())}return this}};ot.DefaultUp=new A(0,1,0);ot.DefaultMatrixAutoUpdate=!0;ot.prototype.isObject3D=!0;var ri=new A,Yi=new A,Pm=new A,Ji=new A,ha=new A,fa=new A,t0=new A,Im=new A,Rm=new A,Bm=new A,Jt=class{constructor(e=new A,t=new A,r=new A){this.a=e,this.b=t,this.c=r}static getNormal(e,t,r,n){n.subVectors(r,t),ri.subVectors(e,t),n.cross(ri);let s=n.lengthSq();return s>0?n.multiplyScalar(1/Math.sqrt(s)):n.set(0,0,0)}static getBarycoord(e,t,r,n,s){ri.subVectors(n,t),Yi.subVectors(r,t),Pm.subVectors(e,t);let o=ri.dot(ri),a=ri.dot(Yi),l=ri.dot(Pm),c=Yi.dot(Yi),u=Yi.dot(Pm),h=o*c-a*a;if(h===0)return s.set(-2,-1,-1);let f=1/h,d=(c*l-a*u)*f,m=(o*u-a*l)*f;return s.set(1-d-m,m,d)}static containsPoint(e,t,r,n){return this.getBarycoord(e,t,r,n,Ji),Ji.x>=0&&Ji.y>=0&&Ji.x+Ji.y<=1}static getUV(e,t,r,n,s,o,a,l){return this.getBarycoord(e,t,r,n,Ji),l.set(0,0),l.addScaledVector(s,Ji.x),l.addScaledVector(o,Ji.y),l.addScaledVector(a,Ji.z),l}static isFrontFacing(e,t,r,n){return ri.subVectors(r,t),Yi.subVectors(e,t),ri.cross(Yi).dot(n)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,n){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,r,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ri.subVectors(this.c,this.b),Yi.subVectors(this.a,this.b),ri.cross(Yi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Jt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Jt.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,n,s){return Jt.getUV(e,this.a,this.b,this.c,t,r,n,s)}containsPoint(e){return Jt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Jt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let r=this.a,n=this.b,s=this.c,o,a;ha.subVectors(n,r),fa.subVectors(s,r),Im.subVectors(e,r);let l=ha.dot(Im),c=fa.dot(Im);if(l<=0&&c<=0)return t.copy(r);Rm.subVectors(e,n);let u=ha.dot(Rm),h=fa.dot(Rm);if(u>=0&&h<=u)return t.copy(n);let f=l*h-u*c;if(f<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(r).addScaledVector(ha,o);Bm.subVectors(e,s);let d=ha.dot(Bm),m=fa.dot(Bm);if(m>=0&&d<=m)return t.copy(s);let p=d*c-l*m;if(p<=0&&c>=0&&m<=0)return a=c/(c-m),t.copy(r).addScaledVector(fa,a);let g=u*m-d*h;if(g<=0&&h-u>=0&&d-m>=0)return t0.subVectors(s,n),a=(h-u)/(h-u+(d-m)),t.copy(n).addScaledVector(t0,a);let y=1/(g+p+f);return o=p*y,a=f*y,t.copy(r).addScaledVector(ha,o).addScaledVector(fa,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},FE=0,cr=class extends jt{constructor(){super(),Object.defineProperty(this,"id",{value:FE++}),this.uuid=Fn(),this.name="",this.type="Material",this.fog=!0,this.blending=Es,this.side=ii,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=rb,this.blendDst=nb,this.blendEquation=Ma,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=$m,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=hE,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=bm,this.stencilZFail=bm,this.stencilZPass=bm,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let r=e[t];if(r===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=r===tb;continue}let n=this[t];if(n===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}n&&n.isColor?n.set(r):n&&n.isVector3&&r&&r.isVector3?n.copy(r):this[t]=r}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let r={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Es&&(r.blending=this.blending),this.side!==ii&&(r.side=this.side),this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,r.colorWrite=this.colorWrite,r.stencilWrite=this.stencilWrite,r.stencilWriteMask=this.stencilWriteMask,r.stencilFunc=this.stencilFunc,r.stencilRef=this.stencilRef,r.stencilFuncMask=this.stencilFuncMask,r.stencilFail=this.stencilFail,r.stencilZFail=this.stencilZFail,r.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(r.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=this.flatShading),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData);function n(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=n(e.textures),o=n(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}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,r=null;if(t!==null){let n=t.length;r=new Array(n);for(let s=0;s!==n;++s)r[s]=t[s].clone()}return this.clippingPlanes=r,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++}};cr.prototype.isMaterial=!0;cr.fromType=function(){return null};var Un=class extends cr{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new xe(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=Kf,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}};Un.prototype.isMeshBasicMaterial=!0;var gr=new A,Nh=new N,Ue=class{constructor(e,t,r){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=r===!0,this.usage=Hc,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,r){e*=this.itemSize,r*=t.itemSize;for(let n=0,s=this.itemSize;n<s;n++)this.array[e+n]=t.array[r+n];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){let t=this.array,r=0;for(let n=0,s=e.length;n<s;n++){let o=e[n];o===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),o=new xe),t[r++]=o.r,t[r++]=o.g,t[r++]=o.b}return this}copyVector2sArray(e){let t=this.array,r=0;for(let n=0,s=e.length;n<s;n++){let o=e[n];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),o=new N),t[r++]=o.x,t[r++]=o.y}return this}copyVector3sArray(e){let t=this.array,r=0;for(let n=0,s=e.length;n<s;n++){let o=e[n];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),o=new A),t[r++]=o.x,t[r++]=o.y,t[r++]=o.z}return this}copyVector4sArray(e){let t=this.array,r=0;for(let n=0,s=e.length;n<s;n++){let o=e[n];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),o=new Qe),t[r++]=o.x,t[r++]=o.y,t[r++]=o.z,t[r++]=o.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,r=this.count;t<r;t++)Nh.fromBufferAttribute(this,t),Nh.applyMatrix3(e),this.setXY(t,Nh.x,Nh.y);else if(this.itemSize===3)for(let t=0,r=this.count;t<r;t++)gr.fromBufferAttribute(this,t),gr.applyMatrix3(e),this.setXYZ(t,gr.x,gr.y,gr.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)gr.fromBufferAttribute(this,t),gr.applyMatrix4(e),this.setXYZ(t,gr.x,gr.y,gr.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)gr.fromBufferAttribute(this,t),gr.applyNormalMatrix(e),this.setXYZ(t,gr.x,gr.y,gr.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)gr.fromBufferAttribute(this,t),gr.transformDirection(e),this.setXYZ(t,gr.x,gr.y,gr.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,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=n,this}setXYZW(e,t,r,n,s){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=n,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){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!==Hc&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}};Ue.prototype.isBufferAttribute=!0;var mf=class extends Ue{constructor(e,t,r){super(new Uint16Array(e),t,r)}};var Is=class extends Ue{constructor(e,t,r){super(new Uint32Array(e),t,r)}},lg=class extends Ue{constructor(e,t,r){super(new Uint16Array(e),t,r)}};lg.prototype.isFloat16BufferAttribute=!0;var Le=class extends Ue{constructor(e,t,r){super(new Float32Array(e),t,r)}};var UE=0,Nn=new Ee,Nm=new ot,da=new A,Tn=new Qt,Lc=new Qt,Er=new A,Ie=class extends jt{constructor(){super(),Object.defineProperty(this,"id",{value:UE++}),this.uuid=Fn(),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(ab(e)?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,r=0){this.groups.push({start:e,count:t,materialIndex:r})}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 r=this.attributes.normal;if(r!==void 0){let s=new Nt().getNormalMatrix(e);r.applyNormalMatrix(s),r.needsUpdate=!0}let n=this.attributes.tangent;return n!==void 0&&(n.transformDirection(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Nn.makeRotationFromQuaternion(e),this.applyMatrix4(Nn),this}rotateX(e){return Nn.makeRotationX(e),this.applyMatrix4(Nn),this}rotateY(e){return Nn.makeRotationY(e),this.applyMatrix4(Nn),this}rotateZ(e){return Nn.makeRotationZ(e),this.applyMatrix4(Nn),this}translate(e,t,r){return Nn.makeTranslation(e,t,r),this.applyMatrix4(Nn),this}scale(e,t,r){return Nn.makeScale(e,t,r),this.applyMatrix4(Nn),this}lookAt(e){return Nm.lookAt(e),Nm.updateMatrix(),this.applyMatrix4(Nm.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(da).negate(),this.translate(da.x,da.y,da.z),this}setFromPoints(e){let t=[];for(let r=0,n=e.length;r<n;r++){let s=e[r];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Le(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qt);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 A(-1/0,-1/0,-1/0),new A(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let r=0,n=t.length;r<n;r++){let s=t[r];Tn.setFromBufferAttribute(s),this.morphTargetsRelative?(Er.addVectors(this.boundingBox.min,Tn.min),this.boundingBox.expandByPoint(Er),Er.addVectors(this.boundingBox.max,Tn.max),this.boundingBox.expandByPoint(Er)):(this.boundingBox.expandByPoint(Tn.min),this.boundingBox.expandByPoint(Tn.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 Yr);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 A,1/0);return}if(e){let r=this.boundingSphere.center;if(Tn.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];Lc.setFromBufferAttribute(a),this.morphTargetsRelative?(Er.addVectors(Tn.min,Lc.min),Tn.expandByPoint(Er),Er.addVectors(Tn.max,Lc.max),Tn.expandByPoint(Er)):(Tn.expandByPoint(Lc.min),Tn.expandByPoint(Lc.max))}Tn.getCenter(r);let n=0;for(let s=0,o=e.count;s<o;s++)Er.fromBufferAttribute(e,s),n=Math.max(n,r.distanceToSquared(Er));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++)Er.fromBufferAttribute(a,c),l&&(da.fromBufferAttribute(e,c),Er.add(da)),n=Math.max(n,r.distanceToSquared(Er))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(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 r=e.array,n=t.position.array,s=t.normal.array,o=t.uv.array,a=n.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ue(new Float32Array(4*a),4));let l=this.getAttribute("tangent").array,c=[],u=[];for(let C=0;C<a;C++)c[C]=new A,u[C]=new A;let h=new A,f=new A,d=new A,m=new N,p=new N,g=new N,y=new A,v=new A;function b(C,M,_){h.fromArray(n,C*3),f.fromArray(n,M*3),d.fromArray(n,_*3),m.fromArray(o,C*2),p.fromArray(o,M*2),g.fromArray(o,_*2),f.sub(h),d.sub(h),p.sub(m),g.sub(m);let R=1/(p.x*g.y-g.x*p.y);!isFinite(R)||(y.copy(f).multiplyScalar(g.y).addScaledVector(d,-p.y).multiplyScalar(R),v.copy(d).multiplyScalar(p.x).addScaledVector(f,-g.x).multiplyScalar(R),c[C].add(y),c[M].add(y),c[_].add(y),u[C].add(v),u[M].add(v),u[_].add(v))}let w=this.groups;w.length===0&&(w=[{start:0,count:r.length}]);for(let C=0,M=w.length;C<M;++C){let _=w[C],R=_.start,B=_.count;for(let O=R,z=R+B;O<z;O+=3)b(r[O+0],r[O+1],r[O+2])}let x=new A,E=new A,T=new A,S=new A;function I(C){T.fromArray(s,C*3),S.copy(T);let M=c[C];x.copy(M),x.sub(T.multiplyScalar(T.dot(M))).normalize(),E.crossVectors(S,M);let R=E.dot(u[C])<0?-1:1;l[C*4]=x.x,l[C*4+1]=x.y,l[C*4+2]=x.z,l[C*4+3]=R}for(let C=0,M=w.length;C<M;++C){let _=w[C],R=_.start,B=_.count;for(let O=R,z=R+B;O<z;O+=3)I(r[O+0]),I(r[O+1]),I(r[O+2])}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new Ue(new Float32Array(t.count*3),3),this.setAttribute("normal",r);else for(let f=0,d=r.count;f<d;f++)r.setXYZ(f,0,0,0);let n=new A,s=new A,o=new A,a=new A,l=new A,c=new A,u=new A,h=new A;if(e)for(let f=0,d=e.count;f<d;f+=3){let m=e.getX(f+0),p=e.getX(f+1),g=e.getX(f+2);n.fromBufferAttribute(t,m),s.fromBufferAttribute(t,p),o.fromBufferAttribute(t,g),u.subVectors(o,s),h.subVectors(n,s),u.cross(h),a.fromBufferAttribute(r,m),l.fromBufferAttribute(r,p),c.fromBufferAttribute(r,g),a.add(u),l.add(u),c.add(u),r.setXYZ(m,a.x,a.y,a.z),r.setXYZ(p,l.x,l.y,l.z),r.setXYZ(g,c.x,c.y,c.z)}else for(let f=0,d=t.count;f<d;f+=3)n.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),o.fromBufferAttribute(t,f+2),u.subVectors(o,s),h.subVectors(n,s),u.cross(h),r.setXYZ(f+0,u.x,u.y,u.z),r.setXYZ(f+1,u.x,u.y,u.z),r.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),r.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 r=this.attributes;for(let n in r){if(e.attributes[n]===void 0)continue;let o=r[n].array,a=e.attributes[n],l=a.array,c=a.itemSize*t,u=Math.min(l.length,o.length-c);for(let h=0,f=c;h<u;h++,f++)o[f]=l[h]}return this}normalizeNormals(){let e=this.attributes.normal;for(let t=0,r=e.count;t<r;t++)Er.fromBufferAttribute(e,t),Er.normalize(),e.setXYZ(t,Er.x,Er.y,Er.z)}toNonIndexed(){function e(a,l){let c=a.array,u=a.itemSize,h=a.normalized,f=new c.constructor(l.length*u),d=0,m=0;for(let p=0,g=l.length;p<g;p++){a.isInterleavedBufferAttribute?d=l[p]*a.data.stride+a.offset:d=l[p]*u;for(let y=0;y<u;y++)f[m++]=c[d++]}return new Ue(f,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new Ie,r=this.index.array,n=this.attributes;for(let a in n){let l=n[a],c=e(l,r);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 f=c[u],d=e(f,r);l.push(d)}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 r=this.attributes;for(let l in r){let c=r[l];e.data.attributes[l]=c.toJSON(e.data)}let n={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let h=0,f=c.length;h<f;h++){let d=c[h];u.push(d.toJSON(e.data))}u.length>0&&(n[l]=u,s=!0)}s&&(e.data.morphAttributes=n,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 this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let r=e.index;r!==null&&this.setIndex(r.clone(t));let n=e.attributes;for(let c in n){let u=n[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],h=s[c];for(let f=0,d=h.length;f<d;f++)u.push(h[f].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,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}};Ie.prototype.isBufferGeometry=!0;var r0=new Ee,pa=new si,Om=new Yr,ws=new A,Ss=new A,Ms=new A,Fm=new A,Um=new A,zm=new A,Oh=new A,Fh=new A,Uh=new A,zh=new N,Gh=new N,kh=new N,Gm=new A,Vh=new A,Gt=class extends ot{constructor(e=new Ie,t=new Un){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,r=Object.keys(t);if(r.length>0){let n=t[r[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=n.length;s<o;s++){let a=n[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 r=this.geometry,n=this.material,s=this.matrixWorld;if(n===void 0||(r.boundingSphere===null&&r.computeBoundingSphere(),Om.copy(r.boundingSphere),Om.applyMatrix4(s),e.ray.intersectsSphere(Om)===!1)||(r0.copy(s).invert(),pa.copy(e.ray).applyMatrix4(r0),r.boundingBox!==null&&pa.intersectsBox(r.boundingBox)===!1))return;let o;if(r.isBufferGeometry){let a=r.index,l=r.attributes.position,c=r.morphAttributes.position,u=r.morphTargetsRelative,h=r.attributes.uv,f=r.attributes.uv2,d=r.groups,m=r.drawRange;if(a!==null)if(Array.isArray(n))for(let p=0,g=d.length;p<g;p++){let y=d[p],v=n[y.materialIndex],b=Math.max(y.start,m.start),w=Math.min(a.count,Math.min(y.start+y.count,m.start+m.count));for(let x=b,E=w;x<E;x+=3){let T=a.getX(x),S=a.getX(x+1),I=a.getX(x+2);o=Hh(this,v,e,pa,l,c,u,h,f,T,S,I),o&&(o.faceIndex=Math.floor(x/3),o.face.materialIndex=y.materialIndex,t.push(o))}}else{let p=Math.max(0,m.start),g=Math.min(a.count,m.start+m.count);for(let y=p,v=g;y<v;y+=3){let b=a.getX(y),w=a.getX(y+1),x=a.getX(y+2);o=Hh(this,n,e,pa,l,c,u,h,f,b,w,x),o&&(o.faceIndex=Math.floor(y/3),t.push(o))}}else if(l!==void 0)if(Array.isArray(n))for(let p=0,g=d.length;p<g;p++){let y=d[p],v=n[y.materialIndex],b=Math.max(y.start,m.start),w=Math.min(l.count,Math.min(y.start+y.count,m.start+m.count));for(let x=b,E=w;x<E;x+=3){let T=x,S=x+1,I=x+2;o=Hh(this,v,e,pa,l,c,u,h,f,T,S,I),o&&(o.faceIndex=Math.floor(x/3),o.face.materialIndex=y.materialIndex,t.push(o))}}else{let p=Math.max(0,m.start),g=Math.min(l.count,m.start+m.count);for(let y=p,v=g;y<v;y+=3){let b=y,w=y+1,x=y+2;o=Hh(this,n,e,pa,l,c,u,h,f,b,w,x),o&&(o.faceIndex=Math.floor(y/3),t.push(o))}}}else r.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}};Gt.prototype.isMesh=!0;function zE(i,e,t,r,n,s,o,a){let l;if(e.side===Cr?l=r.intersectTriangle(o,s,n,!0,a):l=r.intersectTriangle(n,s,o,e.side!==ir,a),l===null)return null;Vh.copy(a),Vh.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(Vh);return c<t.near||c>t.far?null:{distance:c,point:Vh.clone(),object:i}}function Hh(i,e,t,r,n,s,o,a,l,c,u,h){ws.fromBufferAttribute(n,c),Ss.fromBufferAttribute(n,u),Ms.fromBufferAttribute(n,h);let f=i.morphTargetInfluences;if(s&&f){Oh.set(0,0,0),Fh.set(0,0,0),Uh.set(0,0,0);for(let m=0,p=s.length;m<p;m++){let g=f[m],y=s[m];g!==0&&(Fm.fromBufferAttribute(y,c),Um.fromBufferAttribute(y,u),zm.fromBufferAttribute(y,h),o?(Oh.addScaledVector(Fm,g),Fh.addScaledVector(Um,g),Uh.addScaledVector(zm,g)):(Oh.addScaledVector(Fm.sub(ws),g),Fh.addScaledVector(Um.sub(Ss),g),Uh.addScaledVector(zm.sub(Ms),g)))}ws.add(Oh),Ss.add(Fh),Ms.add(Uh)}i.isSkinnedMesh&&(i.boneTransform(c,ws),i.boneTransform(u,Ss),i.boneTransform(h,Ms));let d=zE(i,e,t,r,ws,Ss,Ms,Gm);if(d){a&&(zh.fromBufferAttribute(a,c),Gh.fromBufferAttribute(a,u),kh.fromBufferAttribute(a,h),d.uv=Jt.getUV(Gm,ws,Ss,Ms,zh,Gh,kh,new N)),l&&(zh.fromBufferAttribute(l,c),Gh.fromBufferAttribute(l,u),kh.fromBufferAttribute(l,h),d.uv2=Jt.getUV(Gm,ws,Ss,Ms,zh,Gh,kh,new N));let m={a:c,b:u,c:h,normal:new A,materialIndex:0};Jt.getNormal(ws,Ss,Ms,m.normal),d.face=m}return d}var mn=class extends Ie{constructor(e=1,t=1,r=1,n=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:s,depthSegments:o};let a=this;n=Math.floor(n),s=Math.floor(s),o=Math.floor(o);let l=[],c=[],u=[],h=[],f=0,d=0;m("z","y","x",-1,-1,r,t,e,o,s,0),m("z","y","x",1,-1,r,t,-e,o,s,1),m("x","z","y",1,1,e,r,t,n,o,2),m("x","z","y",1,-1,e,r,-t,n,o,3),m("x","y","z",1,-1,e,t,r,n,s,4),m("x","y","z",-1,-1,e,t,-r,n,s,5),this.setIndex(l),this.setAttribute("position",new Le(c,3)),this.setAttribute("normal",new Le(u,3)),this.setAttribute("uv",new Le(h,2));function m(p,g,y,v,b,w,x,E,T,S,I){let C=w/T,M=x/S,_=w/2,R=x/2,B=E/2,O=T+1,z=S+1,q=0,F=0,ee=new A;for(let k=0;k<z;k++){let V=k*M-R;for(let U=0;U<O;U++){let J=U*C-_;ee[p]=J*v,ee[g]=V*b,ee[y]=B,c.push(ee.x,ee.y,ee.z),ee[p]=0,ee[g]=0,ee[y]=E>0?1:-1,u.push(ee.x,ee.y,ee.z),h.push(U/T),h.push(1-k/S),q+=1}}for(let k=0;k<S;k++)for(let V=0;V<T;V++){let U=f+V+O*k,J=f+V+O*(k+1),K=f+(V+1)+O*(k+1),$=f+(V+1)+O*k;l.push(U,J,$),l.push(J,K,$),F+=6}a.addGroup(d,F,I),d+=F,f+=q}}static fromJSON(e){return new mn(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function Ia(i){let e={};for(let t in i){e[t]={};for(let r in i[t]){let n=i[t][r];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)?e[t][r]=n.clone():Array.isArray(n)?e[t][r]=n.slice():e[t][r]=n}}return e}function Xr(i){let e={};for(let t=0;t<i.length;t++){let r=Ia(i[t]);for(let n in r)e[n]=r[n]}return e}var li={clone:Ia,merge:Xr},GE=`void main() {
|
|
2
2
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
3
3
|
}`,kE=`void main() {
|
|
4
4
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
5
|
-
}`,St=class extends cr{constructor(e){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=GE,this.fragmentShader=kE,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=Ia(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 n in this.uniforms){let o=this.uniforms[n].value;o&&o.isTexture?t.uniforms[n]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[n]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[n]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[n]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[n]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[n]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[n]={type:"m4",value:o.toArray()}:t.uniforms[n]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let r={};for(let n in this.extensions)this.extensions[n]===!0&&(r[n]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}};St.prototype.isShaderMaterial=!0;var zn=class extends ot{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Ee,this.projectionMatrix=new Ee,this.projectionMatrixInverse=new Ee}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)}};zn.prototype.isCamera=!0;var nr=class extends zn{constructor(e=50,t=1,r=.1,n=2e3){super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Wc*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Fc*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Wc*2*Math.atan(Math.tan(Fc*.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,r,n,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=r,this.view.offsetY=n,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(Fc*.5*this.fov)/this.zoom,r=2*t,n=this.aspect*r,s=-.5*n,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*n/l,t-=o.offsetY*r/c,n*=o.width/l,r*=o.height/c}let a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+n,t,t-r,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}};nr.prototype.isPerspectiveCamera=!0;var ma=90,ga=1,Yc=class extends ot{constructor(e,t,r){if(super(),this.type="CubeCamera",r.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=r;let n=new nr(ma,ga,e,t);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new A(1,0,0)),this.add(n);let s=new nr(ma,ga,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new A(-1,0,0)),this.add(s);let o=new nr(ma,ga,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new A(0,1,0)),this.add(o);let a=new nr(ma,ga,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new A(0,-1,0)),this.add(a);let l=new nr(ma,ga,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new A(0,0,1)),this.add(l);let c=new nr(ma,ga,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new A(0,0,-1)),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();let r=this.renderTarget,[n,s,o,a,l,c]=this.children,u=e.getRenderTarget(),h=e.outputEncoding,f=e.toneMapping,d=e.xr.enabled;e.outputEncoding=rn,e.toneMapping=$i,e.xr.enabled=!1;let m=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0),e.render(t,n),e.setRenderTarget(r,1),e.render(t,s),e.setRenderTarget(r,2),e.render(t,o),e.setRenderTarget(r,3),e.render(t,a),e.setRenderTarget(r,4),e.render(t,l),r.texture.generateMipmaps=m,e.setRenderTarget(r,5),e.render(t,c),e.setRenderTarget(u),e.outputEncoding=h,e.toneMapping=f,e.xr.enabled=d,r.texture.needsPMREMUpdate=!0}},Rs=class extends _t{constructor(e,t,r,n,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Ls,super(e,t,r,n,s,o,a,l,c,u),this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};Rs.prototype.isCubeTexture=!0;var
|
|
5
|
+
}`,St=class extends cr{constructor(e){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=GE,this.fragmentShader=kE,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=Ia(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 n in this.uniforms){let o=this.uniforms[n].value;o&&o.isTexture?t.uniforms[n]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[n]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[n]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[n]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[n]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[n]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[n]={type:"m4",value:o.toArray()}:t.uniforms[n]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let r={};for(let n in this.extensions)this.extensions[n]===!0&&(r[n]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}};St.prototype.isShaderMaterial=!0;var zn=class extends ot{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Ee,this.projectionMatrix=new Ee,this.projectionMatrixInverse=new Ee}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)}};zn.prototype.isCamera=!0;var nr=class extends zn{constructor(e=50,t=1,r=.1,n=2e3){super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Wc*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Fc*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Wc*2*Math.atan(Math.tan(Fc*.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,r,n,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=r,this.view.offsetY=n,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(Fc*.5*this.fov)/this.zoom,r=2*t,n=this.aspect*r,s=-.5*n,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*n/l,t-=o.offsetY*r/c,n*=o.width/l,r*=o.height/c}let a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+n,t,t-r,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}};nr.prototype.isPerspectiveCamera=!0;var ma=90,ga=1,Yc=class extends ot{constructor(e,t,r){if(super(),this.type="CubeCamera",r.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=r;let n=new nr(ma,ga,e,t);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new A(1,0,0)),this.add(n);let s=new nr(ma,ga,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new A(-1,0,0)),this.add(s);let o=new nr(ma,ga,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new A(0,1,0)),this.add(o);let a=new nr(ma,ga,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new A(0,-1,0)),this.add(a);let l=new nr(ma,ga,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new A(0,0,1)),this.add(l);let c=new nr(ma,ga,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new A(0,0,-1)),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();let r=this.renderTarget,[n,s,o,a,l,c]=this.children,u=e.getRenderTarget(),h=e.outputEncoding,f=e.toneMapping,d=e.xr.enabled;e.outputEncoding=rn,e.toneMapping=$i,e.xr.enabled=!1;let m=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0),e.render(t,n),e.setRenderTarget(r,1),e.render(t,s),e.setRenderTarget(r,2),e.render(t,o),e.setRenderTarget(r,3),e.render(t,a),e.setRenderTarget(r,4),e.render(t,l),r.texture.generateMipmaps=m,e.setRenderTarget(r,5),e.render(t,c),e.setRenderTarget(u),e.outputEncoding=h,e.toneMapping=f,e.xr.enabled=d,r.texture.needsPMREMUpdate=!0}},Rs=class extends _t{constructor(e,t,r,n,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Ls,super(e,t,r,n,s,o,a,l,c,u),this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};Rs.prototype.isCubeTexture=!0;var gf=class extends mt{constructor(e,t={}){super(e,e,t);let r={width:e,height:e,depth:1},n=[r,r,r,r,r,r];this.texture=new Rs(n,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:ct}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let r={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
6
6
|
|
|
7
7
|
varying vec3 vWorldDirection;
|
|
8
8
|
|
|
@@ -37,7 +37,7 @@ var oT=Object.create;var Mh=Object.defineProperty,aT=Object.defineProperties,lT=
|
|
|
37
37
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
38
38
|
|
|
39
39
|
}
|
|
40
|
-
`},n=new mn(5,5,5),s=new St({name:"CubemapFromEquirect",uniforms:Ia(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Cr,blending:kt});s.uniforms.tEquirect.value=t;let o=new Gt(n,s),a=t.minFilter;return t.minFilter===ks&&(t.minFilter=ct),new Yc(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,r,n){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,r,n);e.setRenderTarget(s)}};
|
|
40
|
+
`},n=new mn(5,5,5),s=new St({name:"CubemapFromEquirect",uniforms:Ia(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Cr,blending:kt});s.uniforms.tEquirect.value=t;let o=new Gt(n,s),a=t.minFilter;return t.minFilter===ks&&(t.minFilter=ct),new Yc(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,r,n){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,r,n);e.setRenderTarget(s)}};gf.prototype.isWebGLCubeRenderTarget=!0;var km=new A,VE=new A,HE=new Nt,Fr=class{constructor(e=new A(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,r,n){return this.normal.set(e,t,r),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){let n=km.subVectors(r,t).cross(VE.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){let r=e.delta(km),n=this.normal.dot(r);if(n===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let s=-(e.start.dot(this.normal)+this.constant)/n;return s<0||s>1?null:t.copy(r).multiplyScalar(s).add(e.start)}intersectsLine(e){let t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<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 r=t||HE.getNormalMatrix(e),n=this.coplanarPoint(km).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-n.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}};Fr.prototype.isPlane=!0;var ya=new Yr,Wh=new A,Ra=class{constructor(e=new Fr,t=new Fr,r=new Fr,n=new Fr,s=new Fr,o=new Fr){this.planes=[e,t,r,n,s,o]}set(e,t,r,n,s,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(n),a[4].copy(s),a[5].copy(o),this}copy(e){let t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e){let t=this.planes,r=e.elements,n=r[0],s=r[1],o=r[2],a=r[3],l=r[4],c=r[5],u=r[6],h=r[7],f=r[8],d=r[9],m=r[10],p=r[11],g=r[12],y=r[13],v=r[14],b=r[15];return t[0].setComponents(a-n,h-l,p-f,b-g).normalize(),t[1].setComponents(a+n,h+l,p+f,b+g).normalize(),t[2].setComponents(a+s,h+c,p+d,b+y).normalize(),t[3].setComponents(a-s,h-c,p-d,b-y).normalize(),t[4].setComponents(a-o,h-u,p-m,b-v).normalize(),t[5].setComponents(a+o,h+u,p+m,b+v).normalize(),this}intersectsObject(e){let t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),ya.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(ya)}intersectsSprite(e){return ya.center.set(0,0,0),ya.radius=.7071067811865476,ya.applyMatrix4(e.matrixWorld),this.intersectsSphere(ya)}intersectsSphere(e){let t=this.planes,r=e.center,n=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(r)<n)return!1;return!0}intersectsBox(e){let t=this.planes;for(let r=0;r<6;r++){let n=t[r];if(Wh.x=n.normal.x>0?e.max.x:e.min.x,Wh.y=n.normal.y>0?e.max.y:e.min.y,Wh.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(Wh)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function cb(){let i=null,e=!1,t=null,r=null;function n(s,o){t(s,o),r=i.requestAnimationFrame(n)}return{start:function(){e!==!0&&t!==null&&(r=i.requestAnimationFrame(n),e=!0)},stop:function(){i.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function WE(i,e){let t=e.isWebGL2,r=new WeakMap;function n(c,u){let h=c.array,f=c.usage,d=i.createBuffer();i.bindBuffer(u,d),i.bufferData(u,h,f),c.onUploadCallback();let m;if(h instanceof Float32Array)m=5126;else if(h instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)m=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else m=5123;else if(h instanceof Int16Array)m=5122;else if(h instanceof Uint32Array)m=5125;else if(h instanceof Int32Array)m=5124;else if(h instanceof Int8Array)m=5120;else if(h instanceof Uint8Array)m=5121;else if(h instanceof Uint8ClampedArray)m=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:d,type:m,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version}}function s(c,u,h){let f=u.array,d=u.updateRange;i.bindBuffer(h,c),d.count===-1?i.bufferSubData(h,0,f):(t?i.bufferSubData(h,d.offset*f.BYTES_PER_ELEMENT,f,d.offset,d.count):i.bufferSubData(h,d.offset*f.BYTES_PER_ELEMENT,f.subarray(d.offset,d.offset+d.count)),d.count=-1)}function o(c){return c.isInterleavedBufferAttribute&&(c=c.data),r.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);let u=r.get(c);u&&(i.deleteBuffer(u.buffer),r.delete(c))}function l(c,u){if(c.isGLBufferAttribute){let f=r.get(c);(!f||f.version<c.version)&&r.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}c.isInterleavedBufferAttribute&&(c=c.data);let h=r.get(c);h===void 0?r.set(c,n(c,u)):h.version<c.version&&(s(h.buffer,c,u),h.version=c.version)}return{get:o,remove:a,update:l}}var ts=class extends Ie{constructor(e=1,t=1,r=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:n};let s=e/2,o=t/2,a=Math.floor(r),l=Math.floor(n),c=a+1,u=l+1,h=e/a,f=t/l,d=[],m=[],p=[],g=[];for(let y=0;y<u;y++){let v=y*f-o;for(let b=0;b<c;b++){let w=b*h-s;m.push(w,-v,0),p.push(0,0,1),g.push(b/a),g.push(1-y/l)}}for(let y=0;y<l;y++)for(let v=0;v<a;v++){let b=v+c*y,w=v+c*(y+1),x=v+1+c*(y+1),E=v+1+c*y;d.push(b,w,E),d.push(w,x,E)}this.setIndex(d),this.setAttribute("position",new Le(m,3)),this.setAttribute("normal",new Le(p,3)),this.setAttribute("uv",new Le(g,2))}static fromJSON(e){return new ts(e.width,e.height,e.widthSegments,e.heightSegments)}},jE=`#ifdef USE_ALPHAMAP
|
|
41
41
|
diffuseColor.a *= texture2D( alphaMap, vUv ).g;
|
|
42
42
|
#endif`,qE=`#ifdef USE_ALPHAMAP
|
|
43
43
|
uniform sampler2D alphaMap;
|
|
@@ -2783,7 +2783,7 @@ void main() {
|
|
|
2783
2783
|
#include <tonemapping_fragment>
|
|
2784
2784
|
#include <encodings_fragment>
|
|
2785
2785
|
#include <fog_fragment>
|
|
2786
|
-
}`,gt={alphamap_fragment:jE,alphamap_pars_fragment:qE,alphatest_fragment:XE,alphatest_pars_fragment:YE,aomap_fragment:JE,aomap_pars_fragment:QE,begin_vertex:KE,beginnormal_vertex:ZE,bsdfs:$E,bumpmap_pars_fragment:e_,clipping_planes_fragment:t_,clipping_planes_pars_fragment:r_,clipping_planes_pars_vertex:n_,clipping_planes_vertex:i_,color_fragment:s_,color_pars_fragment:o_,color_pars_vertex:a_,color_vertex:l_,common:c_,cube_uv_reflection_fragment:u_,defaultnormal_vertex:h_,displacementmap_pars_vertex:f_,displacementmap_vertex:d_,emissivemap_fragment:p_,emissivemap_pars_fragment:m_,encodings_fragment:g_,encodings_pars_fragment:y_,envmap_fragment:v_,envmap_common_pars_fragment:x_,envmap_pars_fragment:b_,envmap_pars_vertex:w_,envmap_physical_pars_fragment:I_,envmap_vertex:S_,fog_vertex:M_,fog_pars_vertex:A_,fog_fragment:T_,fog_pars_fragment:E_,gradientmap_pars_fragment:__,lightmap_fragment:C_,lightmap_pars_fragment:L_,lights_lambert_vertex:D_,lights_pars_begin:P_,lights_toon_fragment:R_,lights_toon_pars_fragment:B_,lights_phong_fragment:N_,lights_phong_pars_fragment:O_,lights_physical_fragment:F_,lights_physical_pars_fragment:U_,lights_fragment_begin:z_,lights_fragment_maps:G_,lights_fragment_end:k_,logdepthbuf_fragment:V_,logdepthbuf_pars_fragment:H_,logdepthbuf_pars_vertex:W_,logdepthbuf_vertex:j_,map_fragment:q_,map_pars_fragment:X_,map_particle_fragment:Y_,map_particle_pars_fragment:J_,metalnessmap_fragment:Q_,metalnessmap_pars_fragment:K_,morphcolor_vertex:Z_,morphnormal_vertex:$_,morphtarget_pars_vertex:eC,morphtarget_vertex:tC,normal_fragment_begin:rC,normal_fragment_maps:nC,normal_pars_fragment:iC,normal_pars_vertex:sC,normal_vertex:oC,normalmap_pars_fragment:aC,clearcoat_normal_fragment_begin:lC,clearcoat_normal_fragment_maps:cC,clearcoat_pars_fragment:uC,output_fragment:hC,packing:fC,premultiplied_alpha_fragment:dC,project_vertex:pC,dithering_fragment:mC,dithering_pars_fragment:gC,roughnessmap_fragment:yC,roughnessmap_pars_fragment:vC,shadowmap_pars_fragment:xC,shadowmap_pars_vertex:bC,shadowmap_vertex:wC,shadowmask_pars_fragment:SC,skinbase_vertex:MC,skinning_pars_vertex:AC,skinning_vertex:TC,skinnormal_vertex:EC,specularmap_fragment:_C,specularmap_pars_fragment:CC,tonemapping_fragment:LC,tonemapping_pars_fragment:DC,transmission_fragment:PC,transmission_pars_fragment:IC,uv_pars_fragment:RC,uv_pars_vertex:BC,uv_vertex:NC,uv2_pars_fragment:OC,uv2_pars_vertex:FC,uv2_vertex:UC,worldpos_vertex:zC,background_vert:GC,background_frag:kC,cube_vert:VC,cube_frag:HC,depth_vert:WC,depth_frag:jC,distanceRGBA_vert:qC,distanceRGBA_frag:XC,equirect_vert:YC,equirect_frag:JC,linedashed_vert:QC,linedashed_frag:KC,meshbasic_vert:ZC,meshbasic_frag:$C,meshlambert_vert:eL,meshlambert_frag:tL,meshmatcap_vert:rL,meshmatcap_frag:nL,meshnormal_vert:iL,meshnormal_frag:sL,meshphong_vert:oL,meshphong_frag:aL,meshphysical_vert:lL,meshphysical_frag:cL,meshtoon_vert:uL,meshtoon_frag:hL,points_vert:fL,points_frag:dL,shadow_vert:pL,shadow_frag:mL,sprite_vert:gL,sprite_frag:yL},we={common:{diffuse:{value:new xe(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Nt},uv2Transform:{value:new Nt},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},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 N(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 xe(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 xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Nt}},sprite:{diffuse:{value:new xe(16777215)},opacity:{value:1},center:{value:new N(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Nt}}},Mi={basic:{uniforms:Xr([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.fog]),vertexShader:gt.meshbasic_vert,fragmentShader:gt.meshbasic_frag},lambert:{uniforms:Xr([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.fog,we.lights,{emissive:{value:new xe(0)}}]),vertexShader:gt.meshlambert_vert,fragmentShader:gt.meshlambert_frag},phong:{uniforms:Xr([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.fog,we.lights,{emissive:{value:new xe(0)},specular:{value:new xe(1118481)},shininess:{value:30}}]),vertexShader:gt.meshphong_vert,fragmentShader:gt.meshphong_frag},standard:{uniforms:Xr([we.common,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.roughnessmap,we.metalnessmap,we.fog,we.lights,{emissive:{value:new xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:gt.meshphysical_vert,fragmentShader:gt.meshphysical_frag},toon:{uniforms:Xr([we.common,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.gradientmap,we.fog,we.lights,{emissive:{value:new xe(0)}}]),vertexShader:gt.meshtoon_vert,fragmentShader:gt.meshtoon_frag},matcap:{uniforms:Xr([we.common,we.bumpmap,we.normalmap,we.displacementmap,we.fog,{matcap:{value:null}}]),vertexShader:gt.meshmatcap_vert,fragmentShader:gt.meshmatcap_frag},points:{uniforms:Xr([we.points,we.fog]),vertexShader:gt.points_vert,fragmentShader:gt.points_frag},dashed:{uniforms:Xr([we.common,we.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:gt.linedashed_vert,fragmentShader:gt.linedashed_frag},depth:{uniforms:Xr([we.common,we.displacementmap]),vertexShader:gt.depth_vert,fragmentShader:gt.depth_frag},normal:{uniforms:Xr([we.common,we.bumpmap,we.normalmap,we.displacementmap,{opacity:{value:1}}]),vertexShader:gt.meshnormal_vert,fragmentShader:gt.meshnormal_frag},sprite:{uniforms:Xr([we.sprite,we.fog]),vertexShader:gt.sprite_vert,fragmentShader:gt.sprite_frag},background:{uniforms:{uvTransform:{value:new Nt},t2D:{value:null}},vertexShader:gt.background_vert,fragmentShader:gt.background_frag},cube:{uniforms:Xr([we.envmap,{opacity:{value:1}}]),vertexShader:gt.cube_vert,fragmentShader:gt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:gt.equirect_vert,fragmentShader:gt.equirect_frag},distanceRGBA:{uniforms:Xr([we.common,we.displacementmap,{referencePosition:{value:new A},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:gt.distanceRGBA_vert,fragmentShader:gt.distanceRGBA_frag},shadow:{uniforms:Xr([we.lights,we.fog,{color:{value:new xe(0)},opacity:{value:1}}]),vertexShader:gt.shadow_vert,fragmentShader:gt.shadow_frag}};Mi.physical={uniforms:Xr([Mi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new N(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new xe(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new N},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new xe(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new xe(1,1,1)},specularColorMap:{value:null}}]),vertexShader:gt.meshphysical_vert,fragmentShader:gt.meshphysical_frag};function vL(i,e,t,r,n,s){let o=new xe(0),a=n===!0?0:1,l,c,u=null,h=0,f=null;function d(p,g){let y=!1,v=g.isScene===!0?g.background:null;v&&v.isTexture&&(v=e.get(v));let b=i.xr,w=b.getSession&&b.getSession();w&&w.environmentBlendMode==="additive"&&(v=null),v===null?m(o,a):v&&v.isColor&&(m(v,1),y=!0),(i.autoClear||y)&&i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil),v&&(v.isCubeTexture||v.mapping===ja)?(c===void 0&&(c=new Gt(new mn(1,1,1),new St({name:"BackgroundCubeMaterial",uniforms:Ia(Mi.cube.uniforms),vertexShader:Mi.cube.vertexShader,fragmentShader:Mi.cube.fragmentShader,side:Cr,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(x,E,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),c.material.uniforms.envMap.value=v,c.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,(u!==v||h!==v.version||f!==i.toneMapping)&&(c.material.needsUpdate=!0,u=v,h=v.version,f=i.toneMapping),p.unshift(c,c.geometry,c.material,0,0,null)):v&&v.isTexture&&(l===void 0&&(l=new Gt(new ts(2,2),new St({name:"BackgroundMaterial",uniforms:Ia(Mi.background.uniforms),vertexShader:Mi.background.vertexShader,fragmentShader:Mi.background.fragmentShader,side:ii,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=v,v.matrixAutoUpdate===!0&&v.updateMatrix(),l.material.uniforms.uvTransform.value.copy(v.matrix),(u!==v||h!==v.version||f!==i.toneMapping)&&(l.material.needsUpdate=!0,u=v,h=v.version,f=i.toneMapping),p.unshift(l,l.geometry,l.material,0,0,null))}function m(p,g){t.buffers.color.setClear(p.r,p.g,p.b,g,s)}return{getClearColor:function(){return o},setClearColor:function(p,g=1){o.set(p),a=g,m(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(p){a=p,m(o,a)},render:d}}function xL(i,e,t,r){let n=i.getParameter(34921),s=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||s!==null,a={},l=g(null),c=l,u=!1;function h(B,O,z,q,F){let ee=!1;if(o){let k=p(q,z,O);c!==k&&(c=k,d(c.object)),ee=y(q,F),ee&&v(q,F)}else{let k=O.wireframe===!0;(c.geometry!==q.id||c.program!==z.id||c.wireframe!==k)&&(c.geometry=q.id,c.program=z.id,c.wireframe=k,ee=!0)}B.isInstancedMesh===!0&&(ee=!0),F!==null&&t.update(F,34963),(ee||u)&&(u=!1,S(B,O,z,q),F!==null&&i.bindBuffer(34963,t.get(F).buffer))}function f(){return r.isWebGL2?i.createVertexArray():s.createVertexArrayOES()}function d(B){return r.isWebGL2?i.bindVertexArray(B):s.bindVertexArrayOES(B)}function m(B){return r.isWebGL2?i.deleteVertexArray(B):s.deleteVertexArrayOES(B)}function p(B,O,z){let q=z.wireframe===!0,F=a[B.id];F===void 0&&(F={},a[B.id]=F);let ee=F[O.id];ee===void 0&&(ee={},F[O.id]=ee);let k=ee[q];return k===void 0&&(k=g(f()),ee[q]=k),k}function g(B){let O=[],z=[],q=[];for(let F=0;F<n;F++)O[F]=0,z[F]=0,q[F]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:O,enabledAttributes:z,attributeDivisors:q,object:B,attributes:{},index:null}}function y(B,O){let z=c.attributes,q=B.attributes,F=0;for(let ee in q){let k=z[ee],V=q[ee];if(k===void 0||k.attribute!==V||k.data!==V.data)return!0;F++}return c.attributesNum!==F||c.index!==O}function v(B,O){let z={},q=B.attributes,F=0;for(let ee in q){let k=q[ee],V={};V.attribute=k,k.data&&(V.data=k.data),z[ee]=V,F++}c.attributes=z,c.attributesNum=F,c.index=O}function b(){let B=c.newAttributes;for(let O=0,z=B.length;O<z;O++)B[O]=0}function w(B){x(B,0)}function x(B,O){let z=c.newAttributes,q=c.enabledAttributes,F=c.attributeDivisors;z[B]=1,q[B]===0&&(i.enableVertexAttribArray(B),q[B]=1),F[B]!==O&&((r.isWebGL2?i:e.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](B,O),F[B]=O)}function E(){let B=c.newAttributes,O=c.enabledAttributes;for(let z=0,q=O.length;z<q;z++)O[z]!==B[z]&&(i.disableVertexAttribArray(z),O[z]=0)}function T(B,O,z,q,F,ee){r.isWebGL2===!0&&(z===5124||z===5125)?i.vertexAttribIPointer(B,O,z,F,ee):i.vertexAttribPointer(B,O,z,q,F,ee)}function S(B,O,z,q){if(r.isWebGL2===!1&&(B.isInstancedMesh||q.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;b();let F=q.attributes,ee=z.getAttributes(),k=O.defaultAttributeValues;for(let V in ee){let U=ee[V];if(U.location>=0){let J=F[V];if(J===void 0&&(V==="instanceMatrix"&&B.instanceMatrix&&(J=B.instanceMatrix),V==="instanceColor"&&B.instanceColor&&(J=B.instanceColor)),J!==void 0){let K=J.normalized,$=J.itemSize,j=t.get(J);if(j===void 0)continue;let ge=j.buffer,ae=j.type,le=j.bytesPerElement;if(J.isInterleavedBufferAttribute){let W=J.data,ue=W.stride,Y=J.offset;if(W.isInstancedInterleavedBuffer){for(let H=0;H<U.locationSize;H++)x(U.location+H,W.meshPerAttribute);B.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=W.meshPerAttribute*W.count)}else for(let H=0;H<U.locationSize;H++)w(U.location+H);i.bindBuffer(34962,ge);for(let H=0;H<U.locationSize;H++)T(U.location+H,$/U.locationSize,ae,K,ue*le,(Y+$/U.locationSize*H)*le)}else{if(J.isInstancedBufferAttribute){for(let W=0;W<U.locationSize;W++)x(U.location+W,J.meshPerAttribute);B.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=J.meshPerAttribute*J.count)}else for(let W=0;W<U.locationSize;W++)w(U.location+W);i.bindBuffer(34962,ge);for(let W=0;W<U.locationSize;W++)T(U.location+W,$/U.locationSize,ae,K,$*le,$/U.locationSize*W*le)}}else if(k!==void 0){let K=k[V];if(K!==void 0)switch(K.length){case 2:i.vertexAttrib2fv(U.location,K);break;case 3:i.vertexAttrib3fv(U.location,K);break;case 4:i.vertexAttrib4fv(U.location,K);break;default:i.vertexAttrib1fv(U.location,K)}}}}E()}function I(){_();for(let B in a){let O=a[B];for(let z in O){let q=O[z];for(let F in q)m(q[F].object),delete q[F];delete O[z]}delete a[B]}}function C(B){if(a[B.id]===void 0)return;let O=a[B.id];for(let z in O){let q=O[z];for(let F in q)m(q[F].object),delete q[F];delete O[z]}delete a[B.id]}function M(B){for(let O in a){let z=a[O];if(z[B.id]===void 0)continue;let q=z[B.id];for(let F in q)m(q[F].object),delete q[F];delete z[B.id]}}function _(){R(),u=!0,c!==l&&(c=l,d(c.object))}function R(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:h,reset:_,resetDefaultState:R,dispose:I,releaseStatesOfGeometry:C,releaseStatesOfProgram:M,initAttributes:b,enableAttribute:w,disableUnusedAttributes:E}}function bL(i,e,t,r){let n=r.isWebGL2,s;function o(c){s=c}function a(c,u){i.drawArrays(s,c,u),t.update(u,s,1)}function l(c,u,h){if(h===0)return;let f,d;if(n)f=i,d="drawArraysInstanced";else if(f=e.get("ANGLE_instanced_arrays"),d="drawArraysInstancedANGLE",f===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}f[d](s,c,u,h),t.update(u,s,h)}this.setMode=o,this.render=a,this.renderInstances=l}function wL(i,e,t){let r;function n(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){let T=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(T.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function s(T){if(T==="highp"){if(i.getShaderPrecisionFormat(35633,36338).precision>0&&i.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";T="mediump"}return T==="mediump"&&i.getShaderPrecisionFormat(35633,36337).precision>0&&i.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}let o=typeof WebGL2RenderingContext<"u"&&i instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&i 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=i.getParameter(34930),f=i.getParameter(35660),d=i.getParameter(3379),m=i.getParameter(34076),p=i.getParameter(34921),g=i.getParameter(36347),y=i.getParameter(36348),v=i.getParameter(36349),b=f>0,w=o||e.has("OES_texture_float"),x=b&&w,E=o?i.getParameter(36183):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:n,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:f,maxTextureSize:d,maxCubemapSize:m,maxAttributes:p,maxVertexUniforms:g,maxVaryings:y,maxFragmentUniforms:v,vertexTextures:b,floatFragmentTextures:w,floatVertexTextures:x,maxSamples:E}}function SL(i){let e=this,t=null,r=0,n=!1,s=!1,o=new Fr,a=new Nt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f,d){let m=h.length!==0||f||r!==0||n;return n=f,t=u(h,d,0),r=h.length,m},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1,c()},this.setState=function(h,f,d){let m=h.clippingPlanes,p=h.clipIntersection,g=h.clipShadows,y=i.get(h);if(!n||m===null||m.length===0||s&&!g)s?u(null):c();else{let v=s?0:r,b=v*4,w=y.clippingState||null;l.value=w,w=u(m,f,b,d);for(let x=0;x!==b;++x)w[x]=t[x];y.clippingState=w,this.numIntersection=p?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function u(h,f,d,m){let p=h!==null?h.length:0,g=null;if(p!==0){if(g=l.value,m!==!0||g===null){let y=d+p*4,v=f.matrixWorldInverse;a.getNormalMatrix(v),(g===null||g.length<y)&&(g=new Float32Array(y));for(let b=0,w=d;b!==p;++b,w+=4)o.copy(h[b]).applyMatrix4(v,a),o.normal.toArray(g,w),g[w+3]=o.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=p,e.numIntersection=0,g}}function ML(i){let e=new WeakMap;function t(o,a){return a===eg?o.mapping=Ls:a===tg&&(o.mapping=Ds),o}function r(o){if(o&&o.isTexture&&o.isRenderTargetTexture===!1){let a=o.mapping;if(a===eg||a===tg)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=new mf(l.height/2);return c.fromEquirectangularTexture(i,o),e.set(o,c),o.addEventListener("dispose",n),t(c.texture,o.mapping)}else return null}}return o}function n(o){let a=o.target;a.removeEventListener("dispose",n);let l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}var Eo=class extends zn{constructor(e=-1,t=1,r=1,n=-1,s=.1,o=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=n,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,r,n,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=r,this.view.offsetY=n,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),r=(this.right+this.left)/2,n=(this.top+this.bottom)/2,s=r-e,o=r+e,a=n+t,l=n-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}};Eo.prototype.isOrthographicCamera=!0;var Ea=4,n0=[.125,.215,.35,.446,.526,.582],So=20,Vm=new Eo,i0=new xe,Hm=null,wo=(1+Math.sqrt(5))/2,va=1/wo,s0=[new A(1,1,1),new A(-1,1,1),new A(1,1,-1),new A(-1,1,-1),new A(0,wo,va),new A(0,wo,-va),new A(va,0,wo),new A(-va,0,wo),new A(wo,va,0),new A(-wo,va,0)],gf=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,r=.1,n=100){Hm=this._renderer.getRenderTarget(),this._setSize(256);let s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,n,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=l0(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=a0(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Hm),e.scissorTest=!1,Wh(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Ls||e.mapping===Ds?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Hm=this._renderer.getRenderTarget();let r=t||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize-32,r={magFilter:ct,minFilter:ct,generateMipmaps:!1,type:La,format:On,encoding:rn,depthBuffer:!1},n=o0(e,t,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=o0(e,t,r);let{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=AL(s)),this._blurMaterial=TL(s,e,t)}return n}_compileMaterial(e){let t=new Gt(this._lodPlanes[0],e);this._renderer.compile(t,Vm)}_sceneToCubeUV(e,t,r,n){let a=new nr(90,1,t,r),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,f=u.toneMapping;u.getClearColor(i0),u.toneMapping=$i,u.autoClear=!1;let d=new Un({name:"PMREM.Background",side:Cr,depthWrite:!1,depthTest:!1}),m=new Gt(new mn,d),p=!1,g=e.background;g?g.isColor&&(d.color.copy(g),e.background=null,p=!0):(d.color.copy(i0),p=!0);for(let y=0;y<6;y++){let v=y%3;v===0?(a.up.set(0,l[y],0),a.lookAt(c[y],0,0)):v===1?(a.up.set(0,0,l[y]),a.lookAt(0,c[y],0)):(a.up.set(0,l[y],0),a.lookAt(0,0,c[y]));let b=this._cubeSize;Wh(n,v*b,y>2?b:0,b,b),u.setRenderTarget(n),p&&u.render(m,a),u.render(e,a)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=f,u.autoClear=h,e.background=g}_textureToCubeUV(e,t){let r=this._renderer,n=e.mapping===Ls||e.mapping===Ds;n?(this._cubemapMaterial===null&&(this._cubemapMaterial=l0()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=a0());let s=n?this._cubemapMaterial:this._equirectMaterial,o=new Gt(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;let l=this._cubeSize;Wh(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,Vm)}_applyPMREM(e){let t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let n=1;n<this._lodPlanes.length;n++){let s=Math.sqrt(this._sigmas[n]*this._sigmas[n]-this._sigmas[n-1]*this._sigmas[n-1]),o=s0[(n-1)%s0.length];this._blur(e,n-1,n,s,o)}t.autoClear=r}_blur(e,t,r,n,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,r,n,"latitudinal",s),this._halfBlur(o,e,r,r,n,"longitudinal",s)}_halfBlur(e,t,r,n,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(this._lodPlanes[n],c),f=c.uniforms,d=this._sizeLods[r]-1,m=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*So-1),p=s/m,g=isFinite(s)?1+Math.floor(u*p):So;g>So&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${So}`);let y=[],v=0;for(let T=0;T<So;++T){let S=T/p,I=Math.exp(-S*S/2);y.push(I),T===0?v+=I:T<g&&(v+=2*I)}for(let T=0;T<y.length;T++)y[T]=y[T]/v;f.envMap.value=e.texture,f.samples.value=g,f.weights.value=y,f.latitudinal.value=o==="latitudinal",a&&(f.poleAxis.value=a);let{_lodMax:b}=this;f.dTheta.value=m,f.mipInt.value=b-r;let w=this._sizeLods[n],x=3*w*(n>b-Ea?n-b+Ea:0),E=4*(this._cubeSize-w);Wh(t,x,E,3*w,2*w),l.setRenderTarget(t),l.render(h,Vm)}};function AL(i){let e=[],t=[],r=[],n=i,s=i-Ea+1+n0.length;for(let o=0;o<s;o++){let a=Math.pow(2,n);t.push(a);let l=1/a;o>i-Ea?l=n0[o-i+Ea-1]:o===0&&(l=0),r.push(l);let c=1/(a-1),u=-c/2,h=1+c/2,f=[u,u,h,u,h,h,u,u,h,h,u,h],d=6,m=6,p=3,g=2,y=1,v=new Float32Array(p*m*d),b=new Float32Array(g*m*d),w=new Float32Array(y*m*d);for(let E=0;E<d;E++){let T=E%3*2/3-1,S=E>2?0:-1,I=[T,S,0,T+2/3,S,0,T+2/3,S+1,0,T,S,0,T+2/3,S+1,0,T,S+1,0];v.set(I,p*m*E),b.set(f,g*m*E);let C=[E,E,E,E,E,E];w.set(C,y*m*E)}let x=new Ie;x.setAttribute("position",new Ue(v,p)),x.setAttribute("uv",new Ue(b,g)),x.setAttribute("faceIndex",new Ue(w,y)),e.push(x),n>Ea&&n--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function o0(i,e,t){let r=new mt(i,e,t);return r.texture.mapping=ja,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Wh(i,e,t,r,n){i.viewport.set(e,t,r,n),i.scissor.set(e,t,r,n)}function TL(i,e,t){let r=new Float32Array(So),n=new A(0,1,0);return new St({name:"SphericalGaussianBlur",defines:{n:So,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n}},vertexShader:$g(),fragmentShader:`
|
|
2786
|
+
}`,gt={alphamap_fragment:jE,alphamap_pars_fragment:qE,alphatest_fragment:XE,alphatest_pars_fragment:YE,aomap_fragment:JE,aomap_pars_fragment:QE,begin_vertex:KE,beginnormal_vertex:ZE,bsdfs:$E,bumpmap_pars_fragment:e_,clipping_planes_fragment:t_,clipping_planes_pars_fragment:r_,clipping_planes_pars_vertex:n_,clipping_planes_vertex:i_,color_fragment:s_,color_pars_fragment:o_,color_pars_vertex:a_,color_vertex:l_,common:c_,cube_uv_reflection_fragment:u_,defaultnormal_vertex:h_,displacementmap_pars_vertex:f_,displacementmap_vertex:d_,emissivemap_fragment:p_,emissivemap_pars_fragment:m_,encodings_fragment:g_,encodings_pars_fragment:y_,envmap_fragment:v_,envmap_common_pars_fragment:x_,envmap_pars_fragment:b_,envmap_pars_vertex:w_,envmap_physical_pars_fragment:I_,envmap_vertex:S_,fog_vertex:M_,fog_pars_vertex:A_,fog_fragment:T_,fog_pars_fragment:E_,gradientmap_pars_fragment:__,lightmap_fragment:C_,lightmap_pars_fragment:L_,lights_lambert_vertex:D_,lights_pars_begin:P_,lights_toon_fragment:R_,lights_toon_pars_fragment:B_,lights_phong_fragment:N_,lights_phong_pars_fragment:O_,lights_physical_fragment:F_,lights_physical_pars_fragment:U_,lights_fragment_begin:z_,lights_fragment_maps:G_,lights_fragment_end:k_,logdepthbuf_fragment:V_,logdepthbuf_pars_fragment:H_,logdepthbuf_pars_vertex:W_,logdepthbuf_vertex:j_,map_fragment:q_,map_pars_fragment:X_,map_particle_fragment:Y_,map_particle_pars_fragment:J_,metalnessmap_fragment:Q_,metalnessmap_pars_fragment:K_,morphcolor_vertex:Z_,morphnormal_vertex:$_,morphtarget_pars_vertex:eC,morphtarget_vertex:tC,normal_fragment_begin:rC,normal_fragment_maps:nC,normal_pars_fragment:iC,normal_pars_vertex:sC,normal_vertex:oC,normalmap_pars_fragment:aC,clearcoat_normal_fragment_begin:lC,clearcoat_normal_fragment_maps:cC,clearcoat_pars_fragment:uC,output_fragment:hC,packing:fC,premultiplied_alpha_fragment:dC,project_vertex:pC,dithering_fragment:mC,dithering_pars_fragment:gC,roughnessmap_fragment:yC,roughnessmap_pars_fragment:vC,shadowmap_pars_fragment:xC,shadowmap_pars_vertex:bC,shadowmap_vertex:wC,shadowmask_pars_fragment:SC,skinbase_vertex:MC,skinning_pars_vertex:AC,skinning_vertex:TC,skinnormal_vertex:EC,specularmap_fragment:_C,specularmap_pars_fragment:CC,tonemapping_fragment:LC,tonemapping_pars_fragment:DC,transmission_fragment:PC,transmission_pars_fragment:IC,uv_pars_fragment:RC,uv_pars_vertex:BC,uv_vertex:NC,uv2_pars_fragment:OC,uv2_pars_vertex:FC,uv2_vertex:UC,worldpos_vertex:zC,background_vert:GC,background_frag:kC,cube_vert:VC,cube_frag:HC,depth_vert:WC,depth_frag:jC,distanceRGBA_vert:qC,distanceRGBA_frag:XC,equirect_vert:YC,equirect_frag:JC,linedashed_vert:QC,linedashed_frag:KC,meshbasic_vert:ZC,meshbasic_frag:$C,meshlambert_vert:eL,meshlambert_frag:tL,meshmatcap_vert:rL,meshmatcap_frag:nL,meshnormal_vert:iL,meshnormal_frag:sL,meshphong_vert:oL,meshphong_frag:aL,meshphysical_vert:lL,meshphysical_frag:cL,meshtoon_vert:uL,meshtoon_frag:hL,points_vert:fL,points_frag:dL,shadow_vert:pL,shadow_frag:mL,sprite_vert:gL,sprite_frag:yL},we={common:{diffuse:{value:new xe(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Nt},uv2Transform:{value:new Nt},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},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 N(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 xe(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 xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Nt}},sprite:{diffuse:{value:new xe(16777215)},opacity:{value:1},center:{value:new N(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Nt}}},Mi={basic:{uniforms:Xr([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.fog]),vertexShader:gt.meshbasic_vert,fragmentShader:gt.meshbasic_frag},lambert:{uniforms:Xr([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.fog,we.lights,{emissive:{value:new xe(0)}}]),vertexShader:gt.meshlambert_vert,fragmentShader:gt.meshlambert_frag},phong:{uniforms:Xr([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.fog,we.lights,{emissive:{value:new xe(0)},specular:{value:new xe(1118481)},shininess:{value:30}}]),vertexShader:gt.meshphong_vert,fragmentShader:gt.meshphong_frag},standard:{uniforms:Xr([we.common,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.roughnessmap,we.metalnessmap,we.fog,we.lights,{emissive:{value:new xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:gt.meshphysical_vert,fragmentShader:gt.meshphysical_frag},toon:{uniforms:Xr([we.common,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.gradientmap,we.fog,we.lights,{emissive:{value:new xe(0)}}]),vertexShader:gt.meshtoon_vert,fragmentShader:gt.meshtoon_frag},matcap:{uniforms:Xr([we.common,we.bumpmap,we.normalmap,we.displacementmap,we.fog,{matcap:{value:null}}]),vertexShader:gt.meshmatcap_vert,fragmentShader:gt.meshmatcap_frag},points:{uniforms:Xr([we.points,we.fog]),vertexShader:gt.points_vert,fragmentShader:gt.points_frag},dashed:{uniforms:Xr([we.common,we.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:gt.linedashed_vert,fragmentShader:gt.linedashed_frag},depth:{uniforms:Xr([we.common,we.displacementmap]),vertexShader:gt.depth_vert,fragmentShader:gt.depth_frag},normal:{uniforms:Xr([we.common,we.bumpmap,we.normalmap,we.displacementmap,{opacity:{value:1}}]),vertexShader:gt.meshnormal_vert,fragmentShader:gt.meshnormal_frag},sprite:{uniforms:Xr([we.sprite,we.fog]),vertexShader:gt.sprite_vert,fragmentShader:gt.sprite_frag},background:{uniforms:{uvTransform:{value:new Nt},t2D:{value:null}},vertexShader:gt.background_vert,fragmentShader:gt.background_frag},cube:{uniforms:Xr([we.envmap,{opacity:{value:1}}]),vertexShader:gt.cube_vert,fragmentShader:gt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:gt.equirect_vert,fragmentShader:gt.equirect_frag},distanceRGBA:{uniforms:Xr([we.common,we.displacementmap,{referencePosition:{value:new A},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:gt.distanceRGBA_vert,fragmentShader:gt.distanceRGBA_frag},shadow:{uniforms:Xr([we.lights,we.fog,{color:{value:new xe(0)},opacity:{value:1}}]),vertexShader:gt.shadow_vert,fragmentShader:gt.shadow_frag}};Mi.physical={uniforms:Xr([Mi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new N(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new xe(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new N},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new xe(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new xe(1,1,1)},specularColorMap:{value:null}}]),vertexShader:gt.meshphysical_vert,fragmentShader:gt.meshphysical_frag};function vL(i,e,t,r,n,s){let o=new xe(0),a=n===!0?0:1,l,c,u=null,h=0,f=null;function d(p,g){let y=!1,v=g.isScene===!0?g.background:null;v&&v.isTexture&&(v=e.get(v));let b=i.xr,w=b.getSession&&b.getSession();w&&w.environmentBlendMode==="additive"&&(v=null),v===null?m(o,a):v&&v.isColor&&(m(v,1),y=!0),(i.autoClear||y)&&i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil),v&&(v.isCubeTexture||v.mapping===ja)?(c===void 0&&(c=new Gt(new mn(1,1,1),new St({name:"BackgroundCubeMaterial",uniforms:Ia(Mi.cube.uniforms),vertexShader:Mi.cube.vertexShader,fragmentShader:Mi.cube.fragmentShader,side:Cr,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(x,E,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),c.material.uniforms.envMap.value=v,c.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,(u!==v||h!==v.version||f!==i.toneMapping)&&(c.material.needsUpdate=!0,u=v,h=v.version,f=i.toneMapping),p.unshift(c,c.geometry,c.material,0,0,null)):v&&v.isTexture&&(l===void 0&&(l=new Gt(new ts(2,2),new St({name:"BackgroundMaterial",uniforms:Ia(Mi.background.uniforms),vertexShader:Mi.background.vertexShader,fragmentShader:Mi.background.fragmentShader,side:ii,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=v,v.matrixAutoUpdate===!0&&v.updateMatrix(),l.material.uniforms.uvTransform.value.copy(v.matrix),(u!==v||h!==v.version||f!==i.toneMapping)&&(l.material.needsUpdate=!0,u=v,h=v.version,f=i.toneMapping),p.unshift(l,l.geometry,l.material,0,0,null))}function m(p,g){t.buffers.color.setClear(p.r,p.g,p.b,g,s)}return{getClearColor:function(){return o},setClearColor:function(p,g=1){o.set(p),a=g,m(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(p){a=p,m(o,a)},render:d}}function xL(i,e,t,r){let n=i.getParameter(34921),s=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||s!==null,a={},l=g(null),c=l,u=!1;function h(B,O,z,q,F){let ee=!1;if(o){let k=p(q,z,O);c!==k&&(c=k,d(c.object)),ee=y(q,F),ee&&v(q,F)}else{let k=O.wireframe===!0;(c.geometry!==q.id||c.program!==z.id||c.wireframe!==k)&&(c.geometry=q.id,c.program=z.id,c.wireframe=k,ee=!0)}B.isInstancedMesh===!0&&(ee=!0),F!==null&&t.update(F,34963),(ee||u)&&(u=!1,S(B,O,z,q),F!==null&&i.bindBuffer(34963,t.get(F).buffer))}function f(){return r.isWebGL2?i.createVertexArray():s.createVertexArrayOES()}function d(B){return r.isWebGL2?i.bindVertexArray(B):s.bindVertexArrayOES(B)}function m(B){return r.isWebGL2?i.deleteVertexArray(B):s.deleteVertexArrayOES(B)}function p(B,O,z){let q=z.wireframe===!0,F=a[B.id];F===void 0&&(F={},a[B.id]=F);let ee=F[O.id];ee===void 0&&(ee={},F[O.id]=ee);let k=ee[q];return k===void 0&&(k=g(f()),ee[q]=k),k}function g(B){let O=[],z=[],q=[];for(let F=0;F<n;F++)O[F]=0,z[F]=0,q[F]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:O,enabledAttributes:z,attributeDivisors:q,object:B,attributes:{},index:null}}function y(B,O){let z=c.attributes,q=B.attributes,F=0;for(let ee in q){let k=z[ee],V=q[ee];if(k===void 0||k.attribute!==V||k.data!==V.data)return!0;F++}return c.attributesNum!==F||c.index!==O}function v(B,O){let z={},q=B.attributes,F=0;for(let ee in q){let k=q[ee],V={};V.attribute=k,k.data&&(V.data=k.data),z[ee]=V,F++}c.attributes=z,c.attributesNum=F,c.index=O}function b(){let B=c.newAttributes;for(let O=0,z=B.length;O<z;O++)B[O]=0}function w(B){x(B,0)}function x(B,O){let z=c.newAttributes,q=c.enabledAttributes,F=c.attributeDivisors;z[B]=1,q[B]===0&&(i.enableVertexAttribArray(B),q[B]=1),F[B]!==O&&((r.isWebGL2?i:e.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](B,O),F[B]=O)}function E(){let B=c.newAttributes,O=c.enabledAttributes;for(let z=0,q=O.length;z<q;z++)O[z]!==B[z]&&(i.disableVertexAttribArray(z),O[z]=0)}function T(B,O,z,q,F,ee){r.isWebGL2===!0&&(z===5124||z===5125)?i.vertexAttribIPointer(B,O,z,F,ee):i.vertexAttribPointer(B,O,z,q,F,ee)}function S(B,O,z,q){if(r.isWebGL2===!1&&(B.isInstancedMesh||q.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;b();let F=q.attributes,ee=z.getAttributes(),k=O.defaultAttributeValues;for(let V in ee){let U=ee[V];if(U.location>=0){let J=F[V];if(J===void 0&&(V==="instanceMatrix"&&B.instanceMatrix&&(J=B.instanceMatrix),V==="instanceColor"&&B.instanceColor&&(J=B.instanceColor)),J!==void 0){let K=J.normalized,$=J.itemSize,j=t.get(J);if(j===void 0)continue;let ge=j.buffer,ae=j.type,le=j.bytesPerElement;if(J.isInterleavedBufferAttribute){let W=J.data,ue=W.stride,Y=J.offset;if(W.isInstancedInterleavedBuffer){for(let H=0;H<U.locationSize;H++)x(U.location+H,W.meshPerAttribute);B.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=W.meshPerAttribute*W.count)}else for(let H=0;H<U.locationSize;H++)w(U.location+H);i.bindBuffer(34962,ge);for(let H=0;H<U.locationSize;H++)T(U.location+H,$/U.locationSize,ae,K,ue*le,(Y+$/U.locationSize*H)*le)}else{if(J.isInstancedBufferAttribute){for(let W=0;W<U.locationSize;W++)x(U.location+W,J.meshPerAttribute);B.isInstancedMesh!==!0&&q._maxInstanceCount===void 0&&(q._maxInstanceCount=J.meshPerAttribute*J.count)}else for(let W=0;W<U.locationSize;W++)w(U.location+W);i.bindBuffer(34962,ge);for(let W=0;W<U.locationSize;W++)T(U.location+W,$/U.locationSize,ae,K,$*le,$/U.locationSize*W*le)}}else if(k!==void 0){let K=k[V];if(K!==void 0)switch(K.length){case 2:i.vertexAttrib2fv(U.location,K);break;case 3:i.vertexAttrib3fv(U.location,K);break;case 4:i.vertexAttrib4fv(U.location,K);break;default:i.vertexAttrib1fv(U.location,K)}}}}E()}function I(){_();for(let B in a){let O=a[B];for(let z in O){let q=O[z];for(let F in q)m(q[F].object),delete q[F];delete O[z]}delete a[B]}}function C(B){if(a[B.id]===void 0)return;let O=a[B.id];for(let z in O){let q=O[z];for(let F in q)m(q[F].object),delete q[F];delete O[z]}delete a[B.id]}function M(B){for(let O in a){let z=a[O];if(z[B.id]===void 0)continue;let q=z[B.id];for(let F in q)m(q[F].object),delete q[F];delete z[B.id]}}function _(){R(),u=!0,c!==l&&(c=l,d(c.object))}function R(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:h,reset:_,resetDefaultState:R,dispose:I,releaseStatesOfGeometry:C,releaseStatesOfProgram:M,initAttributes:b,enableAttribute:w,disableUnusedAttributes:E}}function bL(i,e,t,r){let n=r.isWebGL2,s;function o(c){s=c}function a(c,u){i.drawArrays(s,c,u),t.update(u,s,1)}function l(c,u,h){if(h===0)return;let f,d;if(n)f=i,d="drawArraysInstanced";else if(f=e.get("ANGLE_instanced_arrays"),d="drawArraysInstancedANGLE",f===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}f[d](s,c,u,h),t.update(u,s,h)}this.setMode=o,this.render=a,this.renderInstances=l}function wL(i,e,t){let r;function n(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){let T=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(T.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function s(T){if(T==="highp"){if(i.getShaderPrecisionFormat(35633,36338).precision>0&&i.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";T="mediump"}return T==="mediump"&&i.getShaderPrecisionFormat(35633,36337).precision>0&&i.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}let o=typeof WebGL2RenderingContext<"u"&&i instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&i 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=i.getParameter(34930),f=i.getParameter(35660),d=i.getParameter(3379),m=i.getParameter(34076),p=i.getParameter(34921),g=i.getParameter(36347),y=i.getParameter(36348),v=i.getParameter(36349),b=f>0,w=o||e.has("OES_texture_float"),x=b&&w,E=o?i.getParameter(36183):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:n,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:f,maxTextureSize:d,maxCubemapSize:m,maxAttributes:p,maxVertexUniforms:g,maxVaryings:y,maxFragmentUniforms:v,vertexTextures:b,floatFragmentTextures:w,floatVertexTextures:x,maxSamples:E}}function SL(i){let e=this,t=null,r=0,n=!1,s=!1,o=new Fr,a=new Nt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f,d){let m=h.length!==0||f||r!==0||n;return n=f,t=u(h,d,0),r=h.length,m},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1,c()},this.setState=function(h,f,d){let m=h.clippingPlanes,p=h.clipIntersection,g=h.clipShadows,y=i.get(h);if(!n||m===null||m.length===0||s&&!g)s?u(null):c();else{let v=s?0:r,b=v*4,w=y.clippingState||null;l.value=w,w=u(m,f,b,d);for(let x=0;x!==b;++x)w[x]=t[x];y.clippingState=w,this.numIntersection=p?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function u(h,f,d,m){let p=h!==null?h.length:0,g=null;if(p!==0){if(g=l.value,m!==!0||g===null){let y=d+p*4,v=f.matrixWorldInverse;a.getNormalMatrix(v),(g===null||g.length<y)&&(g=new Float32Array(y));for(let b=0,w=d;b!==p;++b,w+=4)o.copy(h[b]).applyMatrix4(v,a),o.normal.toArray(g,w),g[w+3]=o.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=p,e.numIntersection=0,g}}function ML(i){let e=new WeakMap;function t(o,a){return a===eg?o.mapping=Ls:a===tg&&(o.mapping=Ds),o}function r(o){if(o&&o.isTexture&&o.isRenderTargetTexture===!1){let a=o.mapping;if(a===eg||a===tg)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=new gf(l.height/2);return c.fromEquirectangularTexture(i,o),e.set(o,c),o.addEventListener("dispose",n),t(c.texture,o.mapping)}else return null}}return o}function n(o){let a=o.target;a.removeEventListener("dispose",n);let l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}var Eo=class extends zn{constructor(e=-1,t=1,r=1,n=-1,s=.1,o=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=n,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,r,n,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=r,this.view.offsetY=n,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),r=(this.right+this.left)/2,n=(this.top+this.bottom)/2,s=r-e,o=r+e,a=n+t,l=n-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}};Eo.prototype.isOrthographicCamera=!0;var Ea=4,n0=[.125,.215,.35,.446,.526,.582],So=20,Vm=new Eo,i0=new xe,Hm=null,wo=(1+Math.sqrt(5))/2,va=1/wo,s0=[new A(1,1,1),new A(-1,1,1),new A(1,1,-1),new A(-1,1,-1),new A(0,wo,va),new A(0,wo,-va),new A(va,0,wo),new A(-va,0,wo),new A(wo,va,0),new A(-wo,va,0)],yf=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,r=.1,n=100){Hm=this._renderer.getRenderTarget(),this._setSize(256);let s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,n,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=l0(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=a0(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Hm),e.scissorTest=!1,jh(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Ls||e.mapping===Ds?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Hm=this._renderer.getRenderTarget();let r=t||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize-32,r={magFilter:ct,minFilter:ct,generateMipmaps:!1,type:La,format:On,encoding:rn,depthBuffer:!1},n=o0(e,t,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=o0(e,t,r);let{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=AL(s)),this._blurMaterial=TL(s,e,t)}return n}_compileMaterial(e){let t=new Gt(this._lodPlanes[0],e);this._renderer.compile(t,Vm)}_sceneToCubeUV(e,t,r,n){let a=new nr(90,1,t,r),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,f=u.toneMapping;u.getClearColor(i0),u.toneMapping=$i,u.autoClear=!1;let d=new Un({name:"PMREM.Background",side:Cr,depthWrite:!1,depthTest:!1}),m=new Gt(new mn,d),p=!1,g=e.background;g?g.isColor&&(d.color.copy(g),e.background=null,p=!0):(d.color.copy(i0),p=!0);for(let y=0;y<6;y++){let v=y%3;v===0?(a.up.set(0,l[y],0),a.lookAt(c[y],0,0)):v===1?(a.up.set(0,0,l[y]),a.lookAt(0,c[y],0)):(a.up.set(0,l[y],0),a.lookAt(0,0,c[y]));let b=this._cubeSize;jh(n,v*b,y>2?b:0,b,b),u.setRenderTarget(n),p&&u.render(m,a),u.render(e,a)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=f,u.autoClear=h,e.background=g}_textureToCubeUV(e,t){let r=this._renderer,n=e.mapping===Ls||e.mapping===Ds;n?(this._cubemapMaterial===null&&(this._cubemapMaterial=l0()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=a0());let s=n?this._cubemapMaterial:this._equirectMaterial,o=new Gt(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;let l=this._cubeSize;jh(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,Vm)}_applyPMREM(e){let t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let n=1;n<this._lodPlanes.length;n++){let s=Math.sqrt(this._sigmas[n]*this._sigmas[n]-this._sigmas[n-1]*this._sigmas[n-1]),o=s0[(n-1)%s0.length];this._blur(e,n-1,n,s,o)}t.autoClear=r}_blur(e,t,r,n,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,r,n,"latitudinal",s),this._halfBlur(o,e,r,r,n,"longitudinal",s)}_halfBlur(e,t,r,n,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(this._lodPlanes[n],c),f=c.uniforms,d=this._sizeLods[r]-1,m=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*So-1),p=s/m,g=isFinite(s)?1+Math.floor(u*p):So;g>So&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${So}`);let y=[],v=0;for(let T=0;T<So;++T){let S=T/p,I=Math.exp(-S*S/2);y.push(I),T===0?v+=I:T<g&&(v+=2*I)}for(let T=0;T<y.length;T++)y[T]=y[T]/v;f.envMap.value=e.texture,f.samples.value=g,f.weights.value=y,f.latitudinal.value=o==="latitudinal",a&&(f.poleAxis.value=a);let{_lodMax:b}=this;f.dTheta.value=m,f.mipInt.value=b-r;let w=this._sizeLods[n],x=3*w*(n>b-Ea?n-b+Ea:0),E=4*(this._cubeSize-w);jh(t,x,E,3*w,2*w),l.setRenderTarget(t),l.render(h,Vm)}};function AL(i){let e=[],t=[],r=[],n=i,s=i-Ea+1+n0.length;for(let o=0;o<s;o++){let a=Math.pow(2,n);t.push(a);let l=1/a;o>i-Ea?l=n0[o-i+Ea-1]:o===0&&(l=0),r.push(l);let c=1/(a-1),u=-c/2,h=1+c/2,f=[u,u,h,u,h,h,u,u,h,h,u,h],d=6,m=6,p=3,g=2,y=1,v=new Float32Array(p*m*d),b=new Float32Array(g*m*d),w=new Float32Array(y*m*d);for(let E=0;E<d;E++){let T=E%3*2/3-1,S=E>2?0:-1,I=[T,S,0,T+2/3,S,0,T+2/3,S+1,0,T,S,0,T+2/3,S+1,0,T,S+1,0];v.set(I,p*m*E),b.set(f,g*m*E);let C=[E,E,E,E,E,E];w.set(C,y*m*E)}let x=new Ie;x.setAttribute("position",new Ue(v,p)),x.setAttribute("uv",new Ue(b,g)),x.setAttribute("faceIndex",new Ue(w,y)),e.push(x),n>Ea&&n--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function o0(i,e,t){let r=new mt(i,e,t);return r.texture.mapping=ja,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function jh(i,e,t,r,n){i.viewport.set(e,t,r,n),i.scissor.set(e,t,r,n)}function TL(i,e,t){let r=new Float32Array(So),n=new A(0,1,0);return new St({name:"SphericalGaussianBlur",defines:{n:So,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n}},vertexShader:$g(),fragmentShader:`
|
|
2787
2787
|
|
|
2788
2788
|
precision mediump float;
|
|
2789
2789
|
precision mediump int;
|
|
@@ -2933,7 +2933,7 @@ void main() {
|
|
|
2933
2933
|
gl_Position = vec4( position, 1.0 );
|
|
2934
2934
|
|
|
2935
2935
|
}
|
|
2936
|
-
`}function EL(i){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){let l=a.mapping,c=l===eg||l===tg,u=l===Ls||l===Ds;if(c||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new gf(i)),h=c?t.fromEquirectangular(a,h):t.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{let h=a.image;if(c&&h&&h.height>0||u&&h&&n(h)){t===null&&(t=new gf(i));let f=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",s),f.texture}else return null}}}return a}function n(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&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:r,dispose:o}}function _L(i){let e={};function t(r){if(e[r]!==void 0)return e[r];let n;switch(r){case"WEBGL_depth_texture":n=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=i.getExtension(r)}return e[r]=n,n}return{has:function(r){return t(r)!==null},init:function(r){r.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"),t("WEBGL_multisampled_render_to_texture")},get:function(r){let n=t(r);return n===null&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),n}}}function CL(i,e,t,r){let n={},s=new WeakMap;function o(h){let f=h.target;f.index!==null&&e.remove(f.index);for(let m in f.attributes)e.remove(f.attributes[m]);f.removeEventListener("dispose",o),delete n[f.id];let d=s.get(f);d&&(e.remove(d),s.delete(f)),r.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function a(h,f){return n[f.id]===!0||(f.addEventListener("dispose",o),n[f.id]=!0,t.memory.geometries++),f}function l(h){let f=h.attributes;for(let m in f)e.update(f[m],34962);let d=h.morphAttributes;for(let m in d){let p=d[m];for(let g=0,y=p.length;g<y;g++)e.update(p[g],34962)}}function c(h){let f=[],d=h.index,m=h.attributes.position,p=0;if(d!==null){let v=d.array;p=d.version;for(let b=0,w=v.length;b<w;b+=3){let x=v[b+0],E=v[b+1],T=v[b+2];f.push(x,E,E,T,T,x)}}else{let v=m.array;p=m.version;for(let b=0,w=v.length/3-1;b<w;b+=3){let x=b+0,E=b+1,T=b+2;f.push(x,E,E,T,T,x)}}let g=new(ab(f)?Is:pf)(f,1);g.version=p;let y=s.get(h);y&&e.remove(y),s.set(h,g)}function u(h){let f=s.get(h);if(f){let d=h.index;d!==null&&f.version<d.version&&c(h)}else c(h);return s.get(h)}return{get:a,update:l,getWireframeAttribute:u}}function LL(i,e,t,r){let n=r.isWebGL2,s;function o(f){s=f}let a,l;function c(f){a=f.type,l=f.bytesPerElement}function u(f,d){i.drawElements(s,d,a,f*l),t.update(d,s,1)}function h(f,d,m){if(m===0)return;let p,g;if(n)p=i,g="drawElementsInstanced";else if(p=e.get("ANGLE_instanced_arrays"),g="drawElementsInstancedANGLE",p===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}p[g](s,d,a,f*l,m),t.update(d,s,m)}this.setMode=o,this.setIndex=c,this.render=u,this.renderInstances=h}function DL(i){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function r(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 n(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:n,update:r}}function PL(i,e){return i[0]-e[0]}function IL(i,e){return Math.abs(e[1])-Math.abs(i[1])}function Wm(i,e){let t=1,r=e.isInterleavedBufferAttribute?e.data.array:e.array;r instanceof Int8Array?t=127:r instanceof Int16Array?t=32767:r instanceof Int32Array?t=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",r),i.divideScalar(t)}function RL(i,e,t){let r={},n=new Float32Array(8),s=new WeakMap,o=new Qe,a=[];for(let c=0;c<8;c++)a[c]=[c,0];function l(c,u,h,f){let d=c.morphTargetInfluences;if(e.isWebGL2===!0){let m=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,p=m!==void 0?m.length:0,g=s.get(u);if(g===void 0||g.count!==p){let O=function(){R.dispose(),s.delete(u),u.removeEventListener("dispose",O)};g!==void 0&&g.texture.dispose();let b=u.morphAttributes.position!==void 0,w=u.morphAttributes.normal!==void 0,x=u.morphAttributes.color!==void 0,E=u.morphAttributes.position||[],T=u.morphAttributes.normal||[],S=u.morphAttributes.color||[],I=0;b===!0&&(I=1),w===!0&&(I=2),x===!0&&(I=3);let C=u.attributes.position.count*I,M=1;C>e.maxTextureSize&&(M=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);let _=new Float32Array(C*M*4*p),R=new Pa(_,C,M,p);R.type=Ts,R.needsUpdate=!0;let B=I*4;for(let z=0;z<p;z++){let q=E[z],F=T[z],ee=S[z],k=C*M*4*z;for(let V=0;V<q.count;V++){let U=V*B;b===!0&&(o.fromBufferAttribute(q,V),q.normalized===!0&&Wm(o,q),_[k+U+0]=o.x,_[k+U+1]=o.y,_[k+U+2]=o.z,_[k+U+3]=0),w===!0&&(o.fromBufferAttribute(F,V),F.normalized===!0&&Wm(o,F),_[k+U+4]=o.x,_[k+U+5]=o.y,_[k+U+6]=o.z,_[k+U+7]=0),x===!0&&(o.fromBufferAttribute(ee,V),ee.normalized===!0&&Wm(o,ee),_[k+U+8]=o.x,_[k+U+9]=o.y,_[k+U+10]=o.z,_[k+U+11]=ee.itemSize===4?o.w:1)}}g={count:p,texture:R,size:new N(C,M)},s.set(u,g),u.addEventListener("dispose",O)}let y=0;for(let b=0;b<d.length;b++)y+=d[b];let v=u.morphTargetsRelative?1:1-y;f.getUniforms().setValue(i,"morphTargetBaseInfluence",v),f.getUniforms().setValue(i,"morphTargetInfluences",d),f.getUniforms().setValue(i,"morphTargetsTexture",g.texture,t),f.getUniforms().setValue(i,"morphTargetsTextureSize",g.size)}else{let m=d===void 0?0:d.length,p=r[u.id];if(p===void 0||p.length!==m){p=[];for(let w=0;w<m;w++)p[w]=[w,0];r[u.id]=p}for(let w=0;w<m;w++){let x=p[w];x[0]=w,x[1]=d[w]}p.sort(IL);for(let w=0;w<8;w++)w<m&&p[w][1]?(a[w][0]=p[w][0],a[w][1]=p[w][1]):(a[w][0]=Number.MAX_SAFE_INTEGER,a[w][1]=0);a.sort(PL);let g=u.morphAttributes.position,y=u.morphAttributes.normal,v=0;for(let w=0;w<8;w++){let x=a[w],E=x[0],T=x[1];E!==Number.MAX_SAFE_INTEGER&&T?(g&&u.getAttribute("morphTarget"+w)!==g[E]&&u.setAttribute("morphTarget"+w,g[E]),y&&u.getAttribute("morphNormal"+w)!==y[E]&&u.setAttribute("morphNormal"+w,y[E]),n[w]=T,v+=T):(g&&u.hasAttribute("morphTarget"+w)===!0&&u.deleteAttribute("morphTarget"+w),y&&u.hasAttribute("morphNormal"+w)===!0&&u.deleteAttribute("morphNormal"+w),n[w]=0)}let b=u.morphTargetsRelative?1:1-v;f.getUniforms().setValue(i,"morphTargetBaseInfluence",b),f.getUniforms().setValue(i,"morphTargetInfluences",n)}}return{update:l}}function BL(i,e,t,r){let n=new WeakMap;function s(l){let c=r.render.frame,u=l.geometry,h=e.get(l,u);return n.get(h)!==c&&(e.update(h),n.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(){n=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 ub=new _t,hb=new Pa,fb=new qc,db=new Rs,c0=[],u0=[],h0=new Float32Array(16),f0=new Float32Array(9),d0=new Float32Array(4);function Xa(i,e,t){let r=i[0];if(r<=0||r>0)return i;let n=e*t,s=c0[n];if(s===void 0&&(s=new Float32Array(n),c0[n]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function nn(i,e){if(i.length!==e.length)return!1;for(let t=0,r=i.length;t<r;t++)if(i[t]!==e[t])return!1;return!0}function Jr(i,e){for(let t=0,r=e.length;t<r;t++)i[t]=e[t]}function Kf(i,e){let t=u0[e];t===void 0&&(t=new Int32Array(e),u0[e]=t);for(let r=0;r!==e;++r)t[r]=i.allocateTextureUnit();return t}function NL(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function OL(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(nn(t,e))return;i.uniform2fv(this.addr,e),Jr(t,e)}}function FL(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.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)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(nn(t,e))return;i.uniform3fv(this.addr,e),Jr(t,e)}}function UL(i,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)&&(i.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(nn(t,e))return;i.uniform4fv(this.addr,e),Jr(t,e)}}function zL(i,e){let t=this.cache,r=e.elements;if(r===void 0){if(nn(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),Jr(t,e)}else{if(nn(t,r))return;d0.set(r),i.uniformMatrix2fv(this.addr,!1,d0),Jr(t,r)}}function GL(i,e){let t=this.cache,r=e.elements;if(r===void 0){if(nn(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),Jr(t,e)}else{if(nn(t,r))return;f0.set(r),i.uniformMatrix3fv(this.addr,!1,f0),Jr(t,r)}}function kL(i,e){let t=this.cache,r=e.elements;if(r===void 0){if(nn(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),Jr(t,e)}else{if(nn(t,r))return;h0.set(r),i.uniformMatrix4fv(this.addr,!1,h0),Jr(t,r)}}function VL(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function HL(i,e){let t=this.cache;nn(t,e)||(i.uniform2iv(this.addr,e),Jr(t,e))}function WL(i,e){let t=this.cache;nn(t,e)||(i.uniform3iv(this.addr,e),Jr(t,e))}function jL(i,e){let t=this.cache;nn(t,e)||(i.uniform4iv(this.addr,e),Jr(t,e))}function qL(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function XL(i,e){let t=this.cache;nn(t,e)||(i.uniform2uiv(this.addr,e),Jr(t,e))}function YL(i,e){let t=this.cache;nn(t,e)||(i.uniform3uiv(this.addr,e),Jr(t,e))}function JL(i,e){let t=this.cache;nn(t,e)||(i.uniform4uiv(this.addr,e),Jr(t,e))}function QL(i,e,t){let r=this.cache,n=t.allocateTextureUnit();r[0]!==n&&(i.uniform1i(this.addr,n),r[0]=n),t.setTexture2D(e||ub,n)}function KL(i,e,t){let r=this.cache,n=t.allocateTextureUnit();r[0]!==n&&(i.uniform1i(this.addr,n),r[0]=n),t.setTexture3D(e||fb,n)}function ZL(i,e,t){let r=this.cache,n=t.allocateTextureUnit();r[0]!==n&&(i.uniform1i(this.addr,n),r[0]=n),t.setTextureCube(e||db,n)}function $L(i,e,t){let r=this.cache,n=t.allocateTextureUnit();r[0]!==n&&(i.uniform1i(this.addr,n),r[0]=n),t.setTexture2DArray(e||hb,n)}function eD(i){switch(i){case 5126:return NL;case 35664:return OL;case 35665:return FL;case 35666:return UL;case 35674:return zL;case 35675:return GL;case 35676:return kL;case 5124:case 35670:return VL;case 35667:case 35671:return HL;case 35668:case 35672:return WL;case 35669:case 35673:return jL;case 5125:return qL;case 36294:return XL;case 36295:return YL;case 36296:return JL;case 35678:case 36198:case 36298:case 36306:case 35682:return QL;case 35679:case 36299:case 36307:return KL;case 35680:case 36300:case 36308:case 36293:return ZL;case 36289:case 36303:case 36311:case 36292:return $L}}function tD(i,e){i.uniform1fv(this.addr,e)}function rD(i,e){let t=Xa(e,this.size,2);i.uniform2fv(this.addr,t)}function nD(i,e){let t=Xa(e,this.size,3);i.uniform3fv(this.addr,t)}function iD(i,e){let t=Xa(e,this.size,4);i.uniform4fv(this.addr,t)}function sD(i,e){let t=Xa(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function oD(i,e){let t=Xa(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function aD(i,e){let t=Xa(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function lD(i,e){i.uniform1iv(this.addr,e)}function cD(i,e){i.uniform2iv(this.addr,e)}function uD(i,e){i.uniform3iv(this.addr,e)}function hD(i,e){i.uniform4iv(this.addr,e)}function fD(i,e){i.uniform1uiv(this.addr,e)}function dD(i,e){i.uniform2uiv(this.addr,e)}function pD(i,e){i.uniform3uiv(this.addr,e)}function mD(i,e){i.uniform4uiv(this.addr,e)}function gD(i,e,t){let r=e.length,n=Kf(t,r);i.uniform1iv(this.addr,n);for(let s=0;s!==r;++s)t.setTexture2D(e[s]||ub,n[s])}function yD(i,e,t){let r=e.length,n=Kf(t,r);i.uniform1iv(this.addr,n);for(let s=0;s!==r;++s)t.setTexture3D(e[s]||fb,n[s])}function vD(i,e,t){let r=e.length,n=Kf(t,r);i.uniform1iv(this.addr,n);for(let s=0;s!==r;++s)t.setTextureCube(e[s]||db,n[s])}function xD(i,e,t){let r=e.length,n=Kf(t,r);i.uniform1iv(this.addr,n);for(let s=0;s!==r;++s)t.setTexture2DArray(e[s]||hb,n[s])}function bD(i){switch(i){case 5126:return tD;case 35664:return rD;case 35665:return nD;case 35666:return iD;case 35674:return sD;case 35675:return oD;case 35676:return aD;case 5124:case 35670:return lD;case 35667:case 35671:return cD;case 35668:case 35672:return uD;case 35669:case 35673:return hD;case 5125:return fD;case 36294:return dD;case 36295:return pD;case 36296:return mD;case 35678:case 36198:case 36298:case 36306:case 35682:return gD;case 35679:case 36299:case 36307:return yD;case 35680:case 36300:case 36308:case 36293:return vD;case 36289:case 36303:case 36311:case 36292:return xD}}function wD(i,e,t){this.id=i,this.addr=t,this.cache=[],this.setValue=eD(e.type)}function pb(i,e,t){this.id=i,this.addr=t,this.cache=[],this.size=e.size,this.setValue=bD(e.type)}pb.prototype.updateCache=function(i){let e=this.cache;i instanceof Float32Array&&e.length!==i.length&&(this.cache=new Float32Array(i.length)),Jr(e,i)};function mb(i){this.id=i,this.seq=[],this.map={}}mb.prototype.setValue=function(i,e,t){let r=this.seq;for(let n=0,s=r.length;n!==s;++n){let o=r[n];o.setValue(i,e[o.id],t)}};var jm=/(\w+)(\])?(\[|\.)?/g;function p0(i,e){i.seq.push(e),i.map[e.id]=e}function SD(i,e,t){let r=i.name,n=r.length;for(jm.lastIndex=0;;){let s=jm.exec(r),o=jm.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===n){p0(t,c===void 0?new wD(a,i,e):new pb(a,i,e));break}else{let h=t.map[a];h===void 0&&(h=new mb(a),p0(t,h)),t=h}}}function Cs(i,e){this.seq=[],this.map={};let t=i.getProgramParameter(e,35718);for(let r=0;r<t;++r){let n=i.getActiveUniform(e,r),s=i.getUniformLocation(e,n.name);SD(n,s,this)}}Cs.prototype.setValue=function(i,e,t,r){let n=this.map[e];n!==void 0&&n.setValue(i,t,r)};Cs.prototype.setOptional=function(i,e,t){let r=e[t];r!==void 0&&this.setValue(i,t,r)};Cs.upload=function(i,e,t,r){for(let n=0,s=e.length;n!==s;++n){let o=e[n],a=t[o.id];a.needsUpdate!==!1&&o.setValue(i,a.value,r)}};Cs.seqWithValue=function(i,e){let t=[];for(let r=0,n=i.length;r!==n;++r){let s=i[r];s.id in e&&t.push(s)}return t};function m0(i,e,t){let r=i.createShader(e);return i.shaderSource(r,t),i.compileShader(r),r}var MD=0;function AD(i,e){let t=i.split(`
|
|
2936
|
+
`}function EL(i){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){let l=a.mapping,c=l===eg||l===tg,u=l===Ls||l===Ds;if(c||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new yf(i)),h=c?t.fromEquirectangular(a,h):t.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{let h=a.image;if(c&&h&&h.height>0||u&&h&&n(h)){t===null&&(t=new yf(i));let f=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",s),f.texture}else return null}}}return a}function n(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&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:r,dispose:o}}function _L(i){let e={};function t(r){if(e[r]!==void 0)return e[r];let n;switch(r){case"WEBGL_depth_texture":n=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=i.getExtension(r)}return e[r]=n,n}return{has:function(r){return t(r)!==null},init:function(r){r.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"),t("WEBGL_multisampled_render_to_texture")},get:function(r){let n=t(r);return n===null&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),n}}}function CL(i,e,t,r){let n={},s=new WeakMap;function o(h){let f=h.target;f.index!==null&&e.remove(f.index);for(let m in f.attributes)e.remove(f.attributes[m]);f.removeEventListener("dispose",o),delete n[f.id];let d=s.get(f);d&&(e.remove(d),s.delete(f)),r.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function a(h,f){return n[f.id]===!0||(f.addEventListener("dispose",o),n[f.id]=!0,t.memory.geometries++),f}function l(h){let f=h.attributes;for(let m in f)e.update(f[m],34962);let d=h.morphAttributes;for(let m in d){let p=d[m];for(let g=0,y=p.length;g<y;g++)e.update(p[g],34962)}}function c(h){let f=[],d=h.index,m=h.attributes.position,p=0;if(d!==null){let v=d.array;p=d.version;for(let b=0,w=v.length;b<w;b+=3){let x=v[b+0],E=v[b+1],T=v[b+2];f.push(x,E,E,T,T,x)}}else{let v=m.array;p=m.version;for(let b=0,w=v.length/3-1;b<w;b+=3){let x=b+0,E=b+1,T=b+2;f.push(x,E,E,T,T,x)}}let g=new(ab(f)?Is:mf)(f,1);g.version=p;let y=s.get(h);y&&e.remove(y),s.set(h,g)}function u(h){let f=s.get(h);if(f){let d=h.index;d!==null&&f.version<d.version&&c(h)}else c(h);return s.get(h)}return{get:a,update:l,getWireframeAttribute:u}}function LL(i,e,t,r){let n=r.isWebGL2,s;function o(f){s=f}let a,l;function c(f){a=f.type,l=f.bytesPerElement}function u(f,d){i.drawElements(s,d,a,f*l),t.update(d,s,1)}function h(f,d,m){if(m===0)return;let p,g;if(n)p=i,g="drawElementsInstanced";else if(p=e.get("ANGLE_instanced_arrays"),g="drawElementsInstancedANGLE",p===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}p[g](s,d,a,f*l,m),t.update(d,s,m)}this.setMode=o,this.setIndex=c,this.render=u,this.renderInstances=h}function DL(i){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function r(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 n(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:n,update:r}}function PL(i,e){return i[0]-e[0]}function IL(i,e){return Math.abs(e[1])-Math.abs(i[1])}function Wm(i,e){let t=1,r=e.isInterleavedBufferAttribute?e.data.array:e.array;r instanceof Int8Array?t=127:r instanceof Int16Array?t=32767:r instanceof Int32Array?t=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",r),i.divideScalar(t)}function RL(i,e,t){let r={},n=new Float32Array(8),s=new WeakMap,o=new Qe,a=[];for(let c=0;c<8;c++)a[c]=[c,0];function l(c,u,h,f){let d=c.morphTargetInfluences;if(e.isWebGL2===!0){let m=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,p=m!==void 0?m.length:0,g=s.get(u);if(g===void 0||g.count!==p){let O=function(){R.dispose(),s.delete(u),u.removeEventListener("dispose",O)};g!==void 0&&g.texture.dispose();let b=u.morphAttributes.position!==void 0,w=u.morphAttributes.normal!==void 0,x=u.morphAttributes.color!==void 0,E=u.morphAttributes.position||[],T=u.morphAttributes.normal||[],S=u.morphAttributes.color||[],I=0;b===!0&&(I=1),w===!0&&(I=2),x===!0&&(I=3);let C=u.attributes.position.count*I,M=1;C>e.maxTextureSize&&(M=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);let _=new Float32Array(C*M*4*p),R=new Pa(_,C,M,p);R.type=Ts,R.needsUpdate=!0;let B=I*4;for(let z=0;z<p;z++){let q=E[z],F=T[z],ee=S[z],k=C*M*4*z;for(let V=0;V<q.count;V++){let U=V*B;b===!0&&(o.fromBufferAttribute(q,V),q.normalized===!0&&Wm(o,q),_[k+U+0]=o.x,_[k+U+1]=o.y,_[k+U+2]=o.z,_[k+U+3]=0),w===!0&&(o.fromBufferAttribute(F,V),F.normalized===!0&&Wm(o,F),_[k+U+4]=o.x,_[k+U+5]=o.y,_[k+U+6]=o.z,_[k+U+7]=0),x===!0&&(o.fromBufferAttribute(ee,V),ee.normalized===!0&&Wm(o,ee),_[k+U+8]=o.x,_[k+U+9]=o.y,_[k+U+10]=o.z,_[k+U+11]=ee.itemSize===4?o.w:1)}}g={count:p,texture:R,size:new N(C,M)},s.set(u,g),u.addEventListener("dispose",O)}let y=0;for(let b=0;b<d.length;b++)y+=d[b];let v=u.morphTargetsRelative?1:1-y;f.getUniforms().setValue(i,"morphTargetBaseInfluence",v),f.getUniforms().setValue(i,"morphTargetInfluences",d),f.getUniforms().setValue(i,"morphTargetsTexture",g.texture,t),f.getUniforms().setValue(i,"morphTargetsTextureSize",g.size)}else{let m=d===void 0?0:d.length,p=r[u.id];if(p===void 0||p.length!==m){p=[];for(let w=0;w<m;w++)p[w]=[w,0];r[u.id]=p}for(let w=0;w<m;w++){let x=p[w];x[0]=w,x[1]=d[w]}p.sort(IL);for(let w=0;w<8;w++)w<m&&p[w][1]?(a[w][0]=p[w][0],a[w][1]=p[w][1]):(a[w][0]=Number.MAX_SAFE_INTEGER,a[w][1]=0);a.sort(PL);let g=u.morphAttributes.position,y=u.morphAttributes.normal,v=0;for(let w=0;w<8;w++){let x=a[w],E=x[0],T=x[1];E!==Number.MAX_SAFE_INTEGER&&T?(g&&u.getAttribute("morphTarget"+w)!==g[E]&&u.setAttribute("morphTarget"+w,g[E]),y&&u.getAttribute("morphNormal"+w)!==y[E]&&u.setAttribute("morphNormal"+w,y[E]),n[w]=T,v+=T):(g&&u.hasAttribute("morphTarget"+w)===!0&&u.deleteAttribute("morphTarget"+w),y&&u.hasAttribute("morphNormal"+w)===!0&&u.deleteAttribute("morphNormal"+w),n[w]=0)}let b=u.morphTargetsRelative?1:1-v;f.getUniforms().setValue(i,"morphTargetBaseInfluence",b),f.getUniforms().setValue(i,"morphTargetInfluences",n)}}return{update:l}}function BL(i,e,t,r){let n=new WeakMap;function s(l){let c=r.render.frame,u=l.geometry,h=e.get(l,u);return n.get(h)!==c&&(e.update(h),n.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(){n=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 ub=new _t,hb=new Pa,fb=new qc,db=new Rs,c0=[],u0=[],h0=new Float32Array(16),f0=new Float32Array(9),d0=new Float32Array(4);function Xa(i,e,t){let r=i[0];if(r<=0||r>0)return i;let n=e*t,s=c0[n];if(s===void 0&&(s=new Float32Array(n),c0[n]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function nn(i,e){if(i.length!==e.length)return!1;for(let t=0,r=i.length;t<r;t++)if(i[t]!==e[t])return!1;return!0}function Jr(i,e){for(let t=0,r=e.length;t<r;t++)i[t]=e[t]}function Zf(i,e){let t=u0[e];t===void 0&&(t=new Int32Array(e),u0[e]=t);for(let r=0;r!==e;++r)t[r]=i.allocateTextureUnit();return t}function NL(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function OL(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(nn(t,e))return;i.uniform2fv(this.addr,e),Jr(t,e)}}function FL(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.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)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(nn(t,e))return;i.uniform3fv(this.addr,e),Jr(t,e)}}function UL(i,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)&&(i.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(nn(t,e))return;i.uniform4fv(this.addr,e),Jr(t,e)}}function zL(i,e){let t=this.cache,r=e.elements;if(r===void 0){if(nn(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),Jr(t,e)}else{if(nn(t,r))return;d0.set(r),i.uniformMatrix2fv(this.addr,!1,d0),Jr(t,r)}}function GL(i,e){let t=this.cache,r=e.elements;if(r===void 0){if(nn(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),Jr(t,e)}else{if(nn(t,r))return;f0.set(r),i.uniformMatrix3fv(this.addr,!1,f0),Jr(t,r)}}function kL(i,e){let t=this.cache,r=e.elements;if(r===void 0){if(nn(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),Jr(t,e)}else{if(nn(t,r))return;h0.set(r),i.uniformMatrix4fv(this.addr,!1,h0),Jr(t,r)}}function VL(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function HL(i,e){let t=this.cache;nn(t,e)||(i.uniform2iv(this.addr,e),Jr(t,e))}function WL(i,e){let t=this.cache;nn(t,e)||(i.uniform3iv(this.addr,e),Jr(t,e))}function jL(i,e){let t=this.cache;nn(t,e)||(i.uniform4iv(this.addr,e),Jr(t,e))}function qL(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function XL(i,e){let t=this.cache;nn(t,e)||(i.uniform2uiv(this.addr,e),Jr(t,e))}function YL(i,e){let t=this.cache;nn(t,e)||(i.uniform3uiv(this.addr,e),Jr(t,e))}function JL(i,e){let t=this.cache;nn(t,e)||(i.uniform4uiv(this.addr,e),Jr(t,e))}function QL(i,e,t){let r=this.cache,n=t.allocateTextureUnit();r[0]!==n&&(i.uniform1i(this.addr,n),r[0]=n),t.setTexture2D(e||ub,n)}function KL(i,e,t){let r=this.cache,n=t.allocateTextureUnit();r[0]!==n&&(i.uniform1i(this.addr,n),r[0]=n),t.setTexture3D(e||fb,n)}function ZL(i,e,t){let r=this.cache,n=t.allocateTextureUnit();r[0]!==n&&(i.uniform1i(this.addr,n),r[0]=n),t.setTextureCube(e||db,n)}function $L(i,e,t){let r=this.cache,n=t.allocateTextureUnit();r[0]!==n&&(i.uniform1i(this.addr,n),r[0]=n),t.setTexture2DArray(e||hb,n)}function eD(i){switch(i){case 5126:return NL;case 35664:return OL;case 35665:return FL;case 35666:return UL;case 35674:return zL;case 35675:return GL;case 35676:return kL;case 5124:case 35670:return VL;case 35667:case 35671:return HL;case 35668:case 35672:return WL;case 35669:case 35673:return jL;case 5125:return qL;case 36294:return XL;case 36295:return YL;case 36296:return JL;case 35678:case 36198:case 36298:case 36306:case 35682:return QL;case 35679:case 36299:case 36307:return KL;case 35680:case 36300:case 36308:case 36293:return ZL;case 36289:case 36303:case 36311:case 36292:return $L}}function tD(i,e){i.uniform1fv(this.addr,e)}function rD(i,e){let t=Xa(e,this.size,2);i.uniform2fv(this.addr,t)}function nD(i,e){let t=Xa(e,this.size,3);i.uniform3fv(this.addr,t)}function iD(i,e){let t=Xa(e,this.size,4);i.uniform4fv(this.addr,t)}function sD(i,e){let t=Xa(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function oD(i,e){let t=Xa(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function aD(i,e){let t=Xa(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function lD(i,e){i.uniform1iv(this.addr,e)}function cD(i,e){i.uniform2iv(this.addr,e)}function uD(i,e){i.uniform3iv(this.addr,e)}function hD(i,e){i.uniform4iv(this.addr,e)}function fD(i,e){i.uniform1uiv(this.addr,e)}function dD(i,e){i.uniform2uiv(this.addr,e)}function pD(i,e){i.uniform3uiv(this.addr,e)}function mD(i,e){i.uniform4uiv(this.addr,e)}function gD(i,e,t){let r=e.length,n=Zf(t,r);i.uniform1iv(this.addr,n);for(let s=0;s!==r;++s)t.setTexture2D(e[s]||ub,n[s])}function yD(i,e,t){let r=e.length,n=Zf(t,r);i.uniform1iv(this.addr,n);for(let s=0;s!==r;++s)t.setTexture3D(e[s]||fb,n[s])}function vD(i,e,t){let r=e.length,n=Zf(t,r);i.uniform1iv(this.addr,n);for(let s=0;s!==r;++s)t.setTextureCube(e[s]||db,n[s])}function xD(i,e,t){let r=e.length,n=Zf(t,r);i.uniform1iv(this.addr,n);for(let s=0;s!==r;++s)t.setTexture2DArray(e[s]||hb,n[s])}function bD(i){switch(i){case 5126:return tD;case 35664:return rD;case 35665:return nD;case 35666:return iD;case 35674:return sD;case 35675:return oD;case 35676:return aD;case 5124:case 35670:return lD;case 35667:case 35671:return cD;case 35668:case 35672:return uD;case 35669:case 35673:return hD;case 5125:return fD;case 36294:return dD;case 36295:return pD;case 36296:return mD;case 35678:case 36198:case 36298:case 36306:case 35682:return gD;case 35679:case 36299:case 36307:return yD;case 35680:case 36300:case 36308:case 36293:return vD;case 36289:case 36303:case 36311:case 36292:return xD}}function wD(i,e,t){this.id=i,this.addr=t,this.cache=[],this.setValue=eD(e.type)}function pb(i,e,t){this.id=i,this.addr=t,this.cache=[],this.size=e.size,this.setValue=bD(e.type)}pb.prototype.updateCache=function(i){let e=this.cache;i instanceof Float32Array&&e.length!==i.length&&(this.cache=new Float32Array(i.length)),Jr(e,i)};function mb(i){this.id=i,this.seq=[],this.map={}}mb.prototype.setValue=function(i,e,t){let r=this.seq;for(let n=0,s=r.length;n!==s;++n){let o=r[n];o.setValue(i,e[o.id],t)}};var jm=/(\w+)(\])?(\[|\.)?/g;function p0(i,e){i.seq.push(e),i.map[e.id]=e}function SD(i,e,t){let r=i.name,n=r.length;for(jm.lastIndex=0;;){let s=jm.exec(r),o=jm.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===n){p0(t,c===void 0?new wD(a,i,e):new pb(a,i,e));break}else{let h=t.map[a];h===void 0&&(h=new mb(a),p0(t,h)),t=h}}}function Cs(i,e){this.seq=[],this.map={};let t=i.getProgramParameter(e,35718);for(let r=0;r<t;++r){let n=i.getActiveUniform(e,r),s=i.getUniformLocation(e,n.name);SD(n,s,this)}}Cs.prototype.setValue=function(i,e,t,r){let n=this.map[e];n!==void 0&&n.setValue(i,t,r)};Cs.prototype.setOptional=function(i,e,t){let r=e[t];r!==void 0&&this.setValue(i,t,r)};Cs.upload=function(i,e,t,r){for(let n=0,s=e.length;n!==s;++n){let o=e[n],a=t[o.id];a.needsUpdate!==!1&&o.setValue(i,a.value,r)}};Cs.seqWithValue=function(i,e){let t=[];for(let r=0,n=i.length;r!==n;++r){let s=i[r];s.id in e&&t.push(s)}return t};function m0(i,e,t){let r=i.createShader(e);return i.shaderSource(r,t),i.compileShader(r),r}var MD=0;function AD(i,e){let t=i.split(`
|
|
2937
2937
|
`),r=[],n=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=n;o<s;o++)r.push(o+1+": "+t[o]);return r.join(`
|
|
2938
2938
|
`)}function TD(i){switch(i){case rn:return["Linear","( value )"];case je:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",i),["Linear","( value )"]}}function g0(i,e,t){let r=i.getShaderParameter(e,35713),n=i.getShaderInfoLog(e).trim();if(r&&n==="")return"";let s=parseInt(/ERROR: 0:(\d+)/.exec(n)[1]);return t.toUpperCase()+`
|
|
2939
2939
|
|
|
@@ -2945,7 +2945,7 @@ void main() {
|
|
|
2945
2945
|
precision `+i.precision+" int;";return i.precision==="highp"?e+=`
|
|
2946
2946
|
#define HIGH_PRECISION`:i.precision==="mediump"?e+=`
|
|
2947
2947
|
#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`
|
|
2948
|
-
#define LOW_PRECISION`),e}function OD(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===eb?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===Qg?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===Nc&&(e="SHADOWMAP_TYPE_VSM"),e}function FD(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case Ls:case Ds:e="ENVMAP_TYPE_CUBE";break;case ja:e="ENVMAP_TYPE_CUBE_UV";break}return e}function UD(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case Ds:e="ENVMAP_MODE_REFRACTION";break}return e}function zD(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case
|
|
2948
|
+
#define LOW_PRECISION`),e}function OD(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===eb?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===Qg?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===Nc&&(e="SHADOWMAP_TYPE_VSM"),e}function FD(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case Ls:case Ds:e="ENVMAP_TYPE_CUBE";break;case ja:e="ENVMAP_TYPE_CUBE_UV";break}return e}function UD(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case Ds:e="ENVMAP_MODE_REFRACTION";break}return e}function zD(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Kf:e="ENVMAP_BLENDING_MULTIPLY";break;case FT:e="ENVMAP_BLENDING_MIX";break;case UT:e="ENVMAP_BLENDING_ADD";break}return e}function GD(i){let e=i.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e/32+1)+3,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:r,maxMip:t}}function kD(i,e,t,r){let n=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=OD(t),c=FD(t),u=UD(t),h=zD(t),f=GD(t),d=t.isWebGL2?"":CD(t),m=LD(s),p=n.createProgram(),g,y,v=t.glslVersion?"#version "+t.glslVersion+`
|
|
2949
2949
|
`:"";t.isRawShaderMaterial?(g=[m].filter(Oc).join(`
|
|
2950
2950
|
`),g.length>0&&(g+=`
|
|
2951
2951
|
`),y=[d,m].filter(Oc).join(`
|
|
@@ -2991,11 +2991,11 @@ void main() {
|
|
|
2991
2991
|
squared_mean = squared_mean / samples;
|
|
2992
2992
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|
2993
2993
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
2994
|
-
}`;function yb(i,e,t){let r=new Ra,n=new N,s=new N,o=new Qe,a=new Jc({depthPacking:cE}),l=new Qc,c={},u=t.maxTextureSize,h={0:Cr,1:ii,2:ir},f=new St({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new N},radius:{value:4}},vertexShader:$D,fragmentShader:eP}),d=f.clone();d.defines.HORIZONTAL_PASS=1;let m=new Ie;m.setAttribute("position",new Ue(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let p=new Gt(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=eb,this.render=function(w,x,E){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||w.length===0)return;let T=i.getRenderTarget(),S=i.getActiveCubeFace(),I=i.getActiveMipmapLevel(),C=i.state;C.setBlending(kt),C.buffers.color.setClear(1,1,1,1),C.buffers.depth.setTest(!0),C.setScissorTest(!1);for(let M=0,_=w.length;M<_;M++){let R=w[M],B=R.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",R,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;n.copy(B.mapSize);let O=B.getFrameExtents();if(n.multiply(O),s.copy(B.mapSize),(n.x>u||n.y>u)&&(n.x>u&&(s.x=Math.floor(u/O.x),n.x=s.x*O.x,B.mapSize.x=s.x),n.y>u&&(s.y=Math.floor(u/O.y),n.y=s.y*O.y,B.mapSize.y=s.y)),B.map===null&&!B.isPointLightShadow&&this.type===Nc&&(B.map=new mt(n.x,n.y),B.map.texture.name=R.name+".shadowMap",B.mapPass=new mt(n.x,n.y),B.camera.updateProjectionMatrix()),B.map===null){let q={minFilter:lr,magFilter:lr,format:On};B.map=new mt(n.x,n.y,q),B.map.texture.name=R.name+".shadowMap",B.camera.updateProjectionMatrix()}i.setRenderTarget(B.map),i.clear();let z=B.getViewportCount();for(let q=0;q<z;q++){let F=B.getViewport(q);o.set(s.x*F.x,s.y*F.y,s.x*F.z,s.y*F.w),C.viewport(o),B.updateMatrices(R,q),r=B.getFrustum(),b(x,E,B.camera,R,this.type)}!B.isPointLightShadow&&this.type===Nc&&y(B,E),B.needsUpdate=!1}g.needsUpdate=!1,i.setRenderTarget(T,S,I)};function y(w,x){let E=e.update(p);f.defines.VSM_SAMPLES!==w.blurSamples&&(f.defines.VSM_SAMPLES=w.blurSamples,d.defines.VSM_SAMPLES=w.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),f.uniforms.shadow_pass.value=w.map.texture,f.uniforms.resolution.value=w.mapSize,f.uniforms.radius.value=w.radius,i.setRenderTarget(w.mapPass),i.clear(),i.renderBufferDirect(x,null,E,f,p,null),d.uniforms.shadow_pass.value=w.mapPass.texture,d.uniforms.resolution.value=w.mapSize,d.uniforms.radius.value=w.radius,i.setRenderTarget(w.map),i.clear(),i.renderBufferDirect(x,null,E,d,p,null)}function v(w,x,E,T,S,I){let C=null,M=E.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(M!==void 0?C=M:C=E.isPointLight===!0?l:a,i.localClippingEnabled&&x.clipShadows===!0&&x.clippingPlanes.length!==0||x.displacementMap&&x.displacementScale!==0||x.alphaMap&&x.alphaTest>0){let _=C.uuid,R=x.uuid,B=c[_];B===void 0&&(B={},c[_]=B);let O=B[R];O===void 0&&(O=C.clone(),B[R]=O),C=O}return C.visible=x.visible,C.wireframe=x.wireframe,I===Nc?C.side=x.shadowSide!==null?x.shadowSide:x.side:C.side=x.shadowSide!==null?x.shadowSide:h[x.side],C.alphaMap=x.alphaMap,C.alphaTest=x.alphaTest,C.clipShadows=x.clipShadows,C.clippingPlanes=x.clippingPlanes,C.clipIntersection=x.clipIntersection,C.displacementMap=x.displacementMap,C.displacementScale=x.displacementScale,C.displacementBias=x.displacementBias,C.wireframeLinewidth=x.wireframeLinewidth,C.linewidth=x.linewidth,E.isPointLight===!0&&C.isMeshDistanceMaterial===!0&&(C.referencePosition.setFromMatrixPosition(E.matrixWorld),C.nearDistance=T,C.farDistance=S),C}function b(w,x,E,T,S){if(w.visible===!1)return;if(w.layers.test(x.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&S===Nc)&&(!w.frustumCulled||r.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(E.matrixWorldInverse,w.matrixWorld);let M=e.update(w),_=w.material;if(Array.isArray(_)){let R=M.groups;for(let B=0,O=R.length;B<O;B++){let z=R[B],q=_[z.materialIndex];if(q&&q.visible){let F=v(w,q,T,E.near,E.far,S);i.renderBufferDirect(E,null,M,F,w,z)}}}else if(_.visible){let R=v(w,_,T,E.near,E.far,S);i.renderBufferDirect(E,null,M,R,w,null)}}let C=w.children;for(let M=0,_=C.length;M<_;M++)b(C[M],x,E,T,S)}}function tP(i,e,t){let r=t.isWebGL2;function n(){let G=!1,Me=new Qe,Ce=null,Ke=new Qe(0,0,0,0);return{setMask:function(Oe){Ce!==Oe&&!G&&(i.colorMask(Oe,Oe,Oe,Oe),Ce=Oe)},setLocked:function(Oe){G=Oe},setClear:function(Oe,Ze,_e,nt,pt){pt===!0&&(Oe*=nt,Ze*=nt,_e*=nt),Me.set(Oe,Ze,_e,nt),Ke.equals(Me)===!1&&(i.clearColor(Oe,Ze,_e,nt),Ke.copy(Me))},reset:function(){G=!1,Ce=null,Ke.set(-1,0,0,0)}}}function s(){let G=!1,Me=null,Ce=null,Ke=null;return{setTest:function(Oe){Oe?$(2929):j(2929)},setMask:function(Oe){Me!==Oe&&!G&&(i.depthMask(Oe),Me=Oe)},setFunc:function(Oe){if(Ce!==Oe){if(Oe)switch(Oe){case DT:i.depthFunc(512);break;case PT:i.depthFunc(519);break;case IT:i.depthFunc(513);break;case $m:i.depthFunc(515);break;case RT:i.depthFunc(514);break;case BT:i.depthFunc(518);break;case NT:i.depthFunc(516);break;case OT:i.depthFunc(517);break;default:i.depthFunc(515)}else i.depthFunc(515);Ce=Oe}},setLocked:function(Oe){G=Oe},setClear:function(Oe){Ke!==Oe&&(i.clearDepth(Oe),Ke=Oe)},reset:function(){G=!1,Me=null,Ce=null,Ke=null}}}function o(){let G=!1,Me=null,Ce=null,Ke=null,Oe=null,Ze=null,_e=null,nt=null,pt=null;return{setTest:function(ht){G||(ht?$(2960):j(2960))},setMask:function(ht){Me!==ht&&!G&&(i.stencilMask(ht),Me=ht)},setFunc:function(ht,Ot,Nr){(Ce!==ht||Ke!==Ot||Oe!==Nr)&&(i.stencilFunc(ht,Ot,Nr),Ce=ht,Ke=Ot,Oe=Nr)},setOp:function(ht,Ot,Nr){(Ze!==ht||_e!==Ot||nt!==Nr)&&(i.stencilOp(ht,Ot,Nr),Ze=ht,_e=Ot,nt=Nr)},setLocked:function(ht){G=ht},setClear:function(ht){pt!==ht&&(i.clearStencil(ht),pt=ht)},reset:function(){G=!1,Me=null,Ce=null,Ke=null,Oe=null,Ze=null,_e=null,nt=null,pt=null}}}let a=new n,l=new s,c=new o,u={},h={},f=new WeakMap,d=[],m=null,p=!1,g=null,y=null,v=null,b=null,w=null,x=null,E=null,T=!1,S=null,I=null,C=null,M=null,_=null,R=i.getParameter(35661),B=!1,O=0,z=i.getParameter(7938);z.indexOf("WebGL")!==-1?(O=parseFloat(/^WebGL (\d)/.exec(z)[1]),B=O>=1):z.indexOf("OpenGL ES")!==-1&&(O=parseFloat(/^OpenGL ES (\d)/.exec(z)[1]),B=O>=2);let q=null,F={},ee=i.getParameter(3088),k=i.getParameter(2978),V=new Qe().fromArray(ee),U=new Qe().fromArray(k);function J(G,Me,Ce){let Ke=new Uint8Array(4),Oe=i.createTexture();i.bindTexture(G,Oe),i.texParameteri(G,10241,9728),i.texParameteri(G,10240,9728);for(let Ze=0;Ze<Ce;Ze++)i.texImage2D(Me+Ze,0,6408,1,1,0,6408,5121,Ke);return Oe}let K={};K[3553]=J(3553,3553,1),K[34067]=J(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),$(2929),l.setFunc($m),Q(!1),ce(mx),$(2884),Y(kt);function $(G){u[G]!==!0&&(i.enable(G),u[G]=!0)}function j(G){u[G]!==!1&&(i.disable(G),u[G]=!1)}function ge(G,Me){return h[G]!==Me?(i.bindFramebuffer(G,Me),h[G]=Me,r&&(G===36009&&(h[36160]=Me),G===36160&&(h[36009]=Me)),!0):!1}function ae(G,Me){let Ce=d,Ke=!1;if(G)if(Ce=f.get(Me),Ce===void 0&&(Ce=[],f.set(Me,Ce)),G.isWebGLMultipleRenderTargets){let Oe=G.texture;if(Ce.length!==Oe.length||Ce[0]!==36064){for(let Ze=0,_e=Oe.length;Ze<_e;Ze++)Ce[Ze]=36064+Ze;Ce.length=Oe.length,Ke=!0}}else Ce[0]!==36064&&(Ce[0]=36064,Ke=!0);else Ce[0]!==1029&&(Ce[0]=1029,Ke=!0);Ke&&(t.isWebGL2?i.drawBuffers(Ce):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Ce))}function le(G){return m!==G?(i.useProgram(G),m=G,!0):!1}let W={[Ma]:32774,[xT]:32778,[bT]:32779};if(r)W[xx]=32775,W[bx]=32776;else{let G=e.get("EXT_blend_minmax");G!==null&&(W[xx]=G.MIN_EXT,W[bx]=G.MAX_EXT)}let ue={[wT]:0,[ST]:1,[MT]:768,[rb]:770,[LT]:776,[_T]:774,[TT]:772,[AT]:769,[nb]:771,[CT]:775,[ET]:773};function Y(G,Me,Ce,Ke,Oe,Ze,_e,nt){if(G===kt){p===!0&&(j(3042),p=!1);return}if(p===!1&&($(3042),p=!0),G!==vT){if(G!==g||nt!==T){if((y!==Ma||w!==Ma)&&(i.blendEquation(32774),y=Ma,w=Ma),nt)switch(G){case Es:i.blendFuncSeparate(1,771,1,771);break;case gx:i.blendFunc(1,1);break;case yx:i.blendFuncSeparate(0,769,0,1);break;case vx:i.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}else switch(G){case Es:i.blendFuncSeparate(770,771,1,771);break;case gx:i.blendFunc(770,1);break;case yx:i.blendFuncSeparate(0,769,0,1);break;case vx:i.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}v=null,b=null,x=null,E=null,g=G,T=nt}return}Oe=Oe||Me,Ze=Ze||Ce,_e=_e||Ke,(Me!==y||Oe!==w)&&(i.blendEquationSeparate(W[Me],W[Oe]),y=Me,w=Oe),(Ce!==v||Ke!==b||Ze!==x||_e!==E)&&(i.blendFuncSeparate(ue[Ce],ue[Ke],ue[Ze],ue[_e]),v=Ce,b=Ke,x=Ze,E=_e),g=G,T=null}function H(G,Me){G.side===ir?j(2884):$(2884);let Ce=G.side===Cr;Me&&(Ce=!Ce),Q(Ce),G.blending===Es&&G.transparent===!1?Y(kt):Y(G.blending,G.blendEquation,G.blendSrc,G.blendDst,G.blendEquationAlpha,G.blendSrcAlpha,G.blendDstAlpha,G.premultipliedAlpha),l.setFunc(G.depthFunc),l.setTest(G.depthTest),l.setMask(G.depthWrite),a.setMask(G.colorWrite);let Ke=G.stencilWrite;c.setTest(Ke),Ke&&(c.setMask(G.stencilWriteMask),c.setFunc(G.stencilFunc,G.stencilRef,G.stencilFuncMask),c.setOp(G.stencilFail,G.stencilZFail,G.stencilZPass)),pe(G.polygonOffset,G.polygonOffsetFactor,G.polygonOffsetUnits),G.alphaToCoverage===!0?$(32926):j(32926)}function Q(G){S!==G&&(G?i.frontFace(2304):i.frontFace(2305),S=G)}function ce(G){G!==gT?($(2884),G!==I&&(G===mx?i.cullFace(1029):G===yT?i.cullFace(1028):i.cullFace(1032))):j(2884),I=G}function ie(G){G!==C&&(B&&i.lineWidth(G),C=G)}function pe(G,Me,Ce){G?($(32823),(M!==Me||_!==Ce)&&(i.polygonOffset(Me,Ce),M=Me,_=Ce)):j(32823)}function ve(G){G?$(3089):j(3089)}function me(G){G===void 0&&(G=33984+R-1),q!==G&&(i.activeTexture(G),q=G)}function De(G,Me){q===null&&me();let Ce=F[q];Ce===void 0&&(Ce={type:void 0,texture:void 0},F[q]=Ce),(Ce.type!==G||Ce.texture!==Me)&&(i.bindTexture(G,Me||K[G]),Ce.type=G,Ce.texture=Me)}function ke(){let G=F[q];G!==void 0&&G.type!==void 0&&(i.bindTexture(G.type,null),G.type=void 0,G.texture=void 0)}function P(){try{i.compressedTexImage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function L(){try{i.texSubImage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function te(){try{i.texSubImage3D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function ye(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Se(){try{i.texStorage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Pe(){try{i.texStorage3D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Fe(){try{i.texImage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function he(){try{i.texImage3D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function rt(G){V.equals(G)===!1&&(i.scissor(G.x,G.y,G.z,G.w),V.copy(G))}function st(G){U.equals(G)===!1&&(i.viewport(G.x,G.y,G.z,G.w),U.copy(G))}function Ae(){i.disable(3042),i.disable(2884),i.disable(2929),i.disable(32823),i.disable(3089),i.disable(2960),i.disable(32926),i.blendEquation(32774),i.blendFunc(1,0),i.blendFuncSeparate(1,0,1,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(513),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(519,0,4294967295),i.stencilOp(7680,7680,7680),i.clearStencil(0),i.cullFace(1029),i.frontFace(2305),i.polygonOffset(0,0),i.activeTexture(33984),i.bindFramebuffer(36160,null),r===!0&&(i.bindFramebuffer(36009,null),i.bindFramebuffer(36008,null)),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),u={},q=null,F={},h={},f=new WeakMap,d=[],m=null,p=!1,g=null,y=null,v=null,b=null,w=null,x=null,E=null,T=!1,S=null,I=null,C=null,M=null,_=null,V.set(0,0,i.canvas.width,i.canvas.height),U.set(0,0,i.canvas.width,i.canvas.height),a.reset(),l.reset(),c.reset()}return{buffers:{color:a,depth:l,stencil:c},enable:$,disable:j,bindFramebuffer:ge,drawBuffers:ae,useProgram:le,setBlending:Y,setMaterial:H,setFlipSided:Q,setCullFace:ce,setLineWidth:ie,setPolygonOffset:pe,setScissorTest:ve,activeTexture:me,bindTexture:De,unbindTexture:ke,compressedTexImage2D:P,texImage2D:Fe,texImage3D:he,texStorage2D:Se,texStorage3D:Pe,texSubImage2D:L,texSubImage3D:te,compressedTexSubImage2D:ye,scissor:rt,viewport:st,reset:Ae}}function rP(i,e,t,r,n,s,o){let a=n.isWebGL2,l=n.maxTextures,c=n.maxCubemapSize,u=n.maxTextureSize,h=n.maxSamples,f=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,d=/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap,p,g=new WeakMap,y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(P,L){return y?new OffscreenCanvas(P,L):jc("canvas")}function b(P,L,te,ye){let Se=1;if((P.width>ye||P.height>ye)&&(Se=ye/Math.max(P.width,P.height)),Se<1||L===!0)if(typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&P instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&P instanceof ImageBitmap){let Pe=L?ff:Math.floor,Fe=Pe(Se*P.width),he=Pe(Se*P.height);p===void 0&&(p=v(Fe,he));let rt=te?v(Fe,he):p;return rt.width=Fe,rt.height=he,rt.getContext("2d").drawImage(P,0,0,Fe,he),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+P.width+"x"+P.height+") to ("+Fe+"x"+he+")."),rt}else return"data"in P&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+P.width+"x"+P.height+")."),P;return P}function w(P){return ig(P.width)&&ig(P.height)}function x(P){return a?!1:P.wrapS!==_r||P.wrapT!==_r||P.minFilter!==lr&&P.minFilter!==ct}function E(P,L){return P.generateMipmaps&&L&&P.minFilter!==lr&&P.minFilter!==ct}function T(P){i.generateMipmap(P)}function S(P,L,te,ye,Se=!1){if(a===!1)return L;if(P!==null){if(i[P]!==void 0)return i[P];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let Pe=L;return L===6403&&(te===5126&&(Pe=33326),te===5131&&(Pe=33325),te===5121&&(Pe=33321)),L===33319&&(te===5126&&(Pe=33328),te===5131&&(Pe=33327),te===5121&&(Pe=33323)),L===6408&&(te===5126&&(Pe=34836),te===5131&&(Pe=34842),te===5121&&(Pe=ye===je&&Se===!1?35907:32856),te===32819&&(Pe=32854),te===32820&&(Pe=32855)),(Pe===33325||Pe===33326||Pe===33327||Pe===33328||Pe===34842||Pe===34836)&&e.get("EXT_color_buffer_float"),Pe}function I(P,L,te){return E(P,te)===!0||P.isFramebufferTexture&&P.minFilter!==lr&&P.minFilter!==ct?Math.log2(Math.max(L.width,L.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?L.mipmaps.length:1}function C(P){return P===lr||P===wx||P===Sx?9728:9729}function M(P){let L=P.target;L.removeEventListener("dispose",M),R(L),L.isVideoTexture&&m.delete(L)}function _(P){let L=P.target;L.removeEventListener("dispose",_),O(L)}function R(P){let L=r.get(P);if(L.__webglInit===void 0)return;let te=P.source,ye=g.get(te);if(ye){let Se=ye[L.__cacheKey];Se.usedTimes--,Se.usedTimes===0&&B(P),Object.keys(ye).length===0&&g.delete(te)}r.remove(P)}function B(P){let L=r.get(P);i.deleteTexture(L.__webglTexture);let te=P.source,ye=g.get(te);delete ye[L.__cacheKey],o.memory.textures--}function O(P){let L=P.texture,te=r.get(P),ye=r.get(L);if(ye.__webglTexture!==void 0&&(i.deleteTexture(ye.__webglTexture),o.memory.textures--),P.depthTexture&&P.depthTexture.dispose(),P.isWebGLCubeRenderTarget)for(let Se=0;Se<6;Se++)i.deleteFramebuffer(te.__webglFramebuffer[Se]),te.__webglDepthbuffer&&i.deleteRenderbuffer(te.__webglDepthbuffer[Se]);else i.deleteFramebuffer(te.__webglFramebuffer),te.__webglDepthbuffer&&i.deleteRenderbuffer(te.__webglDepthbuffer),te.__webglMultisampledFramebuffer&&i.deleteFramebuffer(te.__webglMultisampledFramebuffer),te.__webglColorRenderbuffer&&i.deleteRenderbuffer(te.__webglColorRenderbuffer),te.__webglDepthRenderbuffer&&i.deleteRenderbuffer(te.__webglDepthRenderbuffer);if(P.isWebGLMultipleRenderTargets)for(let Se=0,Pe=L.length;Se<Pe;Se++){let Fe=r.get(L[Se]);Fe.__webglTexture&&(i.deleteTexture(Fe.__webglTexture),o.memory.textures--),r.remove(L[Se])}r.remove(L),r.remove(P)}let z=0;function q(){z=0}function F(){let P=z;return P>=l&&console.warn("THREE.WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+l),z+=1,P}function ee(P){let L=[];return L.push(P.wrapS),L.push(P.wrapT),L.push(P.magFilter),L.push(P.minFilter),L.push(P.anisotropy),L.push(P.internalFormat),L.push(P.format),L.push(P.type),L.push(P.generateMipmaps),L.push(P.premultiplyAlpha),L.push(P.flipY),L.push(P.unpackAlignment),L.push(P.encoding),L.join()}function k(P,L){let te=r.get(P);if(P.isVideoTexture&&De(P),P.isRenderTargetTexture===!1&&P.version>0&&te.__version!==P.version){let ye=P.image;if(ye===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ye.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ae(te,P,L);return}}t.activeTexture(33984+L),t.bindTexture(3553,te.__webglTexture)}function V(P,L){let te=r.get(P);if(P.version>0&&te.__version!==P.version){ae(te,P,L);return}t.activeTexture(33984+L),t.bindTexture(35866,te.__webglTexture)}function U(P,L){let te=r.get(P);if(P.version>0&&te.__version!==P.version){ae(te,P,L);return}t.activeTexture(33984+L),t.bindTexture(32879,te.__webglTexture)}function J(P,L){let te=r.get(P);if(P.version>0&&te.__version!==P.version){le(te,P,L);return}t.activeTexture(33984+L),t.bindTexture(34067,te.__webglTexture)}let K={[Da]:10497,[_r]:33071,[rg]:33648},$={[lr]:9728,[wx]:9984,[Sx]:9986,[ct]:9729,[WT]:9985,[ks]:9987};function j(P,L,te){if(te?(i.texParameteri(P,10242,K[L.wrapS]),i.texParameteri(P,10243,K[L.wrapT]),(P===32879||P===35866)&&i.texParameteri(P,32882,K[L.wrapR]),i.texParameteri(P,10240,$[L.magFilter]),i.texParameteri(P,10241,$[L.minFilter])):(i.texParameteri(P,10242,33071),i.texParameteri(P,10243,33071),(P===32879||P===35866)&&i.texParameteri(P,32882,33071),(L.wrapS!==_r||L.wrapT!==_r)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),i.texParameteri(P,10240,C(L.magFilter)),i.texParameteri(P,10241,C(L.minFilter)),L.minFilter!==lr&&L.minFilter!==ct&&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 ye=e.get("EXT_texture_filter_anisotropic");if(L.type===Ts&&e.has("OES_texture_float_linear")===!1||a===!1&&L.type===La&&e.has("OES_texture_half_float_linear")===!1)return;(L.anisotropy>1||r.get(L).__currentAnisotropy)&&(i.texParameterf(P,ye.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,n.getMaxAnisotropy())),r.get(L).__currentAnisotropy=L.anisotropy)}}function ge(P,L){let te=!1;P.__webglInit===void 0&&(P.__webglInit=!0,L.addEventListener("dispose",M));let ye=L.source,Se=g.get(ye);Se===void 0&&(Se={},g.set(ye,Se));let Pe=ee(L);if(Pe!==P.__cacheKey){Se[Pe]===void 0&&(Se[Pe]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,te=!0),Se[Pe].usedTimes++;let Fe=Se[P.__cacheKey];Fe!==void 0&&(Se[P.__cacheKey].usedTimes--,Fe.usedTimes===0&&B(L)),P.__cacheKey=Pe,P.__webglTexture=Se[Pe].texture}return te}function ae(P,L,te){let ye=3553;L.isDataArrayTexture&&(ye=35866),L.isData3DTexture&&(ye=32879);let Se=ge(P,L),Pe=L.source;if(t.activeTexture(33984+te),t.bindTexture(ye,P.__webglTexture),Pe.version!==Pe.__currentVersion||Se===!0){i.pixelStorei(37440,L.flipY),i.pixelStorei(37441,L.premultiplyAlpha),i.pixelStorei(3317,L.unpackAlignment),i.pixelStorei(37443,0);let Fe=x(L)&&w(L.image)===!1,he=b(L.image,Fe,!1,u);he=ke(L,he);let rt=w(he)||a,st=s.convert(L.format,L.encoding),Ae=s.convert(L.type),G=S(L.internalFormat,st,Ae,L.encoding,L.isVideoTexture);j(ye,L,rt);let Me,Ce=L.mipmaps,Ke=a&&L.isVideoTexture!==!0,Oe=P.__version===void 0,Ze=I(L,he,rt);if(L.isDepthTexture)G=6402,a?L.type===Ts?G=36012:L.type===Ca?G=33190:L.type===_s?G=35056:G=33189:L.type===Ts&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===Ao&&G===6402&&L.type!==Vc&&L.type!==Ca&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=Vc,Ae=s.convert(L.type)),L.format===Ps&&G===6402&&(G=34041,L.type!==_s&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=_s,Ae=s.convert(L.type))),Ke&&Oe?t.texStorage2D(3553,1,G,he.width,he.height):t.texImage2D(3553,0,G,he.width,he.height,0,st,Ae,null);else if(L.isDataTexture)if(Ce.length>0&&rt){Ke&&Oe&&t.texStorage2D(3553,Ze,G,Ce[0].width,Ce[0].height);for(let _e=0,nt=Ce.length;_e<nt;_e++)Me=Ce[_e],Ke?t.texSubImage2D(3553,_e,0,0,Me.width,Me.height,st,Ae,Me.data):t.texImage2D(3553,_e,G,Me.width,Me.height,0,st,Ae,Me.data);L.generateMipmaps=!1}else Ke?(Oe&&t.texStorage2D(3553,Ze,G,he.width,he.height),t.texSubImage2D(3553,0,0,0,he.width,he.height,st,Ae,he.data)):t.texImage2D(3553,0,G,he.width,he.height,0,st,Ae,he.data);else if(L.isCompressedTexture){Ke&&Oe&&t.texStorage2D(3553,Ze,G,Ce[0].width,Ce[0].height);for(let _e=0,nt=Ce.length;_e<nt;_e++)Me=Ce[_e],L.format!==On?st!==null?Ke?t.compressedTexSubImage2D(3553,_e,0,0,Me.width,Me.height,st,Me.data):t.compressedTexImage2D(3553,_e,G,Me.width,Me.height,0,Me.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ke?t.texSubImage2D(3553,_e,0,0,Me.width,Me.height,st,Ae,Me.data):t.texImage2D(3553,_e,G,Me.width,Me.height,0,st,Ae,Me.data)}else if(L.isDataArrayTexture)Ke?(Oe&&t.texStorage3D(35866,Ze,G,he.width,he.height,he.depth),t.texSubImage3D(35866,0,0,0,0,he.width,he.height,he.depth,st,Ae,he.data)):t.texImage3D(35866,0,G,he.width,he.height,he.depth,0,st,Ae,he.data);else if(L.isData3DTexture)Ke?(Oe&&t.texStorage3D(32879,Ze,G,he.width,he.height,he.depth),t.texSubImage3D(32879,0,0,0,0,he.width,he.height,he.depth,st,Ae,he.data)):t.texImage3D(32879,0,G,he.width,he.height,he.depth,0,st,Ae,he.data);else if(L.isFramebufferTexture)Ke&&Oe?t.texStorage2D(3553,Ze,G,he.width,he.height):t.texImage2D(3553,0,G,he.width,he.height,0,st,Ae,null);else if(Ce.length>0&&rt){Ke&&Oe&&t.texStorage2D(3553,Ze,G,Ce[0].width,Ce[0].height);for(let _e=0,nt=Ce.length;_e<nt;_e++)Me=Ce[_e],Ke?t.texSubImage2D(3553,_e,0,0,st,Ae,Me):t.texImage2D(3553,_e,G,st,Ae,Me);L.generateMipmaps=!1}else Ke?(Oe&&t.texStorage2D(3553,Ze,G,he.width,he.height),t.texSubImage2D(3553,0,0,0,st,Ae,he)):t.texImage2D(3553,0,G,st,Ae,he);E(L,rt)&&T(ye),Pe.__currentVersion=Pe.version,L.onUpdate&&L.onUpdate(L)}P.__version=L.version}function le(P,L,te){if(L.image.length!==6)return;let ye=ge(P,L),Se=L.source;if(t.activeTexture(33984+te),t.bindTexture(34067,P.__webglTexture),Se.version!==Se.__currentVersion||ye===!0){i.pixelStorei(37440,L.flipY),i.pixelStorei(37441,L.premultiplyAlpha),i.pixelStorei(3317,L.unpackAlignment),i.pixelStorei(37443,0);let Pe=L.isCompressedTexture||L.image[0].isCompressedTexture,Fe=L.image[0]&&L.image[0].isDataTexture,he=[];for(let _e=0;_e<6;_e++)!Pe&&!Fe?he[_e]=b(L.image[_e],!1,!0,c):he[_e]=Fe?L.image[_e].image:L.image[_e],he[_e]=ke(L,he[_e]);let rt=he[0],st=w(rt)||a,Ae=s.convert(L.format,L.encoding),G=s.convert(L.type),Me=S(L.internalFormat,Ae,G,L.encoding),Ce=a&&L.isVideoTexture!==!0,Ke=P.__version===void 0,Oe=I(L,rt,st);j(34067,L,st);let Ze;if(Pe){Ce&&Ke&&t.texStorage2D(34067,Oe,Me,rt.width,rt.height);for(let _e=0;_e<6;_e++){Ze=he[_e].mipmaps;for(let nt=0;nt<Ze.length;nt++){let pt=Ze[nt];L.format!==On?Ae!==null?Ce?t.compressedTexSubImage2D(34069+_e,nt,0,0,pt.width,pt.height,Ae,pt.data):t.compressedTexImage2D(34069+_e,nt,Me,pt.width,pt.height,0,pt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ce?t.texSubImage2D(34069+_e,nt,0,0,pt.width,pt.height,Ae,G,pt.data):t.texImage2D(34069+_e,nt,Me,pt.width,pt.height,0,Ae,G,pt.data)}}}else{Ze=L.mipmaps,Ce&&Ke&&(Ze.length>0&&Oe++,t.texStorage2D(34067,Oe,Me,he[0].width,he[0].height));for(let _e=0;_e<6;_e++)if(Fe){Ce?t.texSubImage2D(34069+_e,0,0,0,he[_e].width,he[_e].height,Ae,G,he[_e].data):t.texImage2D(34069+_e,0,Me,he[_e].width,he[_e].height,0,Ae,G,he[_e].data);for(let nt=0;nt<Ze.length;nt++){let ht=Ze[nt].image[_e].image;Ce?t.texSubImage2D(34069+_e,nt+1,0,0,ht.width,ht.height,Ae,G,ht.data):t.texImage2D(34069+_e,nt+1,Me,ht.width,ht.height,0,Ae,G,ht.data)}}else{Ce?t.texSubImage2D(34069+_e,0,0,0,Ae,G,he[_e]):t.texImage2D(34069+_e,0,Me,Ae,G,he[_e]);for(let nt=0;nt<Ze.length;nt++){let pt=Ze[nt];Ce?t.texSubImage2D(34069+_e,nt+1,0,0,Ae,G,pt.image[_e]):t.texImage2D(34069+_e,nt+1,Me,Ae,G,pt.image[_e])}}}E(L,st)&&T(34067),Se.__currentVersion=Se.version,L.onUpdate&&L.onUpdate(L)}P.__version=L.version}function W(P,L,te,ye,Se){let Pe=s.convert(te.format,te.encoding),Fe=s.convert(te.type),he=S(te.internalFormat,Pe,Fe,te.encoding);r.get(L).__hasExternalTextures||(Se===32879||Se===35866?t.texImage3D(Se,0,he,L.width,L.height,L.depth,0,Pe,Fe,null):t.texImage2D(Se,0,he,L.width,L.height,0,Pe,Fe,null)),t.bindFramebuffer(36160,P),me(L)?f.framebufferTexture2DMultisampleEXT(36160,ye,Se,r.get(te).__webglTexture,0,ve(L)):i.framebufferTexture2D(36160,ye,Se,r.get(te).__webglTexture,0),t.bindFramebuffer(36160,null)}function ue(P,L,te){if(i.bindRenderbuffer(36161,P),L.depthBuffer&&!L.stencilBuffer){let ye=33189;if(te||me(L)){let Se=L.depthTexture;Se&&Se.isDepthTexture&&(Se.type===Ts?ye=36012:Se.type===Ca&&(ye=33190));let Pe=ve(L);me(L)?f.renderbufferStorageMultisampleEXT(36161,Pe,ye,L.width,L.height):i.renderbufferStorageMultisample(36161,Pe,ye,L.width,L.height)}else i.renderbufferStorage(36161,ye,L.width,L.height);i.framebufferRenderbuffer(36160,36096,36161,P)}else if(L.depthBuffer&&L.stencilBuffer){let ye=ve(L);te&&me(L)===!1?i.renderbufferStorageMultisample(36161,ye,35056,L.width,L.height):me(L)?f.renderbufferStorageMultisampleEXT(36161,ye,35056,L.width,L.height):i.renderbufferStorage(36161,34041,L.width,L.height),i.framebufferRenderbuffer(36160,33306,36161,P)}else{let ye=L.isWebGLMultipleRenderTargets===!0?L.texture[0]:L.texture,Se=s.convert(ye.format,ye.encoding),Pe=s.convert(ye.type),Fe=S(ye.internalFormat,Se,Pe,ye.encoding),he=ve(L);te&&me(L)===!1?i.renderbufferStorageMultisample(36161,he,Fe,L.width,L.height):me(L)?f.renderbufferStorageMultisampleEXT(36161,he,Fe,L.width,L.height):i.renderbufferStorage(36161,Fe,L.width,L.height)}i.bindRenderbuffer(36161,null)}function Y(P,L){if(L&&L.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,P),!(L.depthTexture&&L.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(L.depthTexture).__webglTexture||L.depthTexture.image.width!==L.width||L.depthTexture.image.height!==L.height)&&(L.depthTexture.image.width=L.width,L.depthTexture.image.height=L.height,L.depthTexture.needsUpdate=!0),k(L.depthTexture,0);let ye=r.get(L.depthTexture).__webglTexture,Se=ve(L);if(L.depthTexture.format===Ao)me(L)?f.framebufferTexture2DMultisampleEXT(36160,36096,3553,ye,0,Se):i.framebufferTexture2D(36160,36096,3553,ye,0);else if(L.depthTexture.format===Ps)me(L)?f.framebufferTexture2DMultisampleEXT(36160,33306,3553,ye,0,Se):i.framebufferTexture2D(36160,33306,3553,ye,0);else throw new Error("Unknown depthTexture format")}function H(P){let L=r.get(P),te=P.isWebGLCubeRenderTarget===!0;if(P.depthTexture&&!L.__autoAllocateDepthBuffer){if(te)throw new Error("target.depthTexture not supported in Cube render targets");Y(L.__webglFramebuffer,P)}else if(te){L.__webglDepthbuffer=[];for(let ye=0;ye<6;ye++)t.bindFramebuffer(36160,L.__webglFramebuffer[ye]),L.__webglDepthbuffer[ye]=i.createRenderbuffer(),ue(L.__webglDepthbuffer[ye],P,!1)}else t.bindFramebuffer(36160,L.__webglFramebuffer),L.__webglDepthbuffer=i.createRenderbuffer(),ue(L.__webglDepthbuffer,P,!1);t.bindFramebuffer(36160,null)}function Q(P,L,te){let ye=r.get(P);L!==void 0&&W(ye.__webglFramebuffer,P,P.texture,36064,3553),te!==void 0&&H(P)}function ce(P){let L=P.texture,te=r.get(P),ye=r.get(L);P.addEventListener("dispose",_),P.isWebGLMultipleRenderTargets!==!0&&(ye.__webglTexture===void 0&&(ye.__webglTexture=i.createTexture()),ye.__version=L.version,o.memory.textures++);let Se=P.isWebGLCubeRenderTarget===!0,Pe=P.isWebGLMultipleRenderTargets===!0,Fe=w(P)||a;if(Se){te.__webglFramebuffer=[];for(let he=0;he<6;he++)te.__webglFramebuffer[he]=i.createFramebuffer()}else if(te.__webglFramebuffer=i.createFramebuffer(),Pe)if(n.drawBuffers){let he=P.texture;for(let rt=0,st=he.length;rt<st;rt++){let Ae=r.get(he[rt]);Ae.__webglTexture===void 0&&(Ae.__webglTexture=i.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(a&&P.samples>0&&me(P)===!1){te.__webglMultisampledFramebuffer=i.createFramebuffer(),te.__webglColorRenderbuffer=i.createRenderbuffer(),i.bindRenderbuffer(36161,te.__webglColorRenderbuffer);let he=s.convert(L.format,L.encoding),rt=s.convert(L.type),st=S(L.internalFormat,he,rt,L.encoding),Ae=ve(P);i.renderbufferStorageMultisample(36161,Ae,st,P.width,P.height),t.bindFramebuffer(36160,te.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(36160,36064,36161,te.__webglColorRenderbuffer),i.bindRenderbuffer(36161,null),P.depthBuffer&&(te.__webglDepthRenderbuffer=i.createRenderbuffer(),ue(te.__webglDepthRenderbuffer,P,!0)),t.bindFramebuffer(36160,null)}if(Se){t.bindTexture(34067,ye.__webglTexture),j(34067,L,Fe);for(let he=0;he<6;he++)W(te.__webglFramebuffer[he],P,L,36064,34069+he);E(L,Fe)&&T(34067),t.unbindTexture()}else if(Pe){let he=P.texture;for(let rt=0,st=he.length;rt<st;rt++){let Ae=he[rt],G=r.get(Ae);t.bindTexture(3553,G.__webglTexture),j(3553,Ae,Fe),W(te.__webglFramebuffer,P,Ae,36064+rt,3553),E(Ae,Fe)&&T(3553)}t.unbindTexture()}else{let he=3553;(P.isWebGL3DRenderTarget||P.isWebGLArrayRenderTarget)&&(a?he=P.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(he,ye.__webglTexture),j(he,L,Fe),W(te.__webglFramebuffer,P,L,36064,he),E(L,Fe)&&T(he),t.unbindTexture()}P.depthBuffer&&H(P)}function ie(P){let L=w(P)||a,te=P.isWebGLMultipleRenderTargets===!0?P.texture:[P.texture];for(let ye=0,Se=te.length;ye<Se;ye++){let Pe=te[ye];if(E(Pe,L)){let Fe=P.isWebGLCubeRenderTarget?34067:3553,he=r.get(Pe).__webglTexture;t.bindTexture(Fe,he),T(Fe),t.unbindTexture()}}}function pe(P){if(a&&P.samples>0&&me(P)===!1){let L=P.width,te=P.height,ye=16384,Se=[36064],Pe=P.stencilBuffer?33306:36096;P.depthBuffer&&Se.push(Pe);let Fe=r.get(P),he=Fe.__ignoreDepthValues!==void 0?Fe.__ignoreDepthValues:!1;he===!1&&(P.depthBuffer&&(ye|=256),P.stencilBuffer&&(ye|=1024)),t.bindFramebuffer(36008,Fe.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,Fe.__webglFramebuffer),he===!0&&(i.invalidateFramebuffer(36008,[Pe]),i.invalidateFramebuffer(36009,[Pe])),i.blitFramebuffer(0,0,L,te,0,0,L,te,ye,9728),d&&i.invalidateFramebuffer(36008,Se),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,Fe.__webglMultisampledFramebuffer)}}function ve(P){return Math.min(h,P.samples)}function me(P){let L=r.get(P);return a&&P.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function De(P){let L=o.render.frame;m.get(P)!==L&&(m.set(P,L),P.update())}function ke(P,L){let te=P.encoding,ye=P.format,Se=P.type;return P.isCompressedTexture===!0||P.isVideoTexture===!0||P.format===ng||te!==rn&&(te===je?a===!1?e.has("EXT_sRGB")===!0&&ye===On?(P.format=ng,P.minFilter=ct,P.generateMipmaps=!1):L=es.sRGBToLinear(L):(ye!==On||Se!==Wt)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",te)),L}this.allocateTextureUnit=F,this.resetTextureUnits=q,this.setTexture2D=k,this.setTexture2DArray=V,this.setTexture3D=U,this.setTextureCube=J,this.rebindTextures=Q,this.setupRenderTarget=ce,this.updateRenderTargetMipmap=ie,this.updateMultisampleRenderTarget=pe,this.setupDepthRenderbuffer=H,this.setupFrameBufferTexture=W,this.useMultisampledRTT=me}function nP(i,e,t){let r=t.isWebGL2;function n(s,o=null){let a;if(s===Wt)return 5121;if(s===YT)return 32819;if(s===JT)return 32820;if(s===jT)return 5120;if(s===qT)return 5122;if(s===Vc)return 5123;if(s===XT)return 5124;if(s===Ca)return 5125;if(s===Ts)return 5126;if(s===La)return r?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===QT)return 6406;if(s===On)return 6408;if(s===ZT)return 6409;if(s===$T)return 6410;if(s===Ao)return 6402;if(s===Ps)return 34041;if(s===eE)return 6403;if(s===KT)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(s===ng)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===tE)return 36244;if(s===rE)return 33319;if(s===nE)return 33320;if(s===iE)return 36249;if(s===mm||s===gm||s===ym||s===vm)if(o===je)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===mm)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===gm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===ym)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===vm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===mm)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===gm)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===ym)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===vm)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Mx||s===Ax||s===Tx||s===Ex)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===Mx)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Ax)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Tx)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Ex)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===sE)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===_x||s===Cx)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===_x)return o===je?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Cx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Lx||s===Dx||s===Px||s===Ix||s===Rx||s===Bx||s===Nx||s===Ox||s===Fx||s===Ux||s===zx||s===Gx||s===kx||s===Vx)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Lx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Dx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Px)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Ix)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Rx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Bx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Nx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Ox)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Fx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Ux)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===zx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Gx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===kx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===Vx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Hx)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===Hx)return o===je?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===_s)return r?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:n}}var yf=class extends nr{constructor(e=[]){super(),this.cameras=e}};yf.prototype.isArrayCamera=!0;var Zi=class extends ot{constructor(){super(),this.type="Group"}};Zi.prototype.isGroup=!0;var iP={type:"move"},zc=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Zi,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 Zi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new A,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new A),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Zi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new A,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new A),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,r){let n=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(n=t.getPose(e.targetRaySpace,r),n!==null&&(a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),n.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(n.linearVelocity)):a.hasLinearVelocity=!1,n.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(n.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(iP))),c&&e.hand){o=!0;for(let p of e.hand.values()){let g=t.getJointPose(p,r);if(c.joints[p.jointName]===void 0){let v=new Zi;v.matrixAutoUpdate=!1,v.visible=!1,c.joints[p.jointName]=v,c.add(v)}let y=c.joints[p.jointName];g!==null&&(y.matrix.fromArray(g.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.jointRadius=g.radius),y.visible=g!==null}let u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),d=.02,m=.005;c.inputState.pinching&&f>d+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),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=n!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}},oi=class extends _t{constructor(e,t,r,n,s,o,a,l,c,u){if(u=u!==void 0?u:Ao,u!==Ao&&u!==Ps)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&u===Ao&&(r=Vc),r===void 0&&u===Ps&&(r=_s),super(null,n,s,o,a,l,u,r,c),this.image={width:e,height:t},this.magFilter=a!==void 0?a:lr,this.minFilter=l!==void 0?l:lr,this.flipY=!1,this.generateMipmaps=!1}};oi.prototype.isDepthTexture=!0;var fg=class extends jt{constructor(e,t){super();let r=this,n=null,s=1,o=null,a="local-floor",l=null,c=null,u=null,h=null,f=null,d=t.getContextAttributes(),m=null,p=null,g=[],y=new Map,v=new nr;v.layers.enable(1),v.viewport=new Qe;let b=new nr;b.layers.enable(2),b.viewport=new Qe;let w=[v,b],x=new yf;x.layers.enable(1),x.layers.enable(2);let E=null,T=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(F){let ee=g[F];return ee===void 0&&(ee=new zc,g[F]=ee),ee.getTargetRaySpace()},this.getControllerGrip=function(F){let ee=g[F];return ee===void 0&&(ee=new zc,g[F]=ee),ee.getGripSpace()},this.getHand=function(F){let ee=g[F];return ee===void 0&&(ee=new zc,g[F]=ee),ee.getHandSpace()};function S(F){let ee=y.get(F.inputSource);ee&&ee.dispatchEvent({type:F.type,data:F.inputSource})}function I(){y.forEach(function(F,ee){F.disconnect(ee)}),y.clear(),E=null,T=null,e.setRenderTarget(m),h=null,u=null,c=null,n=null,p=null,q.stop(),r.isPresenting=!1,r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(F){s=F,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(F){a=F,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o},this.getBaseLayer=function(){return u!==null?u:h},this.getBinding=function(){return c},this.getFrame=function(){return f},this.getSession=function(){return n},this.setSession=async function(F){if(n=F,n!==null){if(m=e.getRenderTarget(),n.addEventListener("select",S),n.addEventListener("selectstart",S),n.addEventListener("selectend",S),n.addEventListener("squeeze",S),n.addEventListener("squeezestart",S),n.addEventListener("squeezeend",S),n.addEventListener("end",I),n.addEventListener("inputsourceschange",C),d.xrCompatible!==!0&&await t.makeXRCompatible(),n.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let ee={antialias:n.renderState.layers===void 0?d.antialias:!0,alpha:d.alpha,depth:d.depth,stencil:d.stencil,framebufferScaleFactor:s};h=new XRWebGLLayer(n,t,ee),n.updateRenderState({baseLayer:h}),p=new mt(h.framebufferWidth,h.framebufferHeight,{format:On,type:Wt,encoding:e.outputEncoding})}else{let ee=null,k=null,V=null;d.depth&&(V=d.stencil?35056:33190,ee=d.stencil?Ps:Ao,k=d.stencil?_s:Vc);let U={colorFormat:e.outputEncoding===je?35907:32856,depthFormat:V,scaleFactor:s};c=new XRWebGLBinding(n,t),u=c.createProjectionLayer(U),n.updateRenderState({layers:[u]}),p=new mt(u.textureWidth,u.textureHeight,{format:On,type:Wt,depthTexture:new oi(u.textureWidth,u.textureHeight,k,void 0,void 0,void 0,void 0,void 0,void 0,ee),stencilBuffer:d.stencil,encoding:e.outputEncoding,samples:d.antialias?4:0});let J=e.properties.get(p);J.__ignoreDepthValues=u.ignoreDepthValues}p.isXRRenderTarget=!0,this.setFoveation(1),o=await n.requestReferenceSpace(a),q.setContext(n),q.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}};function C(F){let ee=n.inputSources;for(let k=0;k<g.length;k++)y.set(ee[k],g[k]);for(let k=0;k<F.removed.length;k++){let V=F.removed[k],U=y.get(V);U&&(U.dispatchEvent({type:"disconnected",data:V}),y.delete(V))}for(let k=0;k<F.added.length;k++){let V=F.added[k],U=y.get(V);U&&U.dispatchEvent({type:"connected",data:V})}}let M=new A,_=new A;function R(F,ee,k){M.setFromMatrixPosition(ee.matrixWorld),_.setFromMatrixPosition(k.matrixWorld);let V=M.distanceTo(_),U=ee.projectionMatrix.elements,J=k.projectionMatrix.elements,K=U[14]/(U[10]-1),$=U[14]/(U[10]+1),j=(U[9]+1)/U[5],ge=(U[9]-1)/U[5],ae=(U[8]-1)/U[0],le=(J[8]+1)/J[0],W=K*ae,ue=K*le,Y=V/(-ae+le),H=Y*-ae;ee.matrixWorld.decompose(F.position,F.quaternion,F.scale),F.translateX(H),F.translateZ(Y),F.matrixWorld.compose(F.position,F.quaternion,F.scale),F.matrixWorldInverse.copy(F.matrixWorld).invert();let Q=K+Y,ce=$+Y,ie=W-H,pe=ue+(V-H),ve=j*$/ce*Q,me=ge*$/ce*Q;F.projectionMatrix.makePerspective(ie,pe,ve,me,Q,ce)}function B(F,ee){ee===null?F.matrixWorld.copy(F.matrix):F.matrixWorld.multiplyMatrices(ee.matrixWorld,F.matrix),F.matrixWorldInverse.copy(F.matrixWorld).invert()}this.updateCamera=function(F){if(n===null)return;x.near=b.near=v.near=F.near,x.far=b.far=v.far=F.far,(E!==x.near||T!==x.far)&&(n.updateRenderState({depthNear:x.near,depthFar:x.far}),E=x.near,T=x.far);let ee=F.parent,k=x.cameras;B(x,ee);for(let U=0;U<k.length;U++)B(k[U],ee);x.matrixWorld.decompose(x.position,x.quaternion,x.scale),F.position.copy(x.position),F.quaternion.copy(x.quaternion),F.scale.copy(x.scale),F.matrix.copy(x.matrix),F.matrixWorld.copy(x.matrixWorld);let V=F.children;for(let U=0,J=V.length;U<J;U++)V[U].updateMatrixWorld(!0);k.length===2?R(x,v,b):x.projectionMatrix.copy(v.projectionMatrix)},this.getCamera=function(){return x},this.getFoveation=function(){if(u!==null)return u.fixedFoveation;if(h!==null)return h.fixedFoveation},this.setFoveation=function(F){u!==null&&(u.fixedFoveation=F),h!==null&&h.fixedFoveation!==void 0&&(h.fixedFoveation=F)};let O=null;function z(F,ee){if(l=ee.getViewerPose(o),f=ee,l!==null){let V=l.views;h!==null&&(e.setRenderTargetFramebuffer(p,h.framebuffer),e.setRenderTarget(p));let U=!1;V.length!==x.cameras.length&&(x.cameras.length=0,U=!0);for(let J=0;J<V.length;J++){let K=V[J],$=null;if(h!==null)$=h.getViewport(K);else{let ge=c.getViewSubImage(u,K);$=ge.viewport,J===0&&(e.setRenderTargetTextures(p,ge.colorTexture,u.ignoreDepthValues?void 0:ge.depthStencilTexture),e.setRenderTarget(p))}let j=w[J];j.matrix.fromArray(K.transform.matrix),j.projectionMatrix.fromArray(K.projectionMatrix),j.viewport.set($.x,$.y,$.width,$.height),J===0&&x.matrix.copy(j.matrix),U===!0&&x.cameras.push(j)}}let k=n.inputSources;for(let V=0;V<g.length;V++){let U=g[V],J=k[V];U.update(J,ee,o)}O&&O(F,ee),f=null}let q=new cb;q.setAnimationLoop(z),this.setAnimationLoop=function(F){O=F},this.dispose=function(){}}};function sP(i,e){function t(p,g){p.fogColor.value.copy(g.color),g.isFog?(p.fogNear.value=g.near,p.fogFar.value=g.far):g.isFogExp2&&(p.fogDensity.value=g.density)}function r(p,g,y,v,b){g.isMeshBasicMaterial||g.isMeshLambertMaterial?n(p,g):g.isMeshToonMaterial?(n(p,g),u(p,g)):g.isMeshPhongMaterial?(n(p,g),c(p,g)):g.isMeshStandardMaterial?(n(p,g),h(p,g),g.isMeshPhysicalMaterial&&f(p,g,b)):g.isMeshMatcapMaterial?(n(p,g),d(p,g)):g.isMeshDepthMaterial?n(p,g):g.isMeshDistanceMaterial?(n(p,g),m(p,g)):g.isMeshNormalMaterial?n(p,g):g.isLineBasicMaterial?(s(p,g),g.isLineDashedMaterial&&o(p,g)):g.isPointsMaterial?a(p,g,y,v):g.isSpriteMaterial?l(p,g):g.isShadowMaterial?(p.color.value.copy(g.color),p.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function n(p,g){p.opacity.value=g.opacity,g.color&&p.diffuse.value.copy(g.color),g.emissive&&p.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(p.map.value=g.map),g.alphaMap&&(p.alphaMap.value=g.alphaMap),g.bumpMap&&(p.bumpMap.value=g.bumpMap,p.bumpScale.value=g.bumpScale,g.side===Cr&&(p.bumpScale.value*=-1)),g.displacementMap&&(p.displacementMap.value=g.displacementMap,p.displacementScale.value=g.displacementScale,p.displacementBias.value=g.displacementBias),g.emissiveMap&&(p.emissiveMap.value=g.emissiveMap),g.normalMap&&(p.normalMap.value=g.normalMap,p.normalScale.value.copy(g.normalScale),g.side===Cr&&p.normalScale.value.negate()),g.specularMap&&(p.specularMap.value=g.specularMap),g.alphaTest>0&&(p.alphaTest.value=g.alphaTest);let y=e.get(g).envMap;if(y&&(p.envMap.value=y,p.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,p.reflectivity.value=g.reflectivity,p.ior.value=g.ior,p.refractionRatio.value=g.refractionRatio),g.lightMap){p.lightMap.value=g.lightMap;let w=i.physicallyCorrectLights!==!0?Math.PI:1;p.lightMapIntensity.value=g.lightMapIntensity*w}g.aoMap&&(p.aoMap.value=g.aoMap,p.aoMapIntensity.value=g.aoMapIntensity);let v;g.map?v=g.map:g.specularMap?v=g.specularMap:g.displacementMap?v=g.displacementMap:g.normalMap?v=g.normalMap:g.bumpMap?v=g.bumpMap:g.roughnessMap?v=g.roughnessMap:g.metalnessMap?v=g.metalnessMap:g.alphaMap?v=g.alphaMap:g.emissiveMap?v=g.emissiveMap:g.clearcoatMap?v=g.clearcoatMap:g.clearcoatNormalMap?v=g.clearcoatNormalMap:g.clearcoatRoughnessMap?v=g.clearcoatRoughnessMap:g.specularIntensityMap?v=g.specularIntensityMap:g.specularColorMap?v=g.specularColorMap:g.transmissionMap?v=g.transmissionMap:g.thicknessMap?v=g.thicknessMap:g.sheenColorMap?v=g.sheenColorMap:g.sheenRoughnessMap&&(v=g.sheenRoughnessMap),v!==void 0&&(v.isWebGLRenderTarget&&(v=v.texture),v.matrixAutoUpdate===!0&&v.updateMatrix(),p.uvTransform.value.copy(v.matrix));let b;g.aoMap?b=g.aoMap:g.lightMap&&(b=g.lightMap),b!==void 0&&(b.isWebGLRenderTarget&&(b=b.texture),b.matrixAutoUpdate===!0&&b.updateMatrix(),p.uv2Transform.value.copy(b.matrix))}function s(p,g){p.diffuse.value.copy(g.color),p.opacity.value=g.opacity}function o(p,g){p.dashSize.value=g.dashSize,p.totalSize.value=g.dashSize+g.gapSize,p.scale.value=g.scale}function a(p,g,y,v){p.diffuse.value.copy(g.color),p.opacity.value=g.opacity,p.size.value=g.size*y,p.scale.value=v*.5,g.map&&(p.map.value=g.map),g.alphaMap&&(p.alphaMap.value=g.alphaMap),g.alphaTest>0&&(p.alphaTest.value=g.alphaTest);let b;g.map?b=g.map:g.alphaMap&&(b=g.alphaMap),b!==void 0&&(b.matrixAutoUpdate===!0&&b.updateMatrix(),p.uvTransform.value.copy(b.matrix))}function l(p,g){p.diffuse.value.copy(g.color),p.opacity.value=g.opacity,p.rotation.value=g.rotation,g.map&&(p.map.value=g.map),g.alphaMap&&(p.alphaMap.value=g.alphaMap),g.alphaTest>0&&(p.alphaTest.value=g.alphaTest);let y;g.map?y=g.map:g.alphaMap&&(y=g.alphaMap),y!==void 0&&(y.matrixAutoUpdate===!0&&y.updateMatrix(),p.uvTransform.value.copy(y.matrix))}function c(p,g){p.specular.value.copy(g.specular),p.shininess.value=Math.max(g.shininess,1e-4)}function u(p,g){g.gradientMap&&(p.gradientMap.value=g.gradientMap)}function h(p,g){p.roughness.value=g.roughness,p.metalness.value=g.metalness,g.roughnessMap&&(p.roughnessMap.value=g.roughnessMap),g.metalnessMap&&(p.metalnessMap.value=g.metalnessMap),e.get(g).envMap&&(p.envMapIntensity.value=g.envMapIntensity)}function f(p,g,y){p.ior.value=g.ior,g.sheen>0&&(p.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),p.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(p.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(p.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(p.clearcoat.value=g.clearcoat,p.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(p.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(p.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),p.clearcoatNormalMap.value=g.clearcoatNormalMap,g.side===Cr&&p.clearcoatNormalScale.value.negate())),g.transmission>0&&(p.transmission.value=g.transmission,p.transmissionSamplerMap.value=y.texture,p.transmissionSamplerSize.value.set(y.width,y.height),g.transmissionMap&&(p.transmissionMap.value=g.transmissionMap),p.thickness.value=g.thickness,g.thicknessMap&&(p.thicknessMap.value=g.thicknessMap),p.attenuationDistance.value=g.attenuationDistance,p.attenuationColor.value.copy(g.attenuationColor)),p.specularIntensity.value=g.specularIntensity,p.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(p.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(p.specularColorMap.value=g.specularColorMap)}function d(p,g){g.matcap&&(p.matcap.value=g.matcap)}function m(p,g){p.referencePosition.value.copy(g.referencePosition),p.nearDistance.value=g.nearDistance,p.farDistance.value=g.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:r}}function oP(){let i=jc("canvas");return i.style.display="block",i}function Ct(i={}){let e=i.canvas!==void 0?i.canvas:oP(),t=i.context!==void 0?i.context:null,r=i.depth!==void 0?i.depth:!0,n=i.stencil!==void 0?i.stencil:!0,s=i.antialias!==void 0?i.antialias:!1,o=i.premultipliedAlpha!==void 0?i.premultipliedAlpha:!0,a=i.preserveDrawingBuffer!==void 0?i.preserveDrawingBuffer:!1,l=i.powerPreference!==void 0?i.powerPreference:"default",c=i.failIfMajorPerformanceCaveat!==void 0?i.failIfMajorPerformanceCaveat:!1,u;i.context!==void 0?u=t.getContextAttributes().alpha:u=i.alpha!==void 0?i.alpha:!1;let h=null,f=null,d=[],m=[];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.outputEncoding=rn,this.physicallyCorrectLights=!1,this.toneMapping=$i,this.toneMappingExposure=1;let p=this,g=!1,y=0,v=0,b=null,w=-1,x=null,E=new Qe,T=new Qe,S=null,I=e.width,C=e.height,M=1,_=null,R=null,B=new Qe(0,0,I,C),O=new Qe(0,0,I,C),z=!1,q=new Ra,F=!1,ee=!1,k=null,V=new Ee,U=new N,J=new A,K={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function $(){return b===null?M:1}let j=t;function ge(D,X){for(let ne=0;ne<D.length;ne++){let re=D[ne],fe=e.getContext(re,X);if(fe!==null)return fe}return null}try{let D={alpha:!0,depth:r,stencil:n,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:a,powerPreference:l,failIfMajorPerformanceCaveat:c};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Oo}`),e.addEventListener("webglcontextlost",G,!1),e.addEventListener("webglcontextrestored",Me,!1),j===null){let X=["webgl2","webgl","experimental-webgl"];if(p.isWebGL1Renderer===!0&&X.shift(),j=ge(X,D),j===null)throw ge(X)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}j.getShaderPrecisionFormat===void 0&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(D){throw console.error("THREE.WebGLRenderer: "+D.message),D}let ae,le,W,ue,Y,H,Q,ce,ie,pe,ve,me,De,ke,P,L,te,ye,Se,Pe,Fe,he,rt;function st(){ae=new _L(j),le=new wL(j,ae,i),ae.init(le),he=new nP(j,ae,le),W=new tP(j,ae,le),ue=new DL(j),Y=new WD,H=new rP(j,ae,W,Y,le,he,ue),Q=new ML(p),ce=new EL(p),ie=new WE(j,le),rt=new xL(j,ae,ie,le),pe=new CL(j,ie,ue,rt),ve=new BL(j,pe,ie,ue),Se=new RL(j,le,H),L=new SL(Y),me=new HD(p,Q,ce,ae,le,rt,L),De=new sP(p,Y),ke=new qD,P=new ZD(ae,le),ye=new vL(p,Q,W,ve,u,o),te=new yb(p,ve,le),Pe=new bL(j,ae,ue,le),Fe=new LL(j,ae,ue,le),ue.programs=me.programs,p.capabilities=le,p.extensions=ae,p.properties=Y,p.renderLists=ke,p.shadowMap=te,p.state=W,p.info=ue}st();let Ae=new fg(p,j);this.xr=Ae,this.getContext=function(){return j},this.getContextAttributes=function(){return j.getContextAttributes()},this.forceContextLoss=function(){let D=ae.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){let D=ae.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return M},this.setPixelRatio=function(D){D!==void 0&&(M=D,this.setSize(I,C,!1))},this.getSize=function(D){return D.set(I,C)},this.setSize=function(D,X,ne){if(Ae.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}I=D,C=X,e.width=Math.floor(D*M),e.height=Math.floor(X*M),ne!==!1&&(e.style.width=D+"px",e.style.height=X+"px"),this.setViewport(0,0,D,X)},this.getDrawingBufferSize=function(D){return D.set(I*M,C*M).floor()},this.setDrawingBufferSize=function(D,X,ne){I=D,C=X,M=ne,e.width=Math.floor(D*ne),e.height=Math.floor(X*ne),this.setViewport(0,0,D,X)},this.getCurrentViewport=function(D){return D.copy(E)},this.getViewport=function(D){return D.copy(B)},this.setViewport=function(D,X,ne,re){D.isVector4?B.set(D.x,D.y,D.z,D.w):B.set(D,X,ne,re),W.viewport(E.copy(B).multiplyScalar(M).floor())},this.getScissor=function(D){return D.copy(O)},this.setScissor=function(D,X,ne,re){D.isVector4?O.set(D.x,D.y,D.z,D.w):O.set(D,X,ne,re),W.scissor(T.copy(O).multiplyScalar(M).floor())},this.getScissorTest=function(){return z},this.setScissorTest=function(D){W.setScissorTest(z=D)},this.setOpaqueSort=function(D){_=D},this.setTransparentSort=function(D){R=D},this.getClearColor=function(D){return D.copy(ye.getClearColor())},this.setClearColor=function(){ye.setClearColor.apply(ye,arguments)},this.getClearAlpha=function(){return ye.getClearAlpha()},this.setClearAlpha=function(){ye.setClearAlpha.apply(ye,arguments)},this.clear=function(D=!0,X=!0,ne=!0){let re=0;D&&(re|=16384),X&&(re|=256),ne&&(re|=1024),j.clear(re)},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",G,!1),e.removeEventListener("webglcontextrestored",Me,!1),ke.dispose(),P.dispose(),Y.dispose(),Q.dispose(),ce.dispose(),ve.dispose(),rt.dispose(),me.dispose(),Ae.dispose(),Ae.removeEventListener("sessionstart",nt),Ae.removeEventListener("sessionend",pt),k&&(k.dispose(),k=null),ht.stop()};function G(D){D.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function Me(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;let D=ue.autoReset,X=te.enabled,ne=te.autoUpdate,re=te.needsUpdate,fe=te.type;st(),ue.autoReset=D,te.enabled=X,te.autoUpdate=ne,te.needsUpdate=re,te.type=fe}function Ce(D){let X=D.target;X.removeEventListener("dispose",Ce),Ke(X)}function Ke(D){Oe(D),Y.remove(D)}function Oe(D){let X=Y.get(D).programs;X!==void 0&&(X.forEach(function(ne){me.releaseProgram(ne)}),D.isShaderMaterial&&me.releaseShaderCache(D))}this.renderBufferDirect=function(D,X,ne,re,fe,Ve){X===null&&(X=K);let $e=fe.isMesh&&fe.matrixWorld.determinant()<0,it=vt(D,X,ne,re,fe);W.setMaterial(re,$e);let lt=ne.index,Bt=ne.attributes.position;if(lt===null){if(Bt===void 0||Bt.count===0)return}else if(lt.count===0)return;let wt=1;re.wireframe===!0&&(lt=pe.getWireframeAttribute(ne),wt=2),rt.setup(fe,re,it,ne,lt);let Tt,tr=Pe;lt!==null&&(Tt=ie.get(lt),tr=Fe,tr.setIndex(Tt));let yo=lt!==null?lt.count:Bt.count,ra=ne.drawRange.start*wt,na=ne.drawRange.count*wt,xi=Ve!==null?Ve.start*wt:0,Dt=Ve!==null?Ve.count*wt:1/0,ia=Math.max(ra,xi),mr=Math.min(yo,ra+na,xi+Dt)-1,bi=Math.max(0,mr-ia+1);if(bi!==0){if(fe.isMesh)re.wireframe===!0?(W.setLineWidth(re.wireframeLinewidth*$()),tr.setMode(1)):tr.setMode(4);else if(fe.isLine){let gs=re.linewidth;gs===void 0&&(gs=1),W.setLineWidth(gs*$()),fe.isLineSegments?tr.setMode(1):fe.isLineLoop?tr.setMode(2):tr.setMode(3)}else fe.isPoints?tr.setMode(0):fe.isSprite&&tr.setMode(4);if(fe.isInstancedMesh)tr.renderInstances(ia,bi,fe.count);else if(ne.isInstancedBufferGeometry){let gs=Math.min(ne.instanceCount,ne._maxInstanceCount);tr.renderInstances(ia,bi,gs)}else tr.render(ia,bi)}},this.compile=function(D,X){f=P.get(D),f.init(),m.push(f),D.traverseVisible(function(ne){ne.isLight&&ne.layers.test(X.layers)&&(f.pushLight(ne),ne.castShadow&&f.pushShadow(ne))}),f.setupLights(p.physicallyCorrectLights),D.traverse(function(ne){let re=ne.material;if(re)if(Array.isArray(re))for(let fe=0;fe<re.length;fe++){let Ve=re[fe];at(Ve,D,ne)}else at(re,D,ne)}),m.pop(),f=null};let Ze=null;function _e(D){Ze&&Ze(D)}function nt(){ht.stop()}function pt(){ht.start()}let ht=new cb;ht.setAnimationLoop(_e),typeof self<"u"&&ht.setContext(self),this.setAnimationLoop=function(D){Ze=D,Ae.setAnimationLoop(D),D===null?ht.stop():ht.start()},Ae.addEventListener("sessionstart",nt),Ae.addEventListener("sessionend",pt),this.render=function(D,X){if(X!==void 0&&X.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(g===!0)return;D.autoUpdate===!0&&D.updateMatrixWorld(),X.parent===null&&X.updateMatrixWorld(),Ae.enabled===!0&&Ae.isPresenting===!0&&(Ae.cameraAutoUpdate===!0&&Ae.updateCamera(X),X=Ae.getCamera()),D.isScene===!0&&D.onBeforeRender(p,D,X,b),f=P.get(D,m.length),f.init(),m.push(f),V.multiplyMatrices(X.projectionMatrix,X.matrixWorldInverse),q.setFromProjectionMatrix(V),ee=this.localClippingEnabled,F=L.init(this.clippingPlanes,ee,X),h=ke.get(D,d.length),h.init(),d.push(h),Ot(D,X,0,p.sortObjects),h.finish(),p.sortObjects===!0&&h.sort(_,R),F===!0&&L.beginShadows();let ne=f.state.shadowsArray;if(te.render(ne,D,X),F===!0&&L.endShadows(),this.info.autoReset===!0&&this.info.reset(),ye.render(h,D),f.setupLights(p.physicallyCorrectLights),X.isArrayCamera){let re=X.cameras;for(let fe=0,Ve=re.length;fe<Ve;fe++){let $e=re[fe];Nr(h,D,$e,$e.viewport)}}else Nr(h,D,X);b!==null&&(H.updateMultisampleRenderTarget(b),H.updateRenderTargetMipmap(b)),D.isScene===!0&&D.onAfterRender(p,D,X),rt.resetDefaultState(),w=-1,x=null,m.pop(),m.length>0?f=m[m.length-1]:f=null,d.pop(),d.length>0?h=d[d.length-1]:h=null};function Ot(D,X,ne,re){if(D.visible===!1)return;if(D.layers.test(X.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(X);else if(D.isLight)f.pushLight(D),D.castShadow&&f.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||q.intersectsSprite(D)){re&&J.setFromMatrixPosition(D.matrixWorld).applyMatrix4(V);let $e=ve.update(D),it=D.material;it.visible&&h.push(D,$e,it,ne,J.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(D.isSkinnedMesh&&D.skeleton.frame!==ue.render.frame&&(D.skeleton.update(),D.skeleton.frame=ue.render.frame),!D.frustumCulled||q.intersectsObject(D))){re&&J.setFromMatrixPosition(D.matrixWorld).applyMatrix4(V);let $e=ve.update(D),it=D.material;if(Array.isArray(it)){let lt=$e.groups;for(let Bt=0,wt=lt.length;Bt<wt;Bt++){let Tt=lt[Bt],tr=it[Tt.materialIndex];tr&&tr.visible&&h.push(D,$e,tr,ne,J.z,Tt)}}else it.visible&&h.push(D,$e,it,ne,J.z,null)}}let Ve=D.children;for(let $e=0,it=Ve.length;$e<it;$e++)Ot(Ve[$e],X,ne,re)}function Nr(D,X,ne,re){let fe=D.opaque,Ve=D.transmissive,$e=D.transparent;f.setupLightsView(ne),Ve.length>0&&ta(fe,X,ne),re&&W.viewport(E.copy(re)),fe.length>0&&We(fe,X,ne),Ve.length>0&&We(Ve,X,ne),$e.length>0&&We($e,X,ne),W.buffers.depth.setTest(!0),W.buffers.depth.setMask(!0),W.buffers.color.setMask(!0),W.setPolygonOffset(!1)}function ta(D,X,ne){let re=le.isWebGL2;k===null&&(k=new mt(1,1,{generateMipmaps:!0,type:he.convert(La)!==null?La:Wt,minFilter:ks,samples:re&&s===!0?4:0})),p.getDrawingBufferSize(U),re?k.setSize(U.x,U.y):k.setSize(ff(U.x),ff(U.y));let fe=p.getRenderTarget();p.setRenderTarget(k),p.clear();let Ve=p.toneMapping;p.toneMapping=$i,We(D,X,ne),p.toneMapping=Ve,H.updateMultisampleRenderTarget(k),H.updateRenderTargetMipmap(k),p.setRenderTarget(fe)}function We(D,X,ne){let re=X.isScene===!0?X.overrideMaterial:null;for(let fe=0,Ve=D.length;fe<Ve;fe++){let $e=D[fe],it=$e.object,lt=$e.geometry,Bt=re===null?$e.material:re,wt=$e.group;it.layers.test(ne.layers)&&dt(it,X,ne,lt,Bt,wt)}}function dt(D,X,ne,re,fe,Ve){D.onBeforeRender(p,X,ne,re,fe,Ve),D.modelViewMatrix.multiplyMatrices(ne.matrixWorldInverse,D.matrixWorld),D.normalMatrix.getNormalMatrix(D.modelViewMatrix),fe.onBeforeRender(p,X,ne,re,D,Ve),fe.transparent===!0&&fe.side===ir?(fe.side=Cr,fe.needsUpdate=!0,p.renderBufferDirect(ne,X,re,fe,D,Ve),fe.side=ii,fe.needsUpdate=!0,p.renderBufferDirect(ne,X,re,fe,D,Ve),fe.side=ir):p.renderBufferDirect(ne,X,re,fe,D,Ve),D.onAfterRender(p,X,ne,re,fe,Ve)}function at(D,X,ne){X.isScene!==!0&&(X=K);let re=Y.get(D),fe=f.state.lights,Ve=f.state.shadowsArray,$e=fe.state.version,it=me.getParameters(D,fe.state,Ve,X,ne),lt=me.getProgramCacheKey(it),Bt=re.programs;re.environment=D.isMeshStandardMaterial?X.environment:null,re.fog=X.fog,re.envMap=(D.isMeshStandardMaterial?ce:Q).get(D.envMap||re.environment),Bt===void 0&&(D.addEventListener("dispose",Ce),Bt=new Map,re.programs=Bt);let wt=Bt.get(lt);if(wt!==void 0){if(re.currentProgram===wt&&re.lightsStateVersion===$e)return ut(D,it),wt}else it.uniforms=me.getUniforms(D),D.onBuild(ne,it,p),D.onBeforeCompile(it,p),wt=me.acquireProgram(it,lt),Bt.set(lt,wt),re.uniforms=it.uniforms;let Tt=re.uniforms;(!D.isShaderMaterial&&!D.isRawShaderMaterial||D.clipping===!0)&&(Tt.clippingPlanes=L.uniform),ut(D,it),re.needsLights=Ft(D),re.lightsStateVersion=$e,re.needsLights&&(Tt.ambientLightColor.value=fe.state.ambient,Tt.lightProbe.value=fe.state.probe,Tt.directionalLights.value=fe.state.directional,Tt.directionalLightShadows.value=fe.state.directionalShadow,Tt.spotLights.value=fe.state.spot,Tt.spotLightShadows.value=fe.state.spotShadow,Tt.rectAreaLights.value=fe.state.rectArea,Tt.ltc_1.value=fe.state.rectAreaLTC1,Tt.ltc_2.value=fe.state.rectAreaLTC2,Tt.pointLights.value=fe.state.point,Tt.pointLightShadows.value=fe.state.pointShadow,Tt.hemisphereLights.value=fe.state.hemi,Tt.directionalShadowMap.value=fe.state.directionalShadowMap,Tt.directionalShadowMatrix.value=fe.state.directionalShadowMatrix,Tt.spotShadowMap.value=fe.state.spotShadowMap,Tt.spotShadowMatrix.value=fe.state.spotShadowMatrix,Tt.pointShadowMap.value=fe.state.pointShadowMap,Tt.pointShadowMatrix.value=fe.state.pointShadowMatrix);let tr=wt.getUniforms(),yo=Cs.seqWithValue(tr.seq,Tt);return re.currentProgram=wt,re.uniformsList=yo,wt}function ut(D,X){let ne=Y.get(D);ne.outputEncoding=X.outputEncoding,ne.instancing=X.instancing,ne.skinning=X.skinning,ne.morphTargets=X.morphTargets,ne.morphNormals=X.morphNormals,ne.morphColors=X.morphColors,ne.morphTargetsCount=X.morphTargetsCount,ne.numClippingPlanes=X.numClippingPlanes,ne.numIntersection=X.numClipIntersection,ne.vertexAlphas=X.vertexAlphas,ne.vertexTangents=X.vertexTangents,ne.toneMapping=X.toneMapping}function vt(D,X,ne,re,fe){X.isScene!==!0&&(X=K),H.resetTextureUnits();let Ve=X.fog,$e=re.isMeshStandardMaterial?X.environment:null,it=b===null?p.outputEncoding:b.isXRRenderTarget===!0?b.texture.encoding:rn,lt=(re.isMeshStandardMaterial?ce:Q).get(re.envMap||$e),Bt=re.vertexColors===!0&&!!ne.attributes.color&&ne.attributes.color.itemSize===4,wt=!!re.normalMap&&!!ne.attributes.tangent,Tt=!!ne.morphAttributes.position,tr=!!ne.morphAttributes.normal,yo=!!ne.morphAttributes.color,ra=re.toneMapped?p.toneMapping:$i,na=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,xi=na!==void 0?na.length:0,Dt=Y.get(re),ia=f.state.lights;if(F===!0&&(ee===!0||D!==x)){let Zn=D===x&&re.id===w;L.setState(re,D,Zn)}let mr=!1;re.version===Dt.__version?(Dt.needsLights&&Dt.lightsStateVersion!==ia.state.version||Dt.outputEncoding!==it||fe.isInstancedMesh&&Dt.instancing===!1||!fe.isInstancedMesh&&Dt.instancing===!0||fe.isSkinnedMesh&&Dt.skinning===!1||!fe.isSkinnedMesh&&Dt.skinning===!0||Dt.envMap!==lt||re.fog&&Dt.fog!==Ve||Dt.numClippingPlanes!==void 0&&(Dt.numClippingPlanes!==L.numPlanes||Dt.numIntersection!==L.numIntersection)||Dt.vertexAlphas!==Bt||Dt.vertexTangents!==wt||Dt.morphTargets!==Tt||Dt.morphNormals!==tr||Dt.morphColors!==yo||Dt.toneMapping!==ra||le.isWebGL2===!0&&Dt.morphTargetsCount!==xi)&&(mr=!0):(mr=!0,Dt.__version=re.version);let bi=Dt.currentProgram;mr===!0&&(bi=at(re,X,fe));let gs=!1,Tc=!1,fm=!1,qr=bi.getUniforms(),Ec=Dt.uniforms;if(W.useProgram(bi.program)&&(gs=!0,Tc=!0,fm=!0),re.id!==w&&(w=re.id,Tc=!0),gs||x!==D){if(qr.setValue(j,"projectionMatrix",D.projectionMatrix),le.logarithmicDepthBuffer&&qr.setValue(j,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),x!==D&&(x=D,Tc=!0,fm=!0),re.isShaderMaterial||re.isMeshPhongMaterial||re.isMeshToonMaterial||re.isMeshStandardMaterial||re.envMap){let Zn=qr.map.cameraPosition;Zn!==void 0&&Zn.setValue(j,J.setFromMatrixPosition(D.matrixWorld))}(re.isMeshPhongMaterial||re.isMeshToonMaterial||re.isMeshLambertMaterial||re.isMeshBasicMaterial||re.isMeshStandardMaterial||re.isShaderMaterial)&&qr.setValue(j,"isOrthographic",D.isOrthographicCamera===!0),(re.isMeshPhongMaterial||re.isMeshToonMaterial||re.isMeshLambertMaterial||re.isMeshBasicMaterial||re.isMeshStandardMaterial||re.isShaderMaterial||re.isShadowMaterial||fe.isSkinnedMesh)&&qr.setValue(j,"viewMatrix",D.matrixWorldInverse)}if(fe.isSkinnedMesh){qr.setOptional(j,fe,"bindMatrix"),qr.setOptional(j,fe,"bindMatrixInverse");let Zn=fe.skeleton;Zn&&(le.floatVertexTextures?(Zn.boneTexture===null&&Zn.computeBoneTexture(),qr.setValue(j,"boneTexture",Zn.boneTexture,H),qr.setValue(j,"boneTextureSize",Zn.boneTextureSize)):qr.setOptional(j,Zn,"boneMatrices"))}let dm=ne.morphAttributes;return(dm.position!==void 0||dm.normal!==void 0||dm.color!==void 0&&le.isWebGL2===!0)&&Se.update(fe,ne,re,bi),(Tc||Dt.receiveShadow!==fe.receiveShadow)&&(Dt.receiveShadow=fe.receiveShadow,qr.setValue(j,"receiveShadow",fe.receiveShadow)),Tc&&(qr.setValue(j,"toneMappingExposure",p.toneMappingExposure),Dt.needsLights&&Lt(Ec,fm),Ve&&re.fog&&De.refreshFogUniforms(Ec,Ve),De.refreshMaterialUniforms(Ec,re,M,C,k),Cs.upload(j,Dt.uniformsList,Ec,H)),re.isShaderMaterial&&re.uniformsNeedUpdate===!0&&(Cs.upload(j,Dt.uniformsList,Ec,H),re.uniformsNeedUpdate=!1),re.isSpriteMaterial&&qr.setValue(j,"center",fe.center),qr.setValue(j,"modelViewMatrix",fe.modelViewMatrix),qr.setValue(j,"normalMatrix",fe.normalMatrix),qr.setValue(j,"modelMatrix",fe.matrixWorld),bi}function Lt(D,X){D.ambientLightColor.needsUpdate=X,D.lightProbe.needsUpdate=X,D.directionalLights.needsUpdate=X,D.directionalLightShadows.needsUpdate=X,D.pointLights.needsUpdate=X,D.pointLightShadows.needsUpdate=X,D.spotLights.needsUpdate=X,D.spotLightShadows.needsUpdate=X,D.rectAreaLights.needsUpdate=X,D.hemisphereLights.needsUpdate=X}function Ft(D){return D.isMeshLambertMaterial||D.isMeshToonMaterial||D.isMeshPhongMaterial||D.isMeshStandardMaterial||D.isShadowMaterial||D.isShaderMaterial&&D.lights===!0}this.getActiveCubeFace=function(){return y},this.getActiveMipmapLevel=function(){return v},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(D,X,ne){Y.get(D.texture).__webglTexture=X,Y.get(D.depthTexture).__webglTexture=ne;let re=Y.get(D);re.__hasExternalTextures=!0,re.__hasExternalTextures&&(re.__autoAllocateDepthBuffer=ne===void 0,re.__autoAllocateDepthBuffer||ae.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),re.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(D,X){let ne=Y.get(D);ne.__webglFramebuffer=X,ne.__useDefaultFramebuffer=X===void 0},this.setRenderTarget=function(D,X=0,ne=0){b=D,y=X,v=ne;let re=!0;if(D){let lt=Y.get(D);lt.__useDefaultFramebuffer!==void 0?(W.bindFramebuffer(36160,null),re=!1):lt.__webglFramebuffer===void 0?H.setupRenderTarget(D):lt.__hasExternalTextures&&H.rebindTextures(D,Y.get(D.texture).__webglTexture,Y.get(D.depthTexture).__webglTexture)}let fe=null,Ve=!1,$e=!1;if(D){let lt=D.texture;(lt.isData3DTexture||lt.isDataArrayTexture)&&($e=!0);let Bt=Y.get(D).__webglFramebuffer;D.isWebGLCubeRenderTarget?(fe=Bt[X],Ve=!0):le.isWebGL2&&D.samples>0&&H.useMultisampledRTT(D)===!1?fe=Y.get(D).__webglMultisampledFramebuffer:fe=Bt,E.copy(D.viewport),T.copy(D.scissor),S=D.scissorTest}else E.copy(B).multiplyScalar(M).floor(),T.copy(O).multiplyScalar(M).floor(),S=z;if(W.bindFramebuffer(36160,fe)&&le.drawBuffers&&re&&W.drawBuffers(D,fe),W.viewport(E),W.scissor(T),W.setScissorTest(S),Ve){let lt=Y.get(D.texture);j.framebufferTexture2D(36160,36064,34069+X,lt.__webglTexture,ne)}else if($e){let lt=Y.get(D.texture),Bt=X||0;j.framebufferTextureLayer(36160,36064,lt.__webglTexture,ne||0,Bt)}w=-1},this.readRenderTargetPixels=function(D,X,ne,re,fe,Ve,$e){if(!(D&&D.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let it=Y.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&$e!==void 0&&(it=it[$e]),it){W.bindFramebuffer(36160,it);try{let lt=D.texture,Bt=lt.format,wt=lt.type;if(Bt!==On&&he.convert(Bt)!==j.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Tt=wt===La&&(ae.has("EXT_color_buffer_half_float")||le.isWebGL2&&ae.has("EXT_color_buffer_float"));if(wt!==Wt&&he.convert(wt)!==j.getParameter(35738)&&!(wt===Ts&&(le.isWebGL2||ae.has("OES_texture_float")||ae.has("WEBGL_color_buffer_float")))&&!Tt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}X>=0&&X<=D.width-re&&ne>=0&&ne<=D.height-fe&&j.readPixels(X,ne,re,fe,he.convert(Bt),he.convert(wt),Ve)}finally{let lt=b!==null?Y.get(b).__webglFramebuffer:null;W.bindFramebuffer(36160,lt)}}},this.copyFramebufferToTexture=function(D,X,ne=0){if(X.isFramebufferTexture!==!0){console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");return}let re=Math.pow(2,-ne),fe=Math.floor(X.image.width*re),Ve=Math.floor(X.image.height*re);H.setTexture2D(X,0),j.copyTexSubImage2D(3553,ne,0,0,D.x,D.y,fe,Ve),W.unbindTexture()},this.copyTextureToTexture=function(D,X,ne,re=0){let fe=X.image.width,Ve=X.image.height,$e=he.convert(ne.format),it=he.convert(ne.type);H.setTexture2D(ne,0),j.pixelStorei(37440,ne.flipY),j.pixelStorei(37441,ne.premultiplyAlpha),j.pixelStorei(3317,ne.unpackAlignment),X.isDataTexture?j.texSubImage2D(3553,re,D.x,D.y,fe,Ve,$e,it,X.image.data):X.isCompressedTexture?j.compressedTexSubImage2D(3553,re,D.x,D.y,X.mipmaps[0].width,X.mipmaps[0].height,$e,X.mipmaps[0].data):j.texSubImage2D(3553,re,D.x,D.y,$e,it,X.image),re===0&&ne.generateMipmaps&&j.generateMipmap(3553),W.unbindTexture()},this.copyTextureToTexture3D=function(D,X,ne,re,fe=0){if(p.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Ve=D.max.x-D.min.x+1,$e=D.max.y-D.min.y+1,it=D.max.z-D.min.z+1,lt=he.convert(re.format),Bt=he.convert(re.type),wt;if(re.isData3DTexture)H.setTexture3D(re,0),wt=32879;else if(re.isDataArrayTexture)H.setTexture2DArray(re,0),wt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}j.pixelStorei(37440,re.flipY),j.pixelStorei(37441,re.premultiplyAlpha),j.pixelStorei(3317,re.unpackAlignment);let Tt=j.getParameter(3314),tr=j.getParameter(32878),yo=j.getParameter(3316),ra=j.getParameter(3315),na=j.getParameter(32877),xi=ne.isCompressedTexture?ne.mipmaps[0]:ne.image;j.pixelStorei(3314,xi.width),j.pixelStorei(32878,xi.height),j.pixelStorei(3316,D.min.x),j.pixelStorei(3315,D.min.y),j.pixelStorei(32877,D.min.z),ne.isDataTexture||ne.isData3DTexture?j.texSubImage3D(wt,fe,X.x,X.y,X.z,Ve,$e,it,lt,Bt,xi.data):ne.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),j.compressedTexSubImage3D(wt,fe,X.x,X.y,X.z,Ve,$e,it,lt,xi.data)):j.texSubImage3D(wt,fe,X.x,X.y,X.z,Ve,$e,it,lt,Bt,xi),j.pixelStorei(3314,Tt),j.pixelStorei(32878,tr),j.pixelStorei(3316,yo),j.pixelStorei(3315,ra),j.pixelStorei(32877,na),fe===0&&re.generateMipmaps&&j.generateMipmap(wt),W.unbindTexture()},this.initTexture=function(D){H.setTexture2D(D,0),W.unbindTexture()},this.resetState=function(){y=0,v=0,b=null,W.reset(),rt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Ct.prototype.isWebGLRenderer=!0;var dg=class extends Ct{};dg.prototype.isWebGL1Renderer=!0;var Kc=class{constructor(e,t=25e-5){this.name="",this.color=new xe(e),this.density=t}clone(){return new Kc(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}};Kc.prototype.isFogExp2=!0;var _o=class{constructor(e,t=1,r=1e3){this.name="",this.color=new xe(e),this.near=t,this.far=r}clone(){return new _o(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}};_o.prototype.isFog=!0;var sn=class extends ot{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}};sn.prototype.isScene=!0;var rs=class{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Hc,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Fn()}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,r){e*=this.stride,r*=t.stride;for(let n=0,s=this.stride;n<s;n++)this.array[e+n]=t.array[r+n];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fn()),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]),r=new this.constructor(t,this.stride);return r.setUsage(this.usage),r}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=Fn()),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}}};rs.prototype.isInterleavedBuffer=!0;var en=new A,Ai=class{constructor(e,t,r,n=!1){this.name="",this.data=e,this.itemSize=t,this.offset=r,this.normalized=n===!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,r=this.data.count;t<r;t++)en.fromBufferAttribute(this,t),en.applyMatrix4(e),this.setXYZ(t,en.x,en.y,en.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)en.fromBufferAttribute(this,t),en.applyNormalMatrix(e),this.setXYZ(t,en.x,en.y,en.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)en.fromBufferAttribute(this,t),en.transformDirection(e),this.setXYZ(t,en.x,en.y,en.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,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this}setXYZ(e,t,r,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,this}setXYZW(e,t,r,n,s){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,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 r=0;r<this.count;r++){let n=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[n+s])}return new Ue(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 Ai(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 r=0;r<this.count;r++){let n=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[n+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}};Ai.prototype.isInterleavedBufferAttribute=!0;var Zc=class extends cr{constructor(e){super(),this.type="SpriteMaterial",this.color=new xe(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}};Zc.prototype.isSpriteMaterial=!0;var xa,Dc=new A,ba=new A,wa=new A,Sa=new N,Pc=new N,vb=new Ee,jh=new A,Ic=new A,qh=new A,A0=new N,qm=new N,T0=new N,pg=class extends ot{constructor(e){if(super(),this.type="Sprite",xa===void 0){xa=new Ie;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new rs(t,5);xa.setIndex([0,1,2,0,2,3]),xa.setAttribute("position",new Ai(r,3,0,!1)),xa.setAttribute("uv",new Ai(r,2,3,!1))}this.geometry=xa,this.material=e!==void 0?e:new Zc,this.center=new N(.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),vb.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 r=this.material.rotation,n,s;r!==0&&(s=Math.cos(r),n=Math.sin(r));let o=this.center;Xh(jh.set(-.5,-.5,0),wa,o,ba,n,s),Xh(Ic.set(.5,-.5,0),wa,o,ba,n,s),Xh(qh.set(.5,.5,0),wa,o,ba,n,s),A0.set(0,0),qm.set(1,0),T0.set(1,1);let a=e.ray.intersectTriangle(jh,Ic,qh,!1,Dc);if(a===null&&(Xh(Ic.set(-.5,.5,0),wa,o,ba,n,s),qm.set(0,1),a=e.ray.intersectTriangle(jh,qh,Ic,!1,Dc),a===null))return;let l=e.ray.origin.distanceTo(Dc);l<e.near||l>e.far||t.push({distance:l,point:Dc.clone(),uv:Jt.getUV(Dc,jh,Ic,qh,A0,qm,T0,new N),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};pg.prototype.isSprite=!0;function Xh(i,e,t,r,n,s){Sa.subVectors(i,t).addScalar(.5).multiply(r),n!==void 0?(Pc.x=s*Sa.x-n*Sa.y,Pc.y=n*Sa.x+s*Sa.y):Pc.copy(Sa),i.copy(e),i.x+=Pc.x,i.y+=Pc.y,i.applyMatrix4(vb)}var E0=new A,_0=new Qe,C0=new Qe,aP=new A,L0=new Ee,vf=class extends Gt{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Ee,this.bindMatrixInverse=new Ee}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 r=0,n=t.count;r<n;r++){e.fromBufferAttribute(t,r);let s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(r,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 r=this.skeleton,n=this.geometry;_0.fromBufferAttribute(n.attributes.skinIndex,e),C0.fromBufferAttribute(n.attributes.skinWeight,e),E0.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){let o=C0.getComponent(s);if(o!==0){let a=_0.getComponent(s);L0.multiplyMatrices(r.bones[a].matrixWorld,r.boneInverses[a]),t.addScaledVector(aP.copy(E0).applyMatrix4(L0),o)}}return t.applyMatrix4(this.bindMatrixInverse)}};vf.prototype.isSkinnedMesh=!0;var mg=class extends ot{constructor(){super(),this.type="Bone"}};mg.prototype.isBone=!0;var xf=class extends _t{constructor(e=null,t=1,r=1,n,s,o,a,l,c=lr,u=lr,h,f){super(null,o,a,l,c,u,n,s,h,f),this.image={data:e,width:t,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};xf.prototype.isDataTexture=!0;var Ba=class extends Ue{constructor(e,t,r,n=1){typeof r=="number"&&(n=r,r=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,r),this.meshPerAttribute=n}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}};Ba.prototype.isInstancedBufferAttribute=!0;var D0=new Ee,P0=new Ee,Yh=[],Rc=new Gt,gg=class extends Gt{constructor(e,t,r){super(e,t),this.instanceMatrix=new Ba(new Float32Array(r*16),16),this.instanceColor=null,this.count=r,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 r=this.matrixWorld,n=this.count;if(Rc.geometry=this.geometry,Rc.material=this.material,Rc.material!==void 0)for(let s=0;s<n;s++){this.getMatrixAt(s,D0),P0.multiplyMatrices(r,D0),Rc.matrixWorld=P0,Rc.raycast(e,Yh);for(let o=0,a=Yh.length;o<a;o++){let l=Yh[o];l.instanceId=s,l.object=this,t.push(l)}Yh.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Ba(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"})}};gg.prototype.isInstancedMesh=!0;var Ur=class extends cr{constructor(e){super(),this.type="LineBasicMaterial",this.color=new xe(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}};Ur.prototype.isLineBasicMaterial=!0;var I0=new A,R0=new A,B0=new Ee,Xm=new si,Jh=new Yr,ns=class extends ot{constructor(e=new Ie,t=new Ur){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,r=[0];for(let n=1,s=t.count;n<s;n++)I0.fromBufferAttribute(t,n-1),R0.fromBufferAttribute(t,n),r[n]=r[n-1],r[n]+=I0.distanceTo(R0);e.setAttribute("lineDistance",new Le(r,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 r=this.geometry,n=this.matrixWorld,s=e.params.Line.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),Jh.copy(r.boundingSphere),Jh.applyMatrix4(n),Jh.radius+=s,e.ray.intersectsSphere(Jh)===!1)return;B0.copy(n).invert(),Xm.copy(e.ray).applyMatrix4(B0);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new A,u=new A,h=new A,f=new A,d=this.isLineSegments?2:1;if(r.isBufferGeometry){let m=r.index,g=r.attributes.position;if(m!==null){let y=Math.max(0,o.start),v=Math.min(m.count,o.start+o.count);for(let b=y,w=v-1;b<w;b+=d){let x=m.getX(b),E=m.getX(b+1);if(c.fromBufferAttribute(g,x),u.fromBufferAttribute(g,E),Xm.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);let S=e.ray.origin.distanceTo(f);S<e.near||S>e.far||t.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else{let y=Math.max(0,o.start),v=Math.min(g.count,o.start+o.count);for(let b=y,w=v-1;b<w;b+=d){if(c.fromBufferAttribute(g,b),u.fromBufferAttribute(g,b+1),Xm.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);let E=e.ray.origin.distanceTo(f);E<e.near||E>e.far||t.push({distance:E,point:h.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}else r.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,r=Object.keys(t);if(r.length>0){let n=t[r[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=n.length;s<o;s++){let a=n[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.")}}};ns.prototype.isLine=!0;var N0=new A,O0=new A,ai=class extends ns{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,r=[];for(let n=0,s=t.count;n<s;n+=2)N0.fromBufferAttribute(t,n),O0.fromBufferAttribute(t,n+1),r[n]=n===0?0:r[n-1],r[n+1]=r[n]+N0.distanceTo(O0);e.setAttribute("lineDistance",new Le(r,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}};ai.prototype.isLineSegments=!0;var yg=class extends ns{constructor(e,t){super(e,t),this.type="LineLoop"}};yg.prototype.isLineLoop=!0;var $c=class extends cr{constructor(e){super(),this.type="PointsMaterial",this.color=new xe(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}};$c.prototype.isPointsMaterial=!0;var F0=new Ee,vg=new si,Qh=new Yr,Kh=new A,xg=class extends ot{constructor(e=new Ie,t=new $c){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 r=this.geometry,n=this.matrixWorld,s=e.params.Points.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),Qh.copy(r.boundingSphere),Qh.applyMatrix4(n),Qh.radius+=s,e.ray.intersectsSphere(Qh)===!1)return;F0.copy(n).invert(),vg.copy(e.ray).applyMatrix4(F0);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a;if(r.isBufferGeometry){let c=r.index,h=r.attributes.position;if(c!==null){let f=Math.max(0,o.start),d=Math.min(c.count,o.start+o.count);for(let m=f,p=d;m<p;m++){let g=c.getX(m);Kh.fromBufferAttribute(h,g),U0(Kh,g,l,n,e,t,this)}}else{let f=Math.max(0,o.start),d=Math.min(h.count,o.start+o.count);for(let m=f,p=d;m<p;m++)Kh.fromBufferAttribute(h,m),U0(Kh,m,l,n,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,r=Object.keys(t);if(r.length>0){let n=t[r[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=n.length;s<o;s++){let a=n[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.")}}};xg.prototype.isPoints=!0;function U0(i,e,t,r,n,s,o){let a=vg.distanceSqToPoint(i);if(a<t){let l=new A;vg.closestPointToPoint(i,l),l.applyMatrix4(r);let c=n.ray.origin.distanceTo(l);if(c<n.near||c>n.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}var eu=class extends _t{constructor(e,t,r,n,s,o,a,l,c){super(e,t,r,n,s,o,a,l,c),this.minFilter=o!==void 0?o:ct,this.magFilter=s!==void 0?s:ct,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)}};eu.prototype.isVideoTexture=!0;var bg=class extends _t{constructor(e,t,r){super({width:e,height:t}),this.format=r,this.magFilter=lr,this.minFilter=lr,this.generateMipmaps=!1,this.needsUpdate=!0}};bg.prototype.isFramebufferTexture=!0;var wg=class extends _t{constructor(e,t,r,n,s,o,a,l,c,u,h,f){super(null,o,a,l,c,u,n,s,h,f),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};wg.prototype.isCompressedTexture=!0;var Sg=class extends _t{constructor(e,t,r,n,s,o,a,l,c){super(e,t,r,n,s,o,a,l,c),this.needsUpdate=!0}};Sg.prototype.isCanvasTexture=!0;var gn=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){let t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){let t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/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=[],r,n=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(n),t.push(s),n=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let r=this.getLengths(),n=0,s=r.length,o;t?o=t:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),c=r[n]-o,c<0)a=n+1;else if(c>0)l=n-1;else{l=n;break}if(n=l,r[n]===o)return n/(s-1);let u=r[n],f=r[n+1]-u,d=(o-u)/f;return(n+d)/(s-1)}getTangent(e,t){let n=e-1e-4,s=e+1e-4;n<0&&(n=0),s>1&&(s=1);let o=this.getPoint(n),a=this.getPoint(s),l=t||(o.isVector2?new N:new A);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){let r=new A,n=[],s=[],o=[],a=new A,l=new Ee;for(let d=0;d<=e;d++){let m=d/e;n[d]=this.getTangentAt(m,new A)}s[0]=new A,o[0]=new A;let c=Number.MAX_VALUE,u=Math.abs(n[0].x),h=Math.abs(n[0].y),f=Math.abs(n[0].z);u<=c&&(c=u,r.set(1,0,0)),h<=c&&(c=h,r.set(0,1,0)),f<=c&&r.set(0,0,1),a.crossVectors(n[0],r).normalize(),s[0].crossVectors(n[0],a),o[0].crossVectors(n[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(n[d-1],n[d]),a.length()>Number.EPSILON){a.normalize();let m=Math.acos(yr(n[d-1].dot(n[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(a,m))}o[d].crossVectors(n[d],s[d])}if(t===!0){let d=Math.acos(yr(s[0].dot(s[e]),-1,1));d/=e,n[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(n[m],d*m)),o[m].crossVectors(n[m],s[m])}return{tangents:n,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}},Bs=class extends gn{constructor(e=0,t=0,r=1,n=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=n,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){let r=t||new N,n=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=n;for(;s>n;)s-=n;s<Number.EPSILON&&(o?s=0:s=n),this.aClockwise===!0&&!o&&(s===n?s=-n:s=s-n);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),f=l-this.aX,d=c-this.aY;l=f*u-d*h+this.aX,c=f*h+d*u+this.aY}return r.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}};Bs.prototype.isEllipseCurve=!0;var bf=class extends Bs{constructor(e,t,r,n,s,o){super(e,t,r,r,n,s,o),this.type="ArcCurve"}};bf.prototype.isArcCurve=!0;function ey(){let i=0,e=0,t=0,r=0;function n(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,r=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){n(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,h){let f=(o-s)/c-(a-s)/(c+u)+(a-o)/u,d=(a-o)/u-(l-o)/(u+h)+(l-a)/h;f*=u,d*=u,n(o,a,f,d)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+r*a}}}var Zh=new A,Ym=new ey,Jm=new ey,Qm=new ey,wf=class extends gn{constructor(e=[],t=!1,r="centripetal",n=.5){super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=n}getPoint(e,t=new A){let r=t,n=this.points,s=n.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=n[(a-1)%s]:(Zh.subVectors(n[0],n[1]).add(n[0]),c=Zh);let h=n[a%s],f=n[(a+1)%s];if(this.closed||a+2<s?u=n[(a+2)%s]:(Zh.subVectors(n[s-1],n[s-2]).add(n[s-1]),u=Zh),this.curveType==="centripetal"||this.curveType==="chordal"){let d=this.curveType==="chordal"?.5:.25,m=Math.pow(c.distanceToSquared(h),d),p=Math.pow(h.distanceToSquared(f),d),g=Math.pow(f.distanceToSquared(u),d);p<1e-4&&(p=1),m<1e-4&&(m=p),g<1e-4&&(g=p),Ym.initNonuniformCatmullRom(c.x,h.x,f.x,u.x,m,p,g),Jm.initNonuniformCatmullRom(c.y,h.y,f.y,u.y,m,p,g),Qm.initNonuniformCatmullRom(c.z,h.z,f.z,u.z,m,p,g)}else this.curveType==="catmullrom"&&(Ym.initCatmullRom(c.x,h.x,f.x,u.x,this.tension),Jm.initCatmullRom(c.y,h.y,f.y,u.y,this.tension),Qm.initCatmullRom(c.z,h.z,f.z,u.z,this.tension));return r.set(Ym.calc(l),Jm.calc(l),Qm.calc(l)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(n.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,r=this.points.length;t<r;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(new A().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};wf.prototype.isCatmullRomCurve3=!0;function z0(i,e,t,r,n){let s=(r-e)*.5,o=(n-t)*.5,a=i*i,l=i*a;return(2*t-2*r+s+o)*l+(-3*t+3*r-2*s-o)*a+s*i+t}function lP(i,e){let t=1-i;return t*t*e}function cP(i,e){return 2*(1-i)*i*e}function uP(i,e){return i*i*e}function Gc(i,e,t,r){return lP(i,e)+cP(i,t)+uP(i,r)}function hP(i,e){let t=1-i;return t*t*t*e}function fP(i,e){let t=1-i;return 3*t*t*i*e}function dP(i,e){return 3*(1-i)*i*i*e}function pP(i,e){return i*i*i*e}function kc(i,e,t,r,n){return hP(i,e)+fP(i,t)+dP(i,r)+pP(i,n)}var on=class extends gn{constructor(e=new N,t=new N,r=new N,n=new N){super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=n}getPoint(e,t=new N){let r=t,n=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(kc(e,n.x,s.x,o.x,a.x),kc(e,n.y,s.y,o.y,a.y)),r}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}};on.prototype.isCubicBezierCurve=!0;var Sf=class extends gn{constructor(e=new A,t=new A,r=new A,n=new A){super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=n}getPoint(e,t=new A){let r=t,n=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(kc(e,n.x,s.x,o.x,a.x),kc(e,n.y,s.y,o.y,a.y),kc(e,n.z,s.z,o.z,a.z)),r}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}};Sf.prototype.isCubicBezierCurve3=!0;var an=class extends gn{constructor(e=new N,t=new N){super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new N){let r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){let r=t||new N;return r.copy(this.v2).sub(this.v1).normalize(),r}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}};an.prototype.isLineCurve=!0;var tu=class extends gn{constructor(e=new A,t=new A){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new A){let r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}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}},Gn=class extends gn{constructor(e=new N,t=new N,r=new N){super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new N){let r=t,n=this.v0,s=this.v1,o=this.v2;return r.set(Gc(e,n.x,s.x,o.x),Gc(e,n.y,s.y,o.y)),r}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}};Gn.prototype.isQuadraticBezierCurve=!0;var Mf=class extends gn{constructor(e=new A,t=new A,r=new A){super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new A){let r=t,n=this.v0,s=this.v1,o=this.v2;return r.set(Gc(e,n.x,s.x,o.x),Gc(e,n.y,s.y,o.y),Gc(e,n.z,s.z,o.z)),r}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}};Mf.prototype.isQuadraticBezierCurve3=!0;var Co=class extends gn{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new N){let r=t,n=this.points,s=(n.length-1)*e,o=Math.floor(s),a=s-o,l=n[o===0?o:o-1],c=n[o],u=n[o>n.length-2?n.length-1:o+1],h=n[o>n.length-3?n.length-1:o+2];return r.set(z0(a,l.x,c.x,u.x,h.x),z0(a,l.y,c.y,u.y,h.y)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(new N().fromArray(n))}return this}};Co.prototype.isSplineCurve=!0;var xb=Object.freeze({__proto__:null,ArcCurve:bf,CatmullRomCurve3:wf,CubicBezierCurve:on,CubicBezierCurve3:Sf,EllipseCurve:Bs,LineCurve:an,LineCurve3:tu,QuadraticBezierCurve:Gn,QuadraticBezierCurve3:Mf,SplineCurve:Co}),Mg=class extends gn{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 an(t,e))}getPoint(e,t){let r=e*this.getLength(),n=this.getCurveLengths(),s=0;for(;s<n.length;){if(n[s]>=r){let o=n[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}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 r=0,n=this.curves.length;r<n;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],r;for(let n=0,s=this.curves;n<s.length;n++){let o=s[n],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){let u=l[c];r&&r.equals(u)||(t.push(u),r=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,r=e.curves.length;t<r;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,r=this.curves.length;t<r;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){let n=e.curves[t];this.curves.push(new xb[n.type]().fromJSON(n))}return this}},Na=class extends Mg{constructor(e){super(),this.type="Path",this.currentPoint=new N,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,r=e.length;t<r;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 r=new an(this.currentPoint.clone(),new N(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,n){let s=new Gn(this.currentPoint.clone(),new N(e,t),new N(r,n));return this.curves.push(s),this.currentPoint.set(r,n),this}bezierCurveTo(e,t,r,n,s,o){let a=new on(this.currentPoint.clone(),new N(e,t),new N(r,n),new N(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),r=new Co(t);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,n,s,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,r,n,s,o),this}absarc(e,t,r,n,s,o){return this.absellipse(e,t,r,r,n,s,o),this}ellipse(e,t,r,n,s,o,a,l){let c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,r,n,s,o,a,l),this}absellipse(e,t,r,n,s,o,a,l){let c=new Bs(e,t,r,n,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}},Oa=class extends Ie{constructor(e=[new N(0,.5),new N(.5,0),new N(0,-.5)],t=12,r=0,n=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},t=Math.floor(t),n=yr(n,0,Math.PI*2);let s=[],o=[],a=[],l=[],c=[],u=1/t,h=new A,f=new N,d=new A,m=new A,p=new A,g=0,y=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:g=e[v+1].x-e[v].x,y=e[v+1].y-e[v].y,d.x=y*1,d.y=-g,d.z=y*0,p.copy(d),d.normalize(),l.push(d.x,d.y,d.z);break;case e.length-1:l.push(p.x,p.y,p.z);break;default:g=e[v+1].x-e[v].x,y=e[v+1].y-e[v].y,d.x=y*1,d.y=-g,d.z=y*0,m.copy(d),d.x+=p.x,d.y+=p.y,d.z+=p.z,d.normalize(),l.push(d.x,d.y,d.z),p.copy(m)}for(let v=0;v<=t;v++){let b=r+v*u*n,w=Math.sin(b),x=Math.cos(b);for(let E=0;E<=e.length-1;E++){h.x=e[E].x*w,h.y=e[E].y,h.z=e[E].x*x,o.push(h.x,h.y,h.z),f.x=v/t,f.y=E/(e.length-1),a.push(f.x,f.y);let T=l[3*E+0]*w,S=l[3*E+1],I=l[3*E+0]*x;c.push(T,S,I)}}for(let v=0;v<t;v++)for(let b=0;b<e.length-1;b++){let w=b+v*e.length,x=w,E=w+e.length,T=w+e.length+1,S=w+1;s.push(x,E,S),s.push(T,S,E)}this.setIndex(s),this.setAttribute("position",new Le(o,3)),this.setAttribute("uv",new Le(a,2)),this.setAttribute("normal",new Le(c,3))}static fromJSON(e){return new Oa(e.points,e.segments,e.phiStart,e.phiLength)}};var Lo=class extends Ie{constructor(e=1,t=1,r=1,n=8,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;n=Math.floor(n),s=Math.floor(s);let u=[],h=[],f=[],d=[],m=0,p=[],g=r/2,y=0;v(),o===!1&&(e>0&&b(!0),t>0&&b(!1)),this.setIndex(u),this.setAttribute("position",new Le(h,3)),this.setAttribute("normal",new Le(f,3)),this.setAttribute("uv",new Le(d,2));function v(){let w=new A,x=new A,E=0,T=(t-e)/r;for(let S=0;S<=s;S++){let I=[],C=S/s,M=C*(t-e)+e;for(let _=0;_<=n;_++){let R=_/n,B=R*l+a,O=Math.sin(B),z=Math.cos(B);x.x=M*O,x.y=-C*r+g,x.z=M*z,h.push(x.x,x.y,x.z),w.set(O,T,z).normalize(),f.push(w.x,w.y,w.z),d.push(R,1-C),I.push(m++)}p.push(I)}for(let S=0;S<n;S++)for(let I=0;I<s;I++){let C=p[I][S],M=p[I+1][S],_=p[I+1][S+1],R=p[I][S+1];u.push(C,M,R),u.push(M,_,R),E+=6}c.addGroup(y,E,0),y+=E}function b(w){let x=m,E=new N,T=new A,S=0,I=w===!0?e:t,C=w===!0?1:-1;for(let _=1;_<=n;_++)h.push(0,g*C,0),f.push(0,C,0),d.push(.5,.5),m++;let M=m;for(let _=0;_<=n;_++){let B=_/n*l+a,O=Math.cos(B),z=Math.sin(B);T.x=I*z,T.y=g*C,T.z=I*O,h.push(T.x,T.y,T.z),f.push(0,C,0),E.x=O*.5+.5,E.y=z*.5*C+.5,d.push(E.x,E.y),m++}for(let _=0;_<n;_++){let R=x+_,B=M+_;w===!0?u.push(B,B+1,R):u.push(B+1,B,R),S+=3}c.addGroup(y,S,w===!0?1:2),y+=S}}static fromJSON(e){return new Lo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Fa=class extends Lo{constructor(e=1,t=1,r=8,n=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,r,n,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:n,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new Fa(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Ua=class extends Ie{constructor(e=[],t=[],r=1,n=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:n};let s=[],o=[];a(n),c(r),u(),this.setAttribute("position",new Le(s,3)),this.setAttribute("normal",new Le(s.slice(),3)),this.setAttribute("uv",new Le(o,2)),n===0?this.computeVertexNormals():this.normalizeNormals();function a(v){let b=new A,w=new A,x=new A;for(let E=0;E<t.length;E+=3)d(t[E+0],b),d(t[E+1],w),d(t[E+2],x),l(b,w,x,v)}function l(v,b,w,x){let E=x+1,T=[];for(let S=0;S<=E;S++){T[S]=[];let I=v.clone().lerp(w,S/E),C=b.clone().lerp(w,S/E),M=E-S;for(let _=0;_<=M;_++)_===0&&S===E?T[S][_]=I:T[S][_]=I.clone().lerp(C,_/M)}for(let S=0;S<E;S++)for(let I=0;I<2*(E-S)-1;I++){let C=Math.floor(I/2);I%2===0?(f(T[S][C+1]),f(T[S+1][C]),f(T[S][C])):(f(T[S][C+1]),f(T[S+1][C+1]),f(T[S+1][C]))}}function c(v){let b=new A;for(let w=0;w<s.length;w+=3)b.x=s[w+0],b.y=s[w+1],b.z=s[w+2],b.normalize().multiplyScalar(v),s[w+0]=b.x,s[w+1]=b.y,s[w+2]=b.z}function u(){let v=new A;for(let b=0;b<s.length;b+=3){v.x=s[b+0],v.y=s[b+1],v.z=s[b+2];let w=g(v)/2/Math.PI+.5,x=y(v)/Math.PI+.5;o.push(w,1-x)}m(),h()}function h(){for(let v=0;v<o.length;v+=6){let b=o[v+0],w=o[v+2],x=o[v+4],E=Math.max(b,w,x),T=Math.min(b,w,x);E>.9&&T<.1&&(b<.2&&(o[v+0]+=1),w<.2&&(o[v+2]+=1),x<.2&&(o[v+4]+=1))}}function f(v){s.push(v.x,v.y,v.z)}function d(v,b){let w=v*3;b.x=e[w+0],b.y=e[w+1],b.z=e[w+2]}function m(){let v=new A,b=new A,w=new A,x=new A,E=new N,T=new N,S=new N;for(let I=0,C=0;I<s.length;I+=9,C+=6){v.set(s[I+0],s[I+1],s[I+2]),b.set(s[I+3],s[I+4],s[I+5]),w.set(s[I+6],s[I+7],s[I+8]),E.set(o[C+0],o[C+1]),T.set(o[C+2],o[C+3]),S.set(o[C+4],o[C+5]),x.copy(v).add(b).add(w).divideScalar(3);let M=g(x);p(E,C+0,v,M),p(T,C+2,b,M),p(S,C+4,w,M)}}function p(v,b,w,x){x<0&&v.x===1&&(o[b]=v.x-1),w.x===0&&w.z===0&&(o[b]=x/2/Math.PI+.5)}function g(v){return Math.atan2(v.z,-v.x)}function y(v){return Math.atan2(-v.y,Math.sqrt(v.x*v.x+v.z*v.z))}}static fromJSON(e){return new Ua(e.vertices,e.indices,e.radius,e.details)}},za=class extends Ua{constructor(e=1,t=0){let r=(1+Math.sqrt(5))/2,n=1/r,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],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 za(e.radius,e.detail)}},Oz=new A,Fz=new A,Uz=new A,zz=new Jt;var tn=class extends Na{constructor(e){super(e),this.uuid=Fn(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let r=0,n=this.holes.length;r<n;r++)t[r]=this.holes[r].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,r=e.holes.length;t<r;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,r=this.holes.length;t<r;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){let n=e.holes[t];this.holes.push(new Na().fromJSON(n))}return this}},mP={triangulate:function(i,e,t=2){let r=e&&e.length,n=r?e[0]*t:i.length,s=bb(i,0,n,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,h,f,d;if(r&&(s=bP(i,e,s,t)),i.length>80*t){a=c=i[0],l=u=i[1];for(let m=t;m<n;m+=t)h=i[m],f=i[m+1],h<a&&(a=h),f<l&&(l=f),h>c&&(c=h),f>u&&(u=f);d=Math.max(c-a,u-l),d=d!==0?1/d:0}return ru(s,o,t,a,l,d),o}};function bb(i,e,t,r,n){let s,o;if(n===PP(i,e,t,r)>0)for(s=e;s<t;s+=r)o=G0(s,i[s],i[s+1],o);else for(s=t-r;s>=e;s-=r)o=G0(s,i[s],i[s+1],o);return o&&Zf(o,o.next)&&(iu(o),o=o.next),o}function Ns(i,e){if(!i)return i;e||(e=i);let t=i,r;do if(r=!1,!t.steiner&&(Zf(t,t.next)||$t(t.prev,t,t.next)===0)){if(iu(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function ru(i,e,t,r,n,s,o){if(!i)return;!o&&s&&TP(i,r,n,s);let a=i,l,c;for(;i.prev!==i.next;){if(l=i.prev,c=i.next,s?yP(i,r,n,s):gP(i)){e.push(l.i/t),e.push(i.i/t),e.push(c.i/t),iu(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=vP(Ns(i),e,t),ru(i,e,t,r,n,s,2)):o===2&&xP(i,e,t,r,n,s):ru(Ns(i),e,t,r,n,s,1);break}}}function gP(i){let e=i.prev,t=i,r=i.next;if($t(e,t,r)>=0)return!1;let n=i.next.next;for(;n!==i.prev;){if(_a(e.x,e.y,t.x,t.y,r.x,r.y,n.x,n.y)&&$t(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function yP(i,e,t,r){let n=i.prev,s=i,o=i.next;if($t(n,s,o)>=0)return!1;let a=n.x<s.x?n.x<o.x?n.x:o.x:s.x<o.x?s.x:o.x,l=n.y<s.y?n.y<o.y?n.y:o.y:s.y<o.y?s.y:o.y,c=n.x>s.x?n.x>o.x?n.x:o.x:s.x>o.x?s.x:o.x,u=n.y>s.y?n.y>o.y?n.y:o.y:s.y>o.y?s.y:o.y,h=Ag(a,l,e,t,r),f=Ag(c,u,e,t,r),d=i.prevZ,m=i.nextZ;for(;d&&d.z>=h&&m&&m.z<=f;){if(d!==i.prev&&d!==i.next&&_a(n.x,n.y,s.x,s.y,o.x,o.y,d.x,d.y)&&$t(d.prev,d,d.next)>=0||(d=d.prevZ,m!==i.prev&&m!==i.next&&_a(n.x,n.y,s.x,s.y,o.x,o.y,m.x,m.y)&&$t(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;d&&d.z>=h;){if(d!==i.prev&&d!==i.next&&_a(n.x,n.y,s.x,s.y,o.x,o.y,d.x,d.y)&&$t(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=f;){if(m!==i.prev&&m!==i.next&&_a(n.x,n.y,s.x,s.y,o.x,o.y,m.x,m.y)&&$t(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function vP(i,e,t){let r=i;do{let n=r.prev,s=r.next.next;!Zf(n,s)&&wb(n,r,r.next,s)&&nu(n,s)&&nu(s,n)&&(e.push(n.i/t),e.push(r.i/t),e.push(s.i/t),iu(r),iu(r.next),r=i=s),r=r.next}while(r!==i);return Ns(r)}function xP(i,e,t,r,n,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&CP(o,a)){let l=Sb(o,a);o=Ns(o,o.next),l=Ns(l,l.next),ru(o,e,t,r,n,s),ru(l,e,t,r,n,s);return}a=a.next}o=o.next}while(o!==i)}function bP(i,e,t,r){let n=[],s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*r,l=s<o-1?e[s+1]*r:i.length,c=bb(i,a,l,r,!1),c===c.next&&(c.steiner=!0),n.push(_P(c));for(n.sort(wP),s=0;s<n.length;s++)SP(n[s],t),t=Ns(t,t.next);return t}function wP(i,e){return i.x-e.x}function SP(i,e){if(e=MP(i,e),e){let t=Sb(e,i);Ns(e,e.next),Ns(t,t.next)}}function MP(i,e){let t=e,r=i.x,n=i.y,s=-1/0,o;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){let f=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=r&&f>s){if(s=f,f===r){if(n===t.y)return t;if(n===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(r===s)return o;let a=o,l=o.x,c=o.y,u=1/0,h;t=o;do r>=t.x&&t.x>=l&&r!==t.x&&_a(n<c?r:s,n,l,c,n<c?s:r,n,t.x,t.y)&&(h=Math.abs(n-t.y)/(r-t.x),nu(t,i)&&(h<u||h===u&&(t.x>o.x||t.x===o.x&&AP(o,t)))&&(o=t,u=h)),t=t.next;while(t!==a);return o}function AP(i,e){return $t(i.prev,i,e.prev)<0&&$t(e.next,i,i.next)<0}function TP(i,e,t,r){let n=i;do n.z===null&&(n.z=Ag(n.x,n.y,e,t,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==i);n.prevZ.nextZ=null,n.prevZ=null,EP(n)}function EP(i){let e,t,r,n,s,o,a,l,c=1;do{for(t=i,i=null,s=null,o=0;t;){for(o++,r=t,a=0,e=0;e<c&&(a++,r=r.nextZ,!!r);e++);for(l=c;a>0||l>0&&r;)a!==0&&(l===0||!r||t.z<=r.z)?(n=t,t=t.nextZ,a--):(n=r,r=r.nextZ,l--),s?s.nextZ=n:i=n,n.prevZ=s,s=n;t=r}s.nextZ=null,c*=2}while(o>1);return i}function Ag(i,e,t,r,n){return i=32767*(i-t)*n,e=32767*(e-r)*n,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function _P(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function _a(i,e,t,r,n,s,o,a){return(n-o)*(e-a)-(i-o)*(s-a)>=0&&(i-o)*(r-a)-(t-o)*(e-a)>=0&&(t-o)*(s-a)-(n-o)*(r-a)>=0}function CP(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!LP(i,e)&&(nu(i,e)&&nu(e,i)&&DP(i,e)&&($t(i.prev,i,e.prev)||$t(i,e.prev,e))||Zf(i,e)&&$t(i.prev,i,i.next)>0&&$t(e.prev,e,e.next)>0)}function $t(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function Zf(i,e){return i.x===e.x&&i.y===e.y}function wb(i,e,t,r){let n=ef($t(i,e,t)),s=ef($t(i,e,r)),o=ef($t(t,r,i)),a=ef($t(t,r,e));return!!(n!==s&&o!==a||n===0&&$h(i,t,e)||s===0&&$h(i,r,e)||o===0&&$h(t,i,r)||a===0&&$h(t,e,r))}function $h(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function ef(i){return i>0?1:i<0?-1:0}function LP(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&wb(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function nu(i,e){return $t(i.prev,i,i.next)<0?$t(i,e,i.next)>=0&&$t(i,i.prev,e)>=0:$t(i,e,i.prev)<0||$t(i,i.next,e)<0}function DP(i,e){let t=i,r=!1,n=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&n<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==i);return r}function Sb(i,e){let t=new Tg(i.i,i.x,i.y),r=new Tg(e.i,e.x,e.y),n=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=n,n.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function G0(i,e,t,r){let n=new Tg(i,e,t);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function iu(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Tg(i,e,t){this.i=i,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 PP(i,e,t,r){let n=0;for(let s=e,o=t-r;s<t;s+=r)n+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return n}var ni=class{static area(e){let t=e.length,r=0;for(let n=t-1,s=0;s<t;n=s++)r+=e[n].x*e[s].y-e[s].x*e[n].y;return r*.5}static isClockWise(e){return ni.area(e)<0}static triangulateShape(e,t){let r=[],n=[],s=[];k0(e),V0(r,e);let o=e.length;t.forEach(k0);for(let l=0;l<t.length;l++)n.push(o),o+=t[l].length,V0(r,t[l]);let a=mP.triangulate(r,n);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function k0(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function V0(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var Os=class extends Ie{constructor(e=new tn([new N(.5,.5),new N(-.5,.5),new N(-.5,-.5),new N(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let r=this,n=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new Le(n,3)),this.setAttribute("uv",new Le(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:1,f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,m=t.bevelSize!==void 0?t.bevelSize:d-.1,p=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3,y=t.extrudePath,v=t.UVGenerator!==void 0?t.UVGenerator:IP;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),h=t.amount);let b,w=!1,x,E,T,S;y&&(b=y.getSpacedPoints(u),w=!0,f=!1,x=y.computeFrenetFrames(u,!1),E=new A,T=new A,S=new A),f||(g=0,d=0,m=0,p=0);let I=a.extractPoints(c),C=I.shape,M=I.holes;if(!ni.isClockWise(C)){C=C.reverse();for(let Y=0,H=M.length;Y<H;Y++){let Q=M[Y];ni.isClockWise(Q)&&(M[Y]=Q.reverse())}}let R=ni.triangulateShape(C,M),B=C;for(let Y=0,H=M.length;Y<H;Y++){let Q=M[Y];C=C.concat(Q)}function O(Y,H,Q){return H||console.error("THREE.ExtrudeGeometry: vec does not exist"),H.clone().multiplyScalar(Q).add(Y)}let z=C.length,q=R.length;function F(Y,H,Q){let ce,ie,pe,ve=Y.x-H.x,me=Y.y-H.y,De=Q.x-Y.x,ke=Q.y-Y.y,P=ve*ve+me*me,L=ve*ke-me*De;if(Math.abs(L)>Number.EPSILON){let te=Math.sqrt(P),ye=Math.sqrt(De*De+ke*ke),Se=H.x-me/te,Pe=H.y+ve/te,Fe=Q.x-ke/ye,he=Q.y+De/ye,rt=((Fe-Se)*ke-(he-Pe)*De)/(ve*ke-me*De);ce=Se+ve*rt-Y.x,ie=Pe+me*rt-Y.y;let st=ce*ce+ie*ie;if(st<=2)return new N(ce,ie);pe=Math.sqrt(st/2)}else{let te=!1;ve>Number.EPSILON?De>Number.EPSILON&&(te=!0):ve<-Number.EPSILON?De<-Number.EPSILON&&(te=!0):Math.sign(me)===Math.sign(ke)&&(te=!0),te?(ce=-me,ie=ve,pe=Math.sqrt(P)):(ce=ve,ie=me,pe=Math.sqrt(P/2))}return new N(ce/pe,ie/pe)}let ee=[];for(let Y=0,H=B.length,Q=H-1,ce=Y+1;Y<H;Y++,Q++,ce++)Q===H&&(Q=0),ce===H&&(ce=0),ee[Y]=F(B[Y],B[Q],B[ce]);let k=[],V,U=ee.concat();for(let Y=0,H=M.length;Y<H;Y++){let Q=M[Y];V=[];for(let ce=0,ie=Q.length,pe=ie-1,ve=ce+1;ce<ie;ce++,pe++,ve++)pe===ie&&(pe=0),ve===ie&&(ve=0),V[ce]=F(Q[ce],Q[pe],Q[ve]);k.push(V),U=U.concat(V)}for(let Y=0;Y<g;Y++){let H=Y/g,Q=d*Math.cos(H*Math.PI/2),ce=m*Math.sin(H*Math.PI/2)+p;for(let ie=0,pe=B.length;ie<pe;ie++){let ve=O(B[ie],ee[ie],ce);ge(ve.x,ve.y,-Q)}for(let ie=0,pe=M.length;ie<pe;ie++){let ve=M[ie];V=k[ie];for(let me=0,De=ve.length;me<De;me++){let ke=O(ve[me],V[me],ce);ge(ke.x,ke.y,-Q)}}}let J=m+p;for(let Y=0;Y<z;Y++){let H=f?O(C[Y],U[Y],J):C[Y];w?(T.copy(x.normals[0]).multiplyScalar(H.x),E.copy(x.binormals[0]).multiplyScalar(H.y),S.copy(b[0]).add(T).add(E),ge(S.x,S.y,S.z)):ge(H.x,H.y,0)}for(let Y=1;Y<=u;Y++)for(let H=0;H<z;H++){let Q=f?O(C[H],U[H],J):C[H];w?(T.copy(x.normals[Y]).multiplyScalar(Q.x),E.copy(x.binormals[Y]).multiplyScalar(Q.y),S.copy(b[Y]).add(T).add(E),ge(S.x,S.y,S.z)):ge(Q.x,Q.y,h/u*Y)}for(let Y=g-1;Y>=0;Y--){let H=Y/g,Q=d*Math.cos(H*Math.PI/2),ce=m*Math.sin(H*Math.PI/2)+p;for(let ie=0,pe=B.length;ie<pe;ie++){let ve=O(B[ie],ee[ie],ce);ge(ve.x,ve.y,h+Q)}for(let ie=0,pe=M.length;ie<pe;ie++){let ve=M[ie];V=k[ie];for(let me=0,De=ve.length;me<De;me++){let ke=O(ve[me],V[me],ce);w?ge(ke.x,ke.y+b[u-1].y,b[u-1].x+Q):ge(ke.x,ke.y,h+Q)}}}K(),$();function K(){let Y=n.length/3;if(f){let H=0,Q=z*H;for(let ce=0;ce<q;ce++){let ie=R[ce];ae(ie[2]+Q,ie[1]+Q,ie[0]+Q)}H=u+g*2,Q=z*H;for(let ce=0;ce<q;ce++){let ie=R[ce];ae(ie[0]+Q,ie[1]+Q,ie[2]+Q)}}else{for(let H=0;H<q;H++){let Q=R[H];ae(Q[2],Q[1],Q[0])}for(let H=0;H<q;H++){let Q=R[H];ae(Q[0]+z*u,Q[1]+z*u,Q[2]+z*u)}}r.addGroup(Y,n.length/3-Y,0)}function $(){let Y=n.length/3,H=0;j(B,H),H+=B.length;for(let Q=0,ce=M.length;Q<ce;Q++){let ie=M[Q];j(ie,H),H+=ie.length}r.addGroup(Y,n.length/3-Y,1)}function j(Y,H){let Q=Y.length;for(;--Q>=0;){let ce=Q,ie=Q-1;ie<0&&(ie=Y.length-1);for(let pe=0,ve=u+g*2;pe<ve;pe++){let me=z*pe,De=z*(pe+1),ke=H+ce+me,P=H+ie+me,L=H+ie+De,te=H+ce+De;le(ke,P,L,te)}}}function ge(Y,H,Q){l.push(Y),l.push(H),l.push(Q)}function ae(Y,H,Q){W(Y),W(H),W(Q);let ce=n.length/3,ie=v.generateTopUV(r,n,ce-3,ce-2,ce-1);ue(ie[0]),ue(ie[1]),ue(ie[2])}function le(Y,H,Q,ce){W(Y),W(H),W(ce),W(H),W(Q),W(ce);let ie=n.length/3,pe=v.generateSideWallUV(r,n,ie-6,ie-3,ie-2,ie-1);ue(pe[0]),ue(pe[1]),ue(pe[3]),ue(pe[1]),ue(pe[2]),ue(pe[3])}function W(Y){n.push(l[Y*3+0]),n.push(l[Y*3+1]),n.push(l[Y*3+2])}function ue(Y){s.push(Y.x),s.push(Y.y)}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,r=this.parameters.options;return RP(t,r,e)}static fromJSON(e,t){let r=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];r.push(a)}let n=e.options.extrudePath;return n!==void 0&&(e.options.extrudePath=new xb[n.type]().fromJSON(n)),new Os(r,e.options)}},IP={generateTopUV:function(i,e,t,r,n){let s=e[t*3],o=e[t*3+1],a=e[r*3],l=e[r*3+1],c=e[n*3],u=e[n*3+1];return[new N(s,o),new N(a,l),new N(c,u)]},generateSideWallUV:function(i,e,t,r,n,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[r*3],u=e[r*3+1],h=e[r*3+2],f=e[n*3],d=e[n*3+1],m=e[n*3+2],p=e[s*3],g=e[s*3+1],y=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new N(o,1-l),new N(c,1-h),new N(f,1-m),new N(p,1-y)]:[new N(a,1-l),new N(u,1-h),new N(d,1-m),new N(g,1-y)]}};function RP(i,e,t){if(t.shapes=[],Array.isArray(i))for(let r=0,n=i.length;r<n;r++){let s=i[r];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var Ga=class extends Ua{constructor(e=1,t=0){let r=(1+Math.sqrt(5))/2,n=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(n,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ga(e.radius,e.detail)}};var Do=class extends Ie{constructor(e=new tn([new N(0,.5),new N(-.5,-.5),new N(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let r=[],n=[],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(r),this.setAttribute("position",new Le(n,3)),this.setAttribute("normal",new Le(s,3)),this.setAttribute("uv",new Le(o,2));function c(u){let h=n.length/3,f=u.extractPoints(t),d=f.shape,m=f.holes;ni.isClockWise(d)===!1&&(d=d.reverse());for(let g=0,y=m.length;g<y;g++){let v=m[g];ni.isClockWise(v)===!0&&(m[g]=v.reverse())}let p=ni.triangulateShape(d,m);for(let g=0,y=m.length;g<y;g++){let v=m[g];d=d.concat(v)}for(let g=0,y=d.length;g<y;g++){let v=d[g];n.push(v.x,v.y,0),s.push(0,0,1),o.push(v.x,v.y)}for(let g=0,y=p.length;g<y;g++){let v=p[g],b=v[0]+h,w=v[1]+h,x=v[2]+h;r.push(b,w,x),l+=3}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return BP(t,e)}static fromJSON(e,t){let r=[];for(let n=0,s=e.shapes.length;n<s;n++){let o=t[e.shapes[n]];r.push(o)}return new Do(r,e.curveSegments)}};function BP(i,e){if(e.shapes=[],Array.isArray(i))for(let t=0,r=i.length;t<r;t++){let n=i[t];e.shapes.push(n.uuid)}else e.shapes.push(i.uuid);return e}var Po=class extends Ie{constructor(e=1,t=32,r=16,n=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),r=Math.max(2,Math.floor(r));let l=Math.min(o+a,Math.PI),c=0,u=[],h=new A,f=new A,d=[],m=[],p=[],g=[];for(let y=0;y<=r;y++){let v=[],b=y/r,w=0;y==0&&o==0?w=.5/t:y==r&&l==Math.PI&&(w=-.5/t);for(let x=0;x<=t;x++){let E=x/t;h.x=-e*Math.cos(n+E*s)*Math.sin(o+b*a),h.y=e*Math.cos(o+b*a),h.z=e*Math.sin(n+E*s)*Math.sin(o+b*a),m.push(h.x,h.y,h.z),f.copy(h).normalize(),p.push(f.x,f.y,f.z),g.push(E+w,1-b),v.push(c++)}u.push(v)}for(let y=0;y<r;y++)for(let v=0;v<t;v++){let b=u[y][v+1],w=u[y][v],x=u[y+1][v],E=u[y+1][v+1];(y!==0||o>0)&&d.push(b,w,E),(y!==r-1||l<Math.PI)&&d.push(w,x,E)}this.setIndex(d),this.setAttribute("position",new Le(m,3)),this.setAttribute("normal",new Le(p,3)),this.setAttribute("uv",new Le(g,2))}static fromJSON(e){return new Po(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var ka=class extends Ie{constructor(e=1,t=.4,r=64,n=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:n,p:s,q:o},r=Math.floor(r),n=Math.floor(n);let a=[],l=[],c=[],u=[],h=new A,f=new A,d=new A,m=new A,p=new A,g=new A,y=new A;for(let b=0;b<=r;++b){let w=b/r*s*Math.PI*2;v(w,s,o,e,d),v(w+.01,s,o,e,m),g.subVectors(m,d),y.addVectors(m,d),p.crossVectors(g,y),y.crossVectors(p,g),p.normalize(),y.normalize();for(let x=0;x<=n;++x){let E=x/n*Math.PI*2,T=-t*Math.cos(E),S=t*Math.sin(E);h.x=d.x+(T*y.x+S*p.x),h.y=d.y+(T*y.y+S*p.y),h.z=d.z+(T*y.z+S*p.z),l.push(h.x,h.y,h.z),f.subVectors(h,d).normalize(),c.push(f.x,f.y,f.z),u.push(b/r),u.push(x/n)}}for(let b=1;b<=r;b++)for(let w=1;w<=n;w++){let x=(n+1)*(b-1)+(w-1),E=(n+1)*b+(w-1),T=(n+1)*b+w,S=(n+1)*(b-1)+w;a.push(x,E,S),a.push(E,T,S)}this.setIndex(a),this.setAttribute("position",new Le(l,3)),this.setAttribute("normal",new Le(c,3)),this.setAttribute("uv",new Le(u,2));function v(b,w,x,E,T){let S=Math.cos(b),I=Math.sin(b),C=x/w*b,M=Math.cos(C);T.x=E*(2+M)*.5*S,T.y=E*(2+M)*I*.5,T.z=E*Math.sin(C)*.5}}static fromJSON(e){return new ka(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}};var Af=class extends cr{constructor(e){super(),this.type="ShadowMaterial",this.color=new xe(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}};Af.prototype.isShadowMaterial=!0;var Tf=class extends St{constructor(e){super(e),this.type="RawShaderMaterial"}};Tf.prototype.isRawShaderMaterial=!0;var su=class extends cr{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new xe(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 xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qa,this.normalScale=new N(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.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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}};su.prototype.isMeshStandardMaterial=!0;var Ef=class extends su{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new N(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return yr(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new xe(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}};Ef.prototype.isMeshPhysicalMaterial=!0;var _f=class extends cr{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new xe(16777215),this.specular=new xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qa,this.normalScale=new N(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Qf,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}};_f.prototype.isMeshPhongMaterial=!0;var Cf=class extends cr{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qa,this.normalScale=new N(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}};Cf.prototype.isMeshToonMaterial=!0;var Lf=class extends cr{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qa,this.normalScale=new N(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}};Lf.prototype.isMeshNormalMaterial=!0;var Df=class extends cr{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Qf,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}};Df.prototype.isMeshLambertMaterial=!0;var Pf=class extends cr{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qa,this.normalScale=new N(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}};Pf.prototype.isMeshMatcapMaterial=!0;var If=class extends Ur{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}};If.prototype.isLineDashedMaterial=!0;var NP={ShadowMaterial:Af,SpriteMaterial:Zc,RawShaderMaterial:Tf,ShaderMaterial:St,PointsMaterial:$c,MeshPhysicalMaterial:Ef,MeshStandardMaterial:su,MeshPhongMaterial:_f,MeshToonMaterial:Cf,MeshNormalMaterial:Lf,MeshLambertMaterial:Df,MeshDepthMaterial:Jc,MeshDistanceMaterial:Qc,MeshBasicMaterial:Un,MeshMatcapMaterial:Pf,LineDashedMaterial:If,LineBasicMaterial:Ur,Material:cr};cr.fromType=function(i){return new NP[i]};var Yt={arraySlice:function(i,e,t){return Yt.isTypedArray(i)?new i.constructor(i.subarray(e,t!==void 0?t:i.length)):i.slice(e,t)},convertArray:function(i,e,t){return!i||!t&&i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)},isTypedArray:function(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)},getKeyframeOrder:function(i){function e(n,s){return i[n]-i[s]}let t=i.length,r=new Array(t);for(let n=0;n!==t;++n)r[n]=n;return r.sort(e),r},sortedArray:function(i,e,t){let r=i.length,n=new i.constructor(r);for(let s=0,o=0;o!==r;++s){let a=t[s]*e;for(let l=0;l!==e;++l)n[o++]=i[a+l]}return n},flattenJSON:function(i,e,t,r){let n=1,s=i[0];for(;s!==void 0&&s[r]===void 0;)s=i[n++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=i[n++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=i[n++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),t.push(o)),s=i[n++];while(s!==void 0)},subclip:function(i,e,t,r,n=30){let s=i.clone();s.name=e;let o=[];for(let l=0;l<s.tracks.length;++l){let c=s.tracks[l],u=c.getValueSize(),h=[],f=[];for(let d=0;d<c.times.length;++d){let m=c.times[d]*n;if(!(m<t||m>=r)){h.push(c.times[d]);for(let p=0;p<u;++p)f.push(c.values[d*u+p])}}h.length!==0&&(c.times=Yt.convertArray(h,c.times.constructor),c.values=Yt.convertArray(f,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(i,e=0,t=i,r=30){r<=0&&(r=30);let n=t.tracks.length,s=e/r;for(let o=0;o<n;++o){let a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;let c=i.tracks.find(function(y){return y.name===a.name&&y.ValueTypeName===l});if(c===void 0)continue;let u=0,h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let f=0,d=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);let m=a.times.length-1,p;if(s<=a.times[0]){let y=u,v=h-u;p=Yt.arraySlice(a.values,y,v)}else if(s>=a.times[m]){let y=m*h+u,v=y+h-u;p=Yt.arraySlice(a.values,y,v)}else{let y=a.createInterpolant(),v=u,b=h-u;y.evaluate(s),p=Yt.arraySlice(y.resultBuffer,v,b)}l==="quaternion"&&new Ut().fromArray(p).normalize().conjugate().toArray(p);let g=c.times.length;for(let y=0;y<g;++y){let v=y*d+f;if(l==="quaternion")Ut.multiplyQuaternionsFlat(c.values,v,p,0,c.values,v);else{let b=d-f*2;for(let w=0;w<b;++w)c.values[v+w]-=p[w]}}}return i.blendMode=sb,i}},Ti=class{constructor(e,t,r,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=n!==void 0?n:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,r=this._cachedIndex,n=t[r],s=t[r-1];e:{t:{let o;r:{n:if(!(e<n)){for(let a=r+2;;){if(n===void 0){if(e<s)break n;return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,e,s)}if(r===a)break;if(s=n,n=t[++r],e<n)break t}o=t.length;break r}if(!(e>=s)){let a=t[1];e<a&&(r=2,s=a);for(let l=r-2;;){if(s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(r===l)break;if(n=s,s=t[--r-1],e>=s)break t}o=r,r=0;break r}break e}for(;r<o;){let a=r+o>>>1;e<t[a]?o=a:r=a+1}if(n=t[r],s=t[r-1],s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(n===void 0)return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,s,e)}this._cachedIndex=r,this.intervalChanged_(r,s,n)}return this.interpolate_(r,s,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,s=e*n;for(let o=0;o!==n;++o)t[o]=r[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}};Ti.prototype.beforeStart_=Ti.prototype.copySampleValue_;Ti.prototype.afterEnd_=Ti.prototype.copySampleValue_;var Eg=class extends Ti{constructor(e,t,r,n){super(e,t,r,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Aa,endingEnd:Aa}}intervalChanged_(e,t,r){let n=this.parameterPositions,s=e-2,o=e+1,a=n[s],l=n[o];if(a===void 0)switch(this.getSettings_().endingStart){case Ta:s=e,a=2*t-r;break;case uf:s=n.length-2,a=t+n[s]-n[s+1];break;default:s=e,a=r}if(l===void 0)switch(this.getSettings_().endingEnd){case Ta:o=e,l=2*r-t;break;case uf:o=1,l=r+n[1]-n[0];break;default:o=e-1,l=t}let c=(r-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-r),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,d=this._weightNext,m=(r-t)/(n-t),p=m*m,g=p*m,y=-f*g+2*f*p-f*m,v=(1+f)*g+(-1.5-2*f)*p+(-.5+f)*m+1,b=(-1-d)*g+(1.5+d)*p+.5*m,w=d*g-d*p;for(let x=0;x!==a;++x)s[x]=y*o[u+x]+v*o[c+x]+b*o[l+x]+w*o[h+x];return s}},Rf=class extends Ti{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(r-t)/(n-t),h=1-u;for(let f=0;f!==a;++f)s[f]=o[c+f]*h+o[l+f]*u;return s}},_g=class extends Ti{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e){return this.copySampleValue_(e-1)}},kn=class{constructor(e,t,r,n){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Yt.convertArray(t,this.TimeBufferType),this.values=Yt.convertArray(r,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,r;if(t.toJSON!==this.toJSON)r=t.toJSON(e);else{r={name:e.name,times:Yt.convertArray(e.times,Array),values:Yt.convertArray(e.values,Array)};let n=e.getInterpolation();n!==e.DefaultInterpolation&&(r.interpolation=n)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new _g(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Rf(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Eg(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case lf:t=this.InterpolantFactoryMethodDiscrete;break;case cf:t=this.InterpolantFactoryMethodLinear;break;case xm:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let r="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(r);return console.warn("THREE.KeyframeTrack:",r),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return lf;case this.InterpolantFactoryMethodLinear:return cf;case this.InterpolantFactoryMethodSmooth:return xm}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let r=0,n=t.length;r!==n;++r)t[r]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let r=0,n=t.length;r!==n;++r)t[r]*=e}return this}trim(e,t){let r=this.times,n=r.length,s=0,o=n-1;for(;s!==n&&r[s]<e;)++s;for(;o!==-1&&r[o]>t;)--o;if(++o,s!==0||o!==n){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=Yt.arraySlice(r,s,o),this.values=Yt.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 r=this.times,n=this.values,s=r.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=r[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(n!==void 0&&Yt.isTypedArray(n))for(let a=0,l=n.length;a!==l;++a){let c=n[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=Yt.arraySlice(this.times),t=Yt.arraySlice(this.values),r=this.getValueSize(),n=this.getInterpolation()===xm,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(n)l=!0;else{let h=a*r,f=h-r,d=h+r;for(let m=0;m!==r;++m){let p=t[h+m];if(p!==t[f+m]||p!==t[d+m]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let h=a*r,f=o*r;for(let d=0;d!==r;++d)t[f+d]=t[h+d]}++o}}if(s>0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=Yt.arraySlice(e,0,o),this.values=Yt.arraySlice(t,0,o*r)):(this.times=e,this.values=t),this}clone(){let e=Yt.arraySlice(this.times,0),t=Yt.arraySlice(this.values,0),r=this.constructor,n=new r(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}};kn.prototype.TimeBufferType=Float32Array;kn.prototype.ValueBufferType=Float32Array;kn.prototype.DefaultInterpolation=cf;var Fs=class extends kn{};Fs.prototype.ValueTypeName="bool";Fs.prototype.ValueBufferType=Array;Fs.prototype.DefaultInterpolation=lf;Fs.prototype.InterpolantFactoryMethodLinear=void 0;Fs.prototype.InterpolantFactoryMethodSmooth=void 0;var Bf=class extends kn{};Bf.prototype.ValueTypeName="color";var Va=class extends kn{};Va.prototype.ValueTypeName="number";var Cg=class extends Ti{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-t)/(n-t),c=e*a;for(let u=c+a;c!==u;c+=4)Ut.slerpFlat(s,0,o,c-a,o,c,l);return s}},Io=class extends kn{InterpolantFactoryMethodLinear(e){return new Cg(this.times,this.values,this.getValueSize(),e)}};Io.prototype.ValueTypeName="quaternion";Io.prototype.DefaultInterpolation=cf;Io.prototype.InterpolantFactoryMethodSmooth=void 0;var Us=class extends kn{};Us.prototype.ValueTypeName="string";Us.prototype.ValueBufferType=Array;Us.prototype.DefaultInterpolation=lf;Us.prototype.InterpolantFactoryMethodLinear=void 0;Us.prototype.InterpolantFactoryMethodSmooth=void 0;var Ha=class extends kn{};Ha.prototype.ValueTypeName="vector";var Nf=class{constructor(e,t=-1,r,n=Kg){this.name=e,this.tracks=r,this.duration=t,this.blendMode=n,this.uuid=Fn(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],r=e.tracks,n=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)t.push(FP(r[o]).scale(n));let s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){let t=[],r=e.tracks,n={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)t.push(kn.toJSON(r[s]));return n}static CreateFromMorphTargetSequence(e,t,r,n){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=Yt.getKeyframeOrder(l);l=Yt.sortedArray(l,1,u),c=Yt.sortedArray(c,1,u),!n&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new Va(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/r))}return new this(e,-1,o)}static findByName(e,t){let r=e;if(!Array.isArray(e)){let n=e;r=n.geometry&&n.geometry.animations||n.animations}for(let n=0;n<r.length;n++)if(r[n].name===t)return r[n];return null}static CreateClipsFromMorphTargetSequences(e,t,r){let n={},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],f=n[h];f||(n[h]=f=[]),f.push(c)}}let o=[];for(let a in n)o.push(this.CreateFromMorphTargetSequence(a,n[a],t,r));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let r=function(h,f,d,m,p){if(d.length!==0){let g=[],y=[];Yt.flattenJSON(d,g,y,m),g.length!==0&&p.push(new h(f,g,y))}},n=[],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 f=c[h].keys;if(!(!f||f.length===0))if(f[0].morphTargets){let d={},m;for(m=0;m<f.length;m++)if(f[m].morphTargets)for(let p=0;p<f[m].morphTargets.length;p++)d[f[m].morphTargets[p]]=-1;for(let p in d){let g=[],y=[];for(let v=0;v!==f[m].morphTargets.length;++v){let b=f[m];g.push(b.time),y.push(b.morphTarget===p?1:0)}n.push(new Va(".morphTargetInfluence["+p+"]",g,y))}l=d.length*o}else{let d=".bones["+t[h].name+"]";r(Ha,d+".position",f,"pos",n),r(Io,d+".quaternion",f,"rot",n),r(Ha,d+".scale",f,"scl",n)}}return n.length===0?null:new this(s,l,n,a)}resetDuration(){let e=this.tracks,t=0;for(let r=0,n=e.length;r!==n;++r){let s=this.tracks[r];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 OP(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Va;case"vector":case"vector2":case"vector3":case"vector4":return Ha;case"color":return Bf;case"quaternion":return Io;case"bool":case"boolean":return Fs;case"string":return Us}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function FP(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=OP(i.type);if(i.times===void 0){let t=[],r=[];Yt.flattenJSON(i.keys,t,r,"value"),i.times=t,i.values=r}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}var Wa={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}},Ro=class{constructor(e,t,r){let n=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(u){a++,s===!1&&n.onStart!==void 0&&n.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,n.onProgress!==void 0&&n.onProgress(u,o,a),o===a&&(s=!1,n.onLoad!==void 0&&n.onLoad())},this.itemError=function(u){n.onError!==void 0&&n.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,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,f=c.length;h<f;h+=2){let d=c[h],m=c[h+1];if(d.global&&(d.lastIndex=0),d.test(u))return m}return null}}},UP=new Ro,ln=class{constructor(e){this.manager=e!==void 0?e:UP,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let r=this;return new Promise(function(n,s){r.load(e,n,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}},Qi={},is=class extends ln{constructor(e){super(e)}load(e,t,r,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=Wa.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Qi[e]!==void 0){Qi[e].push({onLoad:t,onProgress:r,onError:n});return}Qi[e]=[],Qi[e].push({onLoad:t,onProgress:r,onError:n});let o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;let u=Qi[e],h=c.body.getReader(),f=c.headers.get("Content-Length"),d=f?parseInt(f):0,m=d!==0,p=0,g=new ReadableStream({start(y){v();function v(){h.read().then(({done:b,value:w})=>{if(b)y.close();else{p+=w.byteLength;let x=new ProgressEvent("progress",{lengthComputable:m,loaded:p,total:d});for(let E=0,T=u.length;E<T;E++){let S=u[E];S.onProgress&&S.onProgress(x)}y.enqueue(w),v()}})}}});return new Response(g)}else throw Error(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{let h=/charset="?([^;"\s]*)"?/i.exec(a),f=h&&h[1]?h[1].toLowerCase():void 0,d=new TextDecoder(f);return c.arrayBuffer().then(m=>d.decode(m))}}}).then(c=>{Wa.add(e,c);let u=Qi[e];delete Qi[e];for(let h=0,f=u.length;h<f;h++){let d=u[h];d.onLoad&&d.onLoad(c)}}).catch(c=>{let u=Qi[e];if(u===void 0)throw this.manager.itemError(e),c;delete Qi[e];for(let h=0,f=u.length;h<f;h++){let d=u[h];d.onError&&d.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}};var Of=class extends ln{constructor(e){super(e)}load(e,t,r,n){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=Wa.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;let a=jc("img");function l(){u(),Wa.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),n&&n(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}},Lg=class extends ln{constructor(e){super(e)}load(e,t,r,n){let s=new Rs,o=new Of(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,n)}for(let c=0;c<e.length;++c)l(c);return s}};var Dg=class extends ln{constructor(e){super(e)}load(e,t,r,n){let s=new _t,o=new Of(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},r,n),s}},yn=class extends ot{constructor(e,t=1){super(),this.type="Light",this.color=new xe(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}};yn.prototype.isLight=!0;var zs=class extends yn{constructor(e,t,r){super(e,r),this.type="HemisphereLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.groundColor=new xe(t)}copy(e){return yn.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}};zs.prototype.isHemisphereLight=!0;var H0=new Ee,W0=new A,j0=new A,ou=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new N(512,512),this.map=null,this.mapPass=null,this.matrix=new Ee,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ra,this._frameExtents=new N(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,r=this.matrix;W0.setFromMatrixPosition(e.matrixWorld),t.position.copy(W0),j0.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(j0),t.updateMatrixWorld(),H0.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(H0),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(t.projectionMatrix),r.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}},Ff=class extends ou{constructor(){super(new nr(50,1,.5,500)),this.focus=1}updateMatrices(e){let t=this.camera,r=Wc*2*e.angle*this.focus,n=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(r!==t.fov||n!==t.aspect||s!==t.far)&&(t.fov=r,t.aspect=n,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}};Ff.prototype.isSpotLightShadow=!0;var au=class extends yn{constructor(e,t,r=0,n=Math.PI/3,s=0,o=1){super(e,t),this.type="SpotLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.target=new ot,this.distance=r,this.angle=n,this.penumbra=s,this.decay=o,this.shadow=new Ff}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}};au.prototype.isSpotLight=!0;var q0=new Ee,Bc=new A,Km=new A,Uf=class extends ou{constructor(){super(new nr(90,1,.5,500)),this._frameExtents=new N(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 A(1,0,0),new A(-1,0,0),new A(0,0,1),new A(0,0,-1),new A(0,1,0),new A(0,-1,0)],this._cubeUps=[new A(0,1,0),new A(0,1,0),new A(0,1,0),new A(0,1,0),new A(0,0,1),new A(0,0,-1)]}updateMatrices(e,t=0){let r=this.camera,n=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),Bc.setFromMatrixPosition(e.matrixWorld),r.position.copy(Bc),Km.copy(r.position),Km.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(Km),r.updateMatrixWorld(),n.makeTranslation(-Bc.x,-Bc.y,-Bc.z),q0.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(q0)}};Uf.prototype.isPointLightShadow=!0;var lu=class extends yn{constructor(e,t,r=0,n=1){super(e,t),this.type="PointLight",this.distance=r,this.decay=n,this.shadow=new Uf}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}};lu.prototype.isPointLight=!0;var zf=class extends ou{constructor(){super(new Eo(-5,5,5,-5,.5,500))}};zf.prototype.isDirectionalLightShadow=!0;var cu=class extends yn{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.target=new ot,this.shadow=new zf}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};cu.prototype.isDirectionalLight=!0;var Pg=class extends yn{constructor(e,t){super(e,t),this.type="AmbientLight"}};Pg.prototype.isAmbientLight=!0;var Ig=class extends yn{constructor(e,t,r=10,n=10){super(e,t),this.type="RectAreaLight",this.width=r,this.height=n}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}};Ig.prototype.isRectAreaLight=!0;var Gf=class{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new A)}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 r=e.x,n=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*n),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*r),t.addScaledVector(o[4],1.092548*(r*n)),t.addScaledVector(o[5],1.092548*(n*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(r*s)),t.addScaledVector(o[8],.546274*(r*r-n*n)),t}getIrradianceAt(e,t){let r=e.x,n=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*n),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*r),t.addScaledVector(o[4],2*.429043*r*n),t.addScaledVector(o[5],2*.429043*n*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*r*s),t.addScaledVector(o[8],.429043*(r*r-n*n)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],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 r=this.coefficients;for(let n=0;n<9;n++)r[n].fromArray(e,t+n*3);return this}toArray(e=[],t=0){let r=this.coefficients;for(let n=0;n<9;n++)r[n].toArray(e,t+n*3);return e}static getBasisAt(e,t){let r=e.x,n=e.y,s=e.z;t[0]=.282095,t[1]=.488603*n,t[2]=.488603*s,t[3]=.488603*r,t[4]=1.092548*r*n,t[5]=1.092548*n*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*r*s,t[8]=.546274*(r*r-n*n)}};Gf.prototype.isSphericalHarmonics3=!0;var uu=class extends yn{constructor(e=new Gf,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}};uu.prototype.isLightProbe=!0;var Rg=class{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,n=e.length;r<n;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},kf=class extends Ie{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}};kf.prototype.isInstancedBufferGeometry=!0;var Gs=class extends ln{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new is(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){n?n(l):console.error(l),s.manager.itemError(e)}},r,n)}parse(e){let t={},r={};function n(d,m){if(t[m]!==void 0)return t[m];let g=d.interleavedBuffers[m],y=s(d,g.buffer),v=Ah(g.type,y),b=new rs(v,g.stride);return b.uuid=g.uuid,t[m]=b,b}function s(d,m){if(r[m]!==void 0)return r[m];let g=d.arrayBuffers[m],y=new Uint32Array(g).buffer;return r[m]=y,y}let o=e.isInstancedBufferGeometry?new kf:new Ie,a=e.data.index;if(a!==void 0){let d=Ah(a.type,a.array);o.setIndex(new Ue(d,1))}let l=e.data.attributes;for(let d in l){let m=l[d],p;if(m.isInterleavedBufferAttribute){let g=n(e.data,m.data);p=new Ai(g,m.itemSize,m.offset,m.normalized)}else{let g=Ah(m.type,m.array),y=m.isInstancedBufferAttribute?Ba:Ue;p=new y(g,m.itemSize,m.normalized)}m.name!==void 0&&(p.name=m.name),m.usage!==void 0&&p.setUsage(m.usage),m.updateRange!==void 0&&(p.updateRange.offset=m.updateRange.offset,p.updateRange.count=m.updateRange.count),o.setAttribute(d,p)}let c=e.data.morphAttributes;if(c)for(let d in c){let m=c[d],p=[];for(let g=0,y=m.length;g<y;g++){let v=m[g],b;if(v.isInterleavedBufferAttribute){let w=n(e.data,v.data);b=new Ai(w,v.itemSize,v.offset,v.normalized)}else{let w=Ah(v.type,v.array);b=new Ue(w,v.itemSize,v.normalized)}v.name!==void 0&&(b.name=v.name),p.push(b)}o.morphAttributes[d]=p}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);let h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let d=0,m=h.length;d!==m;++d){let p=h[d];o.addGroup(p.start,p.count,p.materialIndex)}let f=e.data.boundingSphere;if(f!==void 0){let d=new A;f.center!==void 0&&d.fromArray(f.center),o.boundingSphere=new Yr(d,f.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}};var Bg=class extends ln{constructor(e){super(e),typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=Wa.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){Wa.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){n&&n(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}};Bg.prototype.isImageBitmapLoader=!0;var tf,zP={getContext:function(){return tf===void 0&&(tf=new(window.AudioContext||window.webkitAudioContext)),tf},setContext:function(i){tf=i}},Ng=class extends ln{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new is(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);zP.getContext().decodeAudioData(l,function(u){t(u)})}catch(l){n?n(l):console.error(l),s.manager.itemError(e)}},r,n)}},Og=class extends uu{constructor(e,t,r=1){super(void 0,r);let n=new xe().set(e),s=new xe().set(t),o=new A(n.r,n.g,n.b),a=new A(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)}};Og.prototype.isHemisphereLightProbe=!0;var Fg=class extends uu{constructor(e,t=1){super(void 0,t);let r=new xe().set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}};Fg.prototype.isAmbientLightProbe=!0;var Vf=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=X0(),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=X0();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function X0(){return(typeof performance>"u"?Date:performance).now()}var Ug=class extends ot{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 zg=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 r=0;r<t.length;r++)e+=t[r];return e/t.length}},Gg=class{constructor(e,t,r){this.binding=e,this.valueSize=r;let n,s,o;switch(t){case"quaternion":n=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":n=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:n=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=n,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 r=this.buffer,n=this.valueSize,s=e*n+n,o=this.cumulativeWeight;if(o===0){for(let a=0;a!==n;++a)r[s+a]=r[a];o=t}else{o+=t;let a=t/o;this._mixBufferRegion(r,s,0,a,n)}this.cumulativeWeight=o}accumulateAdditive(e){let t=this.buffer,r=this.valueSize,n=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,n,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,r=this.buffer,n=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(r,n,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(r,n,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(r[l]!==r[l+t]){a.setValue(r,n);break}}saveOriginalState(){let e=this.binding,t=this.buffer,r=this.valueSize,n=r*this._origIndex;e.getValue(t,n);for(let s=r,o=n;s!==o;++s)t[s]=t[n+s%r];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 r=e;r<t;r++)this.buffer[r]=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 r=0;r<this.valueSize;r++)this.buffer[t+r]=this.buffer[e+r]}_select(e,t,r,n,s){if(n>=.5)for(let o=0;o!==s;++o)e[t+o]=e[r+o]}_slerp(e,t,r,n){Ut.slerpFlat(e,t,e,t,e,r,n)}_slerpAdditive(e,t,r,n,s){let o=this._workIndex*s;Ut.multiplyQuaternionsFlat(e,o,e,t,e,r),Ut.slerpFlat(e,t,e,t,e,o,n)}_lerp(e,t,r,n,s){let o=1-n;for(let a=0;a!==s;++a){let l=t+a;e[l]=e[l]*o+e[r+a]*n}}_lerpAdditive(e,t,r,n,s){for(let o=0;o!==s;++o){let a=t+o;e[a]=e[a]+e[r+o]*n}}},ty="\\[\\]\\.:\\/",GP=new RegExp("["+ty+"]","g"),ry="[^"+ty+"]",kP="[^"+ty.replace("\\.","")+"]",VP=/((?:WC+[\/:])*)/.source.replace("WC",ry),HP=/(WCOD+)?/.source.replace("WCOD",kP),WP=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ry),jP=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ry),qP=new RegExp("^"+VP+HP+WP+jP+"$"),XP=["material","materials","bones"],kg=class{constructor(e,t,r){let n=r||xt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}getValue(e,t){this.bind();let r=this._targetGroup.nCachedObjects_,n=this._bindings[r];n!==void 0&&n.getValue(e,t)}setValue(e,t){let r=this._bindings;for(let n=this._targetGroup.nCachedObjects_,s=r.length;n!==s;++n)r[n].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}},xt=class{constructor(e,t,r){this.path=t,this.parsedPath=r||xt.parseTrackName(t),this.node=xt.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new xt.Composite(e,t,r):new xt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(GP,"")}static parseTrackName(e){let t=qP.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=r.nodeName&&r.nodeName.lastIndexOf(".");if(n!==void 0&&n!==-1){let s=r.nodeName.substring(n+1);XP.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,n),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){let r=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=r(a.children);if(l)return l}return null},n=r(e.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)e[t++]=r[n]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,r=t.objectName,n=t.propertyName,s=t.propertyIndex;if(e||(e=xt.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(r){let c=t.objectIndex;switch(r){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[r]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}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[n];if(o===void 0){let c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+n+" 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(n==="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=n;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}};xt.Composite=kg;xt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};xt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};xt.prototype.GetterByBindingType=[xt.prototype._getValue_direct,xt.prototype._getValue_array,xt.prototype._getValue_arrayElement,xt.prototype._getValue_toArray];xt.prototype.SetterByBindingTypeAndVersioning=[[xt.prototype._setValue_direct,xt.prototype._setValue_direct_setNeedsUpdate,xt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[xt.prototype._setValue_array,xt.prototype._setValue_array_setNeedsUpdate,xt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[xt.prototype._setValue_arrayElement,xt.prototype._setValue_arrayElement_setNeedsUpdate,xt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[xt.prototype._setValue_fromArray,xt.prototype._setValue_fromArray_setNeedsUpdate,xt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Vg=class{constructor(){this.uuid=Fn(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let e={};this._indicesByUUID=e;for(let r=0,n=arguments.length;r!==n;++r)e[arguments[r].uuid]=r;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,r=this._paths,n=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 f=arguments[u],d=f.uuid,m=t[d];if(m===void 0){m=l++,t[d]=m,e.push(f);for(let p=0,g=o;p!==g;++p)s[p].push(new xt(f,r[p],n[p]))}else if(m<c){a=e[m];let p=--c,g=e[p];t[g.uuid]=m,e[m]=g,t[d]=p,e[p]=f;for(let y=0,v=o;y!==v;++y){let b=s[y],w=b[p],x=b[m];b[m]=w,x===void 0&&(x=new xt(f,r[y],n[y])),b[p]=x}}else e[m]!==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,r=this._bindings,n=r.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++,f=e[h];t[f.uuid]=u,e[u]=f,t[c]=h,e[h]=l;for(let d=0,m=n;d!==m;++d){let p=r[d],g=p[h],y=p[u];p[u]=g,p[h]=y}}}this.nCachedObjects_=s}uncache(){let e=this._objects,t=this._indicesByUUID,r=this._bindings,n=r.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 f=--s,d=e[f],m=--o,p=e[m];t[d.uuid]=h,e[h]=d,t[p.uuid]=f,e[f]=p,e.pop();for(let g=0,y=n;g!==y;++g){let v=r[g],b=v[f],w=v[m];v[h]=b,v[f]=w,v.pop()}}else{let f=--o,d=e[f];f>0&&(t[d.uuid]=h),e[h]=d,e.pop();for(let m=0,p=n;m!==p;++m){let g=r[m];g[h]=g[f],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){let r=this._bindingsIndicesByPath,n=r[e],s=this._bindings;if(n!==void 0)return s[n];let o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);n=s.length,r[e]=n,o.push(e),a.push(t),s.push(h);for(let f=u,d=l.length;f!==d;++f){let m=l[f];h[f]=new xt(m,e,t)}return h}unsubscribe_(e){let t=this._bindingsIndicesByPath,r=t[e];if(r!==void 0){let n=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),n[r]=n[a],n.pop()}}};Vg.prototype.isAnimationObjectGroup=!0;var Hg=class{constructor(e,t,r=null,n=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=n;let s=t.tracks,o=s.length,a=new Array(o),l={endingStart:Aa,endingEnd:Aa};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=aE,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,r){if(e.fadeOut(t),this.fadeIn(t),r){let n=this._clip.duration,s=e._clip.duration,o=s/n,a=n/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,r){return e.crossFadeFrom(this,t,r)}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,r){let n=this._mixer,s=n.time,o=this.timeScale,a=this._timeScaleInterpolant;a===null&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);let l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+r,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,r,n){if(!this.enabled){this._updateWeight(e);return}let s=this._startTime;if(s!==null){let l=(e-s)*r;if(l<0||r===0)return;this._startTime=null,t=r*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 sb:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case Kg:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(n,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let r=this._weightInterpolant;if(r!==null){let n=r.evaluate(e)[0];t*=n,e>r.parameterPositions[1]&&(this.stopFading(),n===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let r=this._timeScaleInterpolant;r!==null&&(t*=r.evaluate(e)[0],e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,r=this.loop,n=this.time+e,s=this._loopCount,o=r===lE;if(e===0)return s===-1?n:o&&(s&1)===1?t-n:n;if(r===oE){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(n>=t)n=t;else if(n<0)n=0;else{this.time=n;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),n>=t||n<0){let a=Math.floor(n/t);n-=t*a,s+=Math.abs(a);let l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=e>0?t:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){let c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=n;if(o&&(s&1)===1)return t-n}return n}_setEndings(e,t,r){let n=this._interpolantSettings;r?(n.endingStart=Ta,n.endingEnd=Ta):(e?n.endingStart=this.zeroSlopeAtStart?Ta:Aa:n.endingStart=uf,t?n.endingEnd=this.zeroSlopeAtEnd?Ta:Aa:n.endingEnd=uf)}_scheduleFading(e,t,r){let n=this._mixer,s=n.time,o=this._weightInterpolant;o===null&&(o=n._lendControlInterpolant(),this._weightInterpolant=o);let a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=r,this}},Wg=class extends jt{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let r=e._localRoot||this._root,n=e._clip.tracks,s=n.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName,u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){let f=n[h],d=f.name,m=u[d];if(m!==void 0)++m.referenceCount,o[h]=m;else{if(m=o[h],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,d));continue}let p=t&&t._propertyBindings[h].binding.parsedPath;m=new Gg(xt.create(r,d,p),f.ValueTypeName,f.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,d),o[h]=m}a[h].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let r=(e._localRoot||this._root).uuid,n=e._clip.uuid,s=this._actionsByClip[n];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,n,r)}let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];--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,r){let n=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=n.length,n.push(e),o.actionByRoot[r]=e}_removeInactiveAction(e){let t=this._actions,r=t[t.length-1],n=e._cacheIndex;r._cacheIndex=n,t[n]=r,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,f=(e._localRoot||this._root).uuid;delete h[f],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){let t=this._actions,r=e._cacheIndex,n=this._nActiveActions++,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_takeBackAction(e){let t=this._actions,r=e._cacheIndex,n=--this._nActiveActions,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_addInactiveBinding(e,t,r){let n=this._bindingsByRootAndName,s=this._bindings,o=n[t];o===void 0&&(o={},n[t]=o),o[r]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){let t=this._bindings,r=e.binding,n=r.rootNode.uuid,s=r.path,o=this._bindingsByRootAndName,a=o[n],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[n]}_lendBinding(e){let t=this._bindings,r=e._cacheIndex,n=this._nActiveBindings++,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_takeBackBinding(e){let t=this._bindings,r=e._cacheIndex,n=--this._nActiveBindings,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return r===void 0&&(r=new Rf(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=t,e[t]=r),r}_takeBackControlInterpolant(e){let t=this._controlInterpolants,r=e.__cacheIndex,n=--this._nActiveControlInterpolants,s=t[n];e.__cacheIndex=n,t[n]=e,s.__cacheIndex=r,t[r]=s}clipAction(e,t,r){let n=t||this._root,s=n.uuid,o=typeof e=="string"?Nf.findByName(n,e):e,a=o!==null?o.uuid:e,l=this._actionsByClip[a],c=null;if(r===void 0&&(o!==null?r=o.blendMode:r=Kg),l!==void 0){let h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===r)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;let u=new Hg(this,o,t,r);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){let r=t||this._root,n=r.uuid,s=typeof e=="string"?Nf.findByName(r,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[n]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let r=t-1;r>=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;let t=this._actions,r=this._nActiveActions,n=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)t[c]._update(n,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,r=e.uuid,n=this._actionsByClip,s=n[r];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 n[r]}}uncacheRoot(e){let t=e.uuid,r=this._actionsByClip;for(let o in r){let a=r[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}let n=this._bindingsByRootAndName,s=n[t];if(s!==void 0)for(let o in s){let a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){let r=this.existingAction(e,t);r!==null&&(this._deactivateAction(r),this._removeInactiveAction(r))}};Wg.prototype._controlInterpolantsResultBuffer=new Float32Array(1);var Te=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 Te(this.value.clone===void 0?this.value:this.value.clone())}},jg=class extends rs{constructor(e,t,r=1){super(e,t),this.meshPerAttribute=r}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}};jg.prototype.isInstancedInterleavedBuffer=!0;var qg=class{constructor(e,t,r,n,s){this.buffer=e,this.type=t,this.itemSize=r,this.elementSize=n,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}};qg.prototype.isGLBufferAttribute=!0;var Hf=class{constructor(e,t,r=0,n=1/0){this.ray=new si(e,t),this.near=r,this.far=n,this.camera=null,this.layers=new Xc,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,r=[]){return Xg(e,this,r,t),r.sort(Y0),r}intersectObjects(e,t=!0,r=[]){for(let n=0,s=e.length;n<s;n++)Xg(e[n],this,r,t);return r.sort(Y0),r}};function Y0(i,e){return i.distance-e.distance}function Xg(i,e,t,r){if(i.layers.test(e.layers)&&i.raycast(e,t),r===!0){let n=i.children;for(let s=0,o=n.length;s<o;s++)Xg(n[s],e,t,!0)}}var hu=class{constructor(e=1,t=0,r=0){return this.radius=e,this.phi=t,this.theta=r,this}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(yr(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var J0=new N,Bo=class{constructor(e=new N(1/0,1/0),t=new N(-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,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=J0.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),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 J0.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)}};Bo.prototype.isBox2=!0;var Q0=new A,rf=new A,Qr=class{constructor(e=new A,t=new A){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){Q0.subVectors(e,this.start),rf.subVectors(this.end,this.start);let r=rf.dot(rf),s=rf.dot(Q0)/r;return t&&(s=yr(s,0,1)),s}closestPointToPoint(e,t,r){let n=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(n).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)}},K0=new A,Wf=class extends ot{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;let r=new Ie,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){let c=o/l*Math.PI*2,u=a/l*Math.PI*2;n.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}r.setAttribute("position",new Le(n,3));let s=new Ur({fog:!1,toneMapped:!1});this.cone=new ai(r,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),K0.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(K0),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},As=new A,nf=new Ee,Zm=new Ee,Yg=class extends ai{constructor(e){let t=Mb(e),r=new Ie,n=[],s=[],o=new xe(0,0,1),a=new xe(0,1,0);for(let c=0;c<t.length;c++){let u=t[c];u.parent&&u.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}r.setAttribute("position",new Le(n,3)),r.setAttribute("color",new Le(s,3));let l=new Ur({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(r,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,r=this.geometry,n=r.getAttribute("position");Zm.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){let a=t[s];a.parent&&a.parent.isBone&&(nf.multiplyMatrices(Zm,a.matrixWorld),As.setFromMatrixPosition(nf),n.setXYZ(o,As.x,As.y,As.z),nf.multiplyMatrices(Zm,a.parent.matrixWorld),As.setFromMatrixPosition(nf),n.setXYZ(o+1,As.x,As.y,As.z),o+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}};function Mb(i){let e=[];i.isBone===!0&&e.push(i);for(let t=0;t<i.children.length;t++)e.push.apply(e,Mb(i.children[t]));return e}var jf=class extends Gt{constructor(e,t,r){let n=new Po(t,4,2),s=new Un({wireframe:!0,fog:!1,toneMapped:!1});super(n,s),this.light=e,this.light.updateMatrixWorld(),this.color=r,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 Jg=class extends ai{constructor(e=10,t=10,r=4473924,n=8947848){r=new xe(r),n=new xe(n);let s=t/2,o=e/t,a=e/2,l=[],c=[];for(let f=0,d=0,m=-a;f<=t;f++,m+=o){l.push(-a,0,m,a,0,m),l.push(m,0,-a,m,0,a);let p=f===s?r:n;p.toArray(c,d),d+=3,p.toArray(c,d),d+=3,p.toArray(c,d),d+=3,p.toArray(c,d),d+=3}let u=new Ie;u.setAttribute("position",new Le(l,3)),u.setAttribute("color",new Le(c,3));let h=new Ur({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}};var Z0=new A,sf=new A,$0=new A,qf=class extends ot{constructor(e,t,r){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,t===void 0&&(t=1);let n=new Ie;n.setAttribute("position",new Le([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let s=new Ur({fog:!1,toneMapped:!1});this.lightPlane=new ns(n,s),this.add(this.lightPlane),n=new Ie,n.setAttribute("position",new Le([0,0,0,0,0,1],3)),this.targetLine=new ns(n,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){Z0.setFromMatrixPosition(this.light.matrixWorld),sf.setFromMatrixPosition(this.light.target.matrixWorld),$0.subVectors(sf,Z0),this.lightPlane.lookAt(sf),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(sf),this.targetLine.scale.z=$0.length()}},of=new A,rr=new zn,Vn=class extends ai{constructor(e){let t=new Ie,r=new Ur({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],s=[],o={},a=new xe(16755200),l=new xe(16711680),c=new xe(43775),u=new xe(16777215),h=new xe(3355443);f("n1","n2",a),f("n2","n4",a),f("n4","n3",a),f("n3","n1",a),f("f1","f2",a),f("f2","f4",a),f("f4","f3",a),f("f3","f1",a),f("n1","f1",a),f("n2","f2",a),f("n3","f3",a),f("n4","f4",a),f("p","n1",l),f("p","n2",l),f("p","n3",l),f("p","n4",l),f("u1","u2",c),f("u2","u3",c),f("u3","u1",c),f("c","t",u),f("p","c",h),f("cn1","cn2",h),f("cn3","cn4",h),f("cf1","cf2",h),f("cf3","cf4",h);function f(m,p,g){d(m,g),d(p,g)}function d(m,p){n.push(0,0,0),s.push(p.r,p.g,p.b),o[m]===void 0&&(o[m]=[]),o[m].push(n.length/3-1)}t.setAttribute("position",new Le(n,3)),t.setAttribute("color",new Le(s,3)),super(t,r),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,r=1,n=1;rr.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),ar("c",t,e,rr,0,0,-1),ar("t",t,e,rr,0,0,1),ar("n1",t,e,rr,-r,-n,-1),ar("n2",t,e,rr,r,-n,-1),ar("n3",t,e,rr,-r,n,-1),ar("n4",t,e,rr,r,n,-1),ar("f1",t,e,rr,-r,-n,1),ar("f2",t,e,rr,r,-n,1),ar("f3",t,e,rr,-r,n,1),ar("f4",t,e,rr,r,n,1),ar("u1",t,e,rr,r*.7,n*1.1,-1),ar("u2",t,e,rr,-r*.7,n*1.1,-1),ar("u3",t,e,rr,0,n*2,-1),ar("cf1",t,e,rr,-r,0,1),ar("cf2",t,e,rr,r,0,1),ar("cf3",t,e,rr,0,-n,1),ar("cf4",t,e,rr,0,n,1),ar("cn1",t,e,rr,-r,0,-1),ar("cn2",t,e,rr,r,0,-1),ar("cn3",t,e,rr,0,-n,-1),ar("cn4",t,e,rr,0,n,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function ar(i,e,t,r,n,s,o){of.set(n,s,o).unproject(r);let a=e[i];if(a!==void 0){let l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],of.x,of.y,of.z)}}var No=class extends ai{constructor(e,t=16776960){let r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Ie;s.setIndex(new Ue(r,1)),s.setAttribute("position",new Le(n,3)),super(s,new Ur({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 Xf=class extends ai{constructor(e=1){let t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],n=new Ie;n.setAttribute("position",new Le(t,3)),n.setAttribute("color",new Le(r,3));let s=new Ur({vertexColors:!0,toneMapped:!1});super(n,s),this.type="AxesHelper"}setColors(e,t,r){let n=new xe,s=this.geometry.attributes.color.array;return n.set(e),n.toArray(s,0),n.toArray(s,3),n.set(t),n.toArray(s,6),n.toArray(s,9),n.set(r),n.toArray(s,12),n.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},Yf=class{constructor(){this.type="ShapePath",this.color=new xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Na,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,n){return this.currentPath.quadraticCurveTo(e,t,r,n),this}bezierCurveTo(e,t,r,n,s,o){return this.currentPath.bezierCurveTo(e,t,r,n,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function r(v){let b=[];for(let w=0,x=v.length;w<x;w++){let E=v[w],T=new tn;T.curves=E.curves,b.push(T)}return b}function n(v,b){let w=b.length,x=!1;for(let E=w-1,T=0;T<w;E=T++){let S=b[E],I=b[T],C=I.x-S.x,M=I.y-S.y;if(Math.abs(M)>Number.EPSILON){if(M<0&&(S=b[T],C=-C,I=b[E],M=-M),v.y<S.y||v.y>I.y)continue;if(v.y===S.y){if(v.x===S.x)return!0}else{let _=M*(v.x-S.x)-C*(v.y-S.y);if(_===0)return!0;if(_<0)continue;x=!x}}else{if(v.y!==S.y)continue;if(I.x<=v.x&&v.x<=S.x||S.x<=v.x&&v.x<=I.x)return!0}}return x}let s=ni.isClockWise,o=this.subPaths;if(o.length===0)return[];if(t===!0)return r(o);let a,l,c,u=[];if(o.length===1)return l=o[0],c=new tn,c.curves=l.curves,u.push(c),u;let h=!s(o[0].getPoints());h=e?!h:h;let f=[],d=[],m=[],p=0,g;d[p]=void 0,m[p]=[];for(let v=0,b=o.length;v<b;v++)l=o[v],g=l.getPoints(),a=s(g),a=e?!a:a,a?(!h&&d[p]&&p++,d[p]={s:new tn,p:g},d[p].s.curves=l.curves,h&&p++,m[p]=[]):m[p].push({h:l,p:g[0]});if(!d[0])return r(o);if(d.length>1){let v=!1,b=0;for(let w=0,x=d.length;w<x;w++)f[w]=[];for(let w=0,x=d.length;w<x;w++){let E=m[w];for(let T=0;T<E.length;T++){let S=E[T],I=!0;for(let C=0;C<d.length;C++)n(S.p,d[C].p)&&(w!==C&&b++,I?(I=!1,f[C].push(S)):v=!0);I&&f[w].push(S)}}b>0&&v===!1&&(m=f)}let y;for(let v=0,b=d.length;v<b;v++){c=d[v].s,u.push(c),y=m[v];for(let w=0,x=y.length;w<x;w++)c.holes.push(y[w].h)}return u}};var Ab=new ArrayBuffer(4),Gz=new Float32Array(Ab),kz=new Uint32Array(Ab),wi=new Uint32Array(512),Si=new Uint32Array(512);for(let i=0;i<256;++i){let e=i-127;e<-27?(wi[i]=0,wi[i|256]=32768,Si[i]=24,Si[i|256]=24):e<-14?(wi[i]=1024>>-e-14,wi[i|256]=1024>>-e-14|32768,Si[i]=-e-1,Si[i|256]=-e-1):e<=15?(wi[i]=e+15<<10,wi[i|256]=e+15<<10|32768,Si[i]=13,Si[i|256]=13):e<128?(wi[i]=31744,wi[i|256]=64512,Si[i]=24,Si[i|256]=24):(wi[i]=31744,wi[i|256]=64512,Si[i]=13,Si[i|256]=13)}var Tb=new Uint32Array(2048),fu=new Uint32Array(64),YP=new Uint32Array(64);for(let i=1;i<1024;++i){let e=i<<13,t=0;for(;(e&8388608)===0;)e<<=1,t-=8388608;e&=-8388609,t+=947912704,Tb[i]=e|t}for(let i=1024;i<2048;++i)Tb[i]=939524096+(i-1024<<13);for(let i=1;i<31;++i)fu[i]=i<<23;fu[31]=1199570944;fu[32]=2147483648;for(let i=33;i<63;++i)fu[i]=2147483648+(i-32<<23);fu[63]=3347054592;for(let i=1;i<64;++i)i!==32&&(YP[i]=1024);gn.create=function(i,e){return console.log("THREE.Curve.create() has been deprecated"),i.prototype=Object.create(gn.prototype),i.prototype.constructor=i,i.prototype.getPoint=e,i};Na.prototype.fromPoints=function(i){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(i)};Jg.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Yg.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};ln.prototype.extractUrlBase=function(i){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Rg.extractUrlBase(i)};ln.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.")}};Bo.prototype.center=function(i){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(i)};Bo.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Bo.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};Bo.prototype.size=function(i){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(i)};Qt.prototype.center=function(i){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(i)};Qt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Qt.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};Qt.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};Qt.prototype.size=function(i){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(i)};pn.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")};Yr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Ra.prototype.setFromMatrix=function(i){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(i)};Qr.prototype.center=function(i){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(i)};Nt.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};Nt.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Nt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};Nt.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Nt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};Nt.prototype.getInverse=function(i){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};Ee.prototype.extractPosition=function(i){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(i)};Ee.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};Ee.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new A().setFromMatrixColumn(this,3)};Ee.prototype.setRotationFromQuaternion=function(i){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(i)};Ee.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};Ee.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Ee.prototype.multiplyVector4=function(i){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Ee.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};Ee.prototype.rotateAxis=function(i){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),i.transformDirection(this)};Ee.prototype.crossVector=function(i){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Ee.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};Ee.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};Ee.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};Ee.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};Ee.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};Ee.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Ee.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};Ee.prototype.makeFrustum=function(i,e,t,r,n,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(i,e,r,t,n,s)};Ee.prototype.getInverse=function(i){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};Fr.prototype.isIntersectionLine=function(i){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(i)};Ut.prototype.multiplyVector3=function(i){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),i.applyQuaternion(this)};Ut.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};si.prototype.isIntersectionBox=function(i){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};si.prototype.isIntersectionPlane=function(i){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(i)};si.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};Jt.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};Jt.prototype.barycoordFromPoint=function(i,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(i,e)};Jt.prototype.midpoint=function(i){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(i)};Jt.prototypenormal=function(i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(i)};Jt.prototype.plane=function(i){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(i)};Jt.barycoordFromPoint=function(i,e,t,r,n){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Jt.getBarycoord(i,e,t,r,n)};Jt.normal=function(i,e,t,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Jt.getNormal(i,e,t,r)};tn.prototype.extractAllPoints=function(i){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(i)};tn.prototype.extrude=function(i){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Os(this,i)};tn.prototype.makeGeometry=function(i){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Do(this,i)};N.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};N.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};N.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};A.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};A.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};A.prototype.getPositionFromMatrix=function(i){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(i)};A.prototype.getScaleFromMatrix=function(i){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(i)};A.prototype.getColumnFromMatrix=function(i,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,i)};A.prototype.applyProjection=function(i){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(i)};A.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};A.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};A.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Qe.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};Qe.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};ot.prototype.getChildByName=function(i){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(i)};ot.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};ot.prototype.translate=function(i,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,i)};ot.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};ot.prototype.applyMatrix=function(i){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(ot.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(i){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=i}},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."),ob},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.")}}});vf.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};nr.prototype.setLens=function(i,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(i)};Object.defineProperties(yn.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(i){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=i}},shadowCameraLeft:{set:function(i){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=i}},shadowCameraRight:{set:function(i){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=i}},shadowCameraTop:{set:function(i){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=i}},shadowCameraBottom:{set:function(i){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=i}},shadowCameraNear:{set:function(i){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=i}},shadowCameraFar:{set:function(i){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=i}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(i){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=i}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(i){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=i}},shadowMapHeight:{set:function(i){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=i}}});Object.defineProperties(Ue.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===hf},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(hf)}}});Ue.prototype.setDynamic=function(i){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?hf:Hc),this};Ue.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Ue.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Ie.prototype.addIndex=function(i){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(i)};Ie.prototype.addAttribute=function(i,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(i,new Ue(arguments[1],arguments[2]))):i==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(i,e)};Ie.prototype.addDrawCall=function(i,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(i,e)};Ie.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};Ie.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};Ie.prototype.removeAttribute=function(i){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(i)};Ie.prototype.applyMatrix=function(i){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(Ie.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}}});rs.prototype.setDynamic=function(i){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?hf:Hc),this};rs.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Os.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};Os.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};Os.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};sn.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};Te.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this};Object.defineProperties(cr.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 xe}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(i){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=i===tb}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(i){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=i}},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(St.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(i){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=i}}});Ct.prototype.clearTarget=function(i,e,t,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(i),this.clear(e,t,r)};Ct.prototype.animate=function(i){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(i)};Ct.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};Ct.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};Ct.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};Ct.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};Ct.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};Ct.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};Ct.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};Ct.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};Ct.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};Ct.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};Ct.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};Ct.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};Ct.prototype.enableScissorTest=function(i){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(i)};Ct.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};Ct.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};Ct.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};Ct.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};Ct.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};Ct.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};Ct.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};Ct.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};Ct.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};Ct.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(Ct.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(i){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=i}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(i){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=i}},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(i){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=i===!0?je:rn}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});Object.defineProperties(yb.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(mt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(i){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=i}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(i){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=i}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(i){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=i}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(i){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=i}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(i){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=i}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(i){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=i}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(i){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=i}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(i){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=i}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(i){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=i}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(i){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=i}}});Ug.prototype.load=function(i){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");let e=this;return new Ng().load(i,function(r){e.setBuffer(r)}),this};zg.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};Yc.prototype.updateCubeMap=function(i,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(i,e)};Yc.prototype.clear=function(i,e,t,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(i,e,t,r)};es.crossOrigin=void 0;es.loadTexture=function(i,e,t,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");let n=new Dg;n.setCrossOrigin(this.crossOrigin);let s=n.load(i,t,void 0,r);return e&&(s.mapping=e),s};es.loadTextureCube=function(i,e,t,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");let n=new Lg;n.setCrossOrigin(this.crossOrigin);let s=n.load(i,t,void 0,r);return e&&(s.mapping=e),s};es.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};es.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var Jf=class extends mt{constructor(e,t,r){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,r),this.samples=4}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Oo}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Oo);var Ya=".",du=Symbol("target"),ny=Symbol("unsubscribe");function pu(i){return i instanceof Date||i instanceof Set||i instanceof Map||i instanceof WeakSet||i instanceof WeakMap||ArrayBuffer.isView(i)}function Eb(i){return(typeof i=="object"?i===null:typeof i!="function")||i instanceof RegExp}var _n=Array.isArray;function Fo(i){return typeof i=="symbol"}var JP={after:(i,e)=>_n(i)?i.slice(e.length):e===""?i:i.slice(e.length+1),concat:(i,e)=>_n(i)?(i=[...i],e&&i.push(e),i):e&&e.toString!==void 0?(i!==""&&(i+=Ya),Fo(e)?i+e.toString():i+e):i,initial:i=>{if(_n(i))return i.slice(0,-1);if(i==="")return i;let e=i.lastIndexOf(Ya);return e===-1?"":i.slice(0,e)},last:i=>{if(_n(i))return i[i.length-1]||"";if(i==="")return i;let e=i.lastIndexOf(Ya);return e===-1?i:i.slice(e+1)},walk:(i,e)=>{if(_n(i))for(let t of i)e(t);else if(i!==""){let t=0,r=i.indexOf(Ya);if(r===-1)e(i);else for(;t<i.length;)r===-1&&(r=i.length),e(i.slice(t,r)),t=r+1,r=i.indexOf(Ya,t)}},get(i,e){return this.walk(e,t=>{i&&(i=i[t])}),i}},cn=JP;function iy(i){return typeof i=="object"&&typeof i.next=="function"}function sy(i,e,t,r,n){let s=i.next;if(e.name==="entries")i.next=function(){let o=s.call(this);return o.done===!1&&(o.value[0]=n(o.value[0],e,o.value[0],r),o.value[1]=n(o.value[1],e,o.value[0],r)),o};else if(e.name==="values"){let o=t[du].keys();i.next=function(){let a=s.call(this);return a.done===!1&&(a.value=n(a.value,e,o.next().value,r)),a}}else i.next=function(){let o=s.call(this);return o.done===!1&&(o.value=n(o.value,e,o.value,r)),o};return i}function $f(i,e,t){return i.isUnsubscribed||e.ignoreSymbols&&Fo(t)||e.ignoreUnderscores&&t.charAt(0)==="_"||"ignoreKeys"in e&&e.ignoreKeys.includes(t)}var mu=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return this._descriptorCache===void 0&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),r=t.get(e);return r===void 0&&(r={},t.set(e,r)),r}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let r=this._getProperties(e),n=r[t];return n===void 0&&(n=Reflect.getOwnPropertyDescriptor(e,t),r[t]=n),n}getProxy(e,t,r,n){if(this.isUnsubscribed)return e;let s=e[n],o=s||e;this._pathCache.set(o,t);let a=this._proxyCache.get(o);return a===void 0&&(a=s===void 0?new Proxy(e,r):e,this._proxyCache.set(o,a)),a}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,cn.get(t,this.getPath(e)))}defineProperty(e,t,r){return Reflect.defineProperty(e,t,r)?(this.isUnsubscribed||(this._getProperties(e)[t]=r),!0):!1}setProperty(e,t,r,n,s){if(!this._equals(s,r)||!(t in e)){let o=this._getOwnPropertyDescriptor(e,t);return o!==void 0&&"set"in o?Reflect.set(e,t,r,n):Reflect.set(e,t,r)}return!0}deleteProperty(e,t,r){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let n=this._getDescriptorCache().get(e);n&&(delete n[t],this._pathCache.delete(r))}return!0}return!1}isSameDescriptor(e,t,r){let n=this._getOwnPropertyDescriptor(t,r);return e!==void 0&&n!==void 0&&Object.is(e.value,n.value)&&(e.writable||!1)===(n.writable||!1)&&(e.enumerable||!1)===(n.enumerable||!1)&&(e.configurable||!1)===(n.configurable||!1)&&e.get===n.get&&e.set===n.set}isGetInvariant(e,t){let r=this._getOwnPropertyDescriptor(e,t);return r!==void 0&&r.configurable!==!0&&r.writable!==!0}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function Ja(i){return toString.call(i)==="[object Object]"}function Qa(){return!0}function Vs(i,e){return i.length!==e.length||i.some((t,r)=>e[r]!==t)}var ed=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]);var QP=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),oy={push:Qa,pop:Qa,shift:Qa,unshift:Qa,copyWithin:Vs,reverse:Vs,sort:Vs,splice:Vs,flat:Vs,fill:Vs},_b=new Set([...ed,...QP,...Object.keys(oy)]);function Ka(i,e){if(i.size!==e.size)return!0;for(let t of i)if(!e.has(t))return!0;return!1}var ay=["keys","values","entries"],ly=new Set(["has","toString"]),cy={add:Ka,clear:Ka,delete:Ka,forEach:Ka},Cb=new Set([...ly,...Object.keys(cy),...ay]);function Za(i,e){if(i.size!==e.size)return!0;let t;for(let[r,n]of i)if(t=e.get(r),t!==n||t===void 0&&!e.has(r))return!0;return!1}var KP=new Set([...ly,"get"]),uy={set:Za,clear:Za,delete:Za,forEach:Za},Lb=new Set([...KP,...Object.keys(uy),...ay]);var Dr=class{constructor(e,t,r,n){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=n,this._changes=n?[]:null,this.clone=t===void 0?e:this._shallowClone(e)}static isHandledMethod(e){return ed.has(e)}_shallowClone(e){let t=e;if(Ja(e))t=se({},e);else if(_n(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(r=>this._shallowClone(r)));else if(e instanceof Map){t=new Map;for(let[r,n]of e.entries())t.set(r,this._shallowClone(n))}return this._clonedCache.add(t),t}preferredThisArg(e,t,r,n){return e?(_n(n)?this._onIsChanged=oy[t]:n instanceof Set?this._onIsChanged=cy[t]:n instanceof Map&&(this._onIsChanged=uy[t]),n):r}update(e,t,r){let n=cn.after(e,this._path);if(t!=="length"){let s=this.clone;cn.walk(n,o=>{s&&s[o]&&(this._clonedCache.has(s[o])||(s[o]=this._shallowClone(s[o])),s=s[o])}),this._hasOnValidate&&this._changes.push({path:n,property:t,previous:r}),s&&s[t]&&(s[t]=r)}this._isChanged=!0}undo(e){let t;for(let r=this._changes.length-1;r!==-1;r--)t=this._changes[r],cn.get(e,t.path)[t.property]=t.previous}isChanged(e){return this._onIsChanged===void 0?this._isChanged:this._onIsChanged(this.clone,e)}};var $a=class extends Dr{static isHandledMethod(e){return _b.has(e)}};var gu=class extends Dr{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}};var el=class extends Dr{static isHandledMethod(e){return Cb.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}};var tl=class extends Dr{static isHandledMethod(e){return Lb.has(e)}undo(e){for(let[t,r]of this.clone.entries())e.set(t,r);for(let t of e.keys())this.clone.has(t)||e.delete(t)}};var yu=class extends Dr{constructor(e,t,r,n){super(void 0,t,r,n),this._arg1=r[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}};var vu=class extends Dr{constructor(e,t,r,n){super(void 0,t,r,n),this._weakKey=r[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}};var ci=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return Ja(e)||_n(e)||pu(e)}static isHandledMethod(e,t){return Ja(e)?Dr.isHandledMethod(t):_n(e)?$a.isHandledMethod(t):e instanceof Set?el.isHandledMethod(t):e instanceof Map?tl.isHandledMethod(t):pu(e)}get isCloning(){return this._stack.length>0}start(e,t,r){let n=Dr;_n(e)?n=$a:e instanceof Date?n=gu:e instanceof Set?n=el:e instanceof Map?n=tl:e instanceof WeakSet?n=yu:e instanceof WeakMap&&(n=vu),this._stack.push(new n(e,t,r,this._hasOnValidate))}update(e,t,r){this._stack[this._stack.length-1].update(e,t,r)}preferredThisArg(e,t,r){let{name:n}=e,s=ci.isHandledMethod(r,n);return this._stack[this._stack.length-1].preferredThisArg(s,n,t,r)}isChanged(e,t,r){return this._stack[this._stack.length-1].isChanged(e,t,r)}undo(e){this._previousClone!==void 0&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}};var ZP={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},hy=(i,e,t={})=>{t=se(se({},ZP),t);let r=Symbol("ProxyTarget"),{equals:n,isShallow:s,ignoreDetached:o,details:a}=t,l=new mu(n),c=typeof t.onValidate=="function",u=new ci(c),h=(v,b,w,x,E)=>!c||u.isCloning||t.onValidate(cn.concat(l.getPath(v),b),w,x,E)===!0,f=(v,b,w,x)=>{!$f(l,t,b)&&!(o&&l.isDetached(v,i))&&d(l.getPath(v),b,w,x)},d=(v,b,w,x,E)=>{u.isCloning?u.update(v,b,x):e(cn.concat(v,b),w,x,E)},m=v=>v&&(v[r]||v),p=(v,b,w,x)=>Eb(v)||w==="constructor"||s&&!ci.isHandledMethod(b,w)||$f(l,t,w)||l.isGetInvariant(b,w)||o&&l.isDetached(b,i)?v:(x===void 0&&(x=l.getPath(b)),l.getProxy(v,cn.concat(x,w),g,r)),g={get(v,b,w){if(Fo(b)){if(b===r||b===du)return v;if(b===ny&&!l.isUnsubscribed&&l.getPath(v).length===0)return l.unsubscribe(),v}let x=pu(v)?Reflect.get(v,b):Reflect.get(v,b,w);return p(x,v,b)},set(v,b,w,x){w=m(w);let E=v[r]||v,T=E[b];if(n(T,w)&&b in v)return!0;let S=h(v,b,w,T);return S&&l.setProperty(E,b,w,x,T)?(f(v,b,v[b],T),!0):!S},defineProperty(v,b,w){if(!l.isSameDescriptor(w,v,b)){let x=v[b];h(v,b,w.value,x)&&l.defineProperty(v,b,w,x)&&f(v,b,w.value,x)}return!0},deleteProperty(v,b){if(!Reflect.has(v,b))return!0;let w=Reflect.get(v,b),x=h(v,b,void 0,w);return x&&l.deleteProperty(v,b,w)?(f(v,b,void 0,w),!0):!x},apply(v,b,w){let x=b[r]||b;if(l.isUnsubscribed)return Reflect.apply(v,x,w);if((a===!1||a!==!0&&!a.includes(v.name))&&ci.isHandledType(x)){let E=cn.initial(l.getPath(v)),T=ci.isHandledMethod(x,v.name);u.start(x,E,w);let S=Reflect.apply(v,u.preferredThisArg(v,b,x),T?w.map(M=>m(M)):w),I=u.isChanged(x,n),C=u.stop();if(ci.isHandledType(S)&&T&&(b instanceof Map&&v.name==="get"&&(E=cn.concat(E,w[0])),S=l.getProxy(S,E,g)),I){let M={name:v.name,args:w,result:S},_=u.isCloning?cn.initial(E):E,R=u.isCloning?cn.last(E):"";h(cn.get(i,_),R,x,C,M)?d(_,R,x,C,M):u.undo(x)}return(b instanceof Map||b instanceof Set)&&iy(S)?sy(S,v,b,E,p):S}return Reflect.apply(v,b,w)}},y=l.getProxy(i,t.pathAsArray?[]:"",g);return e=e.bind(y),c&&(t.onValidate=t.onValidate.bind(y)),y};hy.target=i=>i&&i[du]||i;hy.unsubscribe=i=>i[ny]||i;var fy=hy;var $P=typeof global=="object"&&global&&global.Object===Object&&global,td=$P;var e2=typeof self=="object"&&self&&self.Object===Object&&self,t2=td||e2||Function("return this")(),sr=t2;var r2=sr.Symbol,un=r2;var Db=Object.prototype,n2=Db.hasOwnProperty,i2=Db.toString,xu=un?un.toStringTag:void 0;function s2(i){var e=n2.call(i,xu),t=i[xu];try{i[xu]=void 0;var r=!0}catch{}var n=i2.call(i);return r&&(e?i[xu]=t:delete i[xu]),n}var Pb=s2;var o2=Object.prototype,a2=o2.toString;function l2(i){return a2.call(i)}var Ib=l2;var c2="[object Null]",u2="[object Undefined]",Rb=un?un.toStringTag:void 0;function h2(i){return i==null?i===void 0?u2:c2:Rb&&Rb in Object(i)?Pb(i):Ib(i)}var Cn=h2;function f2(i){return i!=null&&typeof i=="object"}var Kr=f2;var d2="[object Symbol]";function p2(i){return typeof i=="symbol"||Kr(i)&&Cn(i)==d2}var Hs=p2;function m2(i,e){for(var t=-1,r=i==null?0:i.length,n=Array(r);++t<r;)n[t]=e(i[t],t,i);return n}var rd=m2;var g2=Array.isArray,zr=g2;var y2=1/0,Bb=un?un.prototype:void 0,Nb=Bb?Bb.toString:void 0;function Ob(i){if(typeof i=="string")return i;if(zr(i))return rd(i,Ob)+"";if(Hs(i))return Nb?Nb.call(i):"";var e=i+"";return e=="0"&&1/i==-y2?"-0":e}var Fb=Ob;var v2=/\s/;function x2(i){for(var e=i.length;e--&&v2.test(i.charAt(e)););return e}var Ub=x2;var b2=/^\s+/;function w2(i){return i&&i.slice(0,Ub(i)+1).replace(b2,"")}var zb=w2;function S2(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var ur=S2;var Gb=0/0,M2=/^[-+]0x[0-9a-f]+$/i,A2=/^0b[01]+$/i,T2=/^0o[0-7]+$/i,E2=parseInt;function _2(i){if(typeof i=="number")return i;if(Hs(i))return Gb;if(ur(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=ur(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=zb(i);var t=A2.test(i);return t||T2.test(i)?E2(i.slice(2),t?2:8):M2.test(i)?Gb:+i}var dy=_2;function C2(i){return i}var nd=C2;var L2="[object AsyncFunction]",D2="[object Function]",P2="[object GeneratorFunction]",I2="[object Proxy]";function R2(i){if(!ur(i))return!1;var e=Cn(i);return e==D2||e==P2||e==L2||e==I2}var rl=R2;var B2=sr["__core-js_shared__"],id=B2;var kb=function(){var i=/[^.]+$/.exec(id&&id.keys&&id.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function N2(i){return!!kb&&kb in i}var Vb=N2;var O2=Function.prototype,F2=O2.toString;function U2(i){if(i!=null){try{return F2.call(i)}catch{}try{return i+""}catch{}}return""}var ss=U2;var z2=/[\\^$.*+?()[\]{}|]/g,G2=/^\[object .+?Constructor\]$/,k2=Function.prototype,V2=Object.prototype,H2=k2.toString,W2=V2.hasOwnProperty,j2=RegExp("^"+H2.call(W2).replace(z2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function q2(i){if(!ur(i)||Vb(i))return!1;var e=rl(i)?j2:G2;return e.test(ss(i))}var Hb=q2;function X2(i,e){return i==null?void 0:i[e]}var Wb=X2;function Y2(i,e){var t=Wb(i,e);return Hb(t)?t:void 0}var vn=Y2;var J2=vn(sr,"WeakMap"),sd=J2;var jb=Object.create,Q2=function(){function i(){}return function(e){if(!ur(e))return{};if(jb)return jb(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}}(),qb=Q2;function K2(i,e,t){switch(t.length){case 0:return i.call(e);case 1:return i.call(e,t[0]);case 2:return i.call(e,t[0],t[1]);case 3:return i.call(e,t[0],t[1],t[2])}return i.apply(e,t)}var Xb=K2;function Z2(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e}var od=Z2;var $2=800,eI=16,tI=Date.now;function rI(i){var e=0,t=0;return function(){var r=tI(),n=eI-(r-t);if(t=r,n>0){if(++e>=$2)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}var Yb=rI;function nI(i){return function(){return i}}var Jb=nI;var iI=function(){try{var i=vn(Object,"defineProperty");return i({},"",{}),i}catch{}}(),nl=iI;var sI=nl?function(i,e){return nl(i,"toString",{configurable:!0,enumerable:!1,value:Jb(e),writable:!0})}:nd,Qb=sI;var oI=Yb(Qb),ad=oI;function aI(i,e){for(var t=-1,r=i==null?0:i.length;++t<r&&e(i[t],t,i)!==!1;);return i}var Kb=aI;var lI=9007199254740991,cI=/^(?:0|[1-9]\d*)$/;function uI(i,e){var t=typeof i;return e=e==null?lI:e,!!e&&(t=="number"||t!="symbol"&&cI.test(i))&&i>-1&&i%1==0&&i<e}var ld=uI;function hI(i,e,t){e=="__proto__"&&nl?nl(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}var il=hI;function fI(i,e){return i===e||i!==i&&e!==e}var Ws=fI;var dI=Object.prototype,pI=dI.hasOwnProperty;function mI(i,e,t){var r=i[e];(!(pI.call(i,e)&&Ws(r,t))||t===void 0&&!(e in i))&&il(i,e,t)}var cd=mI;function gI(i,e,t,r){var n=!t;t||(t={});for(var s=-1,o=e.length;++s<o;){var a=e[s],l=r?r(t[a],i[a],a,t,i):void 0;l===void 0&&(l=i[a]),n?il(t,a,l):cd(t,a,l)}return t}var Hn=gI;var Zb=Math.max;function yI(i,e,t){return e=Zb(e===void 0?i.length-1:e,0),function(){for(var r=arguments,n=-1,s=Zb(r.length-e,0),o=Array(s);++n<s;)o[n]=r[e+n];n=-1;for(var a=Array(e+1);++n<e;)a[n]=r[n];return a[e]=t(o),Xb(i,this,a)}}var ud=yI;function vI(i,e){return ad(ud(i,e,nd),i+"")}var $b=vI;var xI=9007199254740991;function bI(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=xI}var hd=bI;function wI(i){return i!=null&&hd(i.length)&&!rl(i)}var js=wI;function SI(i,e,t){if(!ur(t))return!1;var r=typeof e;return(r=="number"?js(t)&&ld(e,t.length):r=="string"&&e in t)?Ws(t[e],i):!1}var ew=SI;function MI(i){return $b(function(e,t){var r=-1,n=t.length,s=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(s=i.length>3&&typeof s=="function"?(n--,s):void 0,o&&ew(t[0],t[1],o)&&(s=n<3?void 0:s,n=1),e=Object(e);++r<n;){var a=t[r];a&&i(e,a,r,s)}return e})}var tw=MI;var AI=Object.prototype;function TI(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||AI;return i===t}var sl=TI;function EI(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r}var rw=EI;var _I="[object Arguments]";function CI(i){return Kr(i)&&Cn(i)==_I}var py=CI;var nw=Object.prototype,LI=nw.hasOwnProperty,DI=nw.propertyIsEnumerable,PI=py(function(){return arguments}())?py:function(i){return Kr(i)&&LI.call(i,"callee")&&!DI.call(i,"callee")},Uo=PI;function II(){return!1}var iw=II;var aw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,sw=aw&&typeof module=="object"&&module&&!module.nodeType&&module,RI=sw&&sw.exports===aw,ow=RI?sr.Buffer:void 0,BI=ow?ow.isBuffer:void 0,NI=BI||iw,ol=NI;var OI="[object Arguments]",FI="[object Array]",UI="[object Boolean]",zI="[object Date]",GI="[object Error]",kI="[object Function]",VI="[object Map]",HI="[object Number]",WI="[object Object]",jI="[object RegExp]",qI="[object Set]",XI="[object String]",YI="[object WeakMap]",JI="[object ArrayBuffer]",QI="[object DataView]",KI="[object Float32Array]",ZI="[object Float64Array]",$I="[object Int8Array]",eR="[object Int16Array]",tR="[object Int32Array]",rR="[object Uint8Array]",nR="[object Uint8ClampedArray]",iR="[object Uint16Array]",sR="[object Uint32Array]",qt={};qt[KI]=qt[ZI]=qt[$I]=qt[eR]=qt[tR]=qt[rR]=qt[nR]=qt[iR]=qt[sR]=!0;qt[OI]=qt[FI]=qt[JI]=qt[UI]=qt[QI]=qt[zI]=qt[GI]=qt[kI]=qt[VI]=qt[HI]=qt[WI]=qt[jI]=qt[qI]=qt[XI]=qt[YI]=!1;function oR(i){return Kr(i)&&hd(i.length)&&!!qt[Cn(i)]}var lw=oR;function aR(i){return function(e){return i(e)}}var al=aR;var cw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,bu=cw&&typeof module=="object"&&module&&!module.nodeType&&module,lR=bu&&bu.exports===cw,my=lR&&td.process,cR=function(){try{var i=bu&&bu.require&&bu.require("util").types;return i||my&&my.binding&&my.binding("util")}catch{}}(),os=cR;var uw=os&&os.isTypedArray,uR=uw?al(uw):lw,fd=uR;var hR=Object.prototype,fR=hR.hasOwnProperty;function dR(i,e){var t=zr(i),r=!t&&Uo(i),n=!t&&!r&&ol(i),s=!t&&!r&&!n&&fd(i),o=t||r||n||s,a=o?rw(i.length,String):[],l=a.length;for(var c in i)(e||fR.call(i,c))&&!(o&&(c=="length"||n&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||ld(c,l)))&&a.push(c);return a}var dd=dR;function pR(i,e){return function(t){return i(e(t))}}var pd=pR;var mR=pd(Object.keys,Object),hw=mR;var gR=Object.prototype,yR=gR.hasOwnProperty;function vR(i){if(!sl(i))return hw(i);var e=[];for(var t in Object(i))yR.call(i,t)&&t!="constructor"&&e.push(t);return e}var fw=vR;function xR(i){return js(i)?dd(i):fw(i)}var ll=xR;function bR(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var dw=bR;var wR=Object.prototype,SR=wR.hasOwnProperty;function MR(i){if(!ur(i))return dw(i);var e=sl(i),t=[];for(var r in i)r=="constructor"&&(e||!SR.call(i,r))||t.push(r);return t}var pw=MR;function AR(i){return js(i)?dd(i,!0):pw(i)}var Ei=AR;var TR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ER=/^\w*$/;function _R(i,e){if(zr(i))return!1;var t=typeof i;return t=="number"||t=="symbol"||t=="boolean"||i==null||Hs(i)?!0:ER.test(i)||!TR.test(i)||e!=null&&i in Object(e)}var mw=_R;var CR=vn(Object,"create"),as=CR;function LR(){this.__data__=as?as(null):{},this.size=0}var gw=LR;function DR(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var yw=DR;var PR="__lodash_hash_undefined__",IR=Object.prototype,RR=IR.hasOwnProperty;function BR(i){var e=this.__data__;if(as){var t=e[i];return t===PR?void 0:t}return RR.call(e,i)?e[i]:void 0}var vw=BR;var NR=Object.prototype,OR=NR.hasOwnProperty;function FR(i){var e=this.__data__;return as?e[i]!==void 0:OR.call(e,i)}var xw=FR;var UR="__lodash_hash_undefined__";function zR(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=as&&e===void 0?UR:e,this}var bw=zR;function cl(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}cl.prototype.clear=gw;cl.prototype.delete=yw;cl.prototype.get=vw;cl.prototype.has=xw;cl.prototype.set=bw;var gy=cl;function GR(){this.__data__=[],this.size=0}var ww=GR;function kR(i,e){for(var t=i.length;t--;)if(Ws(i[t][0],e))return t;return-1}var qs=kR;var VR=Array.prototype,HR=VR.splice;function WR(i){var e=this.__data__,t=qs(e,i);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():HR.call(e,t,1),--this.size,!0}var Sw=WR;function jR(i){var e=this.__data__,t=qs(e,i);return t<0?void 0:e[t][1]}var Mw=jR;function qR(i){return qs(this.__data__,i)>-1}var Aw=qR;function XR(i,e){var t=this.__data__,r=qs(t,i);return r<0?(++this.size,t.push([i,e])):t[r][1]=e,this}var Tw=XR;function ul(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}ul.prototype.clear=ww;ul.prototype.delete=Sw;ul.prototype.get=Mw;ul.prototype.has=Aw;ul.prototype.set=Tw;var Xs=ul;var YR=vn(sr,"Map"),Ys=YR;function JR(){this.size=0,this.__data__={hash:new gy,map:new(Ys||Xs),string:new gy}}var Ew=JR;function QR(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}var _w=QR;function KR(i,e){var t=i.__data__;return _w(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Js=KR;function ZR(i){var e=Js(this,i).delete(i);return this.size-=e?1:0,e}var Cw=ZR;function $R(i){return Js(this,i).get(i)}var Lw=$R;function eB(i){return Js(this,i).has(i)}var Dw=eB;function tB(i,e){var t=Js(this,i),r=t.size;return t.set(i,e),this.size+=t.size==r?0:1,this}var Pw=tB;function hl(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}hl.prototype.clear=Ew;hl.prototype.delete=Cw;hl.prototype.get=Lw;hl.prototype.has=Dw;hl.prototype.set=Pw;var wu=hl;var rB="Expected a function";function yy(i,e){if(typeof i!="function"||e!=null&&typeof e!="function")throw new TypeError(rB);var t=function(){var r=arguments,n=e?e.apply(this,r):r[0],s=t.cache;if(s.has(n))return s.get(n);var o=i.apply(this,r);return t.cache=s.set(n,o)||s,o};return t.cache=new(yy.Cache||wu),t}yy.Cache=wu;var Iw=yy;var nB=500;function iB(i){var e=Iw(i,function(r){return t.size===nB&&t.clear(),r}),t=e.cache;return e}var Rw=iB;var sB=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,oB=/\\(\\)?/g,aB=Rw(function(i){var e=[];return i.charCodeAt(0)===46&&e.push(""),i.replace(sB,function(t,r,n,s){e.push(n?s.replace(oB,"$1"):r||t)}),e}),Bw=aB;function lB(i){return i==null?"":Fb(i)}var Nw=lB;function cB(i,e){return zr(i)?i:mw(i,e)?[i]:Bw(Nw(i))}var fl=cB;var uB=1/0;function hB(i){if(typeof i=="string"||Hs(i))return i;var e=i+"";return e=="0"&&1/i==-uB?"-0":e}var md=hB;function fB(i,e){e=fl(e,i);for(var t=0,r=e.length;i!=null&&t<r;)i=i[md(e[t++])];return t&&t==r?i:void 0}var Ow=fB;function dB(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i}var dl=dB;var Fw=un?un.isConcatSpreadable:void 0;function pB(i){return zr(i)||Uo(i)||!!(Fw&&i&&i[Fw])}var Uw=pB;function zw(i,e,t,r,n){var s=-1,o=i.length;for(t||(t=Uw),n||(n=[]);++s<o;){var a=i[s];e>0&&t(a)?e>1?zw(a,e-1,t,r,n):dl(n,a):r||(n[n.length]=a)}return n}var Gw=zw;function mB(i){var e=i==null?0:i.length;return e?Gw(i,1):[]}var kw=mB;function gB(i){return ad(ud(i,void 0,kw),i+"")}var Vw=gB;var yB=pd(Object.getPrototypeOf,Object),pl=yB;var vB="[object Object]",xB=Function.prototype,bB=Object.prototype,Hw=xB.toString,wB=bB.hasOwnProperty,SB=Hw.call(Object);function MB(i){if(!Kr(i)||Cn(i)!=vB)return!1;var e=pl(i);if(e===null)return!0;var t=wB.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Hw.call(t)==SB}var gd=MB;function AB(i,e,t){var r=-1,n=i.length;e<0&&(e=-e>n?0:n+e),t=t>n?n:t,t<0&&(t+=n),n=e>t?0:t-e>>>0,e>>>=0;for(var s=Array(n);++r<n;)s[r]=i[r+e];return s}var Ww=AB;function TB(){this.__data__=new Xs,this.size=0}var jw=TB;function EB(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}var qw=EB;function _B(i){return this.__data__.get(i)}var Xw=_B;function CB(i){return this.__data__.has(i)}var Yw=CB;var LB=200;function DB(i,e){var t=this.__data__;if(t instanceof Xs){var r=t.__data__;if(!Ys||r.length<LB-1)return r.push([i,e]),this.size=++t.size,this;t=this.__data__=new wu(r)}return t.set(i,e),this.size=t.size,this}var Jw=DB;function ml(i){var e=this.__data__=new Xs(i);this.size=e.size}ml.prototype.clear=jw;ml.prototype.delete=qw;ml.prototype.get=Xw;ml.prototype.has=Yw;ml.prototype.set=Jw;var yd=ml;function PB(i,e){return i&&Hn(e,ll(e),i)}var Qw=PB;function IB(i,e){return i&&Hn(e,Ei(e),i)}var Kw=IB;var tS=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zw=tS&&typeof module=="object"&&module&&!module.nodeType&&module,RB=Zw&&Zw.exports===tS,$w=RB?sr.Buffer:void 0,eS=$w?$w.allocUnsafe:void 0;function BB(i,e){if(e)return i.slice();var t=i.length,r=eS?eS(t):new i.constructor(t);return i.copy(r),r}var vd=BB;function NB(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var o=i[t];e(o,t,i)&&(s[n++]=o)}return s}var rS=NB;function OB(){return[]}var xd=OB;var FB=Object.prototype,UB=FB.propertyIsEnumerable,nS=Object.getOwnPropertySymbols,zB=nS?function(i){return i==null?[]:(i=Object(i),rS(nS(i),function(e){return UB.call(i,e)}))}:xd,gl=zB;function GB(i,e){return Hn(i,gl(i),e)}var iS=GB;var kB=Object.getOwnPropertySymbols,VB=kB?function(i){for(var e=[];i;)dl(e,gl(i)),i=pl(i);return e}:xd,bd=VB;function HB(i,e){return Hn(i,bd(i),e)}var sS=HB;function WB(i,e,t){var r=e(i);return zr(i)?r:dl(r,t(i))}var wd=WB;function jB(i){return wd(i,ll,gl)}var oS=jB;function qB(i){return wd(i,Ei,bd)}var Sd=qB;var XB=vn(sr,"DataView"),Md=XB;var YB=vn(sr,"Promise"),Ad=YB;var JB=vn(sr,"Set"),Td=JB;var aS="[object Map]",QB="[object Object]",lS="[object Promise]",cS="[object Set]",uS="[object WeakMap]",hS="[object DataView]",KB=ss(Md),ZB=ss(Ys),$B=ss(Ad),eN=ss(Td),tN=ss(sd),zo=Cn;(Md&&zo(new Md(new ArrayBuffer(1)))!=hS||Ys&&zo(new Ys)!=aS||Ad&&zo(Ad.resolve())!=lS||Td&&zo(new Td)!=cS||sd&&zo(new sd)!=uS)&&(zo=function(i){var e=Cn(i),t=e==QB?i.constructor:void 0,r=t?ss(t):"";if(r)switch(r){case KB:return hS;case ZB:return aS;case $B:return lS;case eN:return cS;case tN:return uS}return e});var yl=zo;var rN=Object.prototype,nN=rN.hasOwnProperty;function iN(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&nN.call(i,"index")&&(t.index=i.index,t.input=i.input),t}var fS=iN;var sN=sr.Uint8Array,vy=sN;function oN(i){var e=new i.constructor(i.byteLength);return new vy(e).set(new vy(i)),e}var vl=oN;function aN(i,e){var t=e?vl(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength)}var dS=aN;var lN=/\w*$/;function cN(i){var e=new i.constructor(i.source,lN.exec(i));return e.lastIndex=i.lastIndex,e}var pS=cN;var mS=un?un.prototype:void 0,gS=mS?mS.valueOf:void 0;function uN(i){return gS?Object(gS.call(i)):{}}var yS=uN;function hN(i,e){var t=e?vl(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length)}var Ed=hN;var fN="[object Boolean]",dN="[object Date]",pN="[object Map]",mN="[object Number]",gN="[object RegExp]",yN="[object Set]",vN="[object String]",xN="[object Symbol]",bN="[object ArrayBuffer]",wN="[object DataView]",SN="[object Float32Array]",MN="[object Float64Array]",AN="[object Int8Array]",TN="[object Int16Array]",EN="[object Int32Array]",_N="[object Uint8Array]",CN="[object Uint8ClampedArray]",LN="[object Uint16Array]",DN="[object Uint32Array]";function PN(i,e,t){var r=i.constructor;switch(e){case bN:return vl(i);case fN:case dN:return new r(+i);case wN:return dS(i,t);case SN:case MN:case AN:case TN:case EN:case _N:case CN:case LN:case DN:return Ed(i,t);case pN:return new r;case mN:case vN:return new r(i);case gN:return pS(i);case yN:return new r;case xN:return yS(i)}}var vS=PN;function IN(i){return typeof i.constructor=="function"&&!sl(i)?qb(pl(i)):{}}var _d=IN;var RN="[object Map]";function BN(i){return Kr(i)&&yl(i)==RN}var xS=BN;var bS=os&&os.isMap,NN=bS?al(bS):xS,wS=NN;var ON="[object Set]";function FN(i){return Kr(i)&&yl(i)==ON}var SS=FN;var MS=os&&os.isSet,UN=MS?al(MS):SS,AS=UN;var zN=1,GN=2,kN=4,TS="[object Arguments]",VN="[object Array]",HN="[object Boolean]",WN="[object Date]",jN="[object Error]",ES="[object Function]",qN="[object GeneratorFunction]",XN="[object Map]",YN="[object Number]",_S="[object Object]",JN="[object RegExp]",QN="[object Set]",KN="[object String]",ZN="[object Symbol]",$N="[object WeakMap]",e3="[object ArrayBuffer]",t3="[object DataView]",r3="[object Float32Array]",n3="[object Float64Array]",i3="[object Int8Array]",s3="[object Int16Array]",o3="[object Int32Array]",a3="[object Uint8Array]",l3="[object Uint8ClampedArray]",c3="[object Uint16Array]",u3="[object Uint32Array]",Vt={};Vt[TS]=Vt[VN]=Vt[e3]=Vt[t3]=Vt[HN]=Vt[WN]=Vt[r3]=Vt[n3]=Vt[i3]=Vt[s3]=Vt[o3]=Vt[XN]=Vt[YN]=Vt[_S]=Vt[JN]=Vt[QN]=Vt[KN]=Vt[ZN]=Vt[a3]=Vt[l3]=Vt[c3]=Vt[u3]=!0;Vt[jN]=Vt[ES]=Vt[$N]=!1;function Cd(i,e,t,r,n,s){var o,a=e&zN,l=e&GN,c=e&kN;if(t&&(o=n?t(i,r,n,s):t(i)),o!==void 0)return o;if(!ur(i))return i;var u=zr(i);if(u){if(o=fS(i),!a)return od(i,o)}else{var h=yl(i),f=h==ES||h==qN;if(ol(i))return vd(i,a);if(h==_S||h==TS||f&&!n){if(o=l||f?{}:_d(i),!a)return l?sS(i,Kw(o,i)):iS(i,Qw(o,i))}else{if(!Vt[h])return n?i:{};o=vS(i,h,a)}}s||(s=new yd);var d=s.get(i);if(d)return d;s.set(i,o),AS(i)?i.forEach(function(g){o.add(Cd(g,e,t,g,i,s))}):wS(i)&&i.forEach(function(g,y){o.set(y,Cd(g,e,t,y,i,s))});var m=c?l?Sd:oS:l?Ei:ll,p=u?void 0:m(i);return Kb(p||i,function(g,y){p&&(y=g,g=i[y]),cd(o,y,Cd(g,e,t,y,i,s))}),o}var Ld=Cd;var h3=1,f3=4;function d3(i){return Ld(i,h3|f3)}var Su=d3;function p3(i){return function(e,t,r){for(var n=-1,s=Object(e),o=r(e),a=o.length;a--;){var l=o[i?a:++n];if(t(s[l],l,s)===!1)break}return e}}var CS=p3;var m3=CS(),LS=m3;var g3=function(){return sr.Date.now()},Dd=g3;var y3="Expected a function",v3=Math.max,x3=Math.min;function b3(i,e,t){var r,n,s,o,a,l,c=0,u=!1,h=!1,f=!0;if(typeof i!="function")throw new TypeError(y3);e=dy(e)||0,ur(t)&&(u=!!t.leading,h="maxWait"in t,s=h?v3(dy(t.maxWait)||0,e):s,f="trailing"in t?!!t.trailing:f);function d(E){var T=r,S=n;return r=n=void 0,c=E,o=i.apply(S,T),o}function m(E){return c=E,a=setTimeout(y,e),u?d(E):o}function p(E){var T=E-l,S=E-c,I=e-T;return h?x3(I,s-S):I}function g(E){var T=E-l,S=E-c;return l===void 0||T>=e||T<0||h&&S>=s}function y(){var E=Dd();if(g(E))return v(E);a=setTimeout(y,p(E))}function v(E){return a=void 0,f&&r?d(E):(r=n=void 0,o)}function b(){a!==void 0&&clearTimeout(a),c=0,r=l=n=a=void 0}function w(){return a===void 0?o:v(Dd())}function x(){var E=Dd(),T=g(E);if(r=arguments,n=this,l=E,T){if(a===void 0)return m(l);if(h)return clearTimeout(a),a=setTimeout(y,e),d(l)}return a===void 0&&(a=setTimeout(y,e)),o}return x.cancel=b,x.flush=w,x}var Mu=b3;function w3(i,e,t){(t!==void 0&&!Ws(i[e],t)||t===void 0&&!(e in i))&&il(i,e,t)}var Au=w3;function S3(i){return Kr(i)&&js(i)}var DS=S3;function M3(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}var Tu=M3;function A3(i){return Hn(i,Ei(i))}var PS=A3;function T3(i,e,t,r,n,s,o){var a=Tu(i,t),l=Tu(e,t),c=o.get(l);if(c){Au(i,t,c);return}var u=s?s(a,l,t+"",i,e,o):void 0,h=u===void 0;if(h){var f=zr(l),d=!f&&ol(l),m=!f&&!d&&fd(l);u=l,f||d||m?zr(a)?u=a:DS(a)?u=od(a):d?(h=!1,u=vd(l,!0)):m?(h=!1,u=Ed(l,!0)):u=[]:gd(l)||Uo(l)?(u=a,Uo(a)?u=PS(a):(!ur(a)||rl(a))&&(u=_d(l))):h=!1}h&&(o.set(l,u),n(u,l,r,s,o),o.delete(l)),Au(i,t,u)}var IS=T3;function RS(i,e,t,r,n){i!==e&&LS(e,function(s,o){if(n||(n=new yd),ur(s))IS(i,e,o,t,RS,r,n);else{var a=r?r(Tu(i,o),s,o+"",i,e,n):void 0;a===void 0&&(a=s),Au(i,o,a)}},Ei)}var BS=RS;function E3(i){var e=i==null?0:i.length;return e?i[e-1]:void 0}var NS=E3;function _3(i,e){return e.length<2?i:Ow(i,Ww(e,0,-1))}var OS=_3;var C3=tw(function(i,e,t){BS(i,e,t)}),Go=C3;function L3(i,e){return e=fl(e,i),i=OS(i,e),i==null||delete i[md(NS(e))]}var FS=L3;function D3(i){return gd(i)?void 0:i}var US=D3;var P3=1,I3=2,R3=4,B3=Vw(function(i,e){var t={};if(i==null)return t;var r=!1;e=rd(e,function(s){return s=fl(s,i),r||(r=s.length>1),s}),Hn(i,Sd(i),t),r&&(t=Ld(t,P3|I3|R3,US));for(var n=e.length;n--;)FS(t,e[n]);return t}),xl=B3;var N3=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().includes(" electron/"),O3=()=>typeof window>"u"?!1:window.navigator.platform.toUpperCase().includes("MAC"),F3=()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(window.navigator.userAgent)||Eu&&"ontouchend"in document,U3=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,z3=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0,Sj=N3(),Eu=O3(),_u=F3(),zS=U3(),Pd=z3();function GS(i){return Array.isArray(i)?i:[i]}function Id(i){return Eu?i.metaKey:i.ctrlKey}var Qs;(t=>{t.all=["PerspectiveCamera","OrthographicCamera"];function e(r){return t.all.includes(r)}t.is=e})(Qs||(Qs={}));var ko;(n=>{n.DefaultUp=[0,1,0],n.DefaultTargetOffset=1e3,n.defaultData={far:1e5,type:"OrthographicCamera",perspective:{near:5,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:n.DefaultUp,isUpVectorFlipped:!1,targetOffset:n.DefaultTargetOffset};function r(s){return s.type==="PerspectiveCamera"?s.perspective.zoom:s.orthographic.zoom}n.getZoom=r})(ko||(ko={}));var ls;(t=>{function i(r,n){return r[0]===n[0]&&r[1]===n[1]}t.isEqual=i;function e(r,n,s){return[r[0]+(n[0]-r[0])*s,r[1]+(n[1]-r[1])*s]}t.lerp=e})(ls||(ls={}));var vr;(n=>{function i(s,o){return s[0]===o[0]&&s[1]===o[1]&&s[2]===o[2]}n.isEqual=i;function e(s,o){return[s[0]+o[0],s[1]+o[1],s[2]+o[2]]}n.add=e;function t(s,o){return[s[0]-o[0],s[1]-o[1],s[2]-o[2]]}n.sub=t;function r(s,o,a){return[s[0]+(o[0]-s[0])*a,s[1]+(o[1]-s[1])*a,s[2]+(o[2]-s[2])*a]}n.lerp=r})(vr||(vr={}));var Cu;(t=>{function i(r,n){return r[0]===n[0]&&r[1]===n[1]&&r[2]===n[2]&&r[3]===n[3]}t.isEqual=i;function e(r,n,s){return[r[0]+(n[0]-r[0])*s,r[1]+(n[1]-r[1])*s,r[2]+(n[2]-r[2])*s,r[3]+(n[3]-r[3])*s]}t.lerp=e})(Cu||(Cu={}));var _i;(s=>{s.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function e(o,a){for(let l=0;l<16;l++)if(o[l]!==a[l])return!1;return!0}s.isEqual=e;function t(o){return o!=null?o:s.identity}s.simplify=t;function r(o,a){let l=a.slice(0);for(var c=0,u=a.length;c<u;c+=3){let h=1/(o[3]*a[c]+o[7]*a[c+1]+o[11]*a[c+2]+o[15]);l[c]=(o[0]*a[c]+o[4]*a[c+1]+o[8]*a[c+2]+o[12])*h,l[c+1]=(o[1]*a[c]+o[5]*a[c+1]+o[9]*a[c+2]+o[13])*h,l[c+2]=(o[2]*a[c]+o[6]*a[c+1]+o[10]*a[c+2]+o[14])*h}return l}s.applyMatrix4=r;function n(o,a){let l=a.slice(0);for(var c=0,u=a.length;c<u;c+=3)l[c]=o[0]*a[c]+o[4]*a[c+1]+o[8]*a[c+2],l[c+1]=o[1]*a[c]+o[5]*a[c+1]+o[9]*a[c+2],l[c+2]=o[2]*a[c]+o[6]*a[c+1]+o[10]*a[c+2];return l}s.applyMatrix3Components=n})(_i||(_i={}));var Sr;(l=>{l.white={r:1,g:1,b:1},l.red={r:1,g:0,b:0},l.black={r:0,g:0,b:0};function r(c){return{r:Math.round(c.r*255),g:Math.round(c.g*255),b:Math.round(c.b*255),a:1}}l.toRgb255a1=r;function n(c){return{r:c.r,g:c.g,b:c.b}}l.clone=n;function s(c){return c=Math.floor(c),{r:(c>>16&255)/255,g:(c>>8&255)/255,b:(c&255)/255}}l.fromHex=s;function o(c,u){return c.r===u.r&&c.g===u.g&&c.b===u.b}l.equals=o;function a(c,u,h){return{r:c.r+(u.r-c.r)*h,g:c.g+(u.g-c.g)*h,b:c.b+(u.b-c.b)*h}}l.lerp=a})(Sr||(Sr={}));var Ln;(o=>{o.white=be(se({},Sr.white),{a:1});function e(a){return{r:a[0],g:a[1],b:a[2],a:a[3]}}o.from0to1=e;function t(a,l){return be(se({},Sr.fromHex(a)),{a:l})}o.fromHexAndA=t;function r(a){return{r:Math.round(a.r*255),g:Math.round(a.g*255),b:Math.round(a.b*255),a:a.a}}o.toRgb255a1=r;function n(a,l){return Sr.equals(a,l)&&a.a===l.a}o.equals=n;function s(a,l,c){return{r:a.r+(l.r-a.r)*c,g:a.g+(l.g-a.g)*c,b:a.b+(l.b-a.b)*c,a:a.a+(l.a-a.a)*c}}o.lerp=s})(Ln||(Ln={}));var Rd;(e=>e.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]})(Rd||(Rd={}));var Bd;(e=>e.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(Bd||(Bd={}));var Nd;(e=>e.defaultData={control1:[.5,.05],control2:[.1,.3]})(Nd||(Nd={}));var Od;(e=>{function i(t,r=.1){return{type:"radial",hideBase:!1,count:3,radial:{radius:Math.max(t[0],t[1])*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[t[0]+t[0]*r,0,0]},grid:{count:[2,2,2],size:t.map(n=>n*(1+r)),useCenter:!0}}}e.defaultData=i})(Od||(Od={}));var Wn=class{modifyById(e,t){let r=this;if(r[e]===void 0)throw new Error("not expected");{let s=be(se({},r),{[e]:t});return Object.setPrototypeOf(s,Wn.prototype),s}}add(e,t){var n;let r=this.runOp({type:1,id:e,data:t});return(n=r==null?void 0:r.data)!=null?n:this}runOp(e){let t=this;if(e.type===1){let r=t[e.id],n;r===void 0?n={type:2,id:e.id}:n={type:1,id:e.id,data:r};let{id:s,data:o}=e,a=be(se({},t),{[s]:o});return Object.setPrototypeOf(a,Wn.prototype),{data:a,actual:e,reverse:n}}else if(e.type===2){let{id:r}=e,n=t[r];if(n===void 0)return null;{let s=se({},t);return Object.setPrototypeOf(s,Wn.prototype),delete s[r],{data:s,actual:e,reverse:{type:1,id:r,data:n}}}}throw new Error("illegal arg")}};function Lu(i){if(i.deepFreeze!==void 0){i.deepFreeze(i);return}let e=Object.getOwnPropertyNames(i);for(let t of e){let r=i[t];r&&typeof r=="object"&&Lu(r)}return Object.freeze(i)}function kS(i,e){let t=0;for(;t<i.length&&t<e.length;){if(i[t]<e[t])return-1;if(i[t]>e[t])return 1;t+=1}return t!==e.length?-1:t!==i.length?1:0}var Fd=class extends Error{};function Ci(i,e,t){if(i===void 0?e===void 0?(i=0,e=10):i=e-10:e===void 0&&(e=i+10),i>e){let s=i;i=e,e=s}let r=[],n=1/(t+1);for(let s=0;s<t;s++){let o=i+(e-i)*(s+.75+Math.random()*.5)*n;r.push(o)}return r}function VS(i){return i instanceof Uint8Array||i instanceof Uint16Array||i instanceof Uint32Array||i instanceof Int8Array||i instanceof Int16Array||i instanceof Int32Array||i instanceof Float32Array||i instanceof Float64Array}function HS(){return typeof process<"u"}function WS(i,e){for(let t of i)e(t.id,t.data),WS(t.children,e)}function jS(i,e){e(i.id,i.data);for(let t of i.children)jS(t,e)}var jn=class extends Array{constructor(...t){super(...t);Object.setPrototypeOf(this,jn.prototype)}deepFreeze(){let t=0;for(;t<this.length;)Lu(this[t]),t++}fillCaches0(t,r){var n;if((n=this.objCaches)!=null&&n.has(t.id))throw new Error("duplicated item");this.objCaches.set(t.id,t),this.parentCaches.set(t.id,r);for(let s of t.children)this.fillCaches0(s,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}isDescendantOf(t,r){for(;t;){let n=this.parent(t);if(n===r)return!0;t=n}return!1}data(t){var r;return(r=this.get(t))==null?void 0:r.data}has(t){return this.childrenOf(t)!==void 0}get(t){return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){var r;return t===null?this:(r=this.get(t))==null?void 0:r.children}traverseFrom(t,r){if(t===null)this.traverse(r);else{let n=this.get(t);n&&jS(n,r)}}traverse(t){WS(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,r){if(this.get(t)===void 0)throw new Error("not expected");{let s=this.parent(t),o=this.childrenArray(s),a=o.findIndex(u=>u.id===t);if(a<0)throw new Error("not expected");let l=o[a];return o=[...o],o[a]=be(se({},l),{data:r}),this.modifyArrayBy(s,o)}}modifyArrayBy(t,r){let n=t,s=r;for(;n!==null;){let a=s,l=n;if(n=this.parent(n),n===void 0)throw new Error;s=this.childrenArray(n);let c=s.findIndex(u=>u.id===l);if(c<0)throw new Error;s=[...s],s[c]=be(se({},s[c]),{children:a})}Object.setPrototypeOf(s,jn.prototype);let o=s;return o.fillCaches(),o}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}}addOp(t){let{parent:r,fi:n,id:s,data:o,children:a}=t;if(r!==null&&this.get(r)===void 0)return null;if(this.get(s)!==void 0)return null;{let l=r,c=this.childrenArray(l),u={fi:n,id:s,data:o,children:a};return c=[...c,u],c.sort((f,d)=>f.fi-d.fi),t.localIndex=c.indexOf(u),{data:this.modifyArrayBy(l,c),actual:t,reverse:{type:8,id:s}}}}deleteOp(t){let{id:r}=t;if(this.get(r)===null)return null;{let n=this.parent(r);if(n===void 0)return null;let s=this.childrenArray(n),o=s.findIndex(c=>c.id===r);t.localIndex=o,s=[...s];let a=s.splice(o,1)[0];return{data:this.modifyArrayBy(n,s),actual:t,reverse:be(se({type:7},a),{parent:n})}}}moveOp(t){let{parent:r,fi:n,id:s}=t;if(r!==null&&this.get(r)===void 0)return this.deleteOp({type:8,id:s});if(r!==null){let d=r;for(;d!==null;){if(d===void 0)throw new Error;if(d===s)throw new Fd("cyclic tree");d=this.parent(d)}}let o=this.parent(s);if(o===void 0)return null;let a=o,l=this.childrenArray(o),c=l.findIndex(d=>d.id===s);l=[...l];let u=l.splice(c,1)[0],h=this.modifyArrayBy(o,l);o=r,l=h.childrenArray(o);let f=u.fi;return u=be(se({},u),{fi:n}),l=[...l,u],l.sort((d,m)=>d.fi-m.fi),t.localIndex=l.indexOf(u),h=h.modifyArrayBy(o,l),{data:h,actual:t,reverse:{type:9,parent:a,fi:f,id:s}}}previous(t,r){if(r===null){let s=this.childrenArray(t);return s.length===0?null:s[s.length-1].id}let n=null;for(let s of this.childrenArray(t)){if(s.id===r)return n;n=s.id}return null}traverseSortNext(t){let r=this.parent(t);if(r!==void 0){let n=this.childrenArray(r),s=n.findIndex(o=>o.id===t)+1;if(s<n.length)return n[s].id;if(r)return this.traverseSortNext(r)}}sortNext(t){let r=this.childrenArray(t);return r.length>0?r[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let r=this.childrenArray(t);return r.length>0?this.traverseSortPrevious(r[r.length-1].id):t}sortPrevious(t){let r=this.parent(t);if(r!==void 0){let n=this.childrenArray(r),s=n.findIndex(o=>o.id===t)-1;return s>=0?this.traverseSortPrevious(n[s].id):r}}getAllSorted(t){let r=[];for(let n of t){let s=this.getWithSortKey(n.id);s!==void 0&&r.push(se(se({},n),s))}r.sort((n,s)=>kS(n.sortKey,s.sortKey));for(let n of r)delete n.sortKey;return r}getWithSortKey(t){var r=t;let n=[],s=this.get(r),o=s;if(s!==void 0){for(;r;)n.splice(0,0,s.fi),r=this.parent(r),r!==null&&(s=this.get(r));return be(se({},o),{sortKey:n})}}insertBeforeHelper(t,r,n){return this.insertAfterHelper(t,this.previous(t,r),n)}insertAfterHelper(t,r,n){let s=this.childrenArray(t);if(r===null){if(s.length===0)return Ci(0,n,n);{let o=s[0].fi;return Ci(o-n,o,n)}}else{let o=this.get(r);if(o===void 0||this.parent(r)!==t)throw new Error("illegal args");let a=s.find(l=>l.fi>o.fi);if(a===void 0){let l=s[s.length-1].fi;return Ci(l,l+n,n)}else return Ci(o.fi,a.fi,n)}}};var Ud;(e=>{function i(t,r){if(Array.isArray(t)){let n=r.props,s={},o=[...t],a=!1;if(n)for(let l of Object.keys(n)){let c=parseInt(l);if(isNaN(c))throw new Error("wrong index");s[l]=o[c],o[c]=n[l],a=!0}return a?{data:o,actual:r,reverse:{type:0,props:s}}:null}else{let n=r.props,s={},o=se({},t),a=!1;if(n)for(let l of Object.keys(n)){s[l]=o[l];let c=n[l];c===void 0?delete o[l]:o[l]=c,a=!0}return a?{data:o,actual:r,reverse:{type:0,props:s}}:null}}e.runOp=i})(Ud||(Ud={}));var er=class extends Array{constructor(...t){super(...t);Object.setPrototypeOf(this,er.prototype)}deepFreeze(){let t=0;for(;t<this.length;)Lu(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){var r;return(r=this.get(t))==null?void 0:r.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,r){if(this.get(t)===void 0)throw new Error("not expected");{let s=this,o=s.findIndex(c=>c.id===t);if(o<0)throw new Error("not expected");let a=s[o];return s=[...s],s[o]=be(se({},a),{data:r}),this.modifyArrayBy(s)}}modifyArrayBy(t){Object.setPrototypeOf(t,er.prototype);let r=t;return HS()||r.fillCaches(),r}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}}addOp(t){let{fi:r,id:n,data:s}=t,o=this,a={fi:r,id:n,data:s};return o=[...o,a],o.sort((c,u)=>c.fi-u.fi),t.localIndex=o.indexOf(a),{data:this.modifyArrayBy(o),actual:t,reverse:{type:5,id:n}}}deleteOp(t){let{id:r}=t,n=this,s=n.findIndex(l=>l.id===r);if(s===-1)return null;t.localIndex=s,n=[...n];let o=n.splice(s,1)[0];return{data:this.modifyArrayBy(n),actual:t,reverse:se({type:4},o)}}moveOp(t){let{fi:r,id:n}=t,s=this;s=[...s];let o=s.findIndex(u=>u.id===n);if(o===-1)return null;let a=s[o].fi,l=be(se({},s[o]),{fi:r});return s[o]=l,s.sort((u,h)=>u.fi-h.fi),t.localIndex=s.indexOf(l),{data:this.modifyArrayBy(s),actual:t,reverse:{type:6,fi:a,id:n}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let r=null;for(let n of this){if(n.id===t)return r;r=n.id}return null}insertBeforeHelper(t,r){return this.insertAfterHelper(this.previous(t),r)}insertAfterHelper(t,r){let n=this;if(t===null){if(n.length===0)return Ci(0,r,r);{let s=n[0].fi;return Ci(s-r,s,r)}}else{let s=this.get(t);if(s===void 0)throw new Error("illegal args");let o=n.find(a=>a.fi>s.fi);if(o===void 0){let a=n[n.length-1].fi;return Ci(a,a+r,r)}else return Ci(s.fi,o.fi,r)}}};var qS=Symbol(),Gd=Symbol(),bl=class{reportOp(e,t){let r=this;if(t===null)return;r._current=t.data;let n=[];for(;!(r instanceof zd);){let s=r._path,o=r._current;if(s!==""&&n.splice(0,0,s),r=r._parent,r===null)return;r.update(s,o)}r.push(n,e,t.actual,t.reverse)}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let r=t[Gd];r&&r(),delete this._children[e]}}}},by=class extends bl{constructor(e,t,r){super(),this._parent=e,this._path=t,this._current=r}update(e,t){if(Array.isArray(this._current)){if(typeof e=="string"&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid path");this._current=[...this._current],this._current[e]=t}else this._current=be(se({},this._current),{[e]:t})}runOp(e){this.reportOp(e,Ud.runOp(this._current,e))}},wy=class extends bl{constructor(e,t,r){super(),this._parent=e,this._path=t,this._current=r}update(e,t){this._current=be(se({},this._current),{[e]:t}),Object.setPrototypeOf(this._current,Wn.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},XS={get(i,e){if(e===Gd)return()=>{i._parent=null};if(e===qS)return i._current;let{_current:t,_children:r}=i;if(e==="push"&&Array.isArray(t))throw new Error("not supported to expand array");let n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=t[e],o=kd(i,e,s);return o!==s?(r===void 0&&(r={},i._children=r),r[e]=o,o):s},has(i,e){return e in i._current},ownKeys(i){return Reflect.ownKeys(i._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(i){return Object.getPrototypeOf(i._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(i,e){let t=i._current,r=Reflect.getOwnPropertyDescriptor(t,e);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:t[e]}}},G3=be(se({},XS),{set(i,e,t){var n;let r={type:0,props:{[e]:(n=Ay(t))!=null?n:t}};return i.deleteChildren(e),i.runOp(r),!0},deleteProperty(i,e){let t={type:0,props:{[e]:void 0}};return i.deleteChildren(e),i.runOp(t),!0}}),k3=be(se({},XS),{set(i,e,t){return t===void 0?this.deleteProperty(i,e):(i.deleteChildren(e),i.runOp({type:1,id:e,data:t})),!0},deleteProperty(i,e){return i.runOp({type:2,id:e}),!0}}),wl=class extends bl{constructor(e,t,r){super(),this._children={},this._parent=e,this._path=t,this._current=r,this[Gd]=()=>{this._parent=null}}unproxy(){return this._current}update(e,t){this._current=this._current.modifyById(e,t)}runOp(e){this.reportOp(e,this._current.runOp(e))}randomId(){return this._current.randomId()}isDescendantOf(e,t){return this._current.isDescendantOf(e,t)}childrenOf(e){return this._current.childrenOf(e)}traverse(e){return this._current.traverse(e)}get(e){return this._current.get(e)}parent(e){return this._current.parent(e)}traverse(e){this._current.traverse((t,r)=>{e(t,this.data(t))})}data(e){var a;let{_current:t,_children:r}=this,n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=(a=t.get(e))==null?void 0:a.data,o=kd(this,e,s);return o!==s?(r===void 0&&(r={},this._children=r),r[e]=o,o):s}add(e,t,r,n,s){this.runOp({type:7,parent:e,fi:t,id:r,data:n,children:s})}move(e,t,r){this.runOp({type:9,parent:e,fi:t,id:r})}insertAfter(e,t,r){let n=this._current.insertAfterHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.add(e,n[s],o.id,o.data,o.children)}}insertBefore(e,t,r){let n=this._current.insertBeforeHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.add(e,n[s],o.id,o.data,o.children)}}moveAfter(e,t,r){let n=this._current.insertAfterHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.move(e,n[s],o)}}moveBefore(e,t,r){let n=this._current.insertBeforeHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.move(e,n[s],o)}}delete(e){this.deleteChildren(e),this.runOp({type:8,id:e})}sortNext(e){return this._current.sortNext(e)}sortPrevious(e){return this._current.sortPrevious(e)}getAllSorted(e){return this._current.getAllSorted(e)}},Sl=class extends bl{constructor(e,t,r){super(),this._children={},this._parent=e,this._path=t,this._current=r,this[Gd]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(e){let t=this.length;for(let r=0;r<t;r++){let n=this._current[r].id;e(this.data(this._current[r].id),n)}}update(e,t){this._current=this._current.modifyById(e,t)}randomId(){return this._current.randomId()}get(e){return be(se({},this._current.get(e)),{data:this.data(e)})}data(e){var a;let{_current:t,_children:r}=this,n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=(a=t.get(e))==null?void 0:a.data,o=kd(this,e,s);return o!==s?(r===void 0&&(r={},this._children=r),r[e]=o,o):s}runOp(e){this.reportOp(e,this._current.runOp(e))}add(e,t,r){this.runOp({type:4,fi:e,id:t,data:r})}move(e,t){this.runOp({type:6,fi:e,id:t})}insertAfter(e,t){let r=this._current.insertAfterHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.add(r[n],s.id,s.data)}}insertBefore(e,t){let r=this._current.insertBeforeHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.add(r[n],s.id,s.data)}}moveAfter(e,t){let r=this._current.insertAfterHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.move(r[n],s)}}moveBefore(e,t){let r=this._current.insertBeforeHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.move(r[n],s)}}delete(e){this.deleteChildren(e),this.runOp({type:5,id:e})}};function xy(i,e,t){if(i.length>0){let r=i[i.length-1];if(r.type===0&&e.type===0&&Vd.equal(r.path,t)){Object.assign(r.props,e.props);return}}i.push(be(se({},e),{path:t}))}var zd=class{constructor(e){this.ts=[],this.actual=[],this.reverse=[],this._current=e}update(e,t){if(e!=="")throw new Error("");this._current=t}push(e,t,r,n){xy(this.ts,t,e),xy(this.actual,r,e),xy(this.reverse,n,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function kd(i,e,t){return t instanceof jn?new wl(i,e,t):t instanceof er?new Sl(i,e,t):t instanceof Wn?new Proxy(new wy(i,e,t),k3):t!==null&&typeof t=="object"?VS(t)?t:new Proxy(new by(i,e,t),G3):t}function Sy(i){let e=new zd(i);return[kd(e,"",i),e]}function My(i,e){let[t,r]=Sy(i);return e(t),r.result()}function Ay(i){return i instanceof wl||i instanceof Sl?i._current:i!==null&&typeof i=="object"?i[qS]:i}var Vd;(r=>{function i(n,s){if(s.length===n.length)for(var o=0;o<n.length;){if(n[o]!==s[o])return!1;o+=1}else return!1;return!0}r.equal=i;function e(n,s,o){let a=t(o,n);if(a!==void 0&&typeof a=="object"&&a!==null){let l=se({},s);return Object.keys(a).forEach(c=>{delete l[c]}),l}else return s}r.removeOverridden=e;function t(n,s,o=0){if(s.length<=o)return n;if((n instanceof jn||n instanceof wl)&&typeof s[o]=="string")return t(n.data(s[o]),s,o+1);if((n instanceof er||n instanceof Sl)&&typeof s[o]=="string")return t(n.data(s[o]),s,o+1);if(typeof s[o]=="number"&&Array.isArray(n))return t(n[s[o]],s,o+1);if(typeof s[o]=="string"&&typeof n=="object")return t(n[s[o]],s,o+1)}r.zoom=t})(Vd||(Vd={}));var Hd=class{},Du=class extends Hd{constructor(t){super();this.id=t}},Pu=class extends Hd{constructor(t){super();this.data=t}};var Ey;try{Ey=new TextDecoder}catch{}var Re,Zs,Z=0;var tM=[],_y=tM,Cy=0,xn={},Et,Ks,qn=0,Li=0,Dn,cs,hn=[],Pt,YS={useRecords:!1,mapsAsObjects:!0},Iu=class{},Dy=new Iu;Dy.name="MessagePack 0xC1";var Ml=!1,Di=class{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0)),Object.assign(this,e)}unpack(e,t){if(Re)return oM(()=>(jd(),this?this.unpack(e,t):Di.prototype.unpack.call(YS,e,t)));Zs=t>-1?t:e.length,Z=0,Cy=0,Li=0,Ks=null,_y=tM,Dn=null,Re=e;try{Pt=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(r){throw Re=null,e instanceof Uint8Array?r:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof Di){if(xn=this,this.structures)return Et=this.structures,Wd();(!Et||Et.length>0)&&(Et=[])}else xn=YS,(!Et||Et.length>0)&&(Et=[]);return Wd()}unpackMultiple(e,t){let r,n=0;try{Ml=!0;let s=e.length,o=this?this.unpack(e,s):Yd.unpack(e,s);if(t){for(t(o);Z<s;)if(n=Z,t(Wd())===!1)return}else{for(r=[o];Z<s;)n=Z,r.push(Wd());return r}}catch(s){throw s.lastPosition=n,s.values=r,s}finally{Ml=!1,jd()}}_mergeStructures(e,t){e=e||[];for(let r=0,n=e.length;r<n;r++){let s=e[r];s&&(s.isShared=!0,r>=32&&(s.highByte=r-32>>5))}e.sharedLength=e.length;for(let r in t||[])if(r>=0){let n=e[r],s=t[r];s&&(n&&((e.restoreStructures||(e.restoreStructures=[]))[r]=n),e[r]=s)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function Wd(){try{if(!xn.trusted&&!Ml){let e=Et.sharedLength||0;e<Et.length&&(Et.length=e)}let i=or();if(Z==Zs)Et.restoreStructures&&JS(),Et=null,Re=null,cs&&(cs=null);else if(Z>Zs){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}else if(!Ml)throw new Error("Data read, but end of buffer not reached");return i}catch(i){throw Et.restoreStructures&&JS(),jd(),(i instanceof RangeError||i.message.startsWith("Unexpected end of buffer"))&&(i.incomplete=!0),i}}function JS(){for(let i in Et.restoreStructures)Et[i]=Et.restoreStructures[i];Et.restoreStructures=null}function or(){let i=Re[Z++];if(i<160)if(i<128){if(i<64)return i;{let e=Et[i&63]||xn.getStructures&&rM()[i&63];return e?(e.read||(e.read=Py(e,i&63)),e.read()):i}}else if(i<144)if(i-=128,xn.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[iM()]=or();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(or(),or());return e}else{i-=144;let e=new Array(i);for(let t=0;t<i;t++)e[t]=or();return e}else if(i<192){let e=i-160;if(Li>=Z)return Ks.slice(Z-qn,(Z+=e)-qn);if(Li==0&&Zs<140){let t=e<16?Iy(e):nM(e);if(t!=null)return t}return Ly(e)}else{let e;switch(i){case 192:return null;case 193:return Dn?(e=or(),e>0?Dn[1].slice(Dn.position1,Dn.position1+=e):Dn[0].slice(Dn.position0,Dn.position0-=e)):Dy;case 194:return!1;case 195:return!0;case 196:return Ty(Re[Z++]);case 197:return e=Pt.getUint16(Z),Z+=2,Ty(e);case 198:return e=Pt.getUint32(Z),Z+=4,Ty(e);case 199:return Vo(Re[Z++]);case 200:return e=Pt.getUint16(Z),Z+=2,Vo(e);case 201:return e=Pt.getUint32(Z),Z+=4,Vo(e);case 202:if(e=Pt.getFloat32(Z),xn.useFloat32>2){let t=Xd[(Re[Z]&127)<<1|Re[Z+1]>>7];return Z+=4,(t*e+(e>0?.5:-.5)>>0)/t}return Z+=4,e;case 203:return e=Pt.getFloat64(Z),Z+=8,e;case 204:return Re[Z++];case 205:return e=Pt.getUint16(Z),Z+=2,e;case 206:return e=Pt.getUint32(Z),Z+=4,e;case 207:return xn.int64AsNumber?(e=Pt.getUint32(Z)*4294967296,e+=Pt.getUint32(Z+4)):e=Pt.getBigUint64(Z),Z+=8,e;case 208:return Pt.getInt8(Z++);case 209:return e=Pt.getInt16(Z),Z+=2,e;case 210:return e=Pt.getInt32(Z),Z+=4,e;case 211:return xn.int64AsNumber?(e=Pt.getInt32(Z)*4294967296,e+=Pt.getUint32(Z+4)):e=Pt.getBigInt64(Z),Z+=8,e;case 212:if(e=Re[Z++],e==114)return eM(Re[Z++]&63);{let t=hn[e];if(t)return t.read?(Z++,t.read(or())):t.noBuffer?(Z++,t()):t(Re.subarray(Z,++Z));throw new Error("Unknown extension "+e)}case 213:return e=Re[Z],e==114?(Z++,eM(Re[Z++]&63,Re[Z++])):Vo(2);case 214:return Vo(4);case 215:return Vo(8);case 216:return Vo(16);case 217:return e=Re[Z++],Li>=Z?Ks.slice(Z-qn,(Z+=e)-qn):H3(e);case 218:return e=Pt.getUint16(Z),Z+=2,Li>=Z?Ks.slice(Z-qn,(Z+=e)-qn):W3(e);case 219:return e=Pt.getUint32(Z),Z+=4,Li>=Z?Ks.slice(Z-qn,(Z+=e)-qn):j3(e);case 220:return e=Pt.getUint16(Z),Z+=2,KS(e);case 221:return e=Pt.getUint32(Z),Z+=4,KS(e);case 222:return e=Pt.getUint16(Z),Z+=2,ZS(e);case 223:return e=Pt.getUint32(Z),Z+=4,ZS(e);default:if(i>=224)return i-256;if(i===void 0){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}throw new Error("Unknown MessagePack token "+i)}}}var V3=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Py(i,e){function t(){if(t.count++>2){let n=i.read=new Function("r","return function(){return {"+i.map(s=>V3.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"}}")(or);return i.highByte===0&&(i.read=QS(e,i.read)),n()}let r={};for(let n=0,s=i.length;n<s;n++){let o=i[n];r[o]=or()}return r}return t.count=0,i.highByte===0?QS(e,t):t}var QS=(i,e)=>function(){let t=Re[Z++];if(t===0)return e();let r=i<32?-(i+(t<<5)):i+(t<<5),n=Et[r]||rM()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=Py(n,i)),n.read()};function rM(){let i=oM(()=>(Re=null,xn.getStructures()));return Et=xn._mergeStructures(i,Et)}var Ly=qd,H3=qd,W3=qd,j3=qd;function qd(i){let e;if(i<16&&(e=Iy(i)))return e;if(i>64&&Ey)return Ey.decode(Re.subarray(Z,Z+=i));let t=Z+i,r=[];for(e="";Z<t;){let n=Re[Z++];if((n&128)===0)r.push(n);else if((n&224)===192){let s=Re[Z++]&63;r.push((n&31)<<6|s)}else if((n&240)===224){let s=Re[Z++]&63,o=Re[Z++]&63;r.push((n&31)<<12|s<<6|o)}else if((n&248)===240){let s=Re[Z++]&63,o=Re[Z++]&63,a=Re[Z++]&63,l=(n&7)<<18|s<<12|o<<6|a;l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|l&1023),r.push(l)}else r.push(n);r.length>=4096&&(e+=Pr.apply(String,r),r.length=0)}return r.length>0&&(e+=Pr.apply(String,r)),e}function KS(i){let e=new Array(i);for(let t=0;t<i;t++)e[t]=or();return e}function ZS(i){if(xn.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[iM()]=or();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(or(),or());return e}}var Pr=String.fromCharCode;function nM(i){let e=Z,t=new Array(i);for(let r=0;r<i;r++){let n=Re[Z++];if((n&128)>0){Z=e;return}t[r]=n}return Pr.apply(String,t)}function Iy(i){if(i<4)if(i<2){if(i===0)return"";{let e=Re[Z++];if((e&128)>1){Z-=1;return}return Pr(e)}}else{let e=Re[Z++],t=Re[Z++];if((e&128)>0||(t&128)>0){Z-=2;return}if(i<3)return Pr(e,t);let r=Re[Z++];if((r&128)>0){Z-=3;return}return Pr(e,t,r)}else{let e=Re[Z++],t=Re[Z++],r=Re[Z++],n=Re[Z++];if((e&128)>0||(t&128)>0||(r&128)>0||(n&128)>0){Z-=4;return}if(i<6){if(i===4)return Pr(e,t,r,n);{let s=Re[Z++];if((s&128)>0){Z-=5;return}return Pr(e,t,r,n,s)}}else if(i<8){let s=Re[Z++],o=Re[Z++];if((s&128)>0||(o&128)>0){Z-=6;return}if(i<7)return Pr(e,t,r,n,s,o);let a=Re[Z++];if((a&128)>0){Z-=7;return}return Pr(e,t,r,n,s,o,a)}else{let s=Re[Z++],o=Re[Z++],a=Re[Z++],l=Re[Z++];if((s&128)>0||(o&128)>0||(a&128)>0||(l&128)>0){Z-=8;return}if(i<10){if(i===8)return Pr(e,t,r,n,s,o,a,l);{let c=Re[Z++];if((c&128)>0){Z-=9;return}return Pr(e,t,r,n,s,o,a,l,c)}}else if(i<12){let c=Re[Z++],u=Re[Z++];if((c&128)>0||(u&128)>0){Z-=10;return}if(i<11)return Pr(e,t,r,n,s,o,a,l,c,u);let h=Re[Z++];if((h&128)>0){Z-=11;return}return Pr(e,t,r,n,s,o,a,l,c,u,h)}else{let c=Re[Z++],u=Re[Z++],h=Re[Z++],f=Re[Z++];if((c&128)>0||(u&128)>0||(h&128)>0||(f&128)>0){Z-=12;return}if(i<14){if(i===12)return Pr(e,t,r,n,s,o,a,l,c,u,h,f);{let d=Re[Z++];if((d&128)>0){Z-=13;return}return Pr(e,t,r,n,s,o,a,l,c,u,h,f,d)}}else{let d=Re[Z++],m=Re[Z++];if((d&128)>0||(m&128)>0){Z-=14;return}if(i<15)return Pr(e,t,r,n,s,o,a,l,c,u,h,f,d,m);let p=Re[Z++];if((p&128)>0){Z-=15;return}return Pr(e,t,r,n,s,o,a,l,c,u,h,f,d,m,p)}}}}}function Ty(i){return xn.copyBuffers?Uint8Array.prototype.slice.call(Re,Z,Z+=i):Re.subarray(Z,Z+=i)}function Vo(i){let e=Re[Z++];if(hn[e])return hn[e](Re.subarray(Z,Z+=i));throw new Error("Unknown extension type "+e)}var $S=new Array(4096);function iM(){let i=Re[Z++];if(i>=160&&i<192){if(i=i-160,Li>=Z)return Ks.slice(Z-qn,(Z+=i)-qn);if(!(Li==0&&Zs<180))return Ly(i)}else return Z--,or();let e=(i<<5^(i>1?Pt.getUint16(Z):i>0?Re[Z]:0))&4095,t=$S[e],r=Z,n=Z+i-3,s,o=0;if(t&&t.bytes==i){for(;r<n;){if(s=Pt.getUint32(r),s!=t[o++]){r=1879048192;break}r+=4}for(n+=3;r<n;)if(s=Re[r++],s!=t[o++]){r=1879048192;break}if(r===n)return Z=r,t.string;n-=3,r=Z}for(t=[],$S[e]=t,t.bytes=i;r<n;)s=Pt.getUint32(r),t.push(s),r+=4;for(n+=3;r<n;)s=Re[r++],t.push(s);let a=i<16?Iy(i):nM(i);return a!=null?t.string=a:t.string=Ly(i)}var eM=(i,e)=>{var t=or();let r=i;e!==void 0&&(i=i<32?-((e<<5)+i):(e<<5)+i,t.highByte=e);let n=Et[i];return n&&n.isShared&&((Et.restoreStructures||(Et.restoreStructures=[]))[i]=n),Et[i]=t,t.read=Py(t,r),t.read()},sM=typeof self=="object"?self:global;hn[0]=()=>{};hn[0].noBuffer=!0;hn[101]=()=>{let i=or();return(sM[i[0]]||Error)(i[1])};hn[105]=i=>{let e=Pt.getUint32(Z-4);cs||(cs=new Map);let t=Re[Z],r;t>=144&&t<160||t==220||t==221?r=[]:r={};let n={target:r};cs.set(e,n);let s=or();return n.used?Object.assign(r,s):(n.target=s,s)};hn[112]=i=>{let e=Pt.getUint32(Z-4),t=cs.get(e);return t.used=!0,t.target};hn[115]=()=>new Set(or());var Ry=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array");hn[116]=i=>{let e=i[0],t=Ry[e];if(!t)throw new Error("Could not find typed array for code "+e);return new sM[t](Uint8Array.prototype.slice.call(i,1).buffer)};hn[120]=()=>{let i=or();return new RegExp(i[0],i[1])};hn[98]=i=>{let e=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],t=Z;Z+=e-4,Dn=[or(),or()],Dn.position0=0,Dn.position1=0;let r=Z;Z=t;try{return or()}finally{Z=r}};hn[255]=i=>i.length==4?new Date((i[0]*16777216+(i[1]<<16)+(i[2]<<8)+i[3])*1e3):i.length==8?new Date(((i[0]<<22)+(i[1]<<14)+(i[2]<<6)+(i[3]>>2))/1e6+((i[3]&3)*4294967296+i[4]*16777216+(i[5]<<16)+(i[6]<<8)+i[7])*1e3):i.length==12?new Date(((i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3])/1e6+((i[4]&128?-281474976710656:0)+i[6]*1099511627776+i[7]*4294967296+i[8]*16777216+(i[9]<<16)+(i[10]<<8)+i[11])*1e3):new Date("invalid");function oM(i){let e=Zs,t=Z,r=Cy,n=qn,s=Li,o=Ks,a=_y,l=cs,c=Dn,u=new Uint8Array(Re.slice(0,Zs)),h=Et,f=Et.slice(0,Et.length),d=xn,m=Ml,p=i();return Zs=e,Z=t,Cy=r,qn=n,Li=s,Ks=o,_y=a,cs=l,Dn=c,Re=u,Ml=m,Et=h,Et.splice(0,Et.length,...f),xn=d,Pt=new DataView(Re.buffer,Re.byteOffset,Re.byteLength),p}function jd(){Re=null,cs=null,Et=null}function aM(i){i.unpack?hn[i.type]=i.unpack:hn[i.type]=i}var Xd=new Array(147);for(let i=0;i<256;i++)Xd[i]=+("1e"+Math.floor(45.15-i*.30103));var Yd=new Di({useRecords:!1}),q3=Yd.unpack,X3=Yd.unpackMultiple,Y3=Yd.unpack,Jd={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},J3=new Float32Array(1),e9=new Uint8Array(J3.buffer,0,4);var Qd;try{Qd=new TextEncoder}catch{}var Kd,Ny,Zd=typeof Buffer<"u",By=Zd?Buffer.allocUnsafeSlow:Uint8Array,hM=Zd?Buffer:Uint8Array,lM=Zd?4294967296:2144337920,de,hr,oe=0,Pi,Ii=null,Q3=/[\u0080-\uFFFF]/,Ru=Symbol("record-id"),Ho=class extends Di{constructor(e){super(e),this.offset=0;let t,r,n,s,o,a,l=0,c=hM.prototype.utf8Write?function(S,I,C){return de.utf8Write(S,I,C)}:Qd&&Qd.encodeInto?function(S,I){return Qd.encodeInto(S,de.subarray(I)).written}:!1,u=this;e||(e={});let h=e&&e.sequential,f=e.structures||e.saveStructures,d=e.maxSharedStructures;if(d==null&&(d=f?32:0),d>8160)throw new Error("Maximum maxSharedStructure is 8160");let m=e.maxOwnStructures;m==null&&(m=f?32:64),h&&!e.saveStructures&&(this.structures=[]);let p=d>32||m+d>64,g=d+64,y=d+m+64;if(y>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let v=[],b=0,w=0;this.pack=this.encode=function(S,I){if(de||(de=new By(8192),hr=new DataView(de.buffer,0,8192),oe=0),Pi=de.length-10,Pi-oe<2048?(de=new By(de.length),hr=new DataView(de.buffer,0,de.length),Pi=de.length-10,oe=0):oe=oe+7&2147483640,r=oe,a=u.structuredClone?new Map:null,u.bundleStrings?(Ii=["",""],de[oe++]=214,de[oe++]=98,Ii.position=oe-r,oe+=4):Ii=null,n=u.structures,n){n.uninitialized&&(n=u._mergeStructures(u.getStructures()));let C=n.sharedLength||0;if(C>d)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+n.sharedLength);if(!n.transitions){n.transitions=Object.create(null);for(let M=0;M<C;M++){let _=n[M];if(!_)continue;let R,B=n.transitions;for(let O=0,z=_.length;O<z;O++){let q=_[O];R=B[q],R||(R=B[q]=Object.create(null)),B=R}B[Ru]=M+64}l=C}h||(n.nextId=C+64)}s&&(s=!1),o=n||[];try{if(x(S),Ii){hr.setUint32(Ii.position+r,oe-Ii.position-r);let C=Ii;Ii=null,x(C[0]),x(C[1])}if(u.offset=oe,a&&a.idsToInsert){oe+=a.idsToInsert.length*6,oe>Pi&&T(oe),u.offset=oe;let C=Z3(de.subarray(r,oe),a.idsToInsert);return a=null,C}return I&dM?(de.start=r,de.end=oe,de):de.subarray(r,oe)}finally{if(n){if(w<10&&w++,b>1e4)n.transitions=null,w=0,b=0,v.length>0&&(v=[]);else if(v.length>0&&!h){for(let C=0,M=v.length;C<M;C++)v[C][Ru]=0;v=[]}if(s&&u.saveStructures){let C=n.sharedLength||d;n.length>C&&(n=n.slice(0,C));let M=de.subarray(r,oe);return u.saveStructures(n,l)===!1?(u._mergeStructures(u.getStructures()),u.pack(S)):(l=C,M)}}I&sO&&(oe=r)}};let x=S=>{oe>Pi&&(de=T(oe));var I=typeof S,C;if(I==="string"){let M=S.length;if(Ii&&M>=8&&M<4096){let B=Q3.test(S);Ii[B?0:1]+=S,de[oe++]=193,x(B?-M:M);return}let _;M<32?_=1:M<256?_=2:M<65536?_=3:_=5;let R=M*3;if(oe+R>Pi&&(de=T(oe+R)),M<64||!c){let B,O,z,q=oe+_;for(B=0;B<M;B++)O=S.charCodeAt(B),O<128?de[q++]=O:O<2048?(de[q++]=O>>6|192,de[q++]=O&63|128):(O&64512)===55296&&((z=S.charCodeAt(B+1))&64512)===56320?(O=65536+((O&1023)<<10)+(z&1023),B++,de[q++]=O>>18|240,de[q++]=O>>12&63|128,de[q++]=O>>6&63|128,de[q++]=O&63|128):(de[q++]=O>>12|224,de[q++]=O>>6&63|128,de[q++]=O&63|128);C=q-oe-_}else C=c(S,oe+_,R);C<32?de[oe++]=160|C:C<256?(_<2&&de.copyWithin(oe+2,oe+1,oe+1+C),de[oe++]=217,de[oe++]=C):C<65536?(_<3&&de.copyWithin(oe+3,oe+2,oe+2+C),de[oe++]=218,de[oe++]=C>>8,de[oe++]=C&255):(_<5&&de.copyWithin(oe+5,oe+3,oe+3+C),de[oe++]=219,hr.setUint32(oe,C),oe+=4),oe+=C}else if(I==="number")if(S>>>0===S)S<64?de[oe++]=S:S<256?(de[oe++]=204,de[oe++]=S):S<65536?(de[oe++]=205,de[oe++]=S>>8,de[oe++]=S&255):(de[oe++]=206,hr.setUint32(oe,S),oe+=4);else if(S>>0===S)S>=-32?de[oe++]=256+S:S>=-128?(de[oe++]=208,de[oe++]=S+256):S>=-32768?(de[oe++]=209,hr.setInt16(oe,S),oe+=2):(de[oe++]=210,hr.setInt32(oe,S),oe+=4);else{let M;if((M=this.useFloat32)>0&&S<4294967296&&S>=-2147483648){de[oe++]=202,hr.setFloat32(oe,S);let _;if(M<4||(_=S*Xd[(de[oe]&127)<<1|de[oe+1]>>7])>>0===_){oe+=4;return}else oe--}de[oe++]=203,hr.setFloat64(oe,S),oe+=8}else if(I==="object")if(!S)de[oe++]=192;else{if(a){let _=a.get(S);if(_){if(!_.id){let R=a.idsToInsert||(a.idsToInsert=[]);_.id=R.push(_)}de[oe++]=214,de[oe++]=112,hr.setUint32(oe,_.id),oe+=4;return}else a.set(S,{offset:oe-r})}let M=S.constructor;if(M===Object)E(S,!0);else if(M===Array){C=S.length,C<16?de[oe++]=144|C:C<65536?(de[oe++]=220,de[oe++]=C>>8,de[oe++]=C&255):(de[oe++]=221,hr.setUint32(oe,C),oe+=4);for(let _=0;_<C;_++)x(S[_])}else if(M===Map){C=S.size,C<16?de[oe++]=128|C:C<65536?(de[oe++]=222,de[oe++]=C>>8,de[oe++]=C&255):(de[oe++]=223,hr.setUint32(oe,C),oe+=4);for(let[_,R]of S)x(_),x(R)}else{for(let _=0,R=Kd.length;_<R;_++){let B=Ny[_];if(S instanceof B){let O=Kd[_];if(O.write){O.type&&(de[oe++]=212,de[oe++]=O.type,de[oe++]=0),x(O.write.call(this,S));return}let z=de,q=hr,F=oe;de=null;let ee;try{ee=O.pack.call(this,S,k=>(de=z,z=null,oe+=k,oe>Pi&&T(oe),{target:de,targetView:hr,position:oe-k}),x)}finally{z&&(de=z,hr=q,oe=F,Pi=de.length-10)}ee&&(ee.length+oe>Pi&&T(ee.length+oe),oe=K3(ee,de,oe,O.type));return}}E(S,!S.hasOwnProperty)}}else if(I==="boolean")de[oe++]=S?195:194;else if(I==="bigint"){if(S<BigInt(1)<<BigInt(63)&&S>=-(BigInt(1)<<BigInt(63)))de[oe++]=211,hr.setBigInt64(oe,S);else if(S<BigInt(1)<<BigInt(64)&&S>0)de[oe++]=207,hr.setBigUint64(oe,S);else if(this.largeBigIntToFloat)de[oe++]=203,hr.setFloat64(oe,Number(S));else throw new RangeError(S+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");oe+=8}else if(I==="undefined")this.encodeUndefinedAsNil?de[oe++]=192:(de[oe++]=212,de[oe++]=0,de[oe++]=0);else if(I==="function")x(this.writeFunction&&this.writeFunction());else throw new Error("Unknown type: "+I)},E=this.useRecords===!1?this.variableMapSize?S=>{let I=Object.keys(S),C=I.length;C<16?de[oe++]=128|C:C<65536?(de[oe++]=222,de[oe++]=C>>8,de[oe++]=C&255):(de[oe++]=223,hr.setUint32(oe,C),oe+=4);let M;for(let _=0;_<C;_++)x(M=I[_]),x(S[M])}:(S,I)=>{de[oe++]=222;let C=oe-r;oe+=2;let M=0;for(let _ in S)(I||S.hasOwnProperty(_))&&(x(_),x(S[_]),M++);de[C+++r]=M>>8,de[C+r]=M&255}:S=>{let I=Object.keys(S),C,M=o.transitions||(o.transitions=Object.create(null)),_=0;for(let B=0,O=I.length;B<O;B++){let z=I[B];C=M[z],C||(C=M[z]=Object.create(null),_++),M=C}let R=M[Ru];if(R)R>=96&&p?(de[oe++]=((R-=96)&31)+96,de[oe++]=R>>5):de[oe++]=R;else{R=o.nextId,R||(R=64),R<g&&this.shouldShareStructure&&!this.shouldShareStructure(I)?(R=o.nextOwnId,R<y||(R=g),o.nextOwnId=R+1):(R>=y&&(R=g),o.nextId=R+1);let B=I.highByte=R>=96&&p?R-96>>5:-1;M[Ru]=R,o[R-64]=I,R<g?(I.isShared=!0,o.sharedLength=R-63,s=!0,B>=0?(de[oe++]=(R&31)+96,de[oe++]=B):de[oe++]=R):(B>=0?(de[oe++]=213,de[oe++]=114,de[oe++]=(R&31)+96,de[oe++]=B):(de[oe++]=212,de[oe++]=114,de[oe++]=R),_&&(b+=w*_),v.length>=m&&(v.shift()[Ru]=0),v.push(M),x(I))}for(let B=0,O=I.length;B<O;B++)x(S[I[B]])},T=S=>{let I;if(S>16777216){if(S-r>lM)throw new Error("Packed buffer would be larger than maximum buffer size");I=Math.min(lM,Math.round(Math.max((S-r)*(S>67108864?1.25:2),4194304)/4096)*4096)}else I=(Math.max(S-r<<2,de.length-1)>>12)+1<<12;let C=new By(I);return hr=new DataView(C.buffer,0,I),de.copy?de.copy(C,0,r,S):C.set(de.slice(r,S)),oe-=r,r=0,Pi=C.length-10,de=C}}useBuffer(e){de=e,hr=new DataView(de.buffer,de.byteOffset,de.byteLength),oe=0}};Ny=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Iu];Kd=[{pack(i,e,t){let r=i.getTime()/1e3;if((this.useTimestamp32||i.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:n,targetView:s,position:o}=e(6);n[o++]=214,n[o++]=255,s.setUint32(o,r)}else if(r>0&&r<17179869184){let{target:n,targetView:s,position:o}=e(10);n[o++]=215,n[o++]=255,s.setUint32(o,i.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),s.setUint32(o+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return e(0),t(this.onInvalidDate());let{target:n,targetView:s,position:o}=e(3);n[o++]=212,n[o++]=255,n[o++]=255}else{let{target:n,targetView:s,position:o}=e(15);n[o++]=199,n[o++]=12,n[o++]=255,s.setUint32(o,i.getMilliseconds()*1e6),s.setBigInt64(o+4,BigInt(Math.floor(r)))}}},{pack(i,e,t){let r=Array.from(i),{target:n,position:s}=e(this.structuredClone?3:0);this.structuredClone&&(n[s++]=212,n[s++]=115,n[s++]=0),t(r)}},{pack(i,e,t){let{target:r,position:n}=e(this.structuredClone?3:0);this.structuredClone&&(r[n++]=212,r[n++]=101,r[n++]=0),t([i.name,i.message])}},{pack(i,e,t){let{target:r,position:n}=e(this.structuredClone?3:0);this.structuredClone&&(r[n++]=212,r[n++]=120,r[n++]=0),t([i.source,i.flags])}},{pack(i,e){this.structuredClone?cM(i,16,e):uM(Zd?Buffer.from(i):new Uint8Array(i),e)}},{pack(i,e){let t=i.constructor;t!==hM&&this.structuredClone?cM(i,Ry.indexOf(t.name),e):uM(i,e)}},{pack(i,e){let{target:t,position:r}=e(1);t[r]=193}}];function cM(i,e,t,r){let n=i.byteLength;if(n+1<256){var{target:s,position:o}=t(4+n);s[o++]=199,s[o++]=n+1}else if(n+1<65536){var{target:s,position:o}=t(5+n);s[o++]=200,s[o++]=n+1>>8,s[o++]=n+1&255}else{var{target:s,position:o,targetView:a}=t(7+n);s[o++]=201,a.setUint32(o,n+1),o+=4}s[o++]=116,s[o++]=e,s.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),o)}function uM(i,e){let t=i.byteLength;var r,n;if(t<256){var{target:r,position:n}=e(t+2);r[n++]=196,r[n++]=t}else if(t<65536){var{target:r,position:n}=e(t+3);r[n++]=197,r[n++]=t>>8,r[n++]=t&255}else{var{target:r,position:n,targetView:s}=e(t+5);r[n++]=198,s.setUint32(n,t),n+=4}r.set(i,n)}function K3(i,e,t,r){let n=i.length;switch(n){case 1:e[t++]=212;break;case 2:e[t++]=213;break;case 4:e[t++]=214;break;case 8:e[t++]=215;break;case 16:e[t++]=216;break;default:n<256?(e[t++]=199,e[t++]=n):n<65536?(e[t++]=200,e[t++]=n>>8,e[t++]=n&255):(e[t++]=201,e[t++]=n>>24,e[t++]=n>>16&255,e[t++]=n>>8&255,e[t++]=n&255)}return e[t++]=r,e.set(i,t),t+=n,t}function Z3(i,e){let t,r=e.length*6,n=i.length-r;for(e.sort((s,o)=>s.offset>o.offset?1:-1);t=e.pop();){let s=t.offset,o=t.id;i.copyWithin(s+r,s,n),r-=6;let a=s+r;i[a++]=214,i[a++]=105,i[a++]=o>>24,i[a++]=o>>16&255,i[a++]=o>>8&255,i[a++]=o&255,n=s}return i}function Wo(i){if(i.Class){if(!i.pack&&!i.write)throw new Error("Extension has no pack or write function");if(i.pack&&!i.type)throw new Error("Extension has no type (numeric code to identify the extension)");Ny.unshift(i.Class),Kd.unshift(i)}aM(i)}var fM=new Ho({useRecords:!1}),$3=fM.pack,eO=fM.pack;var{NEVER:tO,ALWAYS:rO,DECIMAL_ROUND:nO,DECIMAL_FIT:iO}=Jd,dM=512,sO=1024;var pM=new Ho({structuredClone:!0});Wo({Class:Wn.prototype.constructor,type:1,write(i){return se({},i)},read(i){return Object.setPrototypeOf(i,Wn.prototype),i}});Wo({Class:er.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,er.prototype),i}});Wo({Class:jn.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,jn.prototype),i}});Wo({Class:Du.prototype.constructor,type:4,write(i){return i.id},read(i){return new Du(i)}});Wo({Class:Pu.prototype.constructor,type:5,write(i){return i.data},read(i){return new Pu(i)}});function oO(i){var e=0;if(i.length===0)return e;for(let t=0;t<i.length;t++){let r=i[t];e=(e<<5)-e+r,e=e&e}return e}var $d;(r=>{function i(n){return pM.pack(n)}r.serialize=i;function e(n){return pM.unpack(n)}r.deserialize=e;function t(n){return oO(i(n)).toString()}r.checksum=t})($d||($d={}));var ep;(t=>{t.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function e(r){return t.all.includes(r)}t.is=e})(ep||(ep={}));var tp;(t=>{function i(r){return e(r)}t.defaultData=i;function e(r){if(r==="PointLight")return{type:r,color:Ln.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,depth:2500,helper:!0};if(r==="SpotLight")return{type:r,color:Ln.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:2500,helper:!0};if(r==="DirectionalLight")return{type:r,color:Ln.white,intensity:1,shadows:!0,size:2500,depth:2500,helper:!0};throw new Error("not implemented")}})(tp||(tp={}));var Oy;(t=>{t.defaultData={castShadow:!0,receiveShadow:!0};function e(r,n){return r.castShadow===n.castShadow&&r.receiveShadow===n.receiveShadow}t.equals=e})(Oy||(Oy={}));var Fy;(t=>{t.defaultData={flatShading:!1,wireframe:!1,side:0};function e(r,n){return r.flatShading===n.flatShading&&r.side===n.side&&r.wireframe===n.wireframe}t.equals=e})(Fy||(Fy={}));var rp;(e=>e.defaultData=be(se(se({},Fy.defaultData),Oy.defaultData),{cloner:null}))(rp||(rp={}));var Uy=(n=>(n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.Center=3]="Center",n[n.Justify=4]="Justify",n))(Uy||{}),zy=(r=>(r[r.Top=1]="Top",r[r.Center=2]="Center",r[r.Bottom=3]="Bottom",r))(zy||{}),Gy=(r=>(r[r.None=1]="None",r[r.Upper=2]="Upper",r[r.Lower=3]="Lower",r))(Gy||{}),np;(e=>e.defaultData={width:100,height:100,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.5,letterSpacing:1,text:"",textTransform:1,color:Ln.fromHexAndA(6974058,1),alpha:1,font:"roboto_regular"})(np||(np={}));var mM=["mode","gradientType","noiseType","displacementType","projection","cnormal","crop","axis"];var Al;(r=>{function i(n,s){return n==="light"&&s?e(s):t(n)}r.defaultData=i;function e(n){switch(n){case"basic":return{type:"light",category:"basic",alpha:1,visible:!0,mode:0};case"phong":return{category:"phong",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"toon":return{category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"lambert":return{category:"lambert",emissive:{r:0,g:0,b:0,a:1},type:"light",alpha:1,visible:!0,mode:0};case"physical":return{category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0}}}function t(n){switch(n){case"texture":return{alpha:1,visible:!0,size:[128,128],mode:0,axis:"x",type:"texture",projection:0,texture:{image:"image_0",wrapping:1001,repeat:[1,1],offset:[0,0]},crop:!0};case"color":return{type:"color",alpha:1,visible:!0,mode:0,color:Sr.fromHex(4737101)};case"depth":return{type:"depth",alpha:1,visible:!0,mode:0,gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,near:50,far:200};case"normal":return{type:"normal",alpha:1,visible:!0,mode:0,cnormal:[1,1,1]};case"gradient":return{type:"gradient",alpha:1,visible:!0,mode:0,gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{type:"noise",alpha:1,visible:!0,mode:0,size:[100,100,100],noiseType:0,scale:1,move:1,colorA:be(se({},Sr.fromHex(6710886)),{a:1}),colorB:be(se({},Sr.fromHex(6710886)),{a:1}),colorC:be(se({},Sr.fromHex(16777215)),{a:1}),colorD:be(se({},Sr.fromHex(16777215)),{a:1}),distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8]};case"fresnel":return{type:"fresnel",alpha:1,visible:!0,mode:0,color:Ln.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"rainbow":return{type:"rainbow",alpha:1,visible:!0,mode:0,filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"matcap":return{type:"matcap",alpha:1,visible:!0,mode:0,texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0]}};case"transmission":return{type:"transmission",alpha:1,visible:!0,mode:0,thickness:10,ior:1.5,roughness:1};case"displace":return{type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,visible:!0}}}})(Al||(Al={}));var Ri;(a=>{function i(l){return!l.layers.some(u=>{if(u.data.type==="texture"&&u.data.projection!==0||u.data.type==="depth"&&!u.data.isWorldSpace||u.data.type==="noise"||u.data.type==="displace")return!0})&&!t(l)}a.isMergable=i;function e(l){let c="";return l.layers.forEach(u=>{Object.entries(u.data).forEach(([h,f])=>{c+=`${h}${f}`,Array.isArray(f)?f.forEach(d=>c+=`${d}`):typeof f=="object"?Object.values(f).forEach(d=>{typeof d=="number"?c+=`${d.toFixed(4)}`:c+=`${d}`}):c+=`${f}`})}),c}a.getHash=e;function t(l){let c=0;for(let u of l.layers)"alpha"in u.data&&u.data.type!=="light"&&u.data.type!=="fresnel"&&(c+=(1-c)*u.data.alpha);return c<1}a.isTransparent=t;function r(){return{layers:new er}}a.defaultEmptyData=r;function n(l="layer1",c="layer2"){return s("phong",l,c)}a.defaultData=n;function s(l,c="layer1",u="layer2"){let h=new er;return h.push({fi:0,data:Al.defaultData("light",l),id:c}),h.push({fi:1,data:Al.defaultData("color"),id:u}),{layers:h}}a.defaultTwoLayerData=s;function o(l,c="basic",u="layer1",h="layer2"){let f=Al.defaultData("texture");Object.assign(f.texture,{image:l});let d=new er;return d.push({fi:0,data:f,id:u}),d.push({fi:1,data:Al.defaultData("light",c),id:h}),{layers:d}}a.defaultTwoLayerTextureData=o})(Ri||(Ri={}));var Tl;(r=>{function i(){return{points:new er,roundness:0,shapeHoles:[],isClosed:!1}}r.defaultData=i;function e(n,s){let{points:o}=s;if(o){for(let a of o)if(a.data.position[0]===n[0]&&a.data.position[1]===n[1])return!0}return!1}r.isOverlappingExistingPoint=e;function t(n,s){let o=n.controlNext,a=s.controlPrevious;return n.position[0]===o.position[0]&&n.position[1]===o.position[1]&&s.position[0]===a.position[0]&&s.position[1]===a.position[1]}r.isStraightLine=t})(Tl||(Tl={}));var ip;(e=>{function i(t){return t==="PolygonGeometry"||t==="RectangleGeometry"||t==="StarGeometry"||t==="TriangleGeometry"||t==="EllipseGeometry"}e.is2DParametricMesh=i})(ip||(ip={}));var sp;(e=>{function i(t){if(t==="RectangleGeometry")return{width:320,height:320,type:t,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1};if(t==="VectorGeometry")return{width:100,height:100,type:t,subdivisions:12,shape:Tl.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1};throw new Error("not implemented")}e.defaultData=i})(sp||(sp={}));var Bu;(n=>{n.identity=be(se({},Rd.identity),{hiddenMatrix:_i.identity});function e(s){return{position:s.position,rotation:s.rotation,scale:s.scale,hiddenMatrix:s.hiddenMatrix}}n.fromObject=e;function t(s,o){return{position:(o==null?void 0:o.position)||s.position,rotation:(o==null?void 0:o.rotation)||s.rotation,scale:(o==null?void 0:o.scale)||s.scale,hiddenMatrix:(o==null?void 0:o.hiddenMatrix)||s.hiddenMatrix}}n.merge=t;function r(s,o){return{position:vr.isEqual(s.position,o.position)?null:o.position,rotation:vr.isEqual(s.rotation,o.rotation)?null:o.rotation,scale:vr.isEqual(s.scale,o.scale)?null:o.scale,hiddenMatrix:_i.isEqual(s.hiddenMatrix,o.hiddenMatrix)?null:o.hiddenMatrix}}n.diff=r})(Bu||(Bu={}));var $s;(e=>e.defaultData=se({states:new er,events:new er,visible:!0,raycastLock:!1},Bu.identity))($s||($s={}));var gM;(e=>e.defaultData=se({type:"Empty"},$s.defaultData))(gM||(gM={}));var ky;(e=>e.defaultData=se(se({type:"Mesh"},$s.defaultData),rp.defaultData))(ky||(ky={}));var yM;(e=>e.defaultData=se(se({type:"TextFrame"},$s.defaultData),np.defaultData))(yM||(yM={}));var op;(e=>e.defaultData=se(se(se({},$s.defaultData),Bu.identity),ko.defaultData))(op||(op={}));var vM;(e=>{function i(t){return se(se({},$s.defaultData),tp.defaultData(t))}e.defaultData=i})(vM||(vM={}));var xM;(t=>(t.defaultCamera=se({position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],hiddenMatrix:_i.identity,name:"Play Camera",visible:!0,raycastLock:!1,states:new er,events:new er},ko.defaultData),t.defaultMeshObject=be(se(se({name:"Rectangle"},$s.defaultData),ky.defaultData),{geometry:sp.defaultData("RectangleGeometry"),material:Ri.defaultTwoLayerData("basic","layer1","layer2")})))(xM||(xM={}));var Nu;(t=>{function i(r,n){if(n===void 0)return r;let s=se({},r);return"material"in s&&"material"in n&&n.material&&(s.material=My(s.material,o=>{if(typeof o!="string")for(let[a,l]of Object.entries(n.material.layers)){let c=o.layers.data(a);c&&Go(c,l)}}).data),s.materials&&n.materials&&(s.materials=My(s.materials,o=>{var a,l;for(let c=0;c<s.materials.length;c++){let u=n.materials[c];if(typeof u!="string")for(let[h,f]of Object.entries(u.layers)){let d=(l=(a=o[c])==null?void 0:a.layers)==null?void 0:l.data(h);d&&Go(d,f)}}}).data),s}t.patchMaterialState=i;function e(r,n){var o,a;if(n===void 0)return r;let s=se({},r);if(Object.assign(s,Bu.merge(s,n)),Qs.is(r.type)){s.orthographic=se({},s.orthographic),s.perspective=se({},s.perspective);let l=n;((o=l.orthographic)==null?void 0:o.zoom)!==void 0&&(s.orthographic.zoom=l.orthographic.zoom),((a=l.perspective)==null?void 0:a.zoom)!==void 0&&(s.perspective.zoom=l.perspective.zoom)}else if(r.type==="Mesh")s.geometry=se({},s.geometry),Object.assign(s.geometry,n.geometry),s=i(s,n);else if(ep.is(r.type)){let l=n;s.intensity!==void 0&&(s.intensity=l.intensity),l.color!==void 0&&(typeof l.color=="string"?s.color=l.color:s.color=Sr.clone(l.color))}return s}t.patch=e})(Nu||(Nu={}));function wM(i,e=!1){let t=i[0].index!==null,r=new Set(Object.keys(i[0].attributes)),n=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Ie,c=0;for(let u=0;u<i.length;++u){let h=i[u],f=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let d in h.attributes){if(!r.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;s[d]===void 0&&(s[d]=[]),s[d].push(h.attributes[d]),f++}if(f!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let d in h.morphAttributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(h.morphAttributes[d])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(h.userData),e){let d;if(t)d=h.index.count;else if(h.attributes.position!==void 0)d=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,d,u),c+=d}}if(t){let u=0,h=[];for(let f=0;f<i.length;++f){let d=i[f].index;for(let m=0;m<d.count;++m)h.push(d.getX(m)+u);u+=i[f].attributes.position.count}l.setIndex(h)}for(let u in s){let h=bM(s[u]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,h)}for(let u in o){let h=o[u][0].length;if(h===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let f=0;f<h;++f){let d=[];for(let p=0;p<o[u].length;++p)d.push(o[u][p][f]);let m=bM(d);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(m)}}return l}function bM(i){let e,t,r,n=0;for(let a=0;a<i.length;++a){let l=i[a];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(r===void 0&&(r=l.normalized),r!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;n+=l.array.length}let s=new e(n),o=0;for(let a=0;a<i.length;++a)s.set(i[a].array,o),o+=i[a].array.length;return new Ue(s,t,r)}function SM(i,e=1e-4){e=Math.max(e,Number.EPSILON);let t={},r=i.getIndex(),n=i.getAttribute("position"),s=r?r.count:n.count,o=0,a=Object.keys(i.attributes),l={},c={},u=[],h=["getX","getY","getZ","getW"];for(let p=0,g=a.length;p<g;p++){let y=a[p];l[y]=[];let v=i.morphAttributes[y];v&&(c[y]=new Array(v.length).fill().map(()=>[]))}let f=Math.log10(1/e),d=Math.pow(10,f);for(let p=0;p<s;p++){let g=r?r.getX(p):p,y="";for(let v=0,b=a.length;v<b;v++){let w=a[v],x=i.getAttribute(w),E=x.itemSize;for(let T=0;T<E;T++)y+=`${~~(x[h[T]](g)*d)},`}if(y in t)u.push(t[y]);else{for(let v=0,b=a.length;v<b;v++){let w=a[v],x=i.getAttribute(w),E=i.morphAttributes[w],T=x.itemSize,S=l[w],I=c[w];for(let C=0;C<T;C++){let M=h[C];if(S.push(x[M](g)),E)for(let _=0,R=E.length;_<R;_++)I[_].push(E[_][M](g))}}t[y]=o,u.push(o),o++}}let m=i.clone();for(let p=0,g=a.length;p<g;p++){let y=a[p],v=i.getAttribute(y),b=new v.array.constructor(l[y]),w=new Ue(b,v.itemSize,v.normalized);if(m.setAttribute(y,w),y in c)for(let x=0;x<c[y].length;x++){let E=i.morphAttributes[y][x],T=new E.array.constructor(c[y][x]),S=new Ue(T,E.itemSize,E.normalized);m.morphAttributes[y][x]=S}}return m.setIndex(u),m}var Vy={type:"change"},MM={type:"changeZoom"},aO={type:"changePan"},El={type:"start"},Ou={type:"end"},Hy=new Ut,lO=new N,cO=2*Math.PI,uO=1e-8,hO=.01,AM=2,Wy=.125,TM=2,jy=1,qy=1,Xy=.1;var ap=class extends jt{constructor(t,r){super();this.object=t;this.domElement=r;this.enabled=!0;this.useKeyEvents=!0;this.enableDamping=!1;this.enableZoom=!0;this.enableRotate=!0;this.enablePan=!0;this.autoRotate=!1;this.rotationLimitsMode=0;this.panLimitsMode=0;this.rotationSoftLimit=2;this.panSoftLimit=2;this.hoverRotatePanMode=0;this.zoomLimitsEnabled=!1;this.preventScroll=!0;this.mouseButtons=[0,5];this.mouseButtonsPlay=[3,4,5];this.touches=[null,En.DOLLY_ROTATE,En.PAN];this.offset=new A;this.eye=new A;this.lastPosition=new A;this.lastQuaternion=new Ut;this.current=new N;this.overShoot=new N;this.overRatio=new N;this.spherical=new hu;this.sphericalDelta=new hu;this.panOffset=new A;this.panLeftV=new A;this.panUpV=new A;this.panV=new A;this.rotateStart=new N;this.rotateEnd=new N;this.rotateDelta=new N;this.panStart=new N;this.panEnd=new N;this.panDelta=new N;this.dollyStart=new N;this.dollyEnd=new N;this.dollyDelta=new N;this.rotationRangeFactor=new N;this.panRangeFactor=new N;this.state=-1;this.zoomChanged=!1;this.isPointerDown=!1;this.isFirstHover=!0;this.isThetaFlipped=!1;this.prevScale=0;this.scale=1;this.gesture=!1;this.timer=-1;this.timerHover=-1;this.minDistance=0;this.maxDistance=1/0;this.minZoom=0;this.maxZoom=1/0;this.minPhi=0;this.maxPhi=Math.PI;this.minTheta=-1/0;this.maxTheta=1/0;this.minH=0;this.maxH=Math.PI;this.minV=-1/0;this.maxV=1/0;this.autoRotateClockwise=!0;this.isPanOverShoot=!1;this.isRotateOverShoot=!1;this.update=()=>{let t=this.object.position;this.offset.copy(t).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.autoRotate&&this.state===-1&&this.rotateLeft((this.autoRotateClockwise===!0?1:-1)*this.getAutoRotationAngle()),this.rotationLimitsMode!==0&&this.applyLimits(this.sphericalDelta,this.rotationLimitsMode,this.rotationSoftLimit,this.maxTheta,this.minTheta,this.maxPhi,this.minPhi,this.rotationRangeFactor),this.rotationLimitsMode!==2&&(this.spherical.phi+=this.sphericalDelta.phi),(this.rotationLimitsMode!==1||this.autoRotate===!0)&&(this.spherical.theta+=this.sphericalDelta.theta),this.spherical.radius*=this.scale,this.zoomLimitsEnabled&&(this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius))),this.panLimitsMode!==0&&(this.target.applyQuaternion(Hy.copy(this.object.quaternion).invert()),this.panOffset.applyQuaternion(Hy),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(this.object.quaternion),this.panOffset.applyQuaternion(this.object.quaternion)),this.panLimitsMode===2&&(this.panOffset.y=0),this.panLimitsMode===1&&(this.panOffset.x=0),this.state===-1&&!this.gesture?(this.panOffset.multiplyScalar(1-Wy),this.target.add(this.panOffset)):(this.target.add(this.panOffset),this.panOffset.set(0,0,0)),this.offset.setFromSpherical(this.spherical),t.copy(this.target).add(this.offset);let r=this.spherical.phi%cO;return this.eye.copy(this.offset).normalize(),this.object.up.copy(ot.DefaultUp).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),r>0&&r>Math.PI||r<0&&r>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),this.state===-1||this.enableDamping===!0?(this.sphericalDelta.theta*=1-Wy,this.sphericalDelta.phi*=1-Wy):this.sphericalDelta.set(0,0,0),this.scale=1,this.zoomChanged||this.lastPosition.distanceToSquared(this.object.position)>hO||8*(1-this.lastQuaternion.dot(this.object.quaternion))>uO?(this.dispatchEvent(Vy),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),this.zoomChanged=!1,!0):(this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),!1)};this.onPointerDown=t=>{this.enabled!==!1&&(this.isPointerDown=!0,Mt.length===0&&(this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)),dO(t),t.pointerType==="touch"?this.onPointerDownTouch(t):this.onPointerDownMouse(t))};this.onPointerMove=t=>{this.enabled!==!1&&(t.pointerType==="touch"?this.onPointerMoveTouch(t):this.onPointerMoveMouse(t))};this.onPointerUp=t=>{_M(t),this.isPointerDown=!1,Mt.length===0&&(this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp)),this.dispatchEvent(Ou),this.state=-1};this.onPointerCancel=t=>{_M(t)};this.onPointerDownMouse=t=>{let r;switch(this.useKeyEvents?r=this.mouseButtons[t.button]:r=this.mouseButtonsPlay[t.button],r){case 0:if(t.altKey===!0&&!t.shiftKey&&!Id(t)){if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}else if(this.key===" "){if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}break;case 4:if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2;break;case 3:if(Id(t)||t.shiftKey){if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}break;case 5:if(Id(t)||t.shiftKey){if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}else{if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}break;default:this.state=-1}this.state!==-1&&this.dispatchEvent(El)};this.onPointerMoveMouse=t=>{switch(this.state){case 0:if(this.enableRotate===!1)return;this.handleMouseMoveRotate(t);break;case 1:if(this.enableZoom===!1)return;this.handleMouseMoveDolly(t);break;case 2:if(this.enablePan===!1)return;this.handleMouseMovePan(t);break}};this.onPointerDownTouch=t=>{switch(CM(t),this.touches[Mt.length-1]){case En.ROTATE:if(this.enableRotate===!1){this.state=-1;return}this.handleTouchStartRotate(),this.state=3;break;case En.PAN:if(this.enablePan===!1){this.state=-1;return}this.handleTouchStartPan(),this.state=4;break;case En.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchStartDollyPan(),this.state=5;break;case En.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}this.state!==-1&&this.dispatchEvent(El)};this.onPointerMoveTouch=t=>{switch(CM(t),this.state){case 3:if(this.enableRotate===!1)return;this.handleTouchMoveRotate(t),this.update();break;case 4:if(this.enablePan===!1)return;this.handleTouchMovePan(t),this.update();break;case 5:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchMoveDollyPan(t),this.update();break;case 6:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchMoveDollyRotate(t),this.update();break;default:this.state=-1}};this.dispatchEndDebounced=Mu(()=>this.dispatchEvent(Ou),33);this.onMouseWheel=t=>{this.enabled===!1||this.enableZoom===!1&&this.enablePan===!1||((this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth||this.preventScroll)&&t.preventDefault(),this.dispatchEvent(El),this.handleMouseWheel(t),this.dispatchEndDebounced())};this.onGesture=t=>{if(this.enabled!==!1)if(t.preventDefault(),t.type==="gesturechange"){if(this.enableZoom===!1)return;this.dispatchEvent(El),t.scale>this.prevScale?this.dollyIn(this.getZoomScale()):t.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=t.scale,this.update()}else this.dispatchEvent(Ou)};this.onContextMenu=t=>{this.enabled!==!1&&t.preventDefault()};this.onTouchMove=t=>{(t.touches.length>1||this.preventScroll)&&t.preventDefault()};this.onTouchEnd=t=>{t.preventDefault()};this.onKeyDown=t=>{this.enabled!==!1&&(this.key=t.key)};this.onKeyUp=()=>{this.enabled!==!1&&(this.key=void 0,this.state!==-1&&this.onPointerUp(Mt[0]))};this.onPointerHover=t=>{if(!(Pd||this.enabled===!1||this.state!==-1||this.hoverRotatePanMode===2&&this.isPanOverShoot||this.hoverRotatePanMode===1&&this.isRotateOverShoot)){if(window.clearTimeout(this.timerHover),this.isPointerDown=!0,this.isFirstHover){let r={clientX:window.innerWidth/2,clientY:window.innerHeight/2};this.hoverRotatePanMode===2?this.handleMouseDownPan(r):this.hoverRotatePanMode===1&&this.handleMouseDownRotate(r),this.isFirstHover=!1}this.hoverRotatePanMode===2?this.handleMouseMovePan(t,Xy):this.hoverRotatePanMode===1&&this.handleMouseMoveRotate(t,Xy),this.timerHover=window.setTimeout(()=>{this.isPointerDown=!1},30)}};this.object=t,this.domElement=r,this.target=this.object.getTarget(),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.connect(),this.update()}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Vy),this.isFirstHover=!0,this.update(),this.state=-1}resetTo(t,r,n){this.target.copy(t),this.object.position.copy(r),this.object.zoom=n,this.object.updateProjectionMatrix(),this.dispatchEvent(Vy),this.update(),this.state=-1}fromJSON(t){this.setEnableDampingSpeed(t.enableDamping),this.enablePan=t.enablePan,this.enableZoom=t.enableZoom,this.enableRotate=t.enableRotate,this.rotationLimitsMode=t.rotationLimitsMode,this.panLimitsMode=t.panLimitsMode,this.panSoftLimit=t.panSoftLimit,this.rotationSoftLimit=t.rotationSoftLimit,this.hoverRotatePanMode=t.hoverRotatePanMode,this.isFirstHover=!0,this.hoverRotatePanMode!==0&&this.domElement.addEventListener("pointermove",this.onPointerHover),Xy=(t.hoverRotatePanStrength/100)**2,this.zoomLimitsEnabled=t.zoomLimitsEnabled,this.minZoom=t.zoomLimits.min,this.maxZoom=Math.max(t.zoomLimits.min,t.zoomLimits.max),this.minDistance=1e3/t.zoomLimits.max,this.maxDistance=Math.max(this.minDistance,1e3/t.zoomLimits.min),this.autoRotate=t.autoRotate,AM=t.autoRotateSpeed,this.autoRotateClockwise=t.autoRotateClockwise;let n=this.object.getTarget().applyQuaternion(Hy.copy(this.object.quaternion).invert());this.minV=-t.panVerticalOffset.min+n.y,this.maxV=t.panVerticalOffset.max+n.y,this.minH=-t.panHorizontalOffset.min+n.x,this.maxH=t.panHorizontalOffset.max+n.x,this.panRangeFactor.set(this.maxH-this.minH,this.maxV-this.minV).divideScalar(2),this.rotationRangeFactor.setScalar(Math.PI).divideScalar(4),this.minPhi=eo(this.spherical.phi-t.rotationVerticalOffset.min),this.maxPhi=eo(this.spherical.phi+t.rotationVerticalOffset.max),this.minTheta=eo(this.spherical.theta-t.rotationHorizontalOffset.min),this.maxTheta=eo(this.spherical.theta+t.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,this.preventScroll=t.preventScroll,t.orbitTouches===1&&(this.touches[0]=En.ROTATE),t.panTouches===1&&(this.touches[0]=En.PAN),t.orbitTouches===2&&(this.touches[1]=En.DOLLY_ROTATE),t.panTouches===2&&(this.touches[1]=En.DOLLY_PAN),t.orbitTouches===3&&(this.touches[2]=En.ROTATE),t.panTouches===3&&(this.touches[2]=En.PAN)}connect(){this.domElement.addEventListener("contextmenu",this.onContextMenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointercancel",this.onPointerCancel),this.domElement.addEventListener("wheel",this.onMouseWheel),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keyup",this.onKeyUp,!1),_u||(this.domElement.addEventListener("gesturestart",this.onGesture),this.domElement.addEventListener("gesturechange",this.onGesture),this.domElement.addEventListener("gestureend",this.onGesture)),this.domElement.addEventListener("touchmove",this.onTouchMove),this.domElement.addEventListener("touchend",this.onTouchEnd)}dispose(){this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointercancel",this.onPointerCancel),this.domElement.removeEventListener("wheel",this.onMouseWheel),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keyup",this.onKeyUp,!1),this.domElement.removeEventListener("pointermove",this.onPointerHover),_u||(this.domElement.removeEventListener("gesturestart",this.onGesture),this.domElement.removeEventListener("gesturechange",this.onGesture),this.domElement.removeEventListener("gestureend",this.onGesture)),this.domElement.removeEventListener("touchmove",this.onTouchMove),this.domElement.removeEventListener("touchend",this.onTouchEnd),this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp)}applyLimits(t,r,n,s,o,a,l,c){this.overShoot.set(0,0);let u,h,f;t instanceof A?(u=t.x,h=t.y,this.current.set(this.target.x,this.target.y),f=!0):(u=t.theta,h=t.phi,this.current.set(eo(this.spherical.theta),eo(this.spherical.phi)),f=!1),n===0&&(this.current.x+=u,this.current.y+=h),(r===3||r===2)&&(!f&&this.isThetaFlipped?this.current.x>s&&this.current.x<0?this.overShoot.x=s-this.current.x:this.current.x<o&&this.current.x>0&&(this.overShoot.x=o-this.current.x):this.current.x>s?this.overShoot.x=s-this.current.x:this.current.x<o&&(this.overShoot.x=o-this.current.x),s===o&&(u=0)),(r===3||r===1)&&(this.current.y>a?this.overShoot.y=a-this.current.y:this.current.y<l&&(this.overShoot.y=l-this.current.y),a===l&&(h=0)),f||(this.overShoot.x=eo(this.overShoot.x),this.overShoot.y=eo(this.overShoot.y)),n!==0?(this.overRatio.copy(this.overShoot).divide(c),this.overRatio.x=Math.min(Math.abs(this.overRatio.x),1),this.overRatio.y=Math.min(Math.abs(this.overRatio.y),1),n===1&&(this.overRatio.x=EM(Math.abs(this.overRatio.x)),this.overRatio.y=EM(Math.abs(this.overRatio.y))),this.isPointerDown||n===1?n===2&&(this.overRatio.x>.9||this.overRatio.y>.9)?this.isPointerDown=!1:(u*this.overShoot.x<0&&(u*=1-this.overRatio.x),h*this.overShoot.y<0&&(h*=1-this.overRatio.y)):n===2&&(!f&&(this.overRatio.x>.002||this.overRatio.y>.002)||f&&(Math.abs(this.overShoot.x)>2||Math.abs(this.overShoot.y)>2)?(u=this.overShoot.x*.05,h=this.overShoot.y*.05,f?this.isPanOverShoot=!0:this.isRotateOverShoot=!0):f?this.isPanOverShoot=!1:this.isRotateOverShoot=!1)):(u+=this.overShoot.x,h+=this.overShoot.y),t instanceof A?(t.x=u,t.y=h):(t.theta=u,t.phi=h)}setEnableDampingSpeed(t){this.enableDamping=t,jy=t===!0?.2:1}stopDamping(){this.sphericalDelta.theta=0,this.sphericalDelta.phi=0}getAutoRotationAngle(){return 2*Math.PI/60/60*AM}getZoomScale(){return Math.pow(.95,TM)}rotateLeft(t){this.sphericalDelta.theta-=t}rotateUp(t){this.sphericalDelta.phi-=t}panLeft(t,r){this.panLeftV.setFromMatrixColumn(r,0),this.panLeftV.multiplyScalar(-t),this.panOffset.add(this.panLeftV)}panUp(t,r){this.panUpV.setFromMatrixColumn(r,1),this.panUpV.multiplyScalar(t),this.panOffset.add(this.panUpV)}pan(t,r){let n=this.domElement;if(n&&this.object.isPerspectiveCamera){let s=this.object.position;this.panV.copy(s).sub(this.target);let o=this.panV.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*t*o/n.clientHeight,this.object.matrix),this.panUp(2*r*o/n.clientHeight,this.object.matrix)}else n&&this.object.isOrthographicCamera&&(this.panLeft(t*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this.panUp(r*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix));this.dispatchEvent(aO)}dollyOut(t){this.object.isPerspectiveCamera?this.scale/=t:this.object.isOrthographicCamera&&(this.object.zoom*=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(MM)}dollyIn(t){this.object.isPerspectiveCamera?this.scale*=t:this.object.isOrthographicCamera&&(this.object.zoom/=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(MM)}zoomOut(t=this.getZoomScale()){this.dispatchEvent(El),this.dollyOut(t),this.dispatchEvent(Ou)}zoomIn(t=this.getZoomScale()){this.dispatchEvent(El),this.dollyIn(t),this.dispatchEvent(Ou)}handleMouseDownRotate(t){this.rotateStart.set(t.clientX,t.clientY)}handleMouseDownDolly(t){this.dollyStart.set(t.clientX,t.clientY)}handleMouseDownPan(t){this.panStart.set(t.clientX,t.clientY)}handleMouseMoveRotate(t,r=1){this.rotateEnd.set(t.clientX,t.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(jy*r).rotateAround(lO,-this.object.angleOffsetFromUp);let n=this.domElement;this.rotateLeft(2*Math.PI*this.rotateDelta.x/n.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/n.clientHeight),this.rotateStart.copy(this.rotateEnd),this.update()}handleMouseMoveDolly(t){this.dollyEnd.set(t.clientX,t.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyOut(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyIn(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()}handleMouseMovePan(t,r=1){this.panEnd.set(t.clientX,t.clientY),this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(qy*r),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd),this.update()}handleMouseWheel(t){if(fO(t)===!0&&zS===!1){if(this.enablePan===!1)return;this.gesture?(this.panDelta.set(-t.deltaX,-t.deltaY).multiplyScalar(qy),this.panDelta.x=Math.min(Math.abs(this.panDelta.x),100)*(this.panDelta.x<0?-1:1),this.panDelta.y=Math.min(Math.abs(this.panDelta.y),100)*(this.panDelta.y<0?-1:1),t.altKey?this.pan(0,this.panDelta.y):t.shiftKey?this.pan(this.panDelta.x,0):this.pan(this.panDelta.x,this.panDelta.y),this.update()):(this.gesture=!0,this.isPointerDown=!0),window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.gesture=!1,this.isPointerDown=!1},30)}else{if(this.enableZoom===!1)return;t.deltaY===0?t.deltaX<0?this.dollyIn(this.getZoomScale()):t.deltaX>0&&this.dollyOut(this.getZoomScale()):t.deltaY<0?this.dollyIn(this.getZoomScale()):t.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update(),this.gesture=!1,this.isPointerDown=!1}}handleTouchStartRotate(){if(Mt.length===2){let t=.5*(Mt[0].pageX+Mt[1].pageX),r=.5*(Mt[0].pageY+Mt[1].pageY);this.rotateStart.set(t,r)}else this.rotateStart.set(Mt[0].pageX,Mt[0].pageY)}handleTouchStartPan(){if(Mt.length===2){let t=.5*(Mt[0].pageX+Mt[1].pageX),r=.5*(Mt[0].pageY+Mt[1].pageY);this.panStart.set(t,r)}else this.panStart.set(Mt[0].pageX,Mt[0].pageY)}handleTouchStartDolly(){let t=Mt[0].pageX-Mt[1].pageX,r=Mt[0].pageY-Mt[1].pageY,n=Math.sqrt(t*t+r*r);this.dollyStart.set(0,n)}handleTouchStartDollyPan(){this.enableZoom&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(t){if(Mt.length===2){let n=Yy(t),s=.5*(t.pageX+n.x),o=.5*(t.pageY+n.y);this.rotateEnd.set(s,o)}else{if(t.pointerId!==Mt[0].pointerId)return;this.rotateEnd.set(t.pageX,t.pageY)}this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(jy);let r=this.domElement;r&&(this.rotateLeft(2*Math.PI*this.rotateDelta.x/r.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/r.clientHeight)),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(t){if(Mt.length===2){let r=Yy(t),n=.5*(t.pageX+r.x),s=.5*(t.pageY+r.y);this.panEnd.set(n,s)}else{if(t.pointerId!==Mt[0].pointerId)return;this.panEnd.set(t.pageX,t.pageY)}this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(qy),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(t){let r=Yy(t),n=t.pageX-r.x,s=t.pageY-r.y,o=Math.sqrt(n*n+s*s);this.dollyEnd.set(0,o),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,TM)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enablePan&&this.handleTouchMovePan(t)}handleTouchMoveDollyRotate(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enableRotate&&this.handleTouchMoveRotate(t)}};function eo(i){let e=Math.PI*2;for(;i<=-Math.PI;)i+=e;for(;i>Math.PI;)i-=e;return i}function EM(i){return 1-Math.pow(1-i,4)}function fO(i){return i.wheelDeltaY===0||i.deltaY===0?Eu&&i.shiftKey&&Math.abs(i.wheelDeltaX)>=120?!1:i.wheelDeltaX?i.wheelDeltaX===-3*i.deltaX:i.deltaMode===0:i.wheelDeltaY?i.wheelDeltaY===-3*i.deltaY:i.deltaMode===0}var Mt=[],lp={};function dO(i){Mt.push(i)}function _M(i){delete lp[i.pointerId];for(let e=0;e<Mt.length;e++)if(Mt[e].pointerId===i.pointerId){Mt.splice(e,1);return}}function CM(i){let e=lp[i.pointerId];e===void 0&&(e=new N,lp[i.pointerId]=e),e.set(i.pageX,i.pageY)}function Yy(i){let e=i.pointerId===Mt[0].pointerId?Mt[1]:Mt[0];return lp[e.pointerId]}var to=class extends Hf{constructor(){super(),this.layers.enable(3)}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,r=[]){return e.forEach(n=>{n.visible&&this.intersectObject(n,t,r)}),r}createRaycastLineHelper(){let e=new Ur({color:65280,linewidth:10}),t=new A(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),r=new A(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),n=this.camera.far-this.camera.near,s=new A().addVectors(t,r.multiplyScalar(n)),o=new Ie;return o.setFromPoints([t,s]),new ns(o,e)}};var DM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,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},i.parameters),r=t.width/2,n=(a=t.radiusTop)!=null?a:r,s=(l=t.radiusBottom)!=null?l:r;return n===s?(n=r,s=r):n>s?(n=r,s=s*r/n):(n=n*r/s,s=r),{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:n,radiusBottom:s})}}static build(i){let{width:e,depth:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,radiusTop:c,radiusBottom:u,cornerRadius:h,cornerSegments:f,hollow:d}=i.parameters,m;return h||d?m=new Fu(c,u,r,n,s,o,a,l*Math.PI/180,h,h,f,d):m=new Lo(c,u,r,n,s,o,a,l*Math.PI/180),m.scale(1,1,t/e),Object.assign(m,{userData:be(se({},i),{type:"CylinderGeometry"})})}};function ro(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function LM(i){return new N(i.y,-i.x)}var Fu=class extends Ie{constructor(e,t,r,n,s,o,a,l,c,u,h,f,d=!1){super(),this.type="RoundedCylinderBufferGeometry",e=e!==void 0?e:1,t=t!==void 0?t:1,r=r||1,n=Math.floor(n)||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 m=[],p=[],g=[],y=[],v=0,b=r/2,w=new A,x=new A;d&&e==0&&(e=c),d&&t==0&&(t=u);let E=new N(e,b),T=new N(t,-b),S=null,I=null,C=null,M=null,_=E.clone().sub(T),R=0,B=0,O=0;f>0&&(R=Math.min(e,t)*(1-f),B=e-R,O=t-R);let z=E.clone();z.x-=R;let q=Math.PI-_.angle(),F=_.angle(),ee=Math.tan(F/2),k=Math.tan(q/2),V=ee+k,U=f?V:k,J=f?V:ee;if(c=Math.min(c,(e-B)/U,_.length()/V),u=Math.min(u,(t-O)/J,_.length()/V),c>0){let le=c/ee;S=E.clone().sub(new N(le,c)),f&&(C=S.clone(),C.x-=R-V*c),E.sub(_.clone().setLength(le))}if(u>0){let le=u/k;I=T.clone().sub(new N(le,-u)),T.add(_.clone().setLength(le)),f&&(M=I.clone(),M.x-=R-V*u,z.sub(_.clone().setLength(le)))}_=E.clone().sub(T);let K=_.length()<.5,$=[];for(let le=0;le<=n;le++){let W=[],ue=le/n,Y=ue*l+a,H=new N(Math.sin(Y),Math.cos(Y));M&&I?(j(W,ue,H,q,u,M,-1,!0),j(W,ue,H,F,u,I,-1,!1)):I?(ge(W,H,I.x,0,-1),j(W,ue,H,F,u,I,-1,!1)):o||ge(W,H,t,O,-1);let Q=LM(_).normalize();if(ro(Q,H,w),!K)for(let ce=0;ce<=s;ce++){let ie=ce/s,pe=_.clone().multiplyScalar(ie).add(T);ro(pe,H,x),p.push(x.x,x.y,x.z),g.push(w.x,w.y,w.z),y.push(ue,.5+x.y/r),W.push(v++)}if(C&&S?(j(W,ue,H,q,c,S,1,!1),j(W,ue,H,F,c,C,1,!0)):S?(j(W,ue,H,q,c,S,1,!1),ge(W,H,S.x,0,1)):o||ge(W,H,e,B,1),f&&!K){let ce=LM(_).multiplyScalar(-1).normalize();ro(ce,H,w);for(let ie=0;ie<=s;ie++){let pe=ie/s,ve=_.clone().multiplyScalar(-pe).add(z);ro(ve,H,x),p.push(x.x,x.y,x.z),g.push(w.x,w.y,w.z),y.push(ue,.5+x.y/r),W.push(v++)}}f&&!o&&W.push(W[0]),$.push(W)}for(let le=0;le<$.length-1;le++)for(let W=0;W<$[0].length-1;W++){if(o&&f&&W==s)continue;let ue=$[le][W],Y=$[le+1][W],H=$[le+1][W+1],Q=$[le][W+1],ce=p[H*3+0],ie=p[H*3+2];m.push(ue,Y,Q),(ce!=0||ie!=0)&&m.push(Y,H,Q)}l<Math.PI*2&&(ae(-1,$[0],a),ae(1,$[$.length-1],a+l)),this.setIndex(m),this.setAttribute("position",new Le(p,3)),this.setAttribute("normal",new Le(g,3)),this.setAttribute("uv",new Le(y,2));function j(le,W,ue,Y,H,Q,ce,ie){for(let pe=0;pe<h+1;pe++){let ve=pe/h,me=ce<0?ve:1-ve;ie&&(me-=1),me*=Y;let De=new N(Math.sin(me),Math.cos(me)*ce),ke=De.clone().multiplyScalar(H).add(Q);ro(ke,ue,x),p.push(x.x,x.y,x.z),ro(De,ue,w),g.push(w.x,w.y,w.z),y.push(W,.5+x.y/r),le.push(v++)}}function ge(le,W,ue,Y,H){let Q=new A,ce=new N,ie=[ue,Y];H<0&&ie.reverse();for(let pe of ie)ce.set(pe,b*H),ro(ce,W,Q),p.push(Q.x,Q.y,Q.z),g.push(0,H,0),y.push(.5,.5),le.push(v++)}function ae(le,W,ue){let Y=new N(Math.sin(ue),Math.cos(ue)),H=new N(-Math.cos(ue),Math.sin(ue)),Q=new A,ce=le<0?(ve,me,De)=>m.push(ve,me,De):(ve,me,De)=>m.push(ve,De,me),ie=new N((e+t+B+O)/4,0);ro(ie,Y,Q),p.push(Q.x,Q.y,Q.z),g.push(H.x,0,H.y),y.push(.5,.5);let pe=v++;for(let ve of W){let me=p.slice(ve*3,ve*3+3);p.push(...me),g.push(H.x,0,H.y);let De=y.slice(ve*2,ve*2+2);y.push(...De),v++}for(let ve=pe+1;ve<v-1;ve++)ce(pe,ve,ve+1);ce(pe,v-1,pe+1)}}};var PM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:0,cornerRadiusBottom:0,cornerSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,depth:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,cornerRadiusTop:c,cornerRadiusBottom:u,cornerSegments:h}=i.parameters,f;return c>0||u>0||l<360?f=new Fu(0,e/2,r,n,s,o,a,l*Math.PI/180,c,u,h,0,!0):f=new Fa(e/2,r,n,s,o),f.scale(1,1,t/e),Object.assign(f,{userData:be(se({},i),{type:"ConeGeometry"})})}};var IM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:0,cornerSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,widthSegments:n,heightSegments:s,depthSegments:o,cornerRadius:a,cornerSegments:l}=i.parameters,c;return a==0?c=new mn(e,t,r,n,s,o):c=new Qy(e,t,r,n,s,o,a,l),Object.assign(c,{userData:be(se({},i),{type:"CubeGeometry"})})}},Jy=Math.PI/2,Qy=class extends Ie{constructor(e=1,t=1,r=1,n=1,s=1,o=1,a=0,l=4){super(),this.type="BoxBufferGeometry";let c=this;n=Math.floor(n),s=Math.floor(s),o=Math.floor(o),l=Math.floor(l),a=Math.min(a,e/2,t/2,r/2);let u=[],h=[],f=[],d=[],m=0,p=0;g("z","y","x",-1,-1,r,t,e,o,s,0),g("z","y","x",1,-1,r,t,-e,o,s,1),g("x","z","y",1,1,e,r,t,n,o,2),g("x","z","y",1,-1,e,r,-t,n,o,3),g("x","y","z",1,-1,e,t,r,n,s,4),g("x","y","z",-1,-1,e,t,-r,n,s,5),a>0&&(y("z","y","x",-1,-1,1,r,t,e,o,0),y("z","y","x",1,-1,-1,r,t,e,o,1),y("z","y","x",-1,1,-1,r,t,e,o,1),y("z","y","x",1,1,1,r,t,e,o,0),y("x","y","z",-1,-1,-1,e,t,r,n,0),y("x","y","z",1,-1,1,e,t,r,n,1),y("x","y","z",-1,1,1,e,t,r,n,0),y("x","y","z",1,1,-1,e,t,r,n,1),y("y","x","z",-1,-1,1,t,e,r,s,0),y("y","x","z",1,-1,-1,t,e,r,s,1),y("y","x","z",1,1,1,t,e,r,s,1),y("y","x","z",-1,1,-1,t,e,r,s,0),v(1,1,1),v(-1,1,1),v(1,-1,1),v(-1,-1,1),v(1,1,-1),v(-1,1,-1),v(1,-1,-1),v(-1,-1,-1)),this.setIndex(u),this.setAttribute("position",new Le(h,3)),this.setAttribute("normal",new Le(f,3)),this.setAttribute("uv",new Le(d,2));function g(b,w,x,E,T,S,I,C,M,_,R){let B=(S-2*a)/M,O=(I-2*a)/_,z=S/2-a,q=I/2-a,F=C/2,ee=M+1,k=_+1,V=0,U=0,J=new A;for(let K=0;K<k;K++){let $=K*O-q;for(let j=0;j<ee;j++){let ge=j*B-z;J[b]=ge*E,J[w]=$*T,J[x]=F,h.push(J.x,J.y,J.z),J[b]=0,J[w]=0,J[x]=C>0?1:-1,f.push(J.x,J.y,J.z),d.push(j/M),d.push(1-K/_),V+=1}}for(let K=0;K<_;K++)for(let $=0;$<M;$++){let j=m+$+ee*K,ge=m+$+ee*(K+1),ae=m+($+1)+ee*(K+1),le=m+($+1)+ee*K;u.push(j,ge,le),u.push(ge,ae,le),U+=6}c.addGroup(p,U,R),p+=U,m+=V}function y(b,w,x,E,T,S,I,C,M,_,R){let B=(I-2*a)/_,O=I/2-a,z=C/2-a,q=M/2,F=_+1,ee=0,k=0,V=new A,U=new A;for(let J=0;J<l+1;J++){let K=J/l*Jy,$=Math.sin(K)*a,j=(1-Math.cos(K))*a,ge=Math.sin(K),ae=Math.cos(K);V[w]=(z+$)*T,V[x]=(q-j)*S,U[b]=0,U[w]=ge*Math.sign(V[w]),U[x]=ae*Math.sign(V[x]);for(let le=0;le<F;le++){let W=le*B-O;V[b]=W*E,h.push(V.x,V.y,V.z),f.push(U.x,U.y,U.z),d.push(le/_),d.push(0),ee+=1}}for(let J=0;J<l;J++)for(let K=0;K<_;K++){let $=m+K+F*J,j=m+K+F*(J+1),ge=m+(K+1)+F*(J+1),ae=m+(K+1)+F*J;u.push($,j,ae),u.push(j,ge,ae),k+=6}c.addGroup(p,k,R),p+=k,m+=ee}function v(b,w,x){let E=new A,T=new A(e/2,t/2,r/2);T.subScalar(a);let S=[],I=b*w*x>0?(M,_,R)=>u.push(M,_,R):(M,_,R)=>u.push(M,R,_);for(let M=0;M<=l;M++){let _=[],R=Jy*(1-M/l),B=Math.cos(R),O=Math.sin(R),z=0;for(let q=0;q<=M;q++){let F=Math.cos(z),ee=Math.sin(z);E.x=B*F,E.y=O,E.z=B*ee;let k=T.clone().addScaledVector(E,a);h.push(b*k.x,w*k.y,x*k.z),f.push(b*E.x,w*E.y,x*E.z),d.push(0,0),_.push(m++),z+=Jy/M}S.push(_)}let C=S.length-1;for(let M=0;M<C;M++){let _=S[M],R=S[M+1],B=_.length-1;I(_[0],R[1],R[0]);for(let O=1;O<=B;O++)I(_[O-1],_[O],R[O]),I(_[O],R[O+1],R[O])}}}};var no=class extends Ie{constructor(e=[],t=[],r="",n=1,s=.2,o=4){super(),this.type="PolyhedronGeometryRound";let a=[],l=[],c=[];u(),h(),this.setAttribute("position",new Le(a,3)),this.setAttribute("normal",new Le(c,3)),this.setAttribute("uv",new Le(l,2));return;function u(){var ee;s=Math.min(1-1e-5,s),s==0&&(o=0);let d={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[r],m=new A,p=m.clone(),g=new Jt,y=s*n,v=n-y,b=o+1,w=new A,x=(k,V)=>w.subVectors(k,V).normalize(),E=(k,V)=>Array(k).fill(void 0).map(V),T=E(e.length/3,(k,V)=>new A().fromArray(e,V*3).setLength(n)),S=[],I=1e6;for(let k=0;k<T.length;k++){let V=T[k],U=[],J,K,$,j=1e10,ge=-1;for(;(ge=t.indexOf(k,ge+1))!=-1;){let ue=ge-ge%3;J=t[ue+(ge+1)%3],K=t[ue+(ge+2)%3],$=V.distanceToSquared(T[J]),j=Math.min(j,$),U.push([J,K,$])}j+=1e-6;let ae=[],le=0,W=U.length;for(let ue=0;ue<W;ue++){[J,K,$]=U[le];let Y=((ee=S[J])==null?void 0:ee.includes(k))==!0;$<=j&&ae.push(J+ +Y*I),le=U.findIndex(H=>H[0]==K)}S.push(ae)}let C=[];{let k=0,V=0,U,J,K=d==3;for(let $=0;$<=o;$++){U=$*($+1)/2,J=($+1)*($+2)/2;for(let j=0;j<o-$;j++)[k,V]=[U+j+$+2,J+j+$+3],C.push(U,J,...K?[V,U]:[k,J],V,k),[U,J]=[k,V];C.push(U,J,U+o+2)}}let M=m.clone(),_=m.clone(),R=m.clone(),B=m.clone(),O=m.clone(),z=[],q=E(T.length,()=>E(d,()=>m.clone()));for(let k=0;k<T.length;k++){m.copy(T[k]).normalize(),M.copy(m).multiplyScalar(v);let V=S[k];for(let ae=0;ae<V.length;ae++){let le=V[ae],W=V[(ae+1)%d];g.setFromPointsAndIndices(T,k,le%I,W%I),g.b.sub(g.a).setLength(1e10).add(g.a),g.c.sub(g.a).setLength(1e10).add(g.a),g.closestPointToPoint(M,q[k][ae])}let U=[],J=[],K=[],$=new A;o==0&&[...q[k]].reduce((ae,le)=>ae.add(le),$).multiplyScalar(1/d);for(let ae=0;ae<d;ae++){let le=[],W=(ae-1+d)%d,ue=q[k][W],Y=q[k][ae];m.copy(ue).sub(M),p.copy(Y).sub(M);let H=M.angleTo(m),Q=m.angleTo(p),ce=Math.cos(H)*y;o==0?_.copy($):_.copy(M).setLength(v+ce),J.push(ce);let ie=[_,ue,Y];for(let pe=0;pe<2;pe++){let ve=ie[pe],me=ie[pe+1];B.subVectors(ve,M),O.subVectors(me,M),R.crossVectors(B,O).normalize();for(let De=0;De<b;De++){let ke=[H,Q][pe]*De/b;m.copy(B).applyAxisAngle(R,ke).add(M),U.push(m.clone()),pe&&(x(m,M),le.push([De==0?ve:m.clone(),w.clone()]))}pe&&(x(me,M),le.push([me,w.clone()]))}K.push(le)}z.push(K);let j=2*b,ge=2;for(let ae=0;ae<d;ae++){let le=j*ae,W=j*((ae+1)%d),ue=[U[le]];for(let H=1;H<b;H++){B=U[le+H],O=U[W+H],ue.push(B);for(let Q=1,ce=H-ge+1;Q<=ce;Q++)m.lerpVectors(B,O,Q/(ce+1)),m.sub(M).setLength(J[ae]).add(M),ue.push(m.clone());ue.push(O)}for(let H=0;H<b;H++)ue.push(U[H+b+le]);ue.push(U[W+b]);let Y=C.map(H=>ue[H]);a.push(...Y.map(H=>[H.x,H.y,H.z]).flat()),c.push(...Y.map(H=>(x(H,M),[w.x,w.y,w.z])).flat())}}let F=[];for(let k=0;k<S.length;k++)for(let V=0;V<d;V++){let U=S[k][V];if(U<I){let J=S[U].findIndex(j=>j%I==k),K=z[k][V],$=z[U][J];for(let j=0;j<b;j++){let ge=K[j],ae=$[b-j],le=K[j+1],W=$[b-(j+1)];[ge,ae,le,le,ae,W].forEach(ue=>{a.push(ue[0].x,ue[0].y,ue[0].z),c.push(ue[1].x,ue[1].y,ue[1].z)})}F.push(K[0][0],$[b][0],K[b][0],$[0][0])}}for(;F.length;){let k,V,U,J;[k,V]=F.splice(0,2);let K=[k];for(;k!=V;)K.push(V),U=F.indexOf(V),J=U%2,V=F.splice(U-J,2)[1-J];w.subVectors(K[0],K[1]).cross(m.subVectors(K[0],K[2])).normalize();let $=w.dot(K[0])<0;$&&w.negate();for(let j=1;j<=K.length-2;j++)[K[j+ +$],K[j+1-+$],K[0]].forEach(ge=>{a.push(ge.x,ge.y,ge.z),c.push(w.x,w.y,w.z)})}}function h(){let f=new A;for(let T=0;T<a.length;T+=3){f.x=a[T+0],f.y=a[T+1],f.z=a[T+2];let S=x(f)/2/Math.PI+.5,I=E(f)/Math.PI+.5;l.push(S,1-I)}let d=new A,m=new A,p=new A,g=new A,y=new N,v=new N,b=new N,w=(T,S,I,C)=>{C<0&&T.x===1&&(l[S]=T.x-1),I.x===0&&I.z===0&&(l[S]=C/2/Math.PI+.5)};for(let T=0,S=0;T<a.length;T+=9,S+=6){d.set(a[T+0],a[T+1],a[T+2]),m.set(a[T+3],a[T+4],a[T+5]),p.set(a[T+6],a[T+7],a[T+8]),y.set(l[S+0],l[S+1]),v.set(l[S+2],l[S+3]),b.set(l[S+4],l[S+5]),g.copy(d).add(m).add(p).divideScalar(3);let I=x(g);w(y,S+0,d,I),w(v,S+2,m,I),w(b,S+4,p,I)}for(let T=0;T<l.length;T+=6){let S=l[T+0],I=l[T+2],C=l[T+4],M=Math.max(S,I,C),_=Math.min(S,I,C);M>.9&&_<.1&&(S<.2&&(l[T+0]+=1),I<.2&&(l[T+2]+=1),C<.2&&(l[T+4]+=1))}function x(T){return Math.atan2(T.z,-T.x)}function E(T){return Math.atan2(-T.y,Math.sqrt(T.x*T.x+T.z*T.z))}}}static fromJSON(e){return new no(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}};var RM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:n,corner:s,cornerSides:o}=i.parameters,a=n===0&&s!==0?new Uu(e*.5,s,o):new za(e*.5,n);return a.scale(1,t/e,r/e),Object.assign(a,{userData:be(se({},i),{type:"DodecahedronGeometry"})})}},Uu=class extends no{constructor(e=1,t=.2,r=4){let n=(1+Math.sqrt(5))/2,s=1/n,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,-n,0,-s,n,0,s,-n,0,s,n,-s,-n,0,-s,n,0,s,-n,0,s,n,0,-n,0,-s,n,0,-s,-n,0,s,n,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,r),this.type=l}static fromJSON(e){return new Uu(e.radius,e.corner,e.cornerSides)}};var zu=1e-12,_l=class{constructor(e){this.position=new N;this.startPosition=new N;this.uuid=et.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 _l(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},Cl=class extends _l{constructor(t){super(t.position);this.parent=t}copy(t){return super.copy(t),this}clone(){return new Cl(this.parent).copy(this)}},ui=class extends _l{constructor(t,r){super(r);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=t,this.controls.push(new Cl(this),new Cl(this))}static create(t,r){let n=new ui(t,new N(...r.position));return n.controls[0].position.set(...r.controlPrevious.position),n.controls[1].position.set(...r.controlNext.position),n.roundness=r.roundness,n.areControlsDirectionsMirrored=r.areControlsDirectionsMirrored,n}getOppositeControl(t){let r=this.controls.indexOf(t);return r===0?this.controls[1]:r===1?this.controls[0]:null}applyOffsetToControls(t,r=1){for(let n=0,s=this.controls.length;n<s;n++){let o=this.controls[n];this.position.distanceTo(o.position)<=r?o.position.copy(this.position):o.applyOffset(t)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(t){return super.copy(t),this.controls[0].copy(t.controls[0]),this.controls[1].copy(t.controls[1]),this.roundness=t.roundness,this.uuid=t.uuid,this}clone(){return new ui(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}},Ky=i=>i,ku=new N,Zy=new N,pO=new N,mO=new N,gO=new N,yO=new N,BM=new A,NM=new A;function OM(i){let e=new N;e.addVectors(i.v0,ku.subVectors(i.v1,i.v0).multiplyScalar(2/3));let t=new N;return t.addVectors(i.v2,Zy.subVectors(i.v1,i.v2).multiplyScalar(2/3)),new on(i.v0,e,t,i.v2)}function Gu(i,e,t=Number.EPSILON){return Math.abs(i-e)<t}function vO(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function xO(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function $y(i,e,t){let r=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),s=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2));return Math.acos((n*n+r*r-s*s)/(2*n*r))}function FM(i,e,t,r,n){let s=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),o=(i.y+e.y)/2,a=(i.x+e.x)/2,l=Math.sqrt(Math.pow(t,2)-Math.pow(s/2,2))*(i.y-e.y)/s,c=Math.sqrt(Math.pow(t,2)-Math.pow(s/2,2))*(e.x-i.x)/s;return r.set(a+l,o+c),n.set(a-l,o-c),[r,n]}function UM(i,e,t){let r=i.distanceTo(t),n=e.distanceTo(t);return r<n?e:i}function zM(i,e,t,r,n,s){let o=e.x-i.x,a=e.y-i.y,l=t.x-i.x,c=t.y-i.y,u=Math.sqrt((o+l)*(o+l)+(a+c)*(a+c)),h;return $y(e,i,t)>Math.PI&&(u*=-1),Gu(c,a)?h=(a+c)*(r/u-.5)*8/3/(o-l):h=(o+l)*(r/u-.5)*8/3/(c-a),n.set(e.x-h*a,e.y+h*o),s.set(t.x+h*c,t.y-h*l),[n,s]}function ev(i,e){return i.position.equals(i.controls[1].position)&&e.position.equals(e.controls[0].position)}function GM(i,e,t,r,n=.5){let s=ku.subVectors(e,i).multiplyScalar(n).add(i),o=Zy.subVectors(t,e).multiplyScalar(n).add(e),a=pO.subVectors(r,t).multiplyScalar(n).add(t),l=s,c=mO.subVectors(o,s).multiplyScalar(n).add(s),u=gO.subVectors(a,o).multiplyScalar(n).add(o),h=a,f=yO.subVectors(u,c).multiplyScalar(n).add(c);return[i.x,i.y,l.x,l.y,c.x,c.y,f.x,f.y,u.x,u.y,h.x,h.y,r.x,r.y]}function kM(i,e,t=12,r=!0){let n=NM.set(0,0,0),s,o=0,a=[];for(let l=0;l<e.length;l++){let c=Ky(e[l]),u=ku,h=io(c,t);a.push(h);for(let f=0;f<=h;f++)if(c instanceof on||c instanceof Gn||c instanceof an){if(c.getPoint(f/h,u),n.set(u.x,u.y,0),s!==void 0&&xO(s,n))continue;s===void 0&&(s=BM),s.copy(n),i.setXYZ(o,n.x,n.y,n.z),o++}}return r&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),i}function VM(i,e,t,r=12,n=!0){let s=NM.set(0,0,0),o=0,a=[];for(let l=0;l<e.length;l++){if(t[l]===!1)continue;let c,u=Ky(e[l]),h=ku,f=io(u,r);a.push(f);for(let d=0;d<=f;d++)if(u instanceof on||u instanceof Gn||u instanceof an){if(u.getPoint(d/f,h),s.set(h.x,h.y,0),c!=null&&c.equals(s))continue;c===void 0?c=BM:(i.setXYZ(o,c.x,c.y,c.z),o++,i.setXYZ(o,s.x,s.y,s.z),o++),c.copy(s)}}return n&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),a}function tv(i,e=12,t=!1){let r=[];for(let n=0,s=i.length;n<s;n++){let o=i[n],a=0;if(t&&o.roundedCurveCorner!==void 0){let l=io(o.roundedCurveCorner,e)*.5;n>0&&(r[n-1]+=l),a+=l}o.curveAfter!==void 0&&(a+=io(o.curveAfter,e)),r.push(a)}return i.length>0&&t&&i[0].roundedCurveCorner!==void 0&&(r[i.length-1]+=io(i[0].roundedCurveCorner,e)*.5),r}function io(i,e=12){return i&&i instanceof Bs?e*2:i&&(i instanceof an||i instanceof tu)?1:i&&i instanceof Co?e*i.points.length:e}function HM(i,e,t=12,r=!0){let n,s=0;for(let o=0;o<e.length;o++){let a=Ky(e[o]),l=io(a,t),c=ku;for(let u=0;u<=l;u++)if(a instanceof on||a instanceof Gn||a instanceof an){if(a.getPoint(u/l,c),n!==void 0&&vO(n,c,zu))continue;n===void 0&&(n=Zy),n.copy(c),i.push(c.x,c.y),s++}}return Gu(i[0],i[i.length-2],zu)&&Gu(i[1],i[i.length-1],zu)&&(i.pop(),i.pop()),r&&s>1&&!(Gu(i[s-1],i[1],zu)&&Gu(i[s-2],i[0],zu))&&(i.push(i[0],i[1]),s++),i}var rv=new N,bO=new N,wO=new N,SO=new N,MO=new N,AO=new N,At=class extends tn{constructor(t=100,r=100){super();this.points=[];this.shapeHoles=[];this.eventDispatcher=new jt;this.plane=new Fr(new A(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=et.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=t,this._height=r}static createFromState(t,r,n){let s=new At;return s.isClosed=t.isClosed,s.points=t.points.map(o=>ui.create(o.id,o.data)),typeof t.roundness=="number"&&(s.roundness=t.roundness),s.shapeHoles=t.shapeHoles.map(o=>At.createFromState(o)),r!==void 0&&n!==void 0&&s.applySize(r,n),s.update(),s}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(t){if(this._roundness!==t){this._roundness=t;for(let r=0,n=this.points.length;r<n;r++)this.points[r].roundness=t;this.needsUpdate=!0}}getPointsIndexesByIds(t){return t.map(r=>this.getPointIndexById(r)).filter(r=>r>=0)}getPointIndexById(t){return this.points.findIndex(r=>r.uuid===t)}getLineIndexById(t){return this.getPointIndexById(t)}getBezierPoint(t){if(t<=this.points.length-1)return this.points[t];if(this.shapeHoles.length>0)for(let r=0,n=this.shapeHoles.length;r<n;r++){let s=this.shapeHoles[r],o=t-this.points.length;if(o<=s.points.length-1)return s.points[o]}throw new Error("This shape does not have a point for this index: "+t)}getBezierPointIndex(t){let r=this.points.indexOf(t);if(r>=0)return r;if(r=this.points.length,this.shapeHoles.length>0)for(let n=0,s=this.shapeHoles.length;n<s;n++){let o=this.shapeHoles[n],a=o.points.indexOf(t);if(a>=0)return r+a;r+=o.points.length}return-1}getAllPoints(){let t=[].concat(...this.shapeHoles.map(r=>r.points));return[...this.points,...t]}applySize(t,r){t===0&&(t=.001),r===0&&(r=.001),this._width=t,this._height=r}applyScale(t,r){let n=rv.set(t,r);for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s];a.position.multiply(n),a.controls[0].position.multiply(n),a.controls[1].position.multiply(n)}for(let s=0,o=this.shapeHoles.length;s<o;s++)this.shapeHoles[s].applyScale(t,r);this._update(!1)}createPoint(t,r=0,n=et.generateUUID()){let s;t instanceof N?s=t:s=new N(t,r);let o=new ui(n,s);return o.roundness=this.roundness,o}addPoint(t){this.points.push(t),this.needsUpdate=!0}addPointAt(t,r){this.points.splice(r,0,t),this.needsUpdate=!0}getPointByUuid(t){for(let r=0,n=this.points.length;r<n;r++){let s=this.points[r];if(s.uuid===t)return s}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(t){let r=this.points.indexOf(t);r>=0&&this.points.splice(r,1),this.needsUpdate=!0}removePointById(t){let r=this.points.find(n=>n.uuid===t);r&&this.removePoint(r)}update(t=!0){for(let r=0,n=this.shapeHoles.length;r<n;r++)this.shapeHoles[r].update(!1);this._update(t)}extractShapePointsToBuffer(t,r=12,n=!1){this.subdivision=r,this.curveDivisions===void 0&&this.computeCurveDivisions(r);let s=n?this.roundedCurveDivisions:this.curveDivisions;return kM(t,n?this.roundedCurves:this.curves,r,this.autoClose),s.reduce((o,a)=>o+a,0)+1}computeCurveDivisions(t=12){return this.curveDivisions=tv(this.points,t,!1),this.roundedCurveDivisions=tv(this.points,t,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(t,r,n=12){return VM(t,this.curves,r,n,this.autoClose).reduce((o,a)=>o+a,0)*2}extractShapePointsToFlatArray(t,r=12){return this.subdivision=r,this.curveDivisions===void 0&&this.computeCurveDivisions(r),HM(t,this.roundedCurves,r,this.autoClose)}getCurveIndexFromVertexId(t,r=!1){let n=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let s=r?this.roundedCurveDivisions:this.curveDivisions,o=0;r&&this.points[0].roundedCurveCorner!==void 0&&(o=io(this.points[0].roundedCurveCorner,this.subdivision)*.5);let a=t-o;a<0&&(a+=s.reduce((l,c)=>l+c,0));for(let l=0,c=s.length;l<c;l++){let u=s[l];if(a<n+u)return[l,(a-n+1)/u];n+=u}return[0,1]}getCurveT(t,r,n){let s=this.points[t],o=this.points[t>=this.points.length-1?0:t+1],a=this.curveDivisions,l=a[t];if(ev(s,o)){let h=s.position.distanceTo(o.position);return s.position.distanceTo(rv.set(n.x,n.y))/h}let c=0;for(let h=0;h<t;h++)c+=a[h];return(r-c)/l}dispose(){this.eventDispatcher=null}_applyCurveForPoint(t,r){ev(r,t)?this.lineTo(t.position.x,t.position.y):this.bezierCurveTo(r.controls[1].position.x,r.controls[1].position.y,t.controls[0].position.x,t.controls[0].position.y,t.position.x,t.position.y);let n=this.curves[this.curves.length-1];t.curveBefore=n,r.curveAfter=n;let s=n.clone();t.roundedCurveBefore=s,r.roundedCurveAfter=s,t.roundedCurveCorner=void 0,this.roundedCurves.push(s)}_update(t=!0){var n;if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s];if(s===0)this.moveTo(a.position.x,a.position.y);else{let l=this.points[s-1];this._applyCurveForPoint(a,l)}}let r=this.getLastPoint();if(r!=null&&r.curveAfter&&(r.curveAfter=void 0),this.isClosed){let s=this.points[0],o=this.points[this.points.length-1];this._applyCurveForPoint(s,o)}if(this.points.length>2){let s=0;for(let o=0,a=this.points.length;o<a;o++){let l=this.points[o],c=l.roundness;if(!l.controlsMoved()&&c>0){let u=l.curveBefore,h=l.curveAfter;if(u===void 0||h===void 0)continue;let f=l.roundedCurveBefore,d=l.roundedCurveAfter,m=u.getLength(),p=h.getLength(),g=Math.min(c,m*.499),y=Math.min(c,p*.499),v=Math.min(g,y),b=1-v/m,w=v/p,x=u.getPointAt(b,rv),E=h.getPointAt(w,bO);this._subSplitCurve(u,f,b,x,void 0),this._subSplitCurve(h,d,w,void 0,E);let T;if(this.useCubicForRoundedCorners){let S=$y(x,l.position,E)/2,I=Math.tan(S)*x.distanceTo(l.position),[C,M]=FM(x,E,I,wO,SO),_=UM(C,M,l.position),[R,B]=zM(_,x,E,I,MO,AO);T=new on(x.clone(),R.clone(),B.clone(),E.clone())}else T=new Gn(x.clone(),l.position.clone(),E.clone());l.roundedCurveCorner=T,this.roundedCurves.splice(o+s,0,T),s++}}}t&&((n=this.eventDispatcher)==null||n.dispatchEvent({type:"update"}))}_subSplitCurve(t,r,n,s,o){if(t instanceof an)s!==void 0&&r.v2.copy(s),o!==void 0&&r.v1.copy(o);else{let a=t,l=r,c=a.getUtoTmapping(n,0),u=GM(a.v0,a.v1,a.v2,a.v3,c);return s!==void 0&&(l.v0.set(u[0],u[1]),l.v1.set(u[2],u[3]),l.v2.set(u[4],u[5]),l.v3.set(u[6],u[7])),o!==void 0&&(l.v0.set(u[6],u[7]),l.v1.set(u[8],u[9]),l.v2.set(u[10],u[11]),l.v3.set(u[12],u[13])),l}return r}clone(){let t=new At(this._width,this._height);return t.points=this.points.map(r=>r.clone()),t.isClosed=this.isClosed,t.roundness=this.roundness,t.isMesh2D=this.isMesh2D,t.shapeHoles=this.shapeHoles.map(r=>r.clone()),t}toJSON(){return{points:this.points.reduce((t,r)=>t.concat(r.toJSON()),[]),shapeHoles:this.shapeHoles.map(t=>t.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(t){var n;this.points=[],this.pointIDs=0;let r=t.points.length/7;for(let s=0;s<r;s++){let o=s*7,a=t.points[o+0],l=t.points[o+1],c=t.points[o+2],u=t.points[o+3],h=t.points[o+4],f=t.points[o+5],d=t.points[o+6],m=new ui(et.generateUUID(),new N(a,l));m.controls[0].position.set(c,u),m.controls[1].position.set(h,f),m.roundness=d,this.points.push(m)}return this.shapeHoles=(n=t.shapeHoles)!=null&&n.length?t.shapeHoles.map(s=>{let o=new At;return o.fromJSON(s),o}):[],this.isClosed=t.isClosed,this._roundness=t.roundness,this._update(),this}fromShape(t){let r=(s,o)=>{o instanceof on&&o.v3.equals(s.position)&&s.controls[0].position.copy(o.v2)},n=s=>{let o=[],a,l;for(a=0,l=s.length;a<l;a++)s[a]instanceof Gn&&(s[a]=OM(s[a]));for(a=0,l=s.length;a<l;a++){let h=s[a],f=a>0?s[a-1]:null,d;h instanceof on?(d=this.createPoint(h.v0),d.controls[1].position.copy(h.v1)):h instanceof an&&(d=this.createPoint(h.v1)),d!==void 0&&(f!==null&&r(d,f),o.push(d))}let c=s[s.length-1],u=!1;return c instanceof on?c.v3.equals(o[0].position)&&(o[0].controls[0].position.copy(c.v2),u=!0):c instanceof an&&c.v2.equals(o[0].position)&&(u=!0),this.isClosed=u,o};return this.points=n(t.curves),t instanceof tn&&(this.shapeHoles=t.holes.map(s=>{let o=new At;return o.fromShape(s),o})),this.update(),this}};var iv=Math.PI*2;function nv({x:i,y:e},t,r,n,s){return{x:i*t+n,y:e*r+s}}function TO(i,e){let t=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),r=Math.cos(i),n=Math.sin(i),s=Math.cos(i+e),o=Math.sin(i+e);return[{x:r-n*t,y:n+r*t},{x:s+o*t,y:o-s*t},{x:s,y:o}]}function WM(i,e,t,r){let n=i*r-e*t<0?-1:1,s=Math.min(1,Math.max(-1,i*t+e*r));return n*Math.acos(s)}function EO(i,e,t,r,n,s,o,a,l,c){let u=Math.pow(n,2),h=Math.pow(s,2),f=Math.pow(o,2),d=Math.pow(a,2),m=u*h-u*d-h*f;m<0&&(m=0),m/=u*d+h*f,m=Math.sqrt(m)*(l===c?-1:1);let p=m*n/s*a,g=m*-s/n*o,y=p+(i+t)/2,v=g+(e+r)/2,b=(o-p)/n,w=(a-g)/s,x=(-o-p)/n,E=(-a-g)/s,T=WM(1,0,b,w),S=WM(b,w,x,E);return!c&&S>0&&(S-=iv),c&&S<0&&(S+=iv),{centerx:y,centery:v,ang1:T,ang2:S}}function jM({px:i,py:e,cx:t,cy:r,rx:n,ry:s,largeArcFlag:o,sweepFlag:a}){let l=[];if(n===0||s===0)return[];let c=(i-t)/2,u=(e-r)/2;if(c===0&&u===0)return[];n=Math.abs(n),s=Math.abs(s);let h=Math.pow(c,2)/Math.pow(n,2)+Math.pow(u,2)/Math.pow(s,2);h>1&&(n*=Math.sqrt(h),s*=Math.sqrt(h));let f=EO(i,e,t,r,n,s,c,u,o,a),{ang1:d,ang2:m}=f,{centerx:p,centery:g}=f,y=Math.abs(m)/(iv/4);Math.abs(1-y)<1e-7&&(y=1);let v=Math.max(Math.ceil(y),1);m/=v;for(let b=0;b<v;b++)l.push(TO(d,m)),d+=m;return l.map(b=>{let{x:w,y:x}=nv(b[0],n,s,p,g),{x:E,y:T}=nv(b[1],n,s,p,g),{x:S,y:I}=nv(b[2],n,s,p,g);return{x1:w,y1:x,x2:E,y2:T,x:S,y:I}})}var Kt;(function(i){i[i.ODD=0]="ODD",i[i.NONZERO=1]="NONZERO",i[i.POSITIVE=2]="POSITIVE",i[i.NEGATIVE=3]="NEGATIVE",i[i.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(Kt||(Kt={}));var Mr;(function(i){i[i.POLYGONS=0]="POLYGONS",i[i.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",i[i.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(Mr||(Mr={}));function qe(i,e){if(!i)throw e||"Assertion Failed!"}var ze=function(){function i(){}return i.vertEq=function(e,t){return e.s===t.s&&e.t===t.t},i.vertLeq=function(e,t){return e.s<t.s||e.s===t.s&&e.t<=t.t},i.transLeq=function(e,t){return e.t<t.t||e.t===t.t&&e.s<=t.s},i.edgeGoesLeft=function(e){return i.vertLeq(e.Dst,e.Org)},i.edgeGoesRight=function(e){return i.vertLeq(e.Org,e.Dst)},i.vertL1dist=function(e,t){return Math.abs(e.s-t.s)+Math.abs(e.t-t.t)},i.edgeEval=function(e,t,r){qe(i.vertLeq(e,t)&&i.vertLeq(t,r));var n=t.s-e.s,s=r.s-t.s;return n+s>0?n<s?t.t-e.t+(e.t-r.t)*(n/(n+s)):t.t-r.t+(r.t-e.t)*(s/(n+s)):0},i.edgeSign=function(e,t,r){qe(i.vertLeq(e,t)&&i.vertLeq(t,r));var n=t.s-e.s,s=r.s-t.s;return n+s>0?(t.t-r.t)*n+(t.t-e.t)*s:0},i.transEval=function(e,t,r){qe(i.transLeq(e,t)&&i.transLeq(t,r));var n=t.t-e.t,s=r.t-t.t;return n+s>0?n<s?t.s-e.s+(e.s-r.s)*(n/(n+s)):t.s-r.s+(r.s-e.s)*(s/(n+s)):0},i.transSign=function(e,t,r){qe(i.transLeq(e,t)&&i.transLeq(t,r));var n=t.t-e.t,s=r.t-t.t;return n+s>0?(t.s-r.s)*n+(t.s-e.s)*s:0},i.vertCCW=function(e,t,r){return e.s*(t.t-r.t)+t.s*(r.t-e.t)+r.s*(e.t-t.t)>=0},i.interpolate=function(e,t,r,n){return e=e<0?0:e,r=r<0?0:r,e<=r?r===0?(t+n)/2:t+(n-t)*(e/(e+r)):n+(t-n)*(r/(e+r))},i.intersect=function(e,t,r,n,s){var o,a,l;i.vertLeq(e,t)||(l=e,e=t,t=l),i.vertLeq(r,n)||(l=r,r=n,n=l),i.vertLeq(e,r)||(l=e,e=r,r=l,l=t,t=n,n=l),i.vertLeq(r,t)?i.vertLeq(t,n)?(o=i.edgeEval(e,r,t),a=i.edgeEval(r,t,n),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,r.s,a,t.s)):(o=i.edgeSign(e,r,t),a=-i.edgeSign(e,n,t),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,r.s,a,n.s)):s.s=(r.s+t.s)/2,i.transLeq(e,t)||(l=e,e=t,t=l),i.transLeq(r,n)||(l=r,r=n,n=l),i.transLeq(e,r)||(l=e,e=r,r=l,l=t,t=n,n=l),i.transLeq(r,t)?i.transLeq(t,n)?(o=i.transEval(e,r,t),a=i.transEval(r,t,n),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,r.t,a,t.t)):(o=i.transSign(e,r,t),a=-i.transSign(e,n,t),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,r.t,a,n.t)):s.t=(r.t+t.t)/2},i}(),Vu=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}return i}(),cp=function(){function i(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(i.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),i}(),Ll=function(){function i(){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 i}(),qM=function(){function i(){var e=new Ll,t=new Vu,r=new cp(0),n=new cp(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,r.next=r,r.Sym=n,n.next=n,n.Sym=r,this.vHead=e,this.fHead=t,this.eHead=r,this.eHeadSym=n}return i.prototype.makeEdge_=function(e){var t=new cp(0),r=new cp(1);e.Sym.side<e.side&&(e=e.Sym);var n=e.Sym.next;return r.next=n,n.Sym.next=t,t.next=e,e.Sym.next=r,t.Sym=r,t.Onext=t,t.Lnext=r,t.Org=null,t.Lface=null,t.winding=0,t.activeRegion=null,r.Sym=t,r.Onext=r,r.Lnext=t,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,t},i.prototype.splice_=function(e,t){var r=e.Onext,n=t.Onext;r.Sym.Lnext=t,n.Sym.Lnext=e,e.Onext=n,t.Onext=r},i.prototype.makeVertex_=function(e,t,r){var n=e;qe(n,"Vertex can't be null!");var s=r.prev;n.prev=s,s.next=n,n.next=r,r.prev=n,n.anEdge=t;var o=t;do o.Org=n,o=o.Onext;while(o!==t)},i.prototype.makeFace_=function(e,t,r){var n=e;qe(n,"Face can't be null");var s=r.prev;n.prev=s,s.next=n,n.next=r,r.prev=n,n.anEdge=t,n.trail=null,n.marked=!1,n.inside=r.inside;var o=t;do o.Lface=n,o=o.Lnext;while(o!==t)},i.prototype.killEdge_=function(e){e.Sym.side<e.side&&(e=e.Sym);var t=e.next,r=e.Sym.next;t.Sym.next=r,r.Sym.next=t},i.prototype.killVertex_=function(e,t){var r=e.anEdge,n=r;do n.Org=t,n=n.Onext;while(n!==r);var s=e.prev,o=e.next;o.prev=s,s.next=o},i.prototype.killFace_=function(e,t){var r=e.anEdge,n=r;do n.Lface=t,n=n.Lnext;while(n!==r);var s=e.prev,o=e.next;o.prev=s,s.next=o},i.prototype.makeEdge=function(){var e=new Ll,t=new Ll,r=new Vu,n=this.makeEdge_(this.eHead);return this.makeVertex_(e,n,this.vHead),this.makeVertex_(t,n.Sym,this.vHead),this.makeFace_(r,n,this.fHead),n},i.prototype.splice=function(e,t){var r=!1,n=!1;if(e!==t){if(t.Org!==e.Org&&(n=!0,this.killVertex_(t.Org,e.Org)),t.Lface!==e.Lface&&(r=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(t,e),!n){var s=new Ll;this.makeVertex_(s,t,e.Org),e.Org.anEdge=e}if(!r){var o=new Vu;this.makeFace_(o,t,e.Lface),e.Lface.anEdge=e}}},i.prototype.delete=function(e){var t=e.Sym,r=!1;if(e.Lface!==e.Rface&&(r=!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),!r){var n=new Vu;this.makeFace_(n,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)},i.prototype.addEdgeVertex=function(e){var t=this.makeEdge_(e),r=t.Sym;this.splice_(t,e.Lnext),t.Org=e.Dst;var n=new Ll;return this.makeVertex_(n,r,t.Org),t.Lface=r.Lface=e.Lface,t},i.prototype.splitEdge=function(e){var t=this.addEdgeVertex(e),r=t.Sym;return this.splice_(e.Sym,e.Sym.Oprev),this.splice_(e.Sym,r),e.Dst=r.Org,r.Dst.anEdge=r.Sym,r.Rface=e.Rface,r.winding=e.winding,r.Sym.winding=e.Sym.winding,r.idx=e.idx,r.Sym.idx=e.Sym.idx,r},i.prototype.connect=function(e,t){var r=!1,n=this.makeEdge_(e),s=n.Sym;if(t.Lface!==e.Lface&&(r=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(n,e.Lnext),this.splice_(s,t),n.Org=e.Dst,s.Org=t.Org,n.Lface=s.Lface=e.Lface,e.Lface.anEdge=s,!r){var o=new Vu;this.makeFace_(o,n,e.Lface)}return n},i.prototype.zapFace=function(e){var t=e.anEdge,r,n,s,o,a;n=t.Lnext;do r=n,n=r.Lnext,r.Lface=null,r.Rface===null&&(r.Onext===r?this.killVertex_(r.Org,null):(r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),s=r.Sym,s.Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(r));while(r!=t);o=e.prev,a=e.next,a.prev=o,o.next=a},i.prototype.countFaceVerts_=function(e){var t=e.anEdge,r=0;do r++,t=t.Lnext;while(t!==e.anEdge);return r},i.prototype.mergeConvexFaces=function(e){var t,r,n,s,o,a,l;for(t=this.fHead.next;t!==this.fHead;t=t.next)if(!!t.inside)for(r=t.anEdge,o=r.Org;n=r.Lnext,s=r.Sym,s&&s.Lface&&s.Lface.inside&&(a=this.countFaceVerts_(t),l=this.countFaceVerts_(s.Lface),a+l-2<=e&&ze.vertCCW(r.Lprev.Org,r.Org,s.Lnext.Lnext.Org)&&ze.vertCCW(s.Lprev.Org,s.Org,r.Lnext.Lnext.Org)&&(n=s.Lnext,this.delete(s),r=null,s=null)),!(r&&r.Lnext.Org===o);)r=n;return!0},i.prototype.check=function(){var e=this.fHead,t=this.vHead,r=this.eHead,n,s,o,a,l,c;for(s=e,s=e;(n=s.next)!==e;s=n){qe(n.prev===s),l=n.anEdge;do qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l),qe(l.Lface===n),l=l.Lnext;while(l!==n.anEdge)}for(qe(n.prev===s&&n.anEdge===null),a=t,a=t;(o=a.next)!==t;a=o){qe(o.prev===a),l=o.anEdge;do qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l),qe(l.Org===o),l=l.Onext;while(l!==o.anEdge)}for(qe(o.prev===a&&o.anEdge===null),c=r,c=r;(l=c.next)!==r;c=l)qe(l.Sym.next===c.Sym),qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Org!==null),qe(l.Dst!==null),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l);qe(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)},i}(),XM=function(){function i(){this.handle=null}return i}(),YM=function(){function i(){this.key=null,this.node=0}return i}(),_O=function(){function i(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 r=0;r<e+1;r++)this.nodes[r]=new XM,this.handles[r]=new YM;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return i.prototype.floatDown_=function(e){var t=this.nodes,r=this.handles,n,s,o;for(n=t[e].handle;;){if(o=e<<1,o<this.size&&this.leq(r[t[o+1].handle].key,r[t[o].handle].key)&&++o,qe(o<=this.max),s=t[o].handle,o>this.size||this.leq(r[n].key,r[s].key)){t[e].handle=n,r[n].node=e;break}t[e].handle=s,r[s].node=e,e=o}},i.prototype.floatUp_=function(e){var t=this.nodes,r=this.handles,n,s,o;for(n=t[e].handle;;){if(o=e>>1,s=t[o].handle,o===0||this.leq(r[s].key,r[n].key)){t[e].handle=n,r[n].node=e;break}t[e].handle=s,r[s].node=e,e=o}},i.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},i.prototype.min=function(){return this.handles[this.nodes[1].handle].key},i.prototype.insert=function(e){var t,r;if(t=++this.size,t*2>this.max){this.max*=2;var n,s;for(s=this.nodes.length,this.nodes.length=this.max+1,n=s;n<this.nodes.length;n++)this.nodes[n]=new XM;for(s=this.handles.length,this.handles.length=this.max+1,n=s;n<this.handles.length;n++)this.handles[n]=new YM}return this.freeList===0?r=t:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[t].handle=r,this.handles[r].node=t,this.handles[r].key=e,this.initialized&&this.floatUp_(t),r},i.prototype.extractMin=function(){var e=this.nodes,t=this.handles,r=e[1].handle,n=t[r].key;return this.size>0&&(e[1].handle=e[this.size].handle,t[e[1].handle].node=1,t[r].key=null,t[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),n},i.prototype.delete=function(e){var t=this.nodes,r=this.handles,n;qe(e>=1&&e<=this.max&&r[e].key!==null),n=r[e].node,t[n].handle=t[this.size].handle,r[t[n].handle].node=n,--this.size,n<=this.size&&(n<=1||this.leq(r[t[n>>1].handle].key,r[t[n].handle].key)?this.floatDown_(n):this.floatUp_(n)),r[e].key=null,r[e].node=this.freeList,this.freeList=e},i}(),sv=function(){function i(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}return i}(),JM=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),CO=function(){function i(e,t){this.frame=e,this.leq=t,this.head=new JM,this.head.next=this.head,this.head.prev=this.head}return i.prototype.min=function(){return this.head.next},i.prototype.max=function(){return this.head.prev},i.prototype.insert=function(e){return this.insertBefore(this.head,e)},i.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},i.prototype.insertBefore=function(e,t){do e=e.prev;while(e.key!==null&&!this.leq(this.frame,e.key,t));var r=new JM;return r.key=t,r.next=e.next,e.next.prev=r,r.prev=e,e.next=r,r},i.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},i}(),LO=function(){function i(){}return i.regionBelow=function(e){return e.nodeUp.prev.key},i.regionAbove=function(e){return e.nodeUp.next.key},i.debugEvent=function(e){},i.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},i.edgeLeq=function(e,t,r){var n=e.event,s=t.eUp,o=r.eUp;if(s.Dst===n)return o.Dst===n?ze.vertLeq(s.Org,o.Org)?ze.edgeSign(o.Dst,s.Org,o.Org)<=0:ze.edgeSign(s.Dst,o.Org,s.Org)>=0:ze.edgeSign(o.Dst,n,o.Org)<=0;if(o.Dst===n)return ze.edgeSign(s.Dst,n,s.Org)>=0;var a=ze.edgeEval(s.Dst,n,s.Org),l=ze.edgeEval(o.Dst,n,o.Org);return a>=l},i.deleteRegion=function(e,t){t.fixUpperEdge&&qe(t.eUp.winding===0),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},i.fixUpperEdge=function(e,t,r){qe(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,t.eUp=r,r.activeRegion=t},i.topLeftRegion=function(e,t){var r=t.eUp.Org,n;do t=i.regionAbove(t);while(t.eUp.Org===r);if(t.fixUpperEdge){if(n=e.mesh.connect(i.regionBelow(t).eUp.Sym,t.eUp.Lnext),n===null)return null;i.fixUpperEdge(e,t,n),t=i.regionAbove(t)}return t},i.topRightRegion=function(e){var t=e.eUp.Dst;do e=i.regionAbove(e);while(e.eUp.Dst===t);return e},i.addRegionBelow=function(e,t,r){var n=new sv;return n.eUp=r,n.nodeUp=e.dict.insertBefore(t.nodeUp,n),n.fixUpperEdge=!1,n.sentinel=!1,n.dirty=!1,r.activeRegion=n,n},i.isWindingInside=function(e,t){switch(e.windingRule){case Kt.ODD:return(t&1)!==0;case Kt.NONZERO:return t!==0;case Kt.POSITIVE:return t>0;case Kt.NEGATIVE:return t<0;case Kt.ABS_GEQ_TWO:return t>=2||t<=-2}throw new Error("Invalid winding rulle")},i.computeWinding=function(e,t){t.windingNumber=i.regionAbove(t).windingNumber+t.eUp.winding,t.inside=i.isWindingInside(e,t.windingNumber)},i.finishRegion=function(e,t){var r=t.eUp,n=r.Lface;n.inside=t.inside,n.anEdge=r,i.deleteRegion(e,t)},i.finishLeftRegions=function(e,t,r){for(var n,s=null,o=t,a=t.eUp;o!==r;){if(o.fixUpperEdge=!1,s=i.regionBelow(o),n=s.eUp,n.Org!=a.Org){if(!s.fixUpperEdge){i.finishRegion(e,o);break}n=e.mesh.connect(a.Lprev,n.Sym),i.fixUpperEdge(e,s,n)}a.Onext!==n&&(e.mesh.splice(n.Oprev,n),e.mesh.splice(a,n)),i.finishRegion(e,o),a=s.eUp,o=s}return a},i.addRightEdges=function(e,t,r,n,s,o){var a,l,c,u,h=!0;c=r;do qe(ze.vertLeq(c.Org,c.Dst)),i.addRegionBelow(e,t,c.Sym),c=c.Onext;while(c!==n);for(s===null&&(s=i.regionBelow(t).eUp.Rprev),l=t,u=s;a=i.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=i.isWindingInside(e,a.windingNumber),l.dirty=!0,!h&&i.checkForRightSplice(e,l)&&(i.addWinding(c,u),i.deleteRegion(e,l),e.mesh.delete(u)),h=!1,l=a,u=c;l.dirty=!0,qe(l.windingNumber-c.winding===a.windingNumber),o&&i.walkDirtyRegions(e,l)},i.spliceMergeVertices=function(e,t,r){e.mesh.splice(t,r)},i.vertexWeights=function(e,t,r){var n=ze.vertL1dist(t,e),s=ze.vertL1dist(r,e),o=.5*s/(n+s),a=.5*n/(n+s);e.coords[0]+=o*t.coords[0]+a*r.coords[0],e.coords[1]+=o*t.coords[1]+a*r.coords[1],e.coords[2]+=o*t.coords[2]+a*r.coords[2]},i.getIntersectData=function(e,t,r,n,s,o){t.coords[0]=t.coords[1]=t.coords[2]=0,t.idx=-1,i.vertexWeights(t,r,n),i.vertexWeights(t,s,o)},i.checkForRightSplice=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp;if(ze.vertLeq(n.Org,s.Org)){if(ze.edgeSign(s.Dst,n.Org,s.Org)>0)return!1;ze.vertEq(n.Org,s.Org)?n.Org!==s.Org&&(e.pq.delete(n.Org.pqHandle),i.spliceMergeVertices(e,s.Oprev,n)):(e.mesh.splitEdge(s.Sym),e.mesh.splice(n,s.Oprev),t.dirty=r.dirty=!0)}else{if(ze.edgeSign(n.Dst,s.Org,n.Org)<0)return!1;i.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(n.Sym),e.mesh.splice(s.Oprev,n)}return!0},i.checkForLeftSplice=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp,o;if(qe(!ze.vertEq(n.Dst,s.Dst)),ze.vertLeq(n.Dst,s.Dst)){if(ze.edgeSign(n.Dst,s.Dst,n.Org)<0)return!1;i.regionAbove(t).dirty=t.dirty=!0,o=e.mesh.splitEdge(n),e.mesh.splice(s.Sym,o),o.Lface.inside=t.inside}else{if(ze.edgeSign(s.Dst,n.Dst,s.Org)>0)return!1;t.dirty=r.dirty=!0,o=e.mesh.splitEdge(s),e.mesh.splice(n.Lnext,s.Sym),o.Rface.inside=t.inside}return!0},i.checkForIntersect=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp,o=n.Org,a=s.Org,l=n.Dst,c=s.Dst,u,h,f=new Ll,d,m;if(qe(!ze.vertEq(c,l)),qe(ze.edgeSign(l,e.event,o)<=0),qe(ze.edgeSign(c,e.event,a)>=0),qe(o!==e.event&&a!==e.event),qe(!t.fixUpperEdge&&!r.fixUpperEdge),o===a||(u=Math.min(o.t,l.t),h=Math.max(a.t,c.t),u>h))return!1;if(ze.vertLeq(o,a)){if(ze.edgeSign(c,o,a)>0)return!1}else if(ze.edgeSign(l,a,o)<0)return!1;return i.debugEvent(e),ze.intersect(l,o,c,a,f),qe(Math.min(o.t,l.t)<=f.t),qe(f.t<=Math.max(a.t,c.t)),qe(Math.min(c.s,l.s)<=f.s),qe(f.s<=Math.max(a.s,o.s)),ze.vertLeq(f,e.event)&&(f.s=e.event.s,f.t=e.event.t),d=ze.vertLeq(o,a)?o:a,ze.vertLeq(d,f)&&(f.s=d.s,f.t=d.t),ze.vertEq(f,o)||ze.vertEq(f,a)?(i.checkForRightSplice(e,t),!1):!ze.vertEq(l,e.event)&&ze.edgeSign(l,e.event,f)>=0||!ze.vertEq(c,e.event)&&ze.edgeSign(c,e.event,f)<=0?c===e.event?(e.mesh.splitEdge(n.Sym),e.mesh.splice(s.Sym,n),t=i.topLeftRegion(e,t),n=i.regionBelow(t).eUp,i.finishLeftRegions(e,i.regionBelow(t),r),i.addRightEdges(e,t,n.Oprev,n,n,!0),!0):l===e.event?(e.mesh.splitEdge(s.Sym),e.mesh.splice(n.Lnext,s.Oprev),r=t,t=i.topRightRegion(t),m=i.regionBelow(t).eUp.Rprev,r.eUp=s.Oprev,s=i.finishLeftRegions(e,r,null),i.addRightEdges(e,t,s.Onext,n.Rprev,m,!0),!0):(ze.edgeSign(l,e.event,f)>=0&&(i.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(n.Sym),n.Org.s=e.event.s,n.Org.t=e.event.t),ze.edgeSign(c,e.event,f)<=0&&(t.dirty=r.dirty=!0,e.mesh.splitEdge(s.Sym),s.Org.s=e.event.s,s.Org.t=e.event.t),!1):(e.mesh.splitEdge(n.Sym),e.mesh.splitEdge(s.Sym),e.mesh.splice(s.Oprev,n),n.Org.s=f.s,n.Org.t=f.t,n.Org.pqHandle=e.pq.insert(n.Org),i.getIntersectData(e,n.Org,o,l,a,c),i.regionAbove(t).dirty=t.dirty=r.dirty=!0,!1)},i.walkDirtyRegions=function(e,t){for(var r=i.regionBelow(t),n,s;;){for(;r.dirty;)t=r,r=i.regionBelow(r);if(!t.dirty&&(r=t,t=i.regionAbove(t),t===null||!t.dirty))return;if(t.dirty=!1,n=t.eUp,s=r.eUp,n.Dst!==s.Dst&&i.checkForLeftSplice(e,t)&&(r.fixUpperEdge?(i.deleteRegion(e,r),e.mesh.delete(s),r=i.regionBelow(t),s=r.eUp):t.fixUpperEdge&&(i.deleteRegion(e,t),e.mesh.delete(n),t=i.regionAbove(r),n=t.eUp)),n.Org!==s.Org)if(n.Dst!==s.Dst&&!t.fixUpperEdge&&!r.fixUpperEdge&&(n.Dst===e.event||s.Dst===e.event)){if(i.checkForIntersect(e,t))return}else i.checkForRightSplice(e,t);n.Org===s.Org&&n.Dst===s.Dst&&(i.addWinding(s,n),i.deleteRegion(e,t),e.mesh.delete(n),t=i.regionAbove(r))}},i.connectRightVertex=function(e,t,r){var n,s=r.Onext,o=i.regionBelow(t),a=t.eUp,l=o.eUp,c=!1;if(a.Dst!==l.Dst&&i.checkForIntersect(e,t),ze.vertEq(a.Org,e.event)&&(e.mesh.splice(s.Oprev,a),t=i.topLeftRegion(e,t),s=i.regionBelow(t).eUp,i.finishLeftRegions(e,i.regionBelow(t),o),c=!0),ze.vertEq(l.Org,e.event)&&(e.mesh.splice(r,l.Oprev),r=i.finishLeftRegions(e,o,null),c=!0),c){i.addRightEdges(e,t,r.Onext,s,s,!0);return}ze.vertLeq(l.Org,a.Org)?n=l.Oprev:n=a,n=e.mesh.connect(r.Lprev,n),i.addRightEdges(e,t,n,n.Onext,n.Onext,!1),n.Sym.activeRegion.fixUpperEdge=!0,i.walkDirtyRegions(e,t)},i.connectLeftDegenerate=function(e,t,r){var n,s,o,a,l;if(n=t.eUp,ze.vertEq(n.Org,r)){qe(!1),i.spliceMergeVertices(e,n,r.anEdge);return}if(!ze.vertEq(n.Dst,r)){e.mesh.splitEdge(n.Sym),t.fixUpperEdge&&(e.mesh.delete(n.Onext),t.fixUpperEdge=!1),e.mesh.splice(r.anEdge,n),i.sweepEvent(e,r);return}qe(!1),t=i.topRightRegion(t),l=i.regionBelow(t),o=l.eUp.Sym,s=a=o.Onext,l.fixUpperEdge&&(qe(s!==o),i.deleteRegion(e,l),e.mesh.delete(o),o=s.Oprev),e.mesh.splice(r.anEdge,o),ze.edgeGoesLeft(s)||(s=null),i.addRightEdges(e,t,o.Onext,a,s,!0)},i.connectLeftVertex=function(e,t){var r,n,s,o,a,l,c=new sv;if(c.eUp=t.anEdge.Sym,r=e.dict.search(c).key,n=i.regionBelow(r),!!n){if(o=r.eUp,a=n.eUp,ze.edgeSign(o.Dst,t,o.Org)===0){i.connectLeftDegenerate(e,r,t);return}if(s=ze.vertLeq(a.Dst,o.Dst)?r:n,r.inside||s.fixUpperEdge){if(s===r)l=e.mesh.connect(t.anEdge.Sym,o.Lnext);else{var u=e.mesh.connect(a.Dnext,t.anEdge);l=u.Sym}s.fixUpperEdge?i.fixUpperEdge(e,s,l):i.computeWinding(e,i.addRegionBelow(e,r,l)),i.sweepEvent(e,t)}else i.addRightEdges(e,r,t.anEdge,t.anEdge,null,!0)}},i.sweepEvent=function(e,t){e.event=t,i.debugEvent(e);for(var r=t.anEdge;r.activeRegion===null;)if(r=r.Onext,r===t.anEdge){i.connectLeftVertex(e,t);return}var n=i.topLeftRegion(e,r.activeRegion);qe(n!==null);var s=i.regionBelow(n),o=s.eUp,a=i.finishLeftRegions(e,s,null);a.Onext===o?i.connectRightVertex(e,n,a):i.addRightEdges(e,n,a.Onext,o,o,!0)},i.addSentinel=function(e,t,r,n){var s=new sv,o=e.mesh.makeEdge();o.Org.s=r,o.Org.t=n,o.Dst.s=t,o.Dst.t=n,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)},i.initEdgeDict=function(e){e.dict=new CO(e,i.edgeLeq);var t=e.bmax[0]-e.bmin[0],r=e.bmax[1]-e.bmin[1],n=e.bmin[0]-t,s=e.bmax[0]+t,o=e.bmin[1]-r,a=e.bmax[1]+r;i.addSentinel(e,n,s,o),i.addSentinel(e,n,s,a)},i.doneEdgeDict=function(e){for(var t,r=0;(t=e.dict.min().key)!==null;)t.sentinel||(qe(t.fixUpperEdge),qe(++r===1)),qe(t.windingNumber===0),i.deleteRegion(e,t)},i.removeDegenerateEdges=function(e){var t,r,n,s=e.mesh.eHead;for(t=s.next;t!==s;t=r)r=t.next,n=t.Lnext,ze.vertEq(t.Org,t.Dst)&&t.Lnext.Lnext!==t&&(i.spliceMergeVertices(e,n,t),e.mesh.delete(t),t=n,n=t.Lnext),n.Lnext===t&&(n!==t&&((n===r||n===r.Sym)&&(r=r.next),e.mesh.delete(n)),(t===r||t===r.Sym)&&(r=r.next),e.mesh.delete(t))},i.initPriorityQ=function(e){var t,r,n,s=0;for(n=e.mesh.vHead,r=n.next;r!==n;r=r.next)s++;for(s+=8,t=e.pq=new _O(s,ze.vertLeq),n=e.mesh.vHead,r=n.next;r!==n;r=r.next)r.pqHandle=t.insert(r);return r!==n?!1:(t.init(),!0)},i.donePriorityQ=function(e){e.pq=null},i.removeDegenerateFaces=function(e,t){var r,n,s;for(r=t.fHead.next;r!==t.fHead;r=n)n=r.next,s=r.anEdge,qe(s.Lnext!==s),s.Lnext.Lnext===s&&(i.addWinding(s.Onext,s),e.mesh.delete(s));return!0},i.computeInterior=function(e,t){t===void 0&&(t=!0);var r,n;if(i.removeDegenerateEdges(e),!i.initPriorityQ(e))return!1;for(i.initEdgeDict(e);(r=e.pq.extractMin())!==null;){for(;n=e.pq.min(),!(n===null||!ze.vertEq(n,r));)n=e.pq.extractMin(),i.spliceMergeVertices(e,r.anEdge,n.anEdge);i.sweepEvent(e,r)}return e.event=e.dict.min().key.eUp.Org,i.debugEvent(e),i.doneEdgeDict(e),i.donePriorityQ(e),i.removeDegenerateFaces(e,e.mesh)?(t&&e.mesh.check(),!0):!1},i}(),DO=function(){function i(){this.mesh=new qM,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=Kt.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 i.prototype.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},i.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},i.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},i.prototype.computeNormal_=function(e){var t,r,n,s,o,a,l=[0,0,0],c=[0,0,0],u=[0,0,0],h=[0,0,0],f=[0,0,0],d=[null,null,null],m=[null,null,null],p=this.mesh.vHead;t=p.next;for(var g=0;g<3;++g)s=t.coords[g],c[g]=s,m[g]=t,l[g]=s,d[g]=t;for(t=p.next;t!==p;t=t.next)for(var y=0;y<3;++y)s=t.coords[y],s<c[y]&&(c[y]=s,m[y]=t),s>l[y]&&(l[y]=s,d[y]=t);var v=0;if(l[1]-c[1]>l[0]-c[0]&&(v=1),l[2]-c[2]>l[v]-c[v]&&(v=2),c[v]>=l[v]){e[0]=0,e[1]=0,e[2]=1;return}for(a=0,r=m[v],n=d[v],u[0]=r.coords[0]-n.coords[0],u[1]=r.coords[1]-n.coords[1],u[2]=r.coords[2]-n.coords[2],t=p.next;t!==p;t=t.next)h[0]=t.coords[0]-n.coords[0],h[1]=t.coords[1]-n.coords[1],h[2]=t.coords[2]-n.coords[2],f[0]=u[1]*h[2]-u[2]*h[1],f[1]=u[2]*h[0]-u[0]*h[2],f[2]=u[0]*h[1]-u[1]*h[0],o=f[0]*f[0]+f[1]*f[1]+f[2]*f[2],o>a&&(a=o,e[0]=f[0],e[1]=f[1],e[2]=f[2]);a<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(u)]=1)},i.prototype.checkOrientation_=function(){for(var e=this.mesh.fHead,t,r=this.mesh.vHead,n,s=0,o=e.next;o!==e;o=o.next)if(n=o.anEdge,!(n.winding<=0))do s+=(n.Org.s-n.Dst.s)*(n.Org.t+n.Dst.t),n=n.Lnext;while(n!==o.anEdge);if(s<0){for(t=r.next;t!==r;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]}},i.prototype.projectPolygon_=function(){var e=this.mesh.vHead,t=[0,0,0],r,n,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),r=this.sUnit,n=this.tUnit;var o=this.longAxis_(t);r[o]=0,r[(o+1)%3]=1,r[(o+2)%3]=0,n[o]=0,n[(o+1)%3]=0,n[(o+2)%3]=t[o]>0?1:-1;for(var a=e.next;a!==e;a=a.next)a.s=this.dot_(a.coords,r),a.t=this.dot_(a.coords,n);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))},i.prototype.addWinding_=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},i.prototype.tessellateMonoRegion_=function(e,t){var r,n;if(r=t.anEdge,!(r.Lnext!==r&&r.Lnext.Lnext!==r))throw"Mono region invalid";for(;ze.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;ze.vertLeq(r.Org,r.Dst);r=r.Lnext);n=r.Lprev;for(var s=void 0;r.Lnext!==n;)if(ze.vertLeq(r.Dst,n.Org)){for(;n.Lnext!==r&&(ze.edgeGoesLeft(n.Lnext)||ze.edgeSign(n.Org,n.Dst,n.Lnext.Dst)<=0);)s=e.connect(n.Lnext,n),n=s.Sym;n=n.Lprev}else{for(;n.Lnext!==r&&(ze.edgeGoesRight(r.Lprev)||ze.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)s=e.connect(r,r.Lprev),r=s.Sym;r=r.Lnext}if(n.Lnext===r)throw"Mono region invalid";for(;n.Lnext.Lnext!==r;)s=e.connect(n.Lnext,n),n=s.Sym;return!0},i.prototype.tessellateInterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)if(t=r.next,r.inside&&!this.tessellateMonoRegion_(e,r))return!1;return!0},i.prototype.discardExterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)t=r.next,r.inside||e.zapFace(r)},i.prototype.setWindingNumber_=function(e,t,r){for(var n,s=e.eHead.next;s!==e.eHead;s=n)n=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?t:-t:r?e.delete(s):s.winding=0},i.prototype.getNeighbourFace_=function(e){return!e.Rface||!e.Rface.inside?-1:e.Rface.n},i.prototype.outputPolymesh_=function(e,t,r,n){var s,o=0,a=0,l;r>3&&e.mergeConvexFaces(r);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>r)throw"Face vertex greater that support polygon";u.n=o,++o}this.elementCount=o,t===Mr.CONNECTED_POLYGONS&&(o*=2),this.elements=[],this.elements.length=o*r,this.vertexCount=a,this.vertices=[],this.vertices.length=a*n,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*n;this.vertices[h+0]=c.coords[0],this.vertices[h+1]=c.coords[1],n>2&&(this.vertices[h+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var f=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[f++]=c.n,l++,s=s.Lnext}while(s!==u.anEdge);for(var d=l;d<r;++d)this.elements[f++]=-1;if(t===Mr.CONNECTED_POLYGONS){s=u.anEdge;do this.elements[f++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==u.anEdge);for(var m=l;m<r;++m)this.elements[f++]=-1}}},i.prototype.outputContours_=function(e,t){var r,n,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){n=r=a.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==n);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,n=r=a.anEdge;do this.vertices[l++]=r.Org.coords[0],this.vertices[l++]=r.Org.coords[1],t>2&&(this.vertices[l++]=r.Org.coords[2]),this.vertexIndices[c++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,o++,r=r.Lnext;while(r!==n);this.elements[u++]=s,this.elements[u++]=o,s+=o}},i.prototype.addContour=function(e,t){this.mesh===null&&(this.mesh=new qM),e<2&&(e=2),e>3&&(e=3);for(var r=null,n=0;n<t.length;n+=e)r===null?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=t[n+0],r.Org.coords[1]=t[n+1],e>2?r.Org.coords[2]=t[n+2]:r.Org.coords[2]=0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},i.prototype.tesselate=function(e,t,r,n,s,o){if(e===void 0&&(e=Kt.ODD),t===void 0&&(t=Mr.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,n<2&&(n=2),n>3&&(n=3),!this.mesh)return!1;this.projectPolygon_(),LO.computeInterior(this,o);var a=this.mesh;return t===Mr.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),o&&a.check(),t===Mr.BOUNDARY_CONTOURS?this.outputContours_(a,n):this.outputPolymesh_(a,t,r,n),!0},i}();function jo(i){var e=i.windingRule,t=e===void 0?Kt.ODD:e,r=i.elementType,n=r===void 0?Mr.POLYGONS:r,s=i.polySize,o=s===void 0?3:s,a=i.vertexSize,l=a===void 0?2:a,c=i.normal,u=c===void 0?[0,0,1]:c,h=i.contours,f=h===void 0?[]:h,d=i.strict,m=d===void 0?!0:d,p=i.debug,g=p===void 0?!1:p;if(!f&&m)throw new Error("Contours can't be empty");if(!!f){var y=new DO;i.edgeCreateCallback&&(y.edgeCreateCallback=i.edgeCreateCallback),i.vertexIdCallback&&(y.vertexIdCallback=i.vertexIdCallback);for(var v=0;v<f.length;v++)y.addContour(l||2,f[v]);return y.tesselate(t,n,o,l,u,m),{vertices:y.vertices,vertexIndices:y.vertexIndices,vertexCount:y.vertexCount,elements:y.elements,elementCount:y.elementCount,mesh:g?y.mesh:void 0}}}var Zq=Kt.ODD,$q=Kt.NONZERO,e7=Kt.POSITIVE,t7=Kt.NEGATIVE,r7=Kt.ABS_GEQ_TWO,n7=Mr.POLYGONS,i7=Mr.CONNECTED_POLYGONS,s7=Mr.BOUNDARY_CONTOURS;var so=class extends Ie{constructor(t,r=12,n=100,s={}){super();this.type="ShapeGeometry";this.windingRule=Kt.ODD;this.elementType=Mr.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._drawCount=0,this._shape=t,this._curveSegments=r,this._maxCount=n,this._maxDrawCount=n*3,this._triangulationOptions=Object.assign({windingRule:Kt.ODD,elementType:Mr.POLYGONS,polySize:3,vertexSize:2,strict:!0},s),this._positionAttribute=new Ue(new Float32Array(n*3),3),this._normalAttribute=new Ue(new Float32Array(n*3),3),this._uvAttribute=new Ue(new Float32Array(n*2),2),this._indexAttribute=new Ue(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(t){return this._drawCount=t.drawCount,this._maxDrawCount=t._maxDrawCount,this._maxCount=t.maxCount,super.copy(t)}get curveSegments(){return this._curveSegments}set curveSegments(t){this._curveSegments=t,this.updateFromShape()}get drawCount(){return this._drawCount}get maxDrawCount(){return this._maxDrawCount}get maxCount(){return this._maxCount}updateFromShape(){let t=this._shape.extractShapePointsToFlatArray([],this._curveSegments),r=this._shape.shapeHoles.map(c=>c.extractShapePointsToFlatArray([],this._curveSegments)),n,s=!0,o=!0,a,l;for(let c=0,u=t.length/2;c<u;c++){let h=c*2,f=t[h+0],d=t[h+1];if(a!==void 0&&f!==a&&(s=!1),l!==void 0&&d!==l&&(o=!1),a=f,l=d,!s&&!o)break}if(!s&&!o&&(n=jo({contours:[t,...r],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 c=1/0,u=-1/0,h=1/0,f=-1/0;for(let p=0,g=n.vertexCount;p<g;p++){let y=p*2,v=n.vertices[y+0],b=n.vertices[y+1];v<c&&(c=v),v>u&&(u=v),b<h&&(h=b),b>f&&(f=b)}let d=u-c,m=f-h;for(let p=0,g=n.vertexCount;p<g;p++){let y=p*2,v=n.vertices[y+0],b=n.vertices[y+1],w=(v-c)/d,x=(b-h)/m;this._positionAttribute.setXYZ(p,v,b,0),this._normalAttribute.setXYZ(p,0,0,1),this._uvAttribute.setXY(p,w,x)}for(let p=0,g=n.elementCount;p<g;p++){let y=p*3,v=n.elements[y+0],b=n.elements[y+1],w=n.elements[y+2];this._indexAttribute.setX(y+0,v),this._indexAttribute.setX(y+1,b),this._indexAttribute.setX(y+2,w),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}clone(){let t=new so(this._shape,this._curveSegments,this._maxCount);return t.userData=Su(this.userData),t}};var up=class{constructor(e=256,t=!1){this.capacity=e,this.size=0,this.debug=t,this.debug&&console.log(`allocating with cap ${e}`);let r=e*up.eSize;this.buffer=new ArrayBuffer(r);let n=Float32Array.BYTES_PER_ELEMENT,s=0;this.positions=new Float32Array(this.buffer,s*n,3*e),s+=3*e,this.normals=new Float32Array(this.buffer,s*n,3*e),s+=3*e,this.uvs=new Float32Array(this.buffer,s*n,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 r=e*up.eSize,n=new ArrayBuffer(r),s=Float32Array.BYTES_PER_ELEMENT,o=0,a=new Float32Array(n,o*s,3*e);o+=3*e;let l=new Float32Array(n,o*s,3*e);o+=3*e;let c=new Float32Array(n,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=n,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 n=this.capacity;for(;t>n;)n*=2;this.realloc(n)}let r=this.size;return this.size=t,r}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)}},Hu=up;Hu.eSize=(3+3+2)*Float32Array.BYTES_PER_ELEMENT;var ov=(i,e)=>([t,r])=>(r<t&&(r+=e),(i>=t?i:i+e)<=r),Dl=class extends Ie{constructor(t,r,n=0,s=12,o=3){super();this.type="ShapeGeometry";this.vertexCache={};this._shape=t,this._depth=r,this._bevel=n,this._curveSegments=s,this._bevelSegmentsInput=o,n<=0?(this._bevelSize=0,this._bevelSegments=0):(this._bevelSize=Math.min(n,r/2-1e-12),this._bevelSegments=Math.floor(o));let a=this._shape.extractShapePointsToFlatArray([],s),l=this._shape.shapeHoles.map(T=>{let S=T.extractShapePointsToFlatArray([],s),I=[];for(let C=S.length-1;C>=1;C-=2){let M=S[C-1],_=S[C-0];I.push(M,_)}return I}),c=jo({windingRule:Kt.ODD,elementType:Mr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[a]}),u=jo({windingRule:Kt.ODD,elementType:Mr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...l]});if(!c)throw new Error("error generating geometry");let h=c.elementCount;if(u){c.elementCount+=u.elementCount;for(let T=0;T<u.elements.length;T++){let S=u.elements[T],I=T%2===0?c.vertexCount:0;c.elements.push(S+I)}for(let T=0;T<u.vertexIndices.length;T++){let S=u.vertexIndices[T],I=c.vertexCount;c.vertexIndices.push(S+I)}for(let T=0;T<u.vertices.length;T++){let S=u.vertices[T];c.vertices.push(S)}}let f=1/0,d=-1/0,m=1/0,p=-1/0;for(let T=0,S=c.vertexCount;T<S;T++){let I=T*2,C=c.vertices[I+0],M=c.vertices[I+1];C<f&&(f=C),C>d&&(d=C),M<m&&(m=M),M>p&&(p=M)}this._minX=f,this._minY=m,this._width=d-f,this._height=p-m;let g=c.vertexCount*2*(2+this._bevelSegments);this._buffer=new Hu(g);let y=[],v=[];for(let T=c.elementCount-1;T>=0;T--){let S=T>=h,I=T*2,C=c.elements[I+0],M=c.elements[I+1],_=C+M,R={start:C,count:M,normals:[],continuous:[],concave:[]},B=C,O=_-1,z=C+1,q=this._shape.roundedCurves.length;do{let V=B-C,U=c.vertices[O*2+0],J=c.vertices[O*2+1],K=c.vertices[B*2+0],$=c.vertices[B*2+1],j=c.vertices[z*2+0],ge=c.vertices[z*2+1],ae=K-U,le=$-J,W=Math.sqrt(ae*ae+le*le);ae/=W,le/=W;let ue=K-j,Y=$-ge,H=Math.sqrt(ue*ue+Y*Y);ue/=H,Y/=H,R.normals[V*2+0]=-Y,R.normals[V*2+1]=ue,R.concave[V]=ae*Y-le*ue>0;let Q=c.vertexIndices[B];if(Array.isArray(Q))R.continuous[V]=!1;else{let[ce,ie]=this._shape.getCurveIndexFromVertexId(Q-1,!0);if(ie>0&&ie<1)R.continuous[V]=!0;else{let pe=ie===1?ce+1:ce-1;pe=(pe+q)%q;let ve=ie===1?0:1,me=this._shape.roundedCurves[ce].getTangent(ie),De=this._shape.roundedCurves[pe].getTangent(ve);R.continuous[V]=me.dot(De)>.95}}S&&(R.normals[V*2+0]*=-1,R.normals[V*2+1]*=-1),[O,B,z]=[B,z,z+1],z>=_&&(z-=M)}while(z!==C+1);let F=[];F.push({bevelI:0,angle:0,size:0,boundary:{vertices:c.vertices.slice(C*2,_*2),vertexCount:M,vertexIndices:new Array(M).fill(!0).map((V,U)=>[U,U]),elements:[0,M],elementCount:1,mesh:null},reverseMap:[],insetPoints:c.vertices.slice(C*2,_*2)});for(let V=1;V<=this._bevelSegments;V++){let U=V/this._bevelSegments*Math.PI/2,J=(1-Math.cos(U))*this._bevelSize,K=[],$=[],j=[],ge=[],ae=0;for(let W=0;W<M;W++){let ue=W*2,Y=(W-1+M)%M*2,H=c.vertices[R.start*2+ue+0],Q=c.vertices[R.start*2+ue+1],ce=-R.normals[Y+0]*J,ie=-R.normals[Y+1]*J,pe=-R.normals[ue+0]*J,ve=-R.normals[ue+1]*J;if(R.concave[W]||!R.concave[W]&&S){let me=Math.atan2(ie,ce),De=Math.atan2(ve,pe);De>me&&(De-=Math.PI*2);let ke=De-me;if(R.continuous[W]||S){let P=me+ke/2,L=Math.cos(P)*J,te=Math.sin(P)*J;K[2*ae+0]=H+L*(S?-1:1),K[2*ae+1]=Q+te*(S?-1:1),ge[ae]=W,ae++}else{let P=Math.max(1,Math.floor(s/4*Math.abs(ke)/Math.PI));for(let L=0;L<=P;L++){let te=me+ke*(L/P),ye=Math.cos(te)*J,Se=Math.sin(te)*J;K[2*ae+0]=H+ye,K[2*ae+1]=Q+Se,ge[ae]=W,ae++}}}else K[2*ae+0]=H+ce,K[2*ae+1]=Q+ie,ge[ae]=W,$[W]=ae,ae++,K[2*ae+0]=H,K[2*ae+1]=Q,ge[ae]=W,ae++,K[2*ae+0]=H+pe,K[2*ae+1]=Q+ve,ge[ae]=W,j[W]=ae,ae++}let le=jo({windingRule:Kt.POSITIVE,elementType:Mr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[K],edgeCreateCallback:W=>{let Y=W.Org.idx,H=ge[Y],Q=ge[(Y+1)%ge.length];W.idx=[H,Q],W.Sym.idx=[Q,H]},vertexIdCallback:W=>{let ue=W.Lprev.idx;return[ue?ue[1]:0,W.idx[0]]}});if(!le)throw console.log("Error"),new Error(`error generating bevel geometry for ${V}'th loop`);if(!le.vertexCount)break;for(let W=0;W<le.vertexIndices.length;W++){let[ue,Y]=le.vertexIndices[W];if(ue===Y)continue;let H=Y;Y<ue&&(H+=M);for(let Q=ue;Q<H;Q++){let ce=Q%M,ie=(Q+1)%M;if(!R.continuous[ce]||!R.continuous[ie]){le.vertexIndices[W]=[ue,ce],le.vertexIndices.splice(W+1,0,[ie,Y]),le.vertices.splice((W+1)*2,0,le.vertices[W*2],le.vertices[W*2+1]);break}}}F.push({bevelI:V,angle:U,size:J,boundary:le,reverseMap:ge,insetPoints:K})}let ee=(V,U,J)=>{let K=0,$=V.boundary.vertexIndices.length;for(;K<$&&J(V.boundary.vertexIndices[U]);)U=(U+1)%$,K++;return K},k=y.length;for(let V=1;V<F.length;V++){let U=F[V-1],J=F[V],K=U.boundary.vertexIndices.length,$=J.boundary.vertexIndices.length;if(!K||!$)break;let j=R.concave.length,ge=0,ae=ov(ge,M);for(;!U.boundary.vertexIndices.filter(ae).length||!J.boundary.vertexIndices.filter(ae).length;)ge++,ae=ov(ge,M);let le=U.boundary.vertexIndices.findIndex(ae),W=J.boundary.vertexIndices.findIndex(ae);do le=(le+1)%K;while(ae(U.boundary.vertexIndices[le]));do W=(W+1)%$;while(ae(J.boundary.vertexIndices[W]));ge=(ge+1)%M;let ue=ge,Y=this.buildBevelVert(R,U,(le-1+K)%K),H=this.buildBevelVert(R,J,(W-1+$)%$),Q=Y,ce=H,ie,pe,ve=!1;do{ae=ov(ge,M);let me=ee(U,le,ae),De=ee(J,W,ae),ke=ve;if(ve=!1,me&&!De){for(let P=0;P<me;P++)ie=this.buildBevelVert(R,U,(le+P)%K,P/(me-1)),y.push(Q.topN,ie.topP,ce.topN),y.push(ie.bottomP,Q.bottomN,ce.bottomN),Q=ie;ve=!0}else if(!me&&De)for(let P=0;P<De;P++)pe=this.buildBevelVert(R,J,(W+P)%$,P/(De-1)),y.push(ce.topN,Q.topP,pe.topP),y.push(Q.bottomP,ce.bottomN,pe.bottomP),ce=pe;else if(me&&De)if(ie=this.buildBevelVert(R,U,le,0),pe=this.buildBevelVert(R,J,W,0),ke?(y.push(Q.topN,pe.topP,ce.topN),y.push(Q.topN,ie.topP,pe.topP),y.push(pe.bottomP,Q.bottomN,ce.bottomN),y.push(ie.bottomP,Q.bottomN,pe.bottomP)):(y.push(Q.topN,ie.topP,ce.topN),y.push(ce.topN,ie.topP,pe.topP),y.push(ie.bottomP,Q.bottomN,ce.bottomN),y.push(ie.bottomP,ce.bottomN,pe.bottomP)),Q=ie,ce=pe,me===De)for(let P=1;P<me;P++)ie=this.buildBevelVert(R,U,(le+P)%K,P/(me-1)),pe=this.buildBevelVert(R,J,(W+P)%$,P/(De-1)),y.push(Q.topN,ie.topP,ce.topN),y.push(ce.topN,ie.topP,pe.topP),y.push(ie.bottomP,Q.bottomN,ce.bottomN),y.push(ie.bottomP,ce.bottomN,pe.bottomP),Q=ie,ce=pe;else if(me>De){let P=me/De,L=0;for(let te=1;te<me;te++)ie=this.buildBevelVert(R,U,(le+te)%K,te/(me-1)),y.push(Q.topN,ie.topP,ce.topN),y.push(ie.bottomP,Q.bottomN,ce.bottomN),Q=ie,te>(L+1)*P&&(L++,pe=this.buildBevelVert(R,J,(W+L)%$,L/(De-1)),y.push(ce.topN,ie.topP,pe.topP),y.push(ie.bottomP,ce.bottomN,pe.bottomP),ce=pe)}else{let P=De/me,L=0;for(let te=1;te<De;te++)pe=this.buildBevelVert(R,J,(W+te)%$,te/(De-1)),y.push(ce.topN,ie.topP,pe.topP),y.push(ie.bottomP,ce.bottomN,pe.bottomP),ce=pe,te>(L+1)*P&&(L++,ie=this.buildBevelVert(R,U,(le+L)%K,L/(me-1)),y.push(Q.topN,ie.topP,ce.topN),y.push(ie.bottomP,Q.bottomN,ce.bottomN),Q=ie)}le=(le+me)%K,W=(W+De)%$,ge=(ge+1)%j}while(ge!==ue)}{let V=F[0];for(let U=0,J=V.boundary.vertexCount;U<J;U++){let K=this.buildBevelVert(R,V,U),$=this.buildBevelVert(R,V,(U+1)%J);y.push($.topP,K.topN,K.bottomN),y.push($.topP,K.bottomN,$.bottomP)}}if(S){let V=[];for(let U=y.length-1;U>=k+2;U-=3){let J=y[U-2],K=y[U-1],$=y[U-0];V.push($,K,J)}y.splice(k,y.length-k,...V)}if(S){let V=[];for(let U=F[F.length-1].boundary.vertices.length-1;U>=1;U-=2){let J=F[F.length-1].boundary.vertices[U-1],K=F[F.length-1].boundary.vertices[U-0];V.push(J,K)}v.push(V)}if(!S){let V=F[F.length-1],U=jo({windingRule:F.length>1?Kt.POSITIVE:Kt.ODD,elementType:Mr.POLYGONS,vertexSize:2,strict:!0,contours:[V.insetPoints,...v]});if(!U)throw new Error("Error generating geometry for surface");for(let J=0;J<U.elementCount*3;J+=3){let K=this.buildSurfaceVert(U,U.elements[J+0]),$=this.buildSurfaceVert(U,U.elements[J+1]),j=this.buildSurfaceVert(U,U.elements[J+2]);y.push(K.top,$.top,j.top),y.push(j.bottom,$.bottom,K.bottom)}}this.vertexCache={}}this._buffer.shrink();let b=new Ue(Uint32Array.from(y),1),w=new Ue(this._buffer.positions,3),x=new Ue(this._buffer.normals,3),E=new Ue(this._buffer.uvs,2);w.needsUpdate=!0,x.needsUpdate=!0,E.needsUpdate=!0,b.needsUpdate=!0,this.setAttribute("position",w),this.setAttribute("normal",x),this.setAttribute("uv",E),this.setIndex(b)}buildSurfaceVert(t,r){let n=r.toString();if(n in this.vertexCache)return this.vertexCache[n];let s=t.vertices[r*2+0],o=t.vertices[r*2+1],a=(s-this._minX)/this._width,l=(o-this._minY)/this._height,c=this._buffer.get(2),u=c*3,h=c*2,f={top:c+0,bottom:c+1};return this._buffer.positions[u+0]=s,this._buffer.positions[u+1]=o,this._buffer.positions[u+2]=this._depth,this._buffer.normals[u+0]=0,this._buffer.normals[u+1]=0,this._buffer.normals[u+2]=1,this._buffer.uvs[h+0]=a,this._buffer.uvs[h+1]=l,this._buffer.positions[u+3]=s,this._buffer.positions[u+4]=o,this._buffer.positions[u+5]=0,this._buffer.normals[u+3]=0,this._buffer.normals[u+4]=0,this._buffer.normals[u+5]=-1,this._buffer.uvs[h+2]=a,this._buffer.uvs[h+3]=l,this.vertexCache[n]=f,f}buildBevelVert(t,r,n,s=1){let o=`${r.bevelI}:${n}`;if(o in this.vertexCache)return this.vertexCache[o];let[a,l]=r.boundary.vertexIndices[n],c,u,h,f;a!==l?(u=a,c=l,f=!1,h=t.continuous[u]&&t.continuous[c]):(c=a,u=(c-1+t.count)%t.count,f=t.concave[c]&&r.bevelI>0,h=t.continuous[c]||f);let d=Math.cos(r.angle),m=Math.sin(r.angle),p=n*2,g=c*2,y=u*2,v=r.boundary.vertices[p+0],b=r.boundary.vertices[p+1],w=(1-m)*this._bevelSize,x=(v-this._minX)/this._width,E=(b-this._minY)/this._height,T=t.normals[g+0],S=t.normals[g+1],I=t.normals[y+0],C=t.normals[y+1];if(f){let O=I-T,z=C-S;T=T+O*(1-s),S=S+z*(1-s);let q=Math.sqrt(T*T+S*S);T/=q,S/=q}let M=this._buffer.get(h?2:4),_=M*3,R=M*2,B={i:n,fi:c,topP:M+0,topN:M+0,bottomP:M+1,bottomN:M+1};return this._buffer.positions[_+0]=v,this._buffer.positions[_+1]=b,this._buffer.positions[_+2]=this._depth-w,this._buffer.normals[_+0]=T*d,this._buffer.normals[_+1]=S*d,this._buffer.normals[_+2]=m,this._buffer.uvs[R+0]=x,this._buffer.uvs[R+1]=E,this._buffer.positions[_+3]=v,this._buffer.positions[_+4]=b,this._buffer.positions[_+5]=w,this._buffer.normals[_+3]=T*d,this._buffer.normals[_+4]=S*d,this._buffer.normals[_+5]=-m,this._buffer.uvs[R+2]=E,this._buffer.uvs[R+3]=x,h||(M+=2,_+=6,R+=4,B.topP=M+0,B.bottomP=M+1,this._buffer.positions[_+0]=v,this._buffer.positions[_+1]=b,this._buffer.positions[_+2]=this._depth-w,this._buffer.normals[_+0]=I*d,this._buffer.normals[_+1]=C*d,this._buffer.normals[_+2]=m,this._buffer.uvs[R+0]=x,this._buffer.uvs[R+1]=E,this._buffer.positions[_+3]=v,this._buffer.positions[_+4]=b,this._buffer.positions[_+5]=w,this._buffer.normals[_+3]=I*d,this._buffer.normals[_+4]=C*d,this._buffer.normals[_+5]=-m,this._buffer.uvs[R+2]=E,this._buffer.uvs[R+3]=x),this.vertexCache[o]=B,B}clone(){let t=new Dl(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return t.userData=Su(this.userData),t}};var Gr=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var c,u,h,f,d,m,p;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},i.parameters),r=Math.abs(t.width),n=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=(f=i.shape)!=null?f:e==null?void 0:e.shape,a=(d=o==null?void 0:o.roundness)!=null?d:t.roundness;o!==void 0&&(o instanceof At?(o.width!==r||o.height!==n)&&o.applySize(r,n):o=new At(r,n).fromJSON(o),((m=i.parameters)==null?void 0:m.roundness)!==void 0&&((p=i.parameters)==null?void 0:p.roundness)>0&&o.update(!1));let l=o!=null?o:new At(r,n);return{parameters:Object.assign(t,{width:r,height:n,depth:s,extrudeDepth:s,roundness:a}),shape:l}}static build(i){let{extrudeDepth:e,extrudeBevelSize:t,extrudeBevelSegments:r,subdivisions:n,roundness:s,surfaceMaxCount:o}=i.parameters;i.shape.roundness=s;let a;return e<=0?a=new so(i.shape,n,o):a=new Dl(i.shape,e,t,n,r),Object.assign(a,{userData:be(se({},i),{type:"VectorGeometry"})})}};var KM=Math.PI*2,ZM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1e3},i.parameters);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,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(i){let{width:e,height:t,spikes:r,angle:n,innerRadius:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,surfaceMaxCount:c}=i.parameters,u=i.shape,h=e*.5,f=t*.5,d=PO(u,h,f,n*Math.PI/180,r,s);u.isClosed=!0,u.update();let m=Gr.create({shape:u,parameters:{subdivisions:d,surfaceMaxCount:c,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(m,{userData:be(se({},i),{type:"EllipseGeometry"})})}};function PO(i,e,t,r,n,s){if(r>=KM)return n>30||n%4===0?(RO(i,e,t,s),Math.round(n/4)):QM(i,r,n,e,t,s);let o={x:0,y:t},a=r+Math.PI*.5,l={x:Math.cos(a)*e,y:Math.sin(a)*t},c=jM({px:o.x,py:o.y,cx:l.x,cy:l.y,rx:e,ry:t,largeArcFlag:r>Math.PI,sweepFlag:!0});return n>30||n%c.length===0?IO(i,o.x,o.y,c,n,e,t,s):QM(i,r,n,e,t,s)}function IO(i,e,t,r,n,s,o,a){let l=Math.round(n/r.length);i.addPoint(Pl(e,t));for(let c=0,u=r.length;c<u;c++){let h=r[c],f=i.points[c],d=Pl(h.x,h.y);f.controls[1].position.set(h.x1,h.y1),d.controls[0].position.set(h.x2,h.y2),i.addPoint(d)}return a>0?$M(i,s,o,a):i.addPoint(Pl(0,0)),l}function QM(i,e,t,r,n,s){let o=-e/t;for(let a=0;a<=t;a++){let l=o*a,c=Math.sin(l)*r,u=Math.cos(l)*n;i.addPoint(Pl(c,u))}return e<KM?s>0?$M(i,r,n,s):i.addPoint(Pl(0,0)):(i.removePoint(i.points[i.points.length-1]),s>0&&e1(i,r,n,s)),1}function RO(i,e,t,r=0,n=0,s=0){let o=.5522847498,a=e*o,l=t*o;i.addPoint(hp(n-e,s,n-e,s-l,n-e,s+l)),i.addPoint(hp(n,s+t,n-a,s+t,n+a,s+t)),i.addPoint(hp(n+e,s,n+e,s+l,n+e,s-l)),i.addPoint(hp(n,s-t,n+a,s-t,n-a,s-t)),r>0&&e1(i,e,t,r)}function Pl(i,e){return new ui(et.generateUUID(),new N(i,e))}function hp(i,e,t,r,n,s){let o=Pl(i,e);return o.controls[0].position.set(t,r),o.controls[1].position.set(n,s),o}function $M(i,e,t,r){t1(i,e,t,r).forEach(s=>i.addPoint(s))}function e1(i,e,t,r){let n=t1(i,e,t,r),s=new At;n.forEach(o=>s.addPoint(o)),s.isClosed=!0,i.shapeHoles.push(s)}function t1(i,e,t,r){let n=r*e/100,s=n*(Math.abs(t)/Math.abs(e)),o=new N(n/e,s/t),a=i.points.map(l=>{let c=l.clone();return c.uuid=et.generateUUID(),c}).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 r1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,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},i.parameters),r=Math.abs(t.width),n=Math.abs((l=t.height)!=null?l:r),s=Math.abs((c=t.depth)!=null?c:r),o=Math.abs(Math.min(r,s))/2;return{parameters:Object.assign(t,{width:r,height:n,depth:s,radius:o,segments:Math.round(t.segments),pathSegments:Math.round(t.pathSegments),cornerSegments:Math.round(t.cornerSegments)})}}static build(i){let{width:e,height:t,depth:r,radius:n,revolutions:s,segments:o,pathRadius:a,pathType:l,pathSegments:c,cornerRadius:u,cornerSegments:h}=i.parameters,f=new Wu(!1,e,t,r,n,s,o,a,l,c,u,h);return Object.assign(f,{userData:be(se({},i),{type:"HelixGeometry"})})}},Wu=class extends Ie{constructor(e=!0,t=1,r=1,n=1,s=1,o=1,a=1,l=1,c=1,u=1,h=1,f=1){super();let d=e&&o===1;d&&(f=0),h>100&&(h=100);let m=()=>new A,p=new A,g=m(),y=m(),v=m(),b,w,x,E,T,S,I,C,M=m(),_=m(),R=m(),B=m(),O=m(),z=m(),q=m(),F=m(),ee=r-2*l+.001,k=ee/o,V=Math.ceil(a*o),U=V+1,J=ee/V,K=-ee/2,$=u+1,j=2*Math.PI/u,ge=Math.PI/2/f,ae=.01,le=Math.min((1-h/100)*l,l-ae),W=l-le,ue=0,Y=2,H=f*Y+Y,Q=$*H/Y,ce=Q+$*U,ie=$*(U+H),[pe,ve,me]=[3,3,2].map(Ae=>Array(ie*Ae).fill(0)),De=[],ke=s-l;function P(Ae,G){let Me=Math.PI/2;S=G*J,C=2*Math.PI*(S%k)/k+Me,S+=K,I=Math.sin(C)*ke,T=Math.cos(C)*ke,e?Ae.set(T,I,S):Ae.set(T,S,I)}P(p,-1e-10),P(g,0),M.copy(p),P(p,1);let L=p.distanceTo(g),te=W+le,ye=L*V+2*te,Se=le,Pe=ye-te;for(let Ae=0;Ae<=V;Ae++){P(y,Ae),F.subVectors(y,M).normalize(),M.copy(y),z.copy(y).setComponent(+e+1,0).normalize(),q.crossVectors(F,z).normalize();let G=Ae===0,Me=Ae===V,Ce=G?3*Math.PI/2:ge,Ke=G?Se:Pe,Oe=G?$:ce,Ze=G?0:ie-$,_e=F.clone().multiplyScalar(G?-W:W).add(y),nt=F.clone().multiplyScalar(G?-1:1).normalize();for(let pt=0;pt<$;pt++){let ht=pt*j;if(_.addVectors(p.copy(z).multiplyScalar(l*Math.cos(ht)),g.copy(q).multiplyScalar(l*Math.sin(ht))),R.copy(_).normalize(),G||Me){d||(ue=Ze+pt,[0,1,2].forEach(Ot=>{pe[ue*3+Ot]=_e.getComponent(Ot),ve[ue*3+Ot]=nt.getComponent(Ot)}),me[ue*2]=+Me,me[ue*2+1]=pt/u),g.copy(R).multiplyScalar(le),v.addVectors(y,g);for(let Ot=0;Ot<f;Ot++){let Nr=Ot*ge+Ce;B.addVectors(p.copy(F).multiplyScalar(W*Math.sin(Nr)),g.copy(R).multiplyScalar(W*Math.cos(Nr))),O.copy(B).normalize(),g.addVectors(v,B),B.normalize(),ue=Oe+Ot*$+pt,[0,1,2].forEach(We=>{pe[ue*3+We]=g.getComponent(We),ve[ue*3+We]=O.getComponent(We)});let ta=+G+Math.sin(Nr);me[ue*2]=(Ke+W*ta)/ye,me[ue*2+1]=pt/u}}g.addVectors(y,_),ue=Q+Ae*$+pt,[0,1,2].forEach(Ot=>{pe[ue*3+Ot]=g.getComponent(Ot),ve[ue*3+Ot]=R.getComponent(Ot)}),me[ue*2]=(te+Ae*L)/ye,me[ue*2+1]=pt/u}}let Fe=U+2*f+Y,he=1,[rt,st]=d?[he,he+U-1]:[0,Fe-1];for(let Ae=rt;Ae<=st-1;Ae++){let G=d&&Ae===st-1;for(let Me=0;Me<$-1;Me++)b=Ae*$+Me,w=b+1,x=(G?Me:b)+$,E=(G?Me+1:w)+$,Ae===0?De.push(w,E,x):Ae===Fe-2?De.push(b,w,x):De.push(b,w,x,w,E,x)}this.setIndex(De),this.setAttribute("position",new Le(pe,3)),this.setAttribute("normal",new Le(ve,3)),this.setAttribute("uv",new Le(me,2))}};var n1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:n,corner:s,cornerSides:o}=i.parameters,a=n===0&&s!==0?new ju(e*.5,s,o):new Ga(e*.5,n);return a.scale(1,t/e,r/e),Object.assign(a,{userData:be(se({},i),{type:"IcosahedronGeometry"})})}},ju=class extends no{constructor(e=1,t=.2,r=4){let n=(1+Math.sqrt(5))/2,s=[-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],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,r),this.type=a}static fromJSON(e){return new ju(e.radius,e.corner,e.cornerSides)}};var i1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s,o,a;((n=(r=i.parameters)==null?void 0:r.points)!=null?n:[]).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}]},i.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(i){let{points:e,segments:t,verticalSegments:r}=i.parameters,n=new tn;n.moveTo(e[0].x,e[0].y),n.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let s=new Oa(n.extractPoints(r).shape,t);return s.rotateZ(Math.PI),Object.assign(s,{userData:be(se({},i),{type:"LatheGeometry"})})}};var Bi=new Ee,av=new ot,fp=new A,oo=class extends jt{constructor(){super(),this.uuid=et.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 Nt().getNormalMatrix(e);for(let r=0,n=this.vertices.length;r<n;r++)this.vertices[r].applyMatrix4(e);for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r];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 Bi.makeRotationX(e),this.applyMatrix4(Bi),this}rotateY(e){return Bi.makeRotationY(e),this.applyMatrix4(Bi),this}rotateZ(e){return Bi.makeRotationZ(e),this.applyMatrix4(Bi),this}translate(e,t,r){return Bi.makeTranslation(e,t,r),this.applyMatrix4(Bi),this}scale(e,t,r){return Bi.makeScale(e,t,r),this.applyMatrix4(Bi),this}lookAt(e){return av.lookAt(e),av.updateMatrix(),this.applyMatrix4(av.matrix),this}fromBufferGeometry(e){let t=this,r=e.index!==null?e.index:void 0,n=e.attributes;if(n.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;let s=n.position,o=n.normal,a=n.color,l=n.uv,c=n.uv2;c!==void 0&&(this.faceVertexUvs[1]=[]);for(let f=0;f<s.count;f++)t.vertices.push(new A().fromBufferAttribute(s,f)),a!==void 0&&t.colors.push(new xe().fromBufferAttribute(a,f));function u(f,d,m,p){let g=a===void 0?[]:[t.colors[f].clone(),t.colors[d].clone(),t.colors[m].clone()],y=o===void 0?[]:[new A().fromBufferAttribute(o,f),new A().fromBufferAttribute(o,d),new A().fromBufferAttribute(o,m)],v=new Il(f,d,m,y,g,p);t.faces.push(v),l!==void 0&&t.faceVertexUvs[0].push([new N().fromBufferAttribute(l,f),new N().fromBufferAttribute(l,d),new N().fromBufferAttribute(l,m)]),c!==void 0&&t.faceVertexUvs[1].push([new N().fromBufferAttribute(c,f),new N().fromBufferAttribute(c,d),new N().fromBufferAttribute(c,m)])}let h=e.groups;if(h.length>0)for(let f=0;f<h.length;f++){let d=h[f],m=d.start,p=d.count;for(let g=m,y=m+p;g<y;g+=3)r!==void 0?u(r.getX(g),r.getX(g+1),r.getX(g+2),d.materialIndex):u(g,g+1,g+2,d.materialIndex)}else if(r!==void 0)for(let f=0;f<r.count;f+=3)u(r.getX(f),r.getX(f+1),r.getX(f+2));else for(let f=0;f<s.count;f+=3)u(f,f+1,f+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(fp).negate(),this.translate(fp.x,fp.y,fp.z),this}normalize(){this.computeBoundingSphere();let e=this.boundingSphere.center,t=this.boundingSphere.radius,r=t===0?1:1/t,n=new Ee;return n.set(r,0,0,-r*e.x,0,r,0,-r*e.y,0,0,r,-r*e.z,0,0,0,1),this.applyMatrix4(n),this}computeFaceNormals(){let e=new A,t=new A;for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r],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 r=0,n=this.vertices.length;r<n;r++)t[r]=new A;if(e){let r=new A,n=new A;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];r.subVectors(u,c),n.subVectors(l,c),r.cross(n),t[a.a].add(r),t[a.b].add(r),t[a.c].add(r)}}else{this.computeFaceNormals();for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r];t[s.a].add(s.normal),t[s.b].add(s.normal),t[s.c].add(s.normal)}}for(let r=0,n=this.vertices.length;r<n;r++)t[r].normalize();for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r],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 r=this.faces[e],n=r.vertexNormals;n.length===3?(n[0].copy(r.normal),n[1].copy(r.normal),n[2].copy(r.normal)):(n[0]=r.normal.clone(),n[1]=r.normal.clone(),n[2]=r.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let t=0,r=this.faces.length;t<r;t++){let n=this.faces[t];n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]);for(let s=0,o=n.vertexNormals.length;s<o;s++)n.__originalVertexNormals[s]?n.__originalVertexNormals[s].copy(n.vertexNormals[s]):n.__originalVertexNormals[s]=n.vertexNormals[s].clone()}let e=new oo;e.faces=this.faces;for(let t=0,r=this.morphTargets.length;t<r;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 A,u={a:new A,b:new A,c:new A};s.push(c),o.push(u)}}let n=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=n.faceNormals[s],c=n.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,r=this.faces.length;t<r;t++){let n=this.faces[t];n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals}}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qt),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Yr),this.boundingSphere.setFromPoints(this.vertices)}merge(e,t,r=0){if(!(e&&e.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);return}let n,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&&(n=new Nt().getNormalMatrix(t));for(let f=0,d=a.length;f<d;f++){let p=a[f].clone();t!==void 0&&p.applyMatrix4(t),o.push(p)}for(let f=0,d=h.length;f<d;f++)u.push(h[f].clone());for(let f=0,d=c.length;f<d;f++){let m=c[f],p,g,y=m.vertexNormals,v=m.vertexColors,b=new Il(m.a+s,m.b+s,m.c+s);b.normal.copy(m.normal),n!==void 0&&b.normal.applyMatrix3(n).normalize();for(let w=0,x=y.length;w<x;w++)p=y[w].clone(),n!==void 0&&p.applyMatrix3(n).normalize(),b.vertexNormals.push(p);b.color.copy(m.color);for(let w=0,x=v.length;w<x;w++)g=v[w],b.vertexColors.push(g.clone());b.materialIndex=m.materialIndex+r,l.push(b)}for(let f=0,d=e.faceVertexUvs.length;f<d;f++){let m=e.faceVertexUvs[f];this.faceVertexUvs[f]===void 0&&(this.faceVertexUvs[f]=[]);for(let p=0,g=m.length;p<g;p++){let y=m[p],v=[];for(let b=0,w=y.length;b<w;b++)v.push(y[b].clone());this.faceVertexUvs[f].push(v)}}}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={},r=[],n=[],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,r.push(this.vertices[l]),n[l]=r.length-1):n[l]=n[t[h]]}let o=[];for(let l=0,c=this.faces.length;l<c;l++){let u=this.faces[l];u.a=n[u.a],u.b=n[u.b],u.c=n[u.c];let h=[u.a,u.b,u.c];for(let f=0;f<3;f++)if(h[f]===h[(f+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-r.length;return this.vertices=r,a}setFromPoints(e){this.vertices=[];for(let t=0,r=e.length;t<r;t++){let n=e[t];this.vertices.push(new A(n.x,n.y,n.z||0))}return this}sortFacesByMaterialIndex(){let e=this.faces,t=e.length;for(let l=0;l<t;l++)e[l]._id=l;function r(l,c){return l.materialIndex-c.materialIndex}e.sort(r);let n=this.faceVertexUvs[0],s=this.faceVertexUvs[1],o,a;n&&n.length===t&&(o=[]),s&&s.length===t&&(a=[]);for(let l=0;l<t;l++){let c=e[l]._id;o&&o.push(n[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 m=this.parameters;for(let p in m)m[p]!==void 0&&(e[p]=m[p]);return e}let t=[];for(let m=0;m<this.vertices.length;m++){let p=this.vertices[m];t.push(p.x,p.y,p.z)}let r=[],n=[],s={},o=[],a={},l=[],c={};for(let m=0;m<this.faces.length;m++){let p=this.faces[m],g=!0,y=!1,v=this.faceVertexUvs[0][m]!==void 0,b=p.normal.length()>0,w=p.vertexNormals.length>0,x=p.color.r!==1||p.color.g!==1||p.color.b!==1,E=p.vertexColors.length>0,T=0;if(T=u(T,0,0),T=u(T,1,g),T=u(T,2,y),T=u(T,3,v),T=u(T,4,b),T=u(T,5,w),T=u(T,6,x),T=u(T,7,E),r.push(T),r.push(p.a,p.b,p.c),r.push(p.materialIndex),v){let S=this.faceVertexUvs[0][m];r.push(d(S[0]),d(S[1]),d(S[2]))}if(b&&r.push(h(p.normal)),w){let S=p.vertexNormals;r.push(h(S[0]),h(S[1]),h(S[2]))}if(x&&r.push(f(p.color)),E){let S=p.vertexColors;r.push(f(S[0]),f(S[1]),f(S[2]))}}function u(m,p,g){return g?m|1<<p:m&~(1<<p)}function h(m){let p=m.x.toString()+m.y.toString()+m.z.toString();return s[p]!==void 0||(s[p]=n.length/3,n.push(m.x,m.y,m.z)),s[p]}function f(m){let p=m.r.toString()+m.g.toString()+m.b.toString();return a[p]!==void 0||(a[p]=o.length,o.push(m.getHex())),a[p]}function d(m){let p=m.x.toString()+m.y.toString();return c[p]!==void 0||(c[p]=l.length/2,l.push(m.x,m.y)),c[p]}return e.data={},e.data.vertices=t,e.data.normals=n,o.length>0&&(e.data.colors=o),l.length>0&&(e.data.uvs=[l]),e.data.faces=r,e}clone(){return new oo().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 f=0,d=t.length;f<d;f++)this.vertices.push(t[f].clone());let r=e.colors;for(let f=0,d=r.length;f<d;f++)this.colors.push(r[f].clone());let n=e.faces;for(let f=0,d=n.length;f<d;f++)this.faces.push(n[f].clone());for(let f=0,d=e.faceVertexUvs.length;f<d;f++){let m=e.faceVertexUvs[f];this.faceVertexUvs[f]===void 0&&(this.faceVertexUvs[f]=[]);for(let p=0,g=m.length;p<g;p++){let y=m[p],v=[];for(let b=0,w=y.length;b<w;b++){let x=y[b];v.push(x.clone())}this.faceVertexUvs[f].push(v)}}let s=e.morphTargets;for(let f=0,d=s.length;f<d;f++){let m={};if(m.name=s[f].name,s[f].vertices!==void 0){m.vertices=[];for(let p=0,g=s[f].vertices.length;p<g;p++)m.vertices.push(s[f].vertices[p].clone())}if(s[f].normals!==void 0){m.normals=[];for(let p=0,g=s[f].normals.length;p<g;p++)m.normals.push(s[f].normals[p].clone())}this.morphTargets.push(m)}let o=e.morphNormals;for(let f=0,d=o.length;f<d;f++){let m={};if(o[f].vertexNormals!==void 0){m.vertexNormals=[];for(let p=0,g=o[f].vertexNormals.length;p<g;p++){let y=o[f].vertexNormals[p],v={};v.a=y.a.clone(),v.b=y.b.clone(),v.c=y.c.clone(),m.vertexNormals.push(v)}}if(o[f].faceNormals!==void 0){m.faceNormals=[];for(let p=0,g=o[f].faceNormals.length;p<g;p++)m.faceNormals.push(o[f].faceNormals[p].clone())}this.morphNormals.push(m)}let a=e.skinWeights;for(let f=0,d=a.length;f<d;f++)this.skinWeights.push(a[f].clone());let l=e.skinIndices;for(let f=0,d=l.length;f<d;f++)this.skinIndices.push(l[f].clone());let c=e.lineDistances;for(let f=0,d=c.length;f<d;f++)this.lineDistances.push(c[f]);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 lv().fromGeometry(this),t=new Ie,r=new Float32Array(e.vertices.length*3);if(t.setAttribute("position",new Ue(r,3).copyVector3sArray(e.vertices)),e.normals.length>0){let n=new Float32Array(e.normals.length*3);t.setAttribute("normal",new Ue(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){let n=new Float32Array(e.colors.length*3);t.setAttribute("color",new Ue(n,3).copyColorsArray(e.colors))}if(e.uvs.length>0){let n=new Float32Array(e.uvs.length*2);t.setAttribute("uv",new Ue(n,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){let n=new Float32Array(e.uvs2.length*2);t.setAttribute("uv2",new Ue(n,2).copyVector2sArray(e.uvs2))}t.groups=e.groups;for(let n in e.morphTargets){let s=[],o=e.morphTargets[n];for(let a=0,l=o.length;a<l;a++){let c=o[a],u=new Le(c.data.length*3,3);u.name=c.name,s.push(u.copyVector3sArray(c.data))}t.morphAttributes[n]=s}if(e.skinIndices.length>0){let n=new Le(e.skinIndices.length*4,4);t.setAttribute("skinIndex",n.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){let n=new Le(e.skinWeights.length*4,4);t.setAttribute("skinWeight",n.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 Ie,r=e.geometry;if(e.isPoints||e.isLine){let n=new Le(r.vertices.length*3,3),s=new Le(r.colors.length*3,3);if(t.setAttribute("position",n.copyVector3sArray(r.vertices)),t.setAttribute("color",s.copyColorsArray(r.colors)),r.lineDistances&&r.lineDistances.length===r.vertices.length){let o=new Le(r.lineDistances.length,1);t.setAttribute("lineDistance",o.copyArray(r.lineDistances))}r.boundingSphere!==null&&(t.boundingSphere=r.boundingSphere.clone()),r.boundingBox!==null&&(t.boundingBox=r.boundingBox.clone())}else e.isMesh&&(t=r.toBufferGeometry());return t}};oo.prototype.isGeometry=!0;var lv=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=[],r,n,s,o=e.faces;for(n=0;n<o.length;n++){let a=o[n];a.materialIndex!==s&&(s=a.materialIndex,r!==void 0&&(r.count=n*3-r.start,t.push(r)),r={start:n*3,materialIndex:s})}r!==void 0&&(r.count=n*3-r.start,t.push(r)),this.groups=t}fromGeometry(e){let t=e.faces,r=e.vertices,n=e.faceVertexUvs,s=n[0]&&n[0].length>0,o=n[1]&&n[1].length>0,a=e.morphTargets,l=a.length,c;if(l>0){c=[];for(let y=0;y<l;y++)c[y]={name:a[y].name,data:[]};this.morphTargets.position=c}let u=e.morphNormals,h=u.length,f;if(h>0){f=[];for(let y=0;y<h;y++)f[y]={name:u[y].name,data:[]};this.morphTargets.normal=f}let d=e.skinIndices,m=e.skinWeights,p=d.length===r.length,g=m.length===r.length;r.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let y=0;y<t.length;y++){let v=t[y];this.vertices.push(r[v.a],r[v.b],r[v.c]);let b=v.vertexNormals;if(b.length===3)this.normals.push(b[0],b[1],b[2]);else{let x=v.normal;this.normals.push(x,x,x)}let w=v.vertexColors;if(w.length===3)this.colors.push(w[0],w[1],w[2]);else{let x=v.color;this.colors.push(x,x,x)}if(s===!0){let x=n[0][y];x!==void 0?this.uvs.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",y),this.uvs.push(new N,new N,new N))}if(o===!0){let x=n[1][y];x!==void 0?this.uvs2.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",y),this.uvs2.push(new N,new N,new N))}for(let x=0;x<l;x++){let E=a[x].vertices;c[x].data.push(E[v.a],E[v.b],E[v.c])}for(let x=0;x<h;x++){let E=u[x].vertexNormals[y];f[x].data.push(E.a,E.b,E.c)}p&&this.skinIndices.push(d[v.a],d[v.b],d[v.c]),g&&this.skinWeights.push(m[v.a],m[v.b],m[v.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}},Il=class{constructor(e,t,r,n,s,o=0){this.a=e,this.b=t,this.c=r,this.normal=n&&n.isVector3?n:new A,this.vertexNormals=Array.isArray(n)?n:[],this.color=s&&s.isColor?s:new xe,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,r=e.vertexNormals.length;t<r;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,r=e.vertexColors.length;t<r;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}};var BO=["a","b","c"];function NO(i,e){switch(e){case"c":return i.c;case"b":return i.b;case"a":default:return i.a}}function cv(i,e,t){let r=Math.min(i,e),n=Math.max(i,e),s=r+"_"+n;return t.get(s)}function uv(i,e,t,r,n,s){let o=Math.min(i,e),a=Math.max(i,e),l=o+"_"+a,c;if(r.has(l))c=r.get(l);else{let u=t[o],h=t[a];c={a:u,b:h,newEdge:null,faces:[]},r.set(l,c)}c.faces.push(n),s[i].edges.push(c),s[e].edges.push(c)}function OO(i,e,t,r){let n,s,o;for(n=0,s=i.length;n<s;n++)t[n]={edges:[]};for(n=0,s=e.length;n<s;n++)o=e[n],uv(o.a,o.b,i,r,o,t),uv(o.b,o.c,i,r,o,t),uv(o.c,o.a,i,r,o,t)}function dp(i,e,t,r,n){i.push(new Il(e,t,r,void 0,void 0,n))}function Rl(i,e){return Math.abs(e-i)/2+Math.min(i,e)}function pp(i,e,t,r){i.push([e.clone(),t.clone(),r.clone()])}var mp=class{constructor(e=1){this.subdivisions=e}modify(e){e instanceof Ie?e=new oo().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 A,r,n,s,o,a,l=e.vertices,c=e.faces,u=e.faceVertexUvs[0],h=u!==void 0&&u.length>0,f=[],d=new Map;OO(l,c,f,d);let m=[],p,g,y,v,b,w,x;for(let ae of Array.from(d.keys())){for(g=d.get(ae),y=new A,b=3/8,w=1/8,x=g.faces.length,x!=2&&(b=.5,w=0,x!=1),y.addVectors(g.a,g.b).multiplyScalar(b),t.set(0,0,0),o=0;o<x;o++){for(v=g.faces[o],a=0;a<3&&(p=l[NO(v,BO[a])],!(p!==g.a&&p!==g.b));a++);p&&t.add(p)}t.multiplyScalar(w),y.add(t),g.newEdge=m.length,m.push(y)}let E,T,S,I,C,M,_,R=[];for(n=0,s=l.length;n<s;n++){for(M=l[n],C=f[n].edges,r=C.length,r==3?E=3/16:r>3&&(E=3/(8*r)),T=1-r*Number(E),S=E,r<=2&&(r==2?(T=3/4,S=1/8):r==1||r==0),_=M.clone().multiplyScalar(T),t.set(0,0,0),o=0;o<r;o++)I=C[o],p=I.a!==M?I.a:I.b,t.add(p);t.multiplyScalar(Number(S)),_.add(t),R.push(_)}let B=R.concat(m),O=R.length,z,q,F,ee=[],k=[],V,U,J,K,$=new N,j=new N,ge=new N;for(n=0,s=c.length;n<s;n++)v=c[n],z=Number(cv(v.a,v.b,d).newEdge)+O,q=Number(cv(v.b,v.c,d).newEdge)+O,F=Number(cv(v.c,v.a,d).newEdge)+O,dp(ee,z,q,F,v.materialIndex),dp(ee,v.a,z,F,v.materialIndex),dp(ee,v.b,q,z,v.materialIndex),dp(ee,v.c,F,q,v.materialIndex),h&&(V=u[n],U=V[0],J=V[1],K=V[2],$.set(Rl(U.x,J.x),Rl(U.y,J.y)),j.set(Rl(J.x,K.x),Rl(J.y,K.y)),ge.set(Rl(U.x,K.x),Rl(U.y,K.y)),pp(k,$,j,ge),pp(k,U,$,ge),pp(k,J,j,$),pp(k,K,ge,j));e.vertices=B,e.faces=ee,h&&(e.faceVertexUvs[0]=k)}};var Ar=new A,s1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var s,o;let t=(o=(s=i.geometry)!=null?s:e==null?void 0:e.geometry)!=null?o:new Ie().copy(new mn(100,100,100)),r;e===void 0?(t.computeBoundingBox(),t.boundingBox.getSize(Ar),r={width:Ar.x,height:Ar.y,depth:Ar.z,subdivisions:0}):r=e.parameters;let n=se(se({},r),i.parameters);return{parameters:{width:Math.abs(n.width),height:Math.abs(n.height),depth:Math.abs(n.depth),subdivisions:Math.abs(n.subdivisions)},geometry:t}}static build(i){var l;let{width:e,height:t,depth:r,subdivisions:n}=i.parameters,s=(l=i.geometry)!=null?l:new Ie().copy(new mn(100,100,100)),o=s.userData.parameters;o===void 0?(s.computeBoundingBox(),s.boundingBox.getSize(Ar)):Ar.set(o.width,o.height,o.depth),(e!==Ar.x||t!==Ar.y||r!==Ar.z)&&s.scale(Ar.x===0?1:e/Ar.x,Ar.y===0?1:t/Ar.y,Ar.z===0?1:r/Ar.z);let a=s.originalGeometry;return n>0?(a===void 0||(o==null?void 0:o.subdivisions)!==n)&&(a===void 0&&(a=s),s=new mp(n).modify(a).toBufferGeometry()):(a!==void 0&&(s=a),a=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()),a!==void 0&&Object.assign(s,{originalGeometry:a}),delete i.geometry,Object.assign(s,{userData:be(se({},i),{type:"NonParametricGeometry"})})}static loadFromUrl(i,e,t){new Gs(t).load(i,n=>{let s=this.normalizeInputs({geometry:n});n.boundingBox.getSize(Ar);let o=100/Ar.x;Object.assign(s.parameters,{width:100,height:Ar.y*o,depth:Ar.z*o}),e(this.build(s))})}};var o1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o,a;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,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(i){let{width:e,height:t,spikes:r,cornerRadius:n,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a,surfaceMaxCount:l}=i.parameters,c=i.shape,u=e*.5,h=t*.5,f=0,d=0,m=2*Math.PI/r;for(let g=0;g<r;g++){let y=m*g,v=f+Math.sin(y)*u,b=d+Math.cos(y)*h;c.addPoint(c.createPoint(v,b))}c.isClosed=!0;for(let g=0,y=c.points.length;g<y;g++)c.points[g].roundness=n;c.roundness=n,c.update();let p=Gr.create({shape:c,parameters:{surfaceMaxCount:l,roundness:n,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}});return Object.assign(p,{userData:be(se({},i),{type:"PolygonGeometry"})})}};var a1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,radialSegments:n,heightSegments:s,openEnded:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=new fv(e*.5,t,n,s,o,a,l);return c.scale(1,1,r/e),Object.assign(c,{userData:be(se({},i),{type:"PyramidGeometry"})})}};function qu(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function hv(i,e,t,r,n,s){let o=e.clone().sub(i),a=t.clone().sub(i),l=o.angleTo(a);if(o.normalize(),a.normalize(),r===n){let c=o.add(a).normalize();s.copy(i).addScaledVector(c,r/Math.sin(l/2))}else{let c=o.angleTo(a);s.copy(i),s.addScaledVector(o,n/Math.sin(c)),s.addScaledVector(a,r/Math.sin(c))}}function FO(i,e,t){let r=i.clone().sub(e),n=t.clone().sub(e);return r.projectOnVector(n),r.add(e)}var fv=class extends Ie{constructor(e=.5,t=1,r=4,n=1,s=!1,o=0,a=4){super(),r=Math.floor(Math.max(3,r)),n=Math.floor(n),a=Math.floor(a);let l=[],c=[],u=[],h=[],f=0,d=t/2,m=Math.PI/r,p=e*Math.cos(Math.PI/r),g=2*Math.PI/r,y=(r-2)*Math.PI/r,v=Math.PI-y,b=new A(0,-d,0),w=new A(0,d,0),x=new N(e,-d),E=new N(p,-d),T=new N(0,w.y).sub(E),S=new N(0,w.y).sub(x),I=new N(T.y,-T.x).normalize(),C=new N(S.y,-S.x).normalize(),_=e*Math.cos(Math.PI/r)*Math.tan((Math.PI-T.angle())/2)-1e-8;o=Math.min(o,_);let R;{let k=new A(I.x,I.y,0),V=new A(Math.cos(g)*k.x,k.y,Math.sin(g)*k.x);R=k.angleTo(V)}let B=o/Math.tan((Math.PI-T.angle())/2),O=o/Math.tan((Math.PI-R)/2),z=new A;if(!s){c.push(b.x,b.y,b.z),u.push(0,-1,0),h.push(0,0);let k=f++,V=[],U=x.clone(),J=B/Math.cos(Math.PI/r);U.x-=J;for(let K=0;K<r;K++){let $=K/r*Math.PI*2+m,j=new N(Math.sin($),Math.cos($));qu(U,j,z),c.push(z.x,z.y,z.z),u.push(0,-1,0),h.push(0,0),V.push(f++)}for(let K=0;K<V.length;K++)l.push(V[K],k,V[(K+1)%V.length])}let q=[];{let k=new A,V=new A,U=new A,J=new A,K=new A,$=new A;for(let j=0;j<r;j++){let ge=j/r*Math.PI*2+m,ae=(j+.5)/r*Math.PI*2+m,le=(j+1)/r*Math.PI*2+m,W=new N(Math.sin(ge),Math.cos(ge)),ue=new N(Math.sin(ae),Math.cos(ae)),Y=new N(Math.sin(le),Math.cos(le));qu(x,W,V),qu(x,Y,U),qu(I,ue,k),hv(w,V,U,O,O,J),c.push(J.x,J.y,J.z),hv(V,w,U,O,B,K),c.push(K.x,K.y,K.z),hv(U,V,w,B,O,$),c.push($.x,$.y,$.z),u.push(k.x,k.y,k.z),u.push(k.x,k.y,k.z),u.push(k.x,k.y,k.z),h.push(0,0),h.push(0,0),h.push(0,0);let H=f++,Q=f++,ce=f++;if(l.push(H,Q,ce),o>0){{let ve=V.clone().add(U).multiplyScalar(.5),me=w.clone().sub(ve).normalize(),ke=b.clone().sub(ve).normalize().add(me).normalize().multiplyScalar(-1),P=$.clone().sub(K);F(ve,P,ke,T.angle())}let ie,pe;{let ve=new A;qu(C,Y,ve);let me=$.clone().add(J).multiplyScalar(.5);me=FO(me,U,w);let De=$.clone().sub(J);[ie,pe]=F(me,De,ve,R,J.y)}{let ve=ie,me=ve.clone().setY(0).normalize(),De=new A(0,-1,0),ke=me.clone().cross(De);ee(ve,me,De,ke)}q.concat(pe);{let ve=T.angle(),me=Math.PI-ve,De=w.clone();De.y-=o/Math.sin(ve-Math.PI/2);let ke=new A,P=[];for(let te=0;te<a;te++){let ye=[],Se=Math.PI/2-me*te/a,Pe=Math.cos(Se),Fe=Math.sin(Se),he=ae;for(let rt=0;rt<=te;rt++){let st=Math.cos(he),Ae=Math.sin(he);k.x=Pe*Ae,k.y=Fe,k.z=Pe*st,ke.copy(De).addScaledVector(k,o),c.push(ke.x,ke.y,ke.z),u.push(k.x,k.y,k.z),h.push(0,0),ye.push(f++),he+=Math.PI*2/te/r}P.push(ye)}pe.reverse(),P.push(pe);let L=P.length-1;for(let te=0;te<L;te++){let ye=P[te],Se=P[te+1],Pe=ye.length-1;l.push(Se[1],ye[0],Se[0]);for(let Fe=1;Fe<=Pe;Fe++)l.push(ye[Fe],ye[Fe-1],Se[Fe]),l.push(Se[Fe+1],ye[Fe],Se[Fe])}}}}}this.setIndex(l),this.setAttribute("position",new Le(c,3)),this.setAttribute("normal",new Le(u,3)),this.setAttribute("uv",new Le(h,2));function F(k,V,U,J,K){let $=-J/2,j=(Math.PI-J)/2,ge=V.clone().normalize().cross(U);k.addScaledVector(U,-o/Math.sin(j));let ae=new A,le=new A,W=1,ue=f,Y=[];for(let H=0;H<=a;H++){let Q=$+H/a*J;le.set(0,0,0),le.addScaledVector(ge,Math.sin(Q)),le.addScaledVector(U,Math.cos(Q));for(let ce=0;ce<=W;ce++){let ie=ce/W-.5;if(ae.copy(k),ae.addScaledVector(V,ie),ae.addScaledVector(le,o),K!=null){let pe=Math.max(0,ae.y-K);ae.addScaledVector(V,-pe/V.y)}c.push(ae.x,ae.y,ae.z),u.push(le.x,le.y,le.z),h.push(0,0),ce===0&&Y.push(f),f++}}for(let H=0;H<a;H++)for(let Q=0;Q<W;Q++){let ce=ue+Q+(W+1)*H,ie=ce+(W+1),pe=ie+1,ve=ce+1;l.push(ce,ie,ve),l.push(ie,pe,ve)}return[k.clone().addScaledVector(V,.5),Y]}function ee(k,V,U,J){let K=Math.PI/2,$=S.angle()-K,j=[],ge=new A,ae=new A;for(let W=0;W<=a;W++){let ue=[],Y=W/a;for(let H=0;H<=W;H++){let ce=((W?H/W:0)-.5)*v,ie=Math.cos(ce),pe=Math.sin(ce),ve=Math.atan(Math.tan($)*ie),me=(K+ve)*Y,De=Math.cos(me),ke=Math.sin(me);ge.set(0,0,0),ge.addScaledVector(V,ke*ie),ge.addScaledVector(U,De),ge.addScaledVector(J,ke*pe),ae.copy(k).addScaledVector(ge,o),c.push(ae.x,ae.y,ae.z),u.push(ge.x,ge.y,ge.z),h.push(0,0),ue.push(f++)}j.push(ue)}let le=j.length-1;for(let W=0;W<le;W++){let ue=j[W],Y=j[W+1],H=ue.length-1;l.push(ue[0],Y[1],Y[0]);for(let Q=1;Q<=H;Q++)l.push(ue[Q-1],ue[Q],Y[Q]),l.push(ue[Q],Y[Q+1],Y[Q])}}}};var gp=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,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},i.parameters),r=Object.assign((a=e==null?void 0:e.ui)!=null?a:{enabledIndieCorners:!1},i.ui),n=t.cornerRadius.reduce((h,f)=>h+f,0);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,parameters:Object.assign(t,{surfaceMaxCount:((l=t.surfaceMaxCount)!=null?l:n>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:r}}static build(i){let e=i.shape,{width:t,height:r,cornerRadius:n,cornerType:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,surfaceMaxCount:c}=i.parameters,u={x:t*.5,y:r*.5},h={x:-u.x,y:-u.y},f={x:u.x,y:u.y};function d(x,E,T){return E>t&&T>r?Math.min(x*t/E,x*r/T):E>t?x*t/E:T>r?x*r/T:x}let m=[];m[0]=n[0]===0?0:d(n[0],n[0]+n[3],n[0]+n[1]),m[1]=n[1]===0?0:d(n[1],n[1]+n[2],n[1]+n[0]),m[2]=n[2]===0?0:d(n[2],n[2]+n[1],n[2]+n[3]),m[3]=n[3]===0?0:d(n[3],n[3]+n[0],n[3]+n[2]);let p=h.x,g=f.x,y=f.y,v=h.y;e.addPoint(e.createPoint(p,y)),e.addPoint(e.createPoint(g,y)),e.addPoint(e.createPoint(g,v)),e.addPoint(e.createPoint(p,v)),e.isClosed=!0;let b=!0;for(let x=0,E=e.points.length;x<E;x++)e.points[x].roundness=m[x],x>0&&m[x]!==m[x-1]&&(b=!1);b&&(e.roundness=m[0]),e.useCubicForRoundedCorners=s!==1,e.update();let w=Gr.create({shape:e,parameters:{surfaceMaxCount:c,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(w,{userData:be(se({},i),{type:"RectangleGeometry"})})}};var l1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:Math.PI},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e=100,height:t=e,depth:r=e,widthSegments:n=64,heightSegments:s=64,phiStart:o,phiLength:a,thetaStart:l,thetaLength:c}=i.parameters,u=new Po(.5*e,n,s,o,a,l,c);return u.scale(1,t/e,r/e),Object.assign(u,{userData:be(se({},i),{type:"SphereGeometry"})})}};var c1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0,widthSegments:8,heightSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:0})}}static build(i){let{width:e=100,height:t=e,widthSegments:r=8,heightSegments:n=8}=i.parameters,s=new ts(e,t,r,n);return s.scale(1,1,1),Object.assign(s,{userData:be(se({},i),{type:"PlaneGeometry"})})}};var u1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o,a;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,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(i){let{width:e,height:t,innerRadiusPercent:r,spikes:n,cornerRadius:s,angle:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c,surfaceMaxCount:u}=i.parameters,h=i.shape,f=e*.5,d=t*.5,m=0,p=0,g=o*Math.PI/360/n,y=Math.PI/2*3*-1,v=f*r/100,b=d*r/100;if(n==3&&r==50){g=2*Math.PI/n;for(let x=0;x<n;x++){let E=g*x,T=m+Math.sin(E)*f,S=p+Math.cos(E)*d;h.addPoint(h.createPoint(T,S))}}else for(let x=0;x<n;x++){let E=m+Math.cos(y)*f,T=p+Math.sin(y)*d;h.addPoint(h.createPoint(E,T)),y+=g,E=m+Math.cos(y)*v,T=p+Math.sin(y)*b,x<=n,h.addPoint(h.createPoint(E,T)),y+=g}h.isClosed=!0;for(let x=0,E=h.points.length;x<E;x++)h.points[x].roundness=s;h.roundness=s,h.update();let w=Gr.create({shape:h,parameters:{surfaceMaxCount:u,roundness:s,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c}});return Object.assign(w,{userData:be(se({},i),{type:"StarGeometry"})})}};var yp=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:0)})}}static build(i){let{width:e,height:t}=i.parameters,r=new ts(e,t);return Object.assign(r,{userData:be(se({},i),{type:"TextFrameGeometry"})})}};var h1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,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},i.parameters),r=Math.abs(t.width),n=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:r,height:n,depth:s})}}static build(i){let{width:e,height:t,depth:r,radialSegments:n,tubularSegments:s,arc:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=UO(e,t,r,e*.5,o,s,0,0,n,a,l);return c.scale(1,t/e,1),Object.assign(c,{userData:be(se({},i),{type:"TorusGeometry"})})}};function UO(i,e,t,r,n,s,o,a,l,c,u){return[e,t]=[t,e],o=e/2,n/=2*Math.PI,n==1&&(c=0),new Wu(!0,i,e,t,r,n,s,o,a,l,c,u)}var f1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s,o;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width),tube:(o=t.tube)!=null?o:t.width*.125})}}static build(i){let{width:e,tube:t,tubularSegments:r,radialSegments:n,p:s,q:o}=i.parameters,a=e*.5;a!==t&&(a-=t);let l=new ka(a,t,r,n,s,o);return Object.assign(l,{userData:be(se({},i),{type:"TorusKnotGeometry"})})}};var d1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o,a;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},i.parameters);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,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(i){let{width:e=100,height:t,cornerRadius:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:o,isRect:a,surfaceMaxCount:l}=i.parameters,c=i.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 d=0,m=c.points.length;d<m;d++)c.points[d].roundness=r;c.roundness=r,c.update();let f=Gr.create({shape:c,parameters:{surfaceMaxCount:l,roundness:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:o}});return Object.assign(f,{userData:be(se({},i),{type:"TriangleGeometry"})})}};var Xu={};dT(Xu,{addBarycentricAttribute:()=>kO,fixUvs:()=>HO,loadFromUrl:()=>VO,resizeGeometry:()=>GO,roundShapePolygon:()=>zO});var p1=function(i,e){let t=e.x-i.x,r=e.y-i.y,n=Math.sqrt(t*t+r*r),s=t/n,o=r/n,a=Math.atan2(o,s);return{x:t,y:r,len:n,nx:s,ny:o,ang:a}},zO=(i,e,t)=>{let r,n,s,o,a,l,c,u,h,f,d,m,p,g,y=e.length;for(o=e[y-2],i.curves=[],r=1;r<y-1;r++){a=e[r%y],l=e[(r+1)%y];let v=p1(a,o),b=p1(a,l);c=v.nx*b.ny-v.ny*b.nx,u=v.nx*b.nx-v.ny*-b.ny,d=Math.asin(c),h=1,f=!1,u<0?d<0?d=Math.PI+d:(d=Math.PI-d,h=-1,f=!0):d>0&&(h=-1,f=!0),m=d/2,g=Math.abs(Math.cos(m)*t/Math.sin(m)),g>Math.min(v.len/2,b.len/2)?(g=Math.min(v.len/2,b.len/2),p=Math.abs(g*Math.sin(m)/Math.cos(m))):p=t,n=a.x+b.nx*g,s=a.y+b.ny*g,n+=-b.ny*p*h,s+=b.nx*p*h,i.absarc(n,s,p,v.ang+Math.PI/2*h,b.ang-Math.PI/2*h,f),o=a,a=l}i.closePath()},GO=(i,{width:e,height:t,depth:r})=>{e=Math.abs(e),t=Math.abs(t),r=Math.abs(r);let n=i.userData.parameters,s,o,a;e===0?(e=n.width,s=1):s=e/n.width,t===0?(t=n.height,o=1):o=t/n.height,r===0?(r=n.depth,a=1):a=r/n.depth,i.scale(s,o,a),n.width=e,n.height=t,n.depth=r},kO=(i,e)=>{let t=[new A(1,0,0),new A(0,1,0),new A(0,0,1)],r=i.attributes.position,n=new Float32Array(r.count*3);for(let s=0,o=r.count;s<o;s++)t[s%3].toArray(n,s*3);i.setAttribute(e,new Le(n,3))},VO=i=>new Promise(e=>{new Gs().load(i,r=>e(r))}),HO=(i,e,t)=>{let r=i.getAttribute("uv");if(r)for(let n=0;n<r.count;n++){let s=r.getX(n),o=r.getY(n);r.setXY(n,(s+e/2)/e,1-(o-t/2)/t*-1)}};var WO,vp=new Promise(i=>{WO=i});var Xe;vp.then(i=>{Xe=i});var m1=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),g1=new Uint32Array([0,1,2,3]),y1=new Uint8Array([4]),Pn=class{static build(i,e,t,r,n){let s,o,a;if(i===void 0)s=Pn.allocate(n,t),Xe.set_destination_refinement_level(s,0),o=Pn.buildLevel(s,!0,r);else if(i.positionWASM!==void 0){e&&e!==0&&(Xe.free_bvh(e),Xe.free_subdivision_surface(e));try{s=Pn.allocate(n,void 0,i)}catch(l){console.error(l,i),s=Pn.allocate(n,void 0,{positionWASM:m1,indexWASM:g1,verticesPerFaceWASM:y1})}Xe.set_destination_refinement_level(s,0),o=Pn.buildLevel(s,!0,r)}else s=e;if(i!==void 0&&i.subdivisions!==void 0){let l=jO(i.subdivisions,i.positionWASM.length);Xe.set_destination_refinement_level(s,l),l>0?a=Pn.buildLevel(s,!1,r):a=null}return{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}}static allocate(i,e,t){var x;let r,n,s,o=[],a=[];if(t)t.positionWASM&&t.positionWASM.length>0?(r=t.positionWASM,n=t.indexWASM,s=t.verticesPerFaceWASM):(r=m1,n=g1,s=y1);else{e.deleteAttribute("normal"),e.deleteAttribute("uv");let E=SM(e);r=E.attributes.position.array;let T=E.getIndex().array,S=T.length;switch(e.userData.type==="TorusGeometry"&&(e==null?void 0:e.userData.parameters.arc)===Math.PI*2&&(e.userData.type="ClosedTorusGeometry"),e.userData.type){case"ClosedTorusGeometry":case"PlaneGeometry":case"TorusKnotGeometry":case"CubeGeometry":n=new Uint32Array(S/3*2),s=new Uint8Array(S/6).fill(4);for(let O=0,z=0;O<S;O+=6)n[z++]=T[O],n[z++]=T[O+1],n[z++]=T[O+4],n[z++]=T[O+5];break;case"TorusGeometry":case"SphereGeometry":case"HelixGeometry":case"CylinderGeometry":case"ConeGeometry":let I,C,M;if(e.userData.type==="SphereGeometry")C=e.parameters.heightSegments,I=e.parameters.widthSegments,e.parameters.thetaLength!==Math.PI&&(M=!0);else if(e.userData.type==="CylinderGeometry")C=e.parameters.heightSegments+2,I=e.parameters.radialSegments;else if(e.userData.type==="ConeGeometry")C=e.parameters.heightSegments+1,I=e.parameters.radialSegments;else if(e.userData.type==="TorusGeometry"){let O=e.userData.parameters;C=Math.ceil(O.tubularSegments*O.arc/(2*Math.PI))+2,I=O.radialSegments}else{let{pathSegments:O,segments:z,revolutions:q}=e.userData.parameters;C=Math.ceil(z*q)+2,I=O}M?(n=new Uint32Array(1*I*3+(C-1)*I*4),s=new Uint8Array(1*I+(C-1)*I)):(n=new Uint32Array(2*I*3+(C-2)*I*4),s=new Uint8Array(2*I+(C-2)*I));let _=0,R=0,B=0;if(e.userData.type==="SphereGeometry"||e.userData.type==="HelixGeometry"||e.userData.type==="TorusGeometry"){for(;R<3*I;)n[R++]=T[_++],n[R++]=T[_++],n[R++]=T[_++],s[B++]=3;let O=M?n.length:3*I+4*(C-2)*I;for(;R<O;_+=6)n[R++]=T[_],n[R++]=T[_+1],n[R++]=T[_+4],n[R++]=T[_+5],s[B++]=4}else for(;R<4*(C-2)*I;_+=6)n[R++]=T[_],n[R++]=T[_+1],n[R++]=T[_+4],n[R++]=T[_+5],s[B++]=4;for(;R<n.length;)n[R++]=T[_++],n[R++]=T[_++],n[R++]=T[_++],s[B++]=3;break;default:n=T,s=new Uint8Array(S/3).fill(3);break}}let l=r.length,c=n.length,u=s.length,h=r.length+o.length+a.length,f=n.length+s.length,d=h*Float32Array.BYTES_PER_ELEMENT+f*Uint32Array.BYTES_PER_ELEMENT,m=h*Float32Array.BYTES_PER_ELEMENT,p=f*Uint32Array.BYTES_PER_ELEMENT,g=Xe._malloc(d),y=new Float32Array(Xe.HEAPF32.buffer,g,h),v=new Uint32Array(Xe.HEAPU32.buffer,g+m,f);y.set(r,0),y.set(o,r.length),y.set(a,r.length+o.length),v.set(n,0),v.set(s,n.length);let b;(x=t==null?void 0:t.scaleBaked)!=null&&x.some(E=>E!==1)&&(b=new Ee().makeScale(...t.scaleBaked)),i&&(b?b.premultiply(i):b=i);let w=b?Xe.alloc_subdivision_surface2(g,l,g+m,c,g+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u,b.elements):Xe.alloc_subdivision_surface(g,l,g+m,c,g+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u);return Xe._free(g),w}static buildLevel(i,e,t,r,n){let s=n?Xe.get_mesh_data2(i,e?Xe.Level.CONTROL:Xe.Level.REFINED,t!=null?t:!e,n.elements):Xe.get_mesh_data(i,e?Xe.Level.CONTROL:Xe.Level.REFINED,t!=null?t:!e),o=8,a=Xe.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(4,4+4),c=0,u=Xe.HEAPU32[a[c]>>2],h=Xe.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let f=Xe.HEAPU32[a[c]>>2],d=Xe.HEAPF32.subarray(f>>2,(f>>2)+l[c]);c++;let m=Xe.HEAPU32[a[c]>>2],p=Xe.HEAPU32.subarray(m>>2,(m>>2)+l[c]);c++;let g=Xe.HEAPU32[a[c]>>2],y=Xe.HEAPU32.subarray(g>>2,(g>>2)+l[c]);if(c++,r===void 0){let v=new Ie;if(v.setIndex(new Is(y,1)),v.setAttribute("position",new Le(h,3)),v.setAttribute("normal",new Le(d,3)),e){v.setAttribute("faceMap",new Is(p,1));let b=new Float32Array(d.length/3*4).fill(0);v.setAttribute("color",new Ue(b,4))}return Xe.free_mesh_data(s),v.userData.type="SubdivGeometry",v}r.getAttribute("position").copyArray(h),r.getAttribute("normal").copyArray(d),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,Xe.free_mesh_data(s)}static buildControlCageWireframe(i,e,t){let r=Xe.get_wireframe_data_for_base_level(i),n=4,s=Xe.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(2,2+2),a=0,l=Xe.HEAPU32[s[a]>>2],c=Xe.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;let u=Xe.HEAPU32[s[a]>>2],h=Xe.HEAPU32.subarray(u>>2,(u>>2)+o[a]);if(e===void 0){let f=new Ie;f.setAttribute("position",new Le(c,3));let d=new Float32Array(c.length);for(let m=0,p=c.length;m<p;)d[m++]=t.r,d[m++]=t.g,d[m++]=t.b;return f.setAttribute("color",new Ue(d,3)),f.setIndex(new Is(h,1)),Xe.free_wireframe_data_for_base_level(r),f}e.getAttribute("position").copyArray(c),e.attributes.position.needsUpdate=!0,Xe.free_wireframe_data_for_base_level(r)}static updateCollabMesh(i,e,t){e||Xe.set_destination_refinement_level(i,1);let r=t?Xe.get_topological_data2(i,e?Xe.Level.CONTROL:Xe.Level.REFINED,t.elements):Xe.get_topological_data(i,e?Xe.Level.CONTROL:Xe.Level.REFINED),n=6,s=Xe.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(3,3+3),a=0,l=Xe.HEAPU32[s[a]>>2],c=new Float32Array(Xe.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let u=Xe.HEAPU32[s[a]>>2],h=new Uint32Array(Xe.HEAPU32.subarray(u>>2,(u>>2)+o[a]));a++;let f=Xe.HEAPU32[s[a]>>2],d=new Uint8Array(Xe.HEAPU32.subarray(f>>2,(f>>2)+o[a]));return Xe.free_topological_data(r),{positions:c,indices:h,verticesPerFace:d}}};function jO(i,e){let t=i;return t=Math.min(t,3-Math.ceil(Math.log(e/172e3)/Math.log(4))),Math.max(t,0)}var dv={ConeGeometry:PM,CubeGeometry:IM,CylinderGeometry:DM,DodecahedronGeometry:RM,EllipseGeometry:ZM,HelixGeometry:r1,IcosahedronGeometry:n1,LatheGeometry:i1,NonParametricGeometry:s1,PolygonGeometry:o1,PyramidGeometry:a1,RectangleGeometry:gp,SphereGeometry:l1,PlaneGeometry:c1,StarGeometry:u1,TextFrameGeometry:yp,TorusGeometry:h1,TorusKnotGeometry:f1,TriangleGeometry:d1,VectorGeometry:Gr},Yu=i=>dv[i.type].create(i);var kr=class extends xe{constructor(t,r,n,s){super(t,r,n);this.isColorA=!0;this.a=s}setRGBA(t,r,n,s){super.setRGB(t,r,n),this.a=s}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}};function fr(i,e){let t;if(typeof i=="string"){let r=e==null?void 0:e.getColor(i);r?t=r:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new kr(0,0,0,0))}else return"a"in i?new kr(i.r,i.g,i.b,i.a):new kr(i.r,i.g,i.b,1);return t}var qo=i=>"isEntity"in i,us=i=>"isAbstractMesh"in i,v1=i=>i.objectType==="CombinedCamera",x1=i=>qo(i)&&(i.objectType==="LightDirectional"||i.objectType==="LightSpot"||i.objectType==="LightPoint");var hs=i=>"objectHelper"in i;function pv(i,e){var r;let t=!1;e.position&&(i.position.fromArray(e.position),t=!0),e.rotation&&(i.rotation.fromArray(e.rotation),t=!0),e.scale&&(t=!0,i.scale.fromArray(e.scale)),e.hiddenMatrix!==void 0&&"hiddenMatrix"in i&&(t=!0,i.hiddenMatrix.fromArray((r=e.hiddenMatrix)!=null?r:_i.identity)),t&&i.updateMatrix(),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&i.updateWorldMatrix(!1,!0),i.objectType==="CombinedCamera"&&(e.isUpVectorFlipped!==void 0&&(i.isUpVectorFlipped=e.isUpVectorFlipped),i.updateUp())}function qO(i,e){pv(i,e),e.name!==void 0&&(i.name=e.name),e.visible!==void 0&&(i.isEntity?i.visibility=e.visible:i.visible=e.visible)}function b1(i,e,t){qO(i,e),e.color!==void 0&&(i.color=fr(e.color,t)),e.intensity!==void 0&&(i.intensity=e.intensity),e.shadows!==void 0&&!(i instanceof zs)&&(i.castShadow=e.shadows),i.shadow&&!(i instanceof zs)&&e.depth!==void 0&&(i.shadow.camera.far=e.depth,i.shadow.needsUpdate=!0),e.helper!==void 0&&hs(i)&&(i.enableHelper=e.helper,i.gizmos.shadowmap.visible=e.helper)}function w1(i,e){i.shadow.camera.right=e/2,i.shadow.camera.left=-e/2,i.shadow.camera.top=e/2,i.shadow.camera.bottom=-e/2,i.shadow.needsUpdate=!0}var Bl=new Qt,Vr=new A,Ge=new A,xr=new Ee;function XO(i,e,t=0,r=e.count){let n=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,c=-1/0;for(let u=t;u<r;u++){let h=e.getX(u),f=e.getY(u),d=e.getZ(u);h<n&&(n=h),f<s&&(s=f),d<o&&(o=d),h>a&&(a=h),f>l&&(l=f),d>c&&(c=d)}return i.min.set(n,s,o),i.max.set(a,l,c),i}var S1=(i,e,t,r)=>{var n;if(us(i)){let s=i.geometry.userData.parameters,o=i.geometry.getAttribute("position");i.geometry.userData.type==="SubdivGeometry"?Vr.copy(i.originalGeometry.boundingSphere.center):(XO(Bl,o,i.geometry.drawRange.start,i.geometry.drawRange.count<1/0?i.geometry.drawRange.count:o.count),Bl.getCenter(Vr)),i.forceComputeSize?Bl.getSize(Ge).multiplyScalar(.5):Ge.set(s.width,s.height,(n=s.depth)!=null?n:0).multiplyScalar(.5)}else if(hs(i)&&r===!0){let s=i.geometryHelper.getAttribute("position");Bl.setFromArray(s.array),Bl.getCenter(Vr),Bl.getSize(Ge).multiplyScalar(.5)}else Vr.setScalar(0),Ge.setScalar(0);xr.copy(e).multiply(i.matrixWorld),Ge.x===0&&Ge.y===0&&Ge.z===0?t.push(new A(Vr.x,Vr.y,Vr.z).applyMatrix4(xr)):t.push(new A(-Ge.x,Ge.y,Ge.z).add(Vr).applyMatrix4(xr),new A(-Ge.x,-Ge.y,Ge.z).add(Vr).applyMatrix4(xr),new A(Ge.x,-Ge.y,Ge.z).add(Vr).applyMatrix4(xr),new A(Ge.x,Ge.y,Ge.z).add(Vr).applyMatrix4(xr),new A(-Ge.x,Ge.y,-Ge.z).add(Vr).applyMatrix4(xr),new A(-Ge.x,-Ge.y,-Ge.z).add(Vr).applyMatrix4(xr),new A(Ge.x,-Ge.y,-Ge.z).add(Vr).applyMatrix4(xr),new A(Ge.x,Ge.y,-Ge.z).add(Vr).applyMatrix4(xr))},Ju=class extends Qt{constructor(){super(...arguments);this.matrix=new Ee;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(r=>r.clone()),this.faces=t.faces.map(r=>r.clone()),this.edges=t.edges.map(r=>r.clone()),this.centerEdges=t.centerEdges.map(r=>r.clone()),this}setFromObjectSize(t,r=!1){t.updateWorldMatrix(!1,r),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let n=new Ee().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,n,r)}expandByObjectSize(t,r,n=!1){let s=[];return n===!0?t.traverseEntity(o=>{o.visible&&S1(o,r,s,t.enableHelper===!0)}):S1(t,r,s,t.enableHelper===!0),this.setFromPoints(s)}getCenter(t){return t=super.getCenter(t),t.applyMatrix4(this.matrix),t}getPositionToCenter(t){return t=super.getCenter(t),t.applyMatrix4(xr.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Ge).multiplyScalar(.5),this.getCenter(Vr),xr.copy(this.matrix).setPosition(Vr),this.vertices=[new A(-Ge.x,Ge.y,Ge.z).applyMatrix4(xr),new A(-Ge.x,-Ge.y,Ge.z).applyMatrix4(xr),new A(Ge.x,-Ge.y,Ge.z).applyMatrix4(xr),new A(Ge.x,Ge.y,Ge.z).applyMatrix4(xr),new A(-Ge.x,Ge.y,-Ge.z).applyMatrix4(xr),new A(-Ge.x,-Ge.y,-Ge.z).applyMatrix4(xr),new A(Ge.x,-Ge.y,-Ge.z).applyMatrix4(xr),new A(Ge.x,Ge.y,-Ge.z).applyMatrix4(xr)]}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=[new Qr(this.vertices[0],this.vertices[3]),new Qr(this.vertices[1],this.vertices[2]),new Qr(this.vertices[5],this.vertices[6]),new Qr(this.vertices[4],this.vertices[7]),new Qr(this.vertices[0],this.vertices[1]),new Qr(this.vertices[3],this.vertices[2]),new Qr(this.vertices[7],this.vertices[6]),new Qr(this.vertices[4],this.vertices[5]),new Qr(this.vertices[0],this.vertices[4]),new Qr(this.vertices[1],this.vertices[5]),new Qr(this.vertices[2],this.vertices[6]),new Qr(this.vertices[3],this.vertices[7])],this.centerEdges=this.edges.map(t=>t.getCenter(new A))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=[new A().copy(this.vertices[0]).sub(this.vertices[2]).multiplyScalar(.5).add(this.vertices[2]),new A().copy(this.vertices[7]).sub(this.vertices[5]).multiplyScalar(.5).add(this.vertices[5]),new A().copy(this.vertices[4]).sub(this.vertices[1]).multiplyScalar(.5).add(this.vertices[1]),new A().copy(this.vertices[3]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6]),new A().copy(this.vertices[4]).sub(this.vertices[3]).multiplyScalar(.5).add(this.vertices[3]),new A().copy(this.vertices[1]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6])]}};function Qu(i){let e=[];for(let t in i){let r=i[t];delete r.metadata,e.push(r)}return e}function YO(i){let e=[];for(let t in i)e.push(i[t]);return e}var xp=i=>class extends i{hasEntityChild(){return this.children.some(t=>qo(t))}isDescendantOf(t){t instanceof ot&&(t=t.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===t)return!0;r=r.parent}return!1}attach(t,r){this.updateWorldMatrix(!0,!1);let n=new Ee().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),n.multiply(t.parent.matrixWorld)),qo(t)?t.hiddenMatrix.premultiply(n):t.applyMatrix4(n),t.updateWorldMatrix(!1,!1),this.add(t),r!==void 0&&(this.children.pop(),this.children.splice(r,0,t)),this}copy(t,r=!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)),r===!0)for(let n=0;n<t.children.length;n++){let s=t.children[n];this.add(s.clone())}return this}toJSON(t){let r=t===void 0,n={object:{uuid:"",objectType:""}};t===void 0&&(t={geometries:{},materials:{},textures:{},images:{},interactionStates:{},nodes:{}},n.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)(qo(o)||o instanceof yn)&&s.children.push(o.toJSON(t).object)}if(r){let o=Qu(t.geometries),a=Qu(t.materials),l=Qu(t.textures),c=Qu(t.images),u=Qu(t.interactionStates),h=YO(t.nodes);o.length>0&&(n.geometries=o),a.length>0&&(n.materials=a),l.length>0&&(n.textures=l),c.length>0&&(n.images=c),u.length>0&&(n.interactionStates=u),h.length>0&&(n.nodes=h)}return n.object=s,n}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 Xn=i=>"isEntity"in i;var Yn=i=>class extends xp(i){constructor(){super(...arguments);this.objectType="";this.isEntity=!0;this.raycastLock=!1;this.scaleLock=!1;this.hiddenMatrix=new Ee;this._singleBBox=new Ju;this._recursiveBBox=new Ju;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this.forceComputeSize=!1}set visibility(r){this.visible=r;for(let n of this.children)Xn(n)&&n.traverseEntity(s=>{hs(s)&&s.visible&&(s.objectHelper.visible=r)})}get visibility(){return this.visible}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}resetBBoxNeedsUpdate(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.traverseAncestors(r=>{Xn(r)&&(r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0)}),this.traverseEntity(r=>{r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0})}traverseEntity(r){r(this);for(let n of this.children)Xn(n)&&n.traverseEntity(r)}updateMatrixWorld(r){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||r)&&(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,r=!0);for(let n of this.children)n.updateMatrixWorld(r)}updateWorldMatrix(r,n){let s=this.parent;if(r&&s!==null&&s.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 o of this.children)o.updateWorldMatrix(!1,!0)}shallowClone(r){return new this.constructor().shallowCopy(this,r)}shallowCopy(r,n=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),n===!0)for(let s of r.children)Xn(s)&&this.add(s.shallowClone());return this}clone(r){return new this.constructor().copy(this,r)}copy(r,n=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),n===!0)for(let s of r.children)Xn(s)&&this.add(s.clone());return this}keepChildrenMatrixWorld(){let r=new Ee,n=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),r.copy(this.matrixWorld).invert(),r.multiply(n);for(let s of this.children)Xn(s)&&s.hiddenMatrix.premultiply(r)}toJSON(r){let n=super.toJSON(r),s=n.object;return this.raycastLock===!0&&(s.raycastLock=!0),this.scaleLock===!0&&(s.scaleLock=!0),s.hiddenMatrix=this.hiddenMatrix.toArray(),n}fromJSON(r){return super.fromJSON(r),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.scaleLock!==void 0&&(this.scaleLock=r.scaleLock),this.hiddenMatrix.fromArray(r.hiddenMatrix),this}fromObject3D(r){let n=r.children;return r.children=[],Object.assign(r,{raycastLock:!1,scaleLock:!1,hiddenMatrix:new Ee}),this.copy(r),r.children=n,this}toObjectTransformState(r=[]){this.updateWorldMatrix(!0,!1);let n={position:this.position.toArray(),rotation:[this.rotation.x,this.rotation.y,this.rotation.z],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return xl(n,r)}fromObjectTransformState(r){return r.position&&this.position.fromArray(r.position),r.rotation&&this.rotation.fromArray(r.rotation),r.scale&&this.scale.fromArray(r.scale),r.hiddenMatrix&&this.hiddenMatrix.fromArray(r.hiddenMatrix),this.updateMatrix(),this}toState(r=[]){let n=se({name:this.name,visible:this.visible,raycastLock:this.raycastLock},this.toObjectTransformState(r));return xl(n,r)}fromState(r,n){return r.name&&(this.name=r.name),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.type!=="OrthographicCamera"&&r.type!=="PerspectiveCamera"&&(this.matrixAutoUpdate=!1),r.visible!==void 0&&(this.visibility=r.visible),this.fromObjectTransformState(r),this}};var Ku=class extends ot{constructor(t,r={}){super();this.object=t;let n=t.recursiveBBox.getSize(new A),s=.1;this.parameters=Od.defaultData(n.toArray(),s),Go(this.parameters,r),this.update(),this.setHideBase(this.parameters.hideBase)}refreshMaterial(){if("material"in this.object)for(let t of this.children)t.material=this.object.material}setHideBase(t){if("material"in this.object){if(Array.isArray(this.object.material)){if(this.children.length>0){for(let r of this.object.material)r.visible=!0;if(t){let r=this.object.material.map(n=>n.clone());for(let n of this.children)n.material=r}else for(let r of this.children)r.material=this.object.material}for(let r of this.object.material)r.visible=!t}else{if(this.children.length>0)if(this.object.material.visible=!0,t){let r=this.object.material.clone();for(let n of this.children)n.material=r}else for(let r of this.children)r.material=this.object.material;this.object.material.visible=!t}this.parameters.hideBase=t}}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)}this.children.forEach(t=>t.updateMatrix())}_updateCount(){let t=this.parameters.type==="grid"?this.parameters.grid.count[0]*this.parameters.grid.count[1]*this.parameters.grid.count[2]:this.parameters.count;if(this.children.length!==t)if(this.children.length<t)for(let r=0,n=t-this.children.length;r<n;++r){let s=this.object.shallowClone(!1);s.visible=!0,this.add(s),this.parameters.hideBase&&this.setHideBase(!0)}else for(let r=0,n=this.children.length-t;r<n;++r)this.remove(this.children[0])}_updateRadial(t){let r=t.radial,n=r.start*et.DEG2RAD,s=r.end*et.DEG2RAD,o=n-s,a=new pn(r.rotation[0]*et.DEG2RAD,r.rotation[1]*et.DEG2RAD,r.rotation[2]*et.DEG2RAD),l;switch(r.axis){case"z":l=new A(0,0,1);break;case"y":l=new A(0,1,0);break;default:case"x":l=new A(1,0,0);break}for(let[c,u]of this.children.entries()){u.hiddenMatrix.identity(),u.scale.x=r.scale[0],u.scale.y=r.scale[1],u.scale.z=r.scale[2],u.position.setScalar(0);let h=o/t.count*c-n;switch(r.axis){case"x":u.rotation.set(0,h,0);break;case"y":u.rotation.set(0,0,h);break;case"z":u.rotation.set(h,0,0);break}u.translateOnAxis(l,r.radius),u.position.x+=r.position[0],u.position.y+=r.position[1],u.position.z+=r.position[2],r.alignment===!0?(u.rotation.x+=a.x,u.rotation.y+=a.y,u.rotation.z+=a.z):u.rotation.copy(a)}}_updateLinear(t){if(t.type!=="linear")throw new Error;let r=t.linear,n=new pn(r.rotation[0]*et.DEG2RAD,r.rotation[1]*et.DEG2RAD,r.rotation[2]*et.DEG2RAD);for(let[s,o]of this.children.entries())o.hiddenMatrix.identity(),o.scale.x=1+(r.scale[0]-1)*s,o.scale.y=1+(r.scale[1]-1)*s,o.scale.z=1+(r.scale[2]-1)*s,o.rotation.x=n.x*s,o.rotation.y=n.y*s,o.rotation.z=n.z*s,o.position.x=r.position[0]*s,o.position.y=r.position[1]*s,o.position.z=r.position[2]*s}_updateGrid(t){let r=0,n=t.grid;if(n.useCenter===!0){let s={x:n.count[0]%2===0?2:1,y:n.count[1]%2===0?2:1,z:n.count[2]%2===0?2:1},o=new A(n.size[0]*(n.count[0]-s.x)*.5,n.size[1]*(n.count[1]-s.y)*.5,n.size[2]*(n.count[2]-s.z)*.5);for(let a=0;a<n.count[0];a++)for(let l=0;l<n.count[1];l++)for(let c=0;c<n.count[2];c++){let u=this.children[r++];u.hiddenMatrix.identity(),u.scale.setScalar(1),u.rotation.set(0,0,0),u.position.x=n.size[0]*a-o.x,u.position.y=n.size[1]*l-o.y,u.position.z=n.size[2]*c-o.z}}else for(let s=0;s<n.count[0];s++)for(let o=0;o<n.count[1];o++)for(let a=0;a<n.count[2];a++){let l=this.children[r++];l.hiddenMatrix.identity(),l.scale.setScalar(1),l.rotation.set(0,0,0),l.position.x=n.size[0]*s,l.position.y=-n.size[1]*o,l.position.z=-n.size[2]*a}}fromJSON(t){return this}toJSON(){return{}}fromClonerState(t){return t.hideBase!==void 0&&this.setHideBase(t.hideBase),Go(this.parameters,t),this.update(),this}};var Xt=class extends Yn(Gt){constructor(t,r){super(t,r);this.isAbstractMesh=!0;Array.isArray(r)&&(this.selectedMaterial=0,t.groups.length===0&&t.addGroup(0,t.getAttribute("position").count,0))}get cloner(){return this._cloner}set cloner(t){this._cloner&&this.remove(this._cloner),t&&this.add(t),this._cloner=t}getSelectedMaterial(t){return Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=t!=null?t:0),this.material[t!=null?t:this.selectedMaterial]):this.material}setSelectedMaterial(t,r){Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=r!=null?r:0),r=r!=null?r:this.selectedMaterial,this.material[r].dispose(),this.material[r]=t):(this.material.dispose(),this.material=t)}updateGeometry(t){let r=this.geometry,n=dv[r.userData.type],s=this.objectType==="NonParametric"?Object.assign({},r.userData,{geometry:r}):r.userData,o=n.build(n.normalizeInputs(t,s)),a=r.uuid;if(this.geometry.dispose(),this.geometry=o,this.geometry.uuid=a,this.geometry.computeBoundingSphere(),this.cloner)for(let l of this.cloner.children)l.geometry=this.geometry}resizeGeometry(t,r,n){Xu.resizeGeometry(this.geometry,{width:t,height:r,depth:n})}shallowClone(t){return new this.constructor(this.geometry,this.material).shallowCopy(this,t)}clone(t){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,n=Yu(r),s=Array.isArray(this.material)?this.material.map(o=>o.clone()):this.material.clone();return new this.constructor(n,s).copy(this,t)}copy(t,r=!0){return super.copy(t,r),t.cloner&&(this.cloner=new Ku(t,t.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(t){t===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new Ku(this)),this.cloner.fromClonerState(t))}fromState(t,r){var n,s;return super.fromState(t),t.type==="Mesh"&&(this.setFromClonerState(t.cloner),this.castShadow=(n=t.castShadow)!=null?n:!0,this.receiveShadow=(s=t.receiveShadow)!=null?s:!0),this}};var Zu=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 He=class{constructor(e){this.hashProperties=void 0;this.isNode=!0;this.shortcuts={};this.uuid=et.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,r){return r=r!=null?r:{},this.analyze(e,r),this.flow(e,t,r)}flow(e,t,r){r=r!=null?r:{},e.addFlow(r.slot,r.cache,r.context);let n={result:this.build(e,t),code:e.clearNodeCode(),extra:e.context.extra};return e.removeFlow(),n}build(e,t,r){t=t!=null?t:this.getType(e,t);let n=e.getNodeData(r!=null?r:this);return e.analyzing&&this.appendDepsNode(e,n,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,r)}updateFrame(e){}generateReadonly(e,t,r,n,s,o){return""}generate(e,t,r,n,s){return""}parse(e,t,r,n){}appendDepsNode(e,t,r){t.deps=(t.deps||0)+1;let n=e.getTypeLength(r);(n>(t.outputMax||0)||this.getType(e,r))&&(t.outputMax=n,t.output=r)}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,r;for(t in this)r=this[t],r instanceof He&&(e+='"'+t+'":'+r.getHash()+",");if(this.hashProperties)for(let n=0;n<this.hashProperties.length;n++)t=this.hashProperties[n],r=this[t],e+='"'+t+'":"'+String(r)+'",';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 r={};return r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),!t&&e&&(e.nodes[this.uuid]=r),r}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 mv=class{constructor(){this.nodes={};this.keywords={}}add(e){this.nodes[e.name]=e}addKeyword(e,t,r){r=r!==void 0?r:!0,this.keywords[e]={callback:t,cache:r}}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}},Tr=new mv;var Ye=class extends He{constructor(t,r){super(t);this.scope="";r=r!=null?r:{},this.shared=r.shared!==void 0?r.shared:!0,this.unique=r.unique!==void 0?r.unique:!1}build(t,r,n,s){if(r=r!=null?r:this.getType(t),this.getShared(t,r)){let o=this.getUnique(t,r);o&&this.uuid===void 0&&(this.uuid=et.generateUUID()),n=t.getUUID(n!=null?n:this.getUUID(),!o);let a=t.getNodeData(n),l=a.output||this.getType(t);if(t.analyzing)return(a.deps||0)>0||this.getLabel()?(this.appendDepsNode(t,a,r),this.generate(t,r,n)):super.build(t,r,n);if(o)return a.name=a.name||super.build(t,r,n),a.name;if(!this.getLabel()&&(!this.getShared(t,l)||t.context.ignoreCache||a.deps===1))return super.build(t,r,n);n=this.getUUID(!1);let c=this.getTemp(t,n);if(c)return t.format(c,l,r);{c=super.generate(t,r,n,a.output,s);let u=this.generate(t,l,n);return t.addNodeCode(c+" = "+u+";"),t.format(c,l,r)}}return super.build(t,r,n)}getShared(t,r){return r!=="sampler2D"&&r!=="samplerCube"&&this.shared}getUnique(t,r){return this.unique}setLabel(t){return this.label=t,this}getLabel(){return this.label}getUUID(t){let r=this.uuid;return typeof this.scope=="string"&&(r=this.scope+"-"+r),r}getTemp(t,r){r=r||this.uuid;let n=t.getVars()[r];return n?n.name:void 0}generate(t,r,n,s,o){return this.getShared(t,r)||console.error("TempNode is not shared"),n=n!=null?n:this.uuid,t.getTempVar(n,s!=null?s:this.getType(t),o,this.getLabel()).name}};var Ht=class extends Ye{constructor(t,r){r=r!=null?r:{},r.shared=r.shared!==void 0?r.shared:!1;super(t,r);this.readonly=!1}setReadonly(t){return this.readonly=t,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}createJSONNode(t){let r=super.createJSONNode(t);return this.readonly===!0&&(r.readonly=this.readonly),r}fromJSON(t,r){return super.fromJSON(t,r),t.readonly!==void 0&&this.setReadonly(t.readonly),this}generate(t,r,n,s,o,a){n=t.getUUID(n!=null?n:this.getUUID()),s=s!=null?s:this.getType(t);let l=t.getNodeData(n);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(t,r,n,s,o,a):t.isShader("vertex")?(l.vertex||(l.vertex=t.createVertexUniform(s,this,o,a,this.getLabel())),t.format(l.vertex.name,s,r)):(l.fragment||(l.fragment=t.createFragmentUniform(s,this,o,a,this.getLabel())),t.format(l.fragment.name,s,r))}copy(t){return super.copy(t),this.readonly=t.readonly,this}};var Ir=class extends Ht{constructor(t=0,r){super("v2");this.nodeType="Vector2";this.value=t instanceof N?t:new N(t,r)}get x(){return this.value.x}set x(t){this.value.x=t}get y(){return this.value.y}set y(t){this.value.y=t}generateReadonly(t,r,n,s,o,a){return t.format("vec2("+this.value.x+", "+this.value.y+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var Rr=class extends Ht{constructor(t=0,r,n){super("v3");this.nodeType="Vector3";this.value=t instanceof A?t:new A(t,r,n)}get x(){return this.value.x}set x(t){this.value.x=t}get y(){return this.value.y}set y(t){this.value.y=t}get z(){return this.value.z}set z(t){this.value.z=t}generateReadonly(t,r,n,s,o,a){return t.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var hi=class extends Ht{constructor(t){super("v4");this.nodeType="Vector4";this.value=t instanceof kr?t:new kr(t.r,t.g,t.b,t.a)}generateReadonly(t,r,n,s,o,a){return t.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var JO=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,M1=/[a-z_0-9]+/gi,Ne=class extends Ye{constructor(t,r,n,s,o){super(o);this.src="";this.nodeType="Function";this.useKeywords=!0;this.includes=[];this.extensions={};this.keywords={};this.isMethod=o===void 0,this.isInterface=!1,this.parse(t,r,n,s)}getShared(t,r){return!this.isMethod}getType(t){return t.getTypeByFormat(this.type)}getInputByName(t){if(this.inputs){let r=this.inputs.length;for(;r--;)if(this.inputs[r].name===t)return this.inputs[r]}}getIncludeByName(t){if(this.includes){let r=this.includes.length;for(;r--;)if(this.includes[r].name===t)return this.includes[r]}}generate(t,r,n,s,o){let a,l=0,c=this.src;if(this.includes)for(let h=0;h<this.includes.length;h++)t.include(this.includes[h],this);for(let h in this.extensions)t.extensions[h]=!0;let u=[];for(;a=M1.exec(this.src);)u.push(a);for(let h=0;h<u.length;h++){let f=u[h],d=f[0],m=this.isMethod?!this.getInputByName(d):!0,p=d;if(this.keywords[d]||this.useKeywords&&m&&Tr.containsKeyword(d)){let g=this.keywords[d];if(!g){let y=Tr.getKeywordData(d);y.cache&&(g=t.keywords[d]),g=g||Tr.getKeyword(d,t),y.cache&&(t.keywords[d]=g)}p=g.build(t)}d!==p&&(c=c.substring(0,f.index+l)+p+c.substring(f.index+d.length+l),l+=p.length-d.length),this.getIncludeByName(p)===void 0&&Tr.contains(p)&&t.include(Tr.get(p))}return r==="source"?c:this.isMethod?(this.isInterface||t.include(this,void 0,c),this.name):t.format("( "+c+" )",this.getType(t),r)}parse(t,r,n,s){if(this.src=t||"",this.includes=r!=null?r:[],this.extensions=n!=null?n:{},this.keywords=s!=null?s:{},this.isMethod){let o=JO.exec(this.src);if(this.inputs=[],o&&o.length==4){this.type=o[1],this.name=o[2];let a=o[3].match(M1);if(a){let l=0;for(;l<a.length;){let c=a[l++],u;c==="in"||c==="out"||c==="inout"?u=a[l++]:(u=c,c="");let h=a[l++];this.inputs.push({name:h,type:u,qualifier:c})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}copy(t){return super.copy(t),this.isMethod=t.isMethod,this.useKeywords=t.useKeywords,t.type!==void 0&&(this.type=t.type),this.parse(t.src,t.includes,t.extensions,t.keywords),this}toJSON(t){var n;let r=this.getJSONNode(t);if(!r){r=this.createJSONNode(t),r.src=this.src,r.isMethod=this.isMethod,r.useKeywords=this.useKeywords,this.isMethod||(r.type=this.type),r.extensions=JSON.parse(JSON.stringify(this.extensions));let s={};for(let o in this.keywords)s[o]=this.keywords[o].toJSON(t).uuid;if(r.keywords=s,(n=this.includes)!=null&&n.length){let o=[];for(let a=0;a<this.includes.length;a++)o.push(this.includes[a].toJSON(t).uuid);r.includes=o}r.isMethod=this.isMethod,r.inputs=this.inputs}return r.nodeType=this.nodeType,r}fromJSON(t,r){if(super.fromJSON(t,r),t.inputs!==void 0&&(this.inputs=t.inputs),t.isMethod!==void 0&&(this.isMethod=t.isMethod),t.src&&(this.src=t.src),t.isMethod&&(this.isMethod=t.isMethod),t.useKeywords&&(this.useKeywords=t.useKeywords),t.type&&(this.type=t.type),t.extensions&&(this.extensions=t.extensions),t.keywords&&r){this.keywords={};for(let n in t.keywords)this.keywords[n]=r.getNode(t.keywords[n])}return t.includes&&r&&(this.includes=t.includes.map(n=>r.getNode(n))),this}};var QO=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,gv=class extends Ye{constructor(t="",r){super();this.src="";this.useDefine=!1;this.nodeType="Const";this.parse(t||gv.PI,void 0,void 0,void 0,r)}getType(t){return t.getTypeByFormat(this.type)}parse(t,r,n,s,o){this.src=t||"";let a,l,c="",u=QO.exec(t);this.useDefine=o!=null?o:this.src.charAt(0)==="#",u&&u.length>1?(l=u[1],a=u[2],c=u[3]):(a=this.src,l="f"),this.name=a,this.type=l,this.value=c}build(t,r){if(r==="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 t.include(this),t.format(this.name,this.getType(t),r)}generate(t,r,n,s,o){return t.format(this.name,this.getType(t),r)}copy(t){return super.copy(t),this.parse(t.src,void 0,void 0,void 0,t.useDefine),this}},bt=gv;bt.PI="PI",bt.PI2="PI2",bt.RECIPROCAL_PI="RECIPROCAL_PI",bt.RECIPROCAL_PI2="RECIPROCAL_PI2",bt.LOG2="LOG2",bt.EPSILON="EPSILON";var KO=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
|
|
2994
|
+
}`;function yb(i,e,t){let r=new Ra,n=new N,s=new N,o=new Qe,a=new Jc({depthPacking:cE}),l=new Qc,c={},u=t.maxTextureSize,h={0:Cr,1:ii,2:ir},f=new St({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new N},radius:{value:4}},vertexShader:$D,fragmentShader:eP}),d=f.clone();d.defines.HORIZONTAL_PASS=1;let m=new Ie;m.setAttribute("position",new Ue(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let p=new Gt(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=eb,this.render=function(w,x,E){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||w.length===0)return;let T=i.getRenderTarget(),S=i.getActiveCubeFace(),I=i.getActiveMipmapLevel(),C=i.state;C.setBlending(kt),C.buffers.color.setClear(1,1,1,1),C.buffers.depth.setTest(!0),C.setScissorTest(!1);for(let M=0,_=w.length;M<_;M++){let R=w[M],B=R.shadow;if(B===void 0){console.warn("THREE.WebGLShadowMap:",R,"has no shadow.");continue}if(B.autoUpdate===!1&&B.needsUpdate===!1)continue;n.copy(B.mapSize);let O=B.getFrameExtents();if(n.multiply(O),s.copy(B.mapSize),(n.x>u||n.y>u)&&(n.x>u&&(s.x=Math.floor(u/O.x),n.x=s.x*O.x,B.mapSize.x=s.x),n.y>u&&(s.y=Math.floor(u/O.y),n.y=s.y*O.y,B.mapSize.y=s.y)),B.map===null&&!B.isPointLightShadow&&this.type===Nc&&(B.map=new mt(n.x,n.y),B.map.texture.name=R.name+".shadowMap",B.mapPass=new mt(n.x,n.y),B.camera.updateProjectionMatrix()),B.map===null){let q={minFilter:lr,magFilter:lr,format:On};B.map=new mt(n.x,n.y,q),B.map.texture.name=R.name+".shadowMap",B.camera.updateProjectionMatrix()}i.setRenderTarget(B.map),i.clear();let z=B.getViewportCount();for(let q=0;q<z;q++){let F=B.getViewport(q);o.set(s.x*F.x,s.y*F.y,s.x*F.z,s.y*F.w),C.viewport(o),B.updateMatrices(R,q),r=B.getFrustum(),b(x,E,B.camera,R,this.type)}!B.isPointLightShadow&&this.type===Nc&&y(B,E),B.needsUpdate=!1}g.needsUpdate=!1,i.setRenderTarget(T,S,I)};function y(w,x){let E=e.update(p);f.defines.VSM_SAMPLES!==w.blurSamples&&(f.defines.VSM_SAMPLES=w.blurSamples,d.defines.VSM_SAMPLES=w.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),f.uniforms.shadow_pass.value=w.map.texture,f.uniforms.resolution.value=w.mapSize,f.uniforms.radius.value=w.radius,i.setRenderTarget(w.mapPass),i.clear(),i.renderBufferDirect(x,null,E,f,p,null),d.uniforms.shadow_pass.value=w.mapPass.texture,d.uniforms.resolution.value=w.mapSize,d.uniforms.radius.value=w.radius,i.setRenderTarget(w.map),i.clear(),i.renderBufferDirect(x,null,E,d,p,null)}function v(w,x,E,T,S,I){let C=null,M=E.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(M!==void 0?C=M:C=E.isPointLight===!0?l:a,i.localClippingEnabled&&x.clipShadows===!0&&x.clippingPlanes.length!==0||x.displacementMap&&x.displacementScale!==0||x.alphaMap&&x.alphaTest>0){let _=C.uuid,R=x.uuid,B=c[_];B===void 0&&(B={},c[_]=B);let O=B[R];O===void 0&&(O=C.clone(),B[R]=O),C=O}return C.visible=x.visible,C.wireframe=x.wireframe,I===Nc?C.side=x.shadowSide!==null?x.shadowSide:x.side:C.side=x.shadowSide!==null?x.shadowSide:h[x.side],C.alphaMap=x.alphaMap,C.alphaTest=x.alphaTest,C.clipShadows=x.clipShadows,C.clippingPlanes=x.clippingPlanes,C.clipIntersection=x.clipIntersection,C.displacementMap=x.displacementMap,C.displacementScale=x.displacementScale,C.displacementBias=x.displacementBias,C.wireframeLinewidth=x.wireframeLinewidth,C.linewidth=x.linewidth,E.isPointLight===!0&&C.isMeshDistanceMaterial===!0&&(C.referencePosition.setFromMatrixPosition(E.matrixWorld),C.nearDistance=T,C.farDistance=S),C}function b(w,x,E,T,S){if(w.visible===!1)return;if(w.layers.test(x.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&S===Nc)&&(!w.frustumCulled||r.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(E.matrixWorldInverse,w.matrixWorld);let M=e.update(w),_=w.material;if(Array.isArray(_)){let R=M.groups;for(let B=0,O=R.length;B<O;B++){let z=R[B],q=_[z.materialIndex];if(q&&q.visible){let F=v(w,q,T,E.near,E.far,S);i.renderBufferDirect(E,null,M,F,w,z)}}}else if(_.visible){let R=v(w,_,T,E.near,E.far,S);i.renderBufferDirect(E,null,M,R,w,null)}}let C=w.children;for(let M=0,_=C.length;M<_;M++)b(C[M],x,E,T,S)}}function tP(i,e,t){let r=t.isWebGL2;function n(){let G=!1,Me=new Qe,Ce=null,Ke=new Qe(0,0,0,0);return{setMask:function(Oe){Ce!==Oe&&!G&&(i.colorMask(Oe,Oe,Oe,Oe),Ce=Oe)},setLocked:function(Oe){G=Oe},setClear:function(Oe,Ze,_e,nt,pt){pt===!0&&(Oe*=nt,Ze*=nt,_e*=nt),Me.set(Oe,Ze,_e,nt),Ke.equals(Me)===!1&&(i.clearColor(Oe,Ze,_e,nt),Ke.copy(Me))},reset:function(){G=!1,Ce=null,Ke.set(-1,0,0,0)}}}function s(){let G=!1,Me=null,Ce=null,Ke=null;return{setTest:function(Oe){Oe?$(2929):j(2929)},setMask:function(Oe){Me!==Oe&&!G&&(i.depthMask(Oe),Me=Oe)},setFunc:function(Oe){if(Ce!==Oe){if(Oe)switch(Oe){case DT:i.depthFunc(512);break;case PT:i.depthFunc(519);break;case IT:i.depthFunc(513);break;case $m:i.depthFunc(515);break;case RT:i.depthFunc(514);break;case BT:i.depthFunc(518);break;case NT:i.depthFunc(516);break;case OT:i.depthFunc(517);break;default:i.depthFunc(515)}else i.depthFunc(515);Ce=Oe}},setLocked:function(Oe){G=Oe},setClear:function(Oe){Ke!==Oe&&(i.clearDepth(Oe),Ke=Oe)},reset:function(){G=!1,Me=null,Ce=null,Ke=null}}}function o(){let G=!1,Me=null,Ce=null,Ke=null,Oe=null,Ze=null,_e=null,nt=null,pt=null;return{setTest:function(ht){G||(ht?$(2960):j(2960))},setMask:function(ht){Me!==ht&&!G&&(i.stencilMask(ht),Me=ht)},setFunc:function(ht,Ot,Nr){(Ce!==ht||Ke!==Ot||Oe!==Nr)&&(i.stencilFunc(ht,Ot,Nr),Ce=ht,Ke=Ot,Oe=Nr)},setOp:function(ht,Ot,Nr){(Ze!==ht||_e!==Ot||nt!==Nr)&&(i.stencilOp(ht,Ot,Nr),Ze=ht,_e=Ot,nt=Nr)},setLocked:function(ht){G=ht},setClear:function(ht){pt!==ht&&(i.clearStencil(ht),pt=ht)},reset:function(){G=!1,Me=null,Ce=null,Ke=null,Oe=null,Ze=null,_e=null,nt=null,pt=null}}}let a=new n,l=new s,c=new o,u={},h={},f=new WeakMap,d=[],m=null,p=!1,g=null,y=null,v=null,b=null,w=null,x=null,E=null,T=!1,S=null,I=null,C=null,M=null,_=null,R=i.getParameter(35661),B=!1,O=0,z=i.getParameter(7938);z.indexOf("WebGL")!==-1?(O=parseFloat(/^WebGL (\d)/.exec(z)[1]),B=O>=1):z.indexOf("OpenGL ES")!==-1&&(O=parseFloat(/^OpenGL ES (\d)/.exec(z)[1]),B=O>=2);let q=null,F={},ee=i.getParameter(3088),k=i.getParameter(2978),V=new Qe().fromArray(ee),U=new Qe().fromArray(k);function J(G,Me,Ce){let Ke=new Uint8Array(4),Oe=i.createTexture();i.bindTexture(G,Oe),i.texParameteri(G,10241,9728),i.texParameteri(G,10240,9728);for(let Ze=0;Ze<Ce;Ze++)i.texImage2D(Me+Ze,0,6408,1,1,0,6408,5121,Ke);return Oe}let K={};K[3553]=J(3553,3553,1),K[34067]=J(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),$(2929),l.setFunc($m),Q(!1),ce(mx),$(2884),Y(kt);function $(G){u[G]!==!0&&(i.enable(G),u[G]=!0)}function j(G){u[G]!==!1&&(i.disable(G),u[G]=!1)}function ge(G,Me){return h[G]!==Me?(i.bindFramebuffer(G,Me),h[G]=Me,r&&(G===36009&&(h[36160]=Me),G===36160&&(h[36009]=Me)),!0):!1}function ae(G,Me){let Ce=d,Ke=!1;if(G)if(Ce=f.get(Me),Ce===void 0&&(Ce=[],f.set(Me,Ce)),G.isWebGLMultipleRenderTargets){let Oe=G.texture;if(Ce.length!==Oe.length||Ce[0]!==36064){for(let Ze=0,_e=Oe.length;Ze<_e;Ze++)Ce[Ze]=36064+Ze;Ce.length=Oe.length,Ke=!0}}else Ce[0]!==36064&&(Ce[0]=36064,Ke=!0);else Ce[0]!==1029&&(Ce[0]=1029,Ke=!0);Ke&&(t.isWebGL2?i.drawBuffers(Ce):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Ce))}function le(G){return m!==G?(i.useProgram(G),m=G,!0):!1}let W={[Ma]:32774,[xT]:32778,[bT]:32779};if(r)W[xx]=32775,W[bx]=32776;else{let G=e.get("EXT_blend_minmax");G!==null&&(W[xx]=G.MIN_EXT,W[bx]=G.MAX_EXT)}let ue={[wT]:0,[ST]:1,[MT]:768,[rb]:770,[LT]:776,[_T]:774,[TT]:772,[AT]:769,[nb]:771,[CT]:775,[ET]:773};function Y(G,Me,Ce,Ke,Oe,Ze,_e,nt){if(G===kt){p===!0&&(j(3042),p=!1);return}if(p===!1&&($(3042),p=!0),G!==vT){if(G!==g||nt!==T){if((y!==Ma||w!==Ma)&&(i.blendEquation(32774),y=Ma,w=Ma),nt)switch(G){case Es:i.blendFuncSeparate(1,771,1,771);break;case gx:i.blendFunc(1,1);break;case yx:i.blendFuncSeparate(0,769,0,1);break;case vx:i.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}else switch(G){case Es:i.blendFuncSeparate(770,771,1,771);break;case gx:i.blendFunc(770,1);break;case yx:i.blendFuncSeparate(0,769,0,1);break;case vx:i.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}v=null,b=null,x=null,E=null,g=G,T=nt}return}Oe=Oe||Me,Ze=Ze||Ce,_e=_e||Ke,(Me!==y||Oe!==w)&&(i.blendEquationSeparate(W[Me],W[Oe]),y=Me,w=Oe),(Ce!==v||Ke!==b||Ze!==x||_e!==E)&&(i.blendFuncSeparate(ue[Ce],ue[Ke],ue[Ze],ue[_e]),v=Ce,b=Ke,x=Ze,E=_e),g=G,T=null}function H(G,Me){G.side===ir?j(2884):$(2884);let Ce=G.side===Cr;Me&&(Ce=!Ce),Q(Ce),G.blending===Es&&G.transparent===!1?Y(kt):Y(G.blending,G.blendEquation,G.blendSrc,G.blendDst,G.blendEquationAlpha,G.blendSrcAlpha,G.blendDstAlpha,G.premultipliedAlpha),l.setFunc(G.depthFunc),l.setTest(G.depthTest),l.setMask(G.depthWrite),a.setMask(G.colorWrite);let Ke=G.stencilWrite;c.setTest(Ke),Ke&&(c.setMask(G.stencilWriteMask),c.setFunc(G.stencilFunc,G.stencilRef,G.stencilFuncMask),c.setOp(G.stencilFail,G.stencilZFail,G.stencilZPass)),pe(G.polygonOffset,G.polygonOffsetFactor,G.polygonOffsetUnits),G.alphaToCoverage===!0?$(32926):j(32926)}function Q(G){S!==G&&(G?i.frontFace(2304):i.frontFace(2305),S=G)}function ce(G){G!==gT?($(2884),G!==I&&(G===mx?i.cullFace(1029):G===yT?i.cullFace(1028):i.cullFace(1032))):j(2884),I=G}function ie(G){G!==C&&(B&&i.lineWidth(G),C=G)}function pe(G,Me,Ce){G?($(32823),(M!==Me||_!==Ce)&&(i.polygonOffset(Me,Ce),M=Me,_=Ce)):j(32823)}function ve(G){G?$(3089):j(3089)}function me(G){G===void 0&&(G=33984+R-1),q!==G&&(i.activeTexture(G),q=G)}function De(G,Me){q===null&&me();let Ce=F[q];Ce===void 0&&(Ce={type:void 0,texture:void 0},F[q]=Ce),(Ce.type!==G||Ce.texture!==Me)&&(i.bindTexture(G,Me||K[G]),Ce.type=G,Ce.texture=Me)}function ke(){let G=F[q];G!==void 0&&G.type!==void 0&&(i.bindTexture(G.type,null),G.type=void 0,G.texture=void 0)}function P(){try{i.compressedTexImage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function L(){try{i.texSubImage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function te(){try{i.texSubImage3D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function ye(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Se(){try{i.texStorage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Pe(){try{i.texStorage3D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Fe(){try{i.texImage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function he(){try{i.texImage3D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function rt(G){V.equals(G)===!1&&(i.scissor(G.x,G.y,G.z,G.w),V.copy(G))}function st(G){U.equals(G)===!1&&(i.viewport(G.x,G.y,G.z,G.w),U.copy(G))}function Ae(){i.disable(3042),i.disable(2884),i.disable(2929),i.disable(32823),i.disable(3089),i.disable(2960),i.disable(32926),i.blendEquation(32774),i.blendFunc(1,0),i.blendFuncSeparate(1,0,1,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(513),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(519,0,4294967295),i.stencilOp(7680,7680,7680),i.clearStencil(0),i.cullFace(1029),i.frontFace(2305),i.polygonOffset(0,0),i.activeTexture(33984),i.bindFramebuffer(36160,null),r===!0&&(i.bindFramebuffer(36009,null),i.bindFramebuffer(36008,null)),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),u={},q=null,F={},h={},f=new WeakMap,d=[],m=null,p=!1,g=null,y=null,v=null,b=null,w=null,x=null,E=null,T=!1,S=null,I=null,C=null,M=null,_=null,V.set(0,0,i.canvas.width,i.canvas.height),U.set(0,0,i.canvas.width,i.canvas.height),a.reset(),l.reset(),c.reset()}return{buffers:{color:a,depth:l,stencil:c},enable:$,disable:j,bindFramebuffer:ge,drawBuffers:ae,useProgram:le,setBlending:Y,setMaterial:H,setFlipSided:Q,setCullFace:ce,setLineWidth:ie,setPolygonOffset:pe,setScissorTest:ve,activeTexture:me,bindTexture:De,unbindTexture:ke,compressedTexImage2D:P,texImage2D:Fe,texImage3D:he,texStorage2D:Se,texStorage3D:Pe,texSubImage2D:L,texSubImage3D:te,compressedTexSubImage2D:ye,scissor:rt,viewport:st,reset:Ae}}function rP(i,e,t,r,n,s,o){let a=n.isWebGL2,l=n.maxTextures,c=n.maxCubemapSize,u=n.maxTextureSize,h=n.maxSamples,f=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,d=/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap,p,g=new WeakMap,y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(P,L){return y?new OffscreenCanvas(P,L):jc("canvas")}function b(P,L,te,ye){let Se=1;if((P.width>ye||P.height>ye)&&(Se=ye/Math.max(P.width,P.height)),Se<1||L===!0)if(typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&P instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&P instanceof ImageBitmap){let Pe=L?df:Math.floor,Fe=Pe(Se*P.width),he=Pe(Se*P.height);p===void 0&&(p=v(Fe,he));let rt=te?v(Fe,he):p;return rt.width=Fe,rt.height=he,rt.getContext("2d").drawImage(P,0,0,Fe,he),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+P.width+"x"+P.height+") to ("+Fe+"x"+he+")."),rt}else return"data"in P&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+P.width+"x"+P.height+")."),P;return P}function w(P){return ig(P.width)&&ig(P.height)}function x(P){return a?!1:P.wrapS!==_r||P.wrapT!==_r||P.minFilter!==lr&&P.minFilter!==ct}function E(P,L){return P.generateMipmaps&&L&&P.minFilter!==lr&&P.minFilter!==ct}function T(P){i.generateMipmap(P)}function S(P,L,te,ye,Se=!1){if(a===!1)return L;if(P!==null){if(i[P]!==void 0)return i[P];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let Pe=L;return L===6403&&(te===5126&&(Pe=33326),te===5131&&(Pe=33325),te===5121&&(Pe=33321)),L===33319&&(te===5126&&(Pe=33328),te===5131&&(Pe=33327),te===5121&&(Pe=33323)),L===6408&&(te===5126&&(Pe=34836),te===5131&&(Pe=34842),te===5121&&(Pe=ye===je&&Se===!1?35907:32856),te===32819&&(Pe=32854),te===32820&&(Pe=32855)),(Pe===33325||Pe===33326||Pe===33327||Pe===33328||Pe===34842||Pe===34836)&&e.get("EXT_color_buffer_float"),Pe}function I(P,L,te){return E(P,te)===!0||P.isFramebufferTexture&&P.minFilter!==lr&&P.minFilter!==ct?Math.log2(Math.max(L.width,L.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?L.mipmaps.length:1}function C(P){return P===lr||P===wx||P===Sx?9728:9729}function M(P){let L=P.target;L.removeEventListener("dispose",M),R(L),L.isVideoTexture&&m.delete(L)}function _(P){let L=P.target;L.removeEventListener("dispose",_),O(L)}function R(P){let L=r.get(P);if(L.__webglInit===void 0)return;let te=P.source,ye=g.get(te);if(ye){let Se=ye[L.__cacheKey];Se.usedTimes--,Se.usedTimes===0&&B(P),Object.keys(ye).length===0&&g.delete(te)}r.remove(P)}function B(P){let L=r.get(P);i.deleteTexture(L.__webglTexture);let te=P.source,ye=g.get(te);delete ye[L.__cacheKey],o.memory.textures--}function O(P){let L=P.texture,te=r.get(P),ye=r.get(L);if(ye.__webglTexture!==void 0&&(i.deleteTexture(ye.__webglTexture),o.memory.textures--),P.depthTexture&&P.depthTexture.dispose(),P.isWebGLCubeRenderTarget)for(let Se=0;Se<6;Se++)i.deleteFramebuffer(te.__webglFramebuffer[Se]),te.__webglDepthbuffer&&i.deleteRenderbuffer(te.__webglDepthbuffer[Se]);else i.deleteFramebuffer(te.__webglFramebuffer),te.__webglDepthbuffer&&i.deleteRenderbuffer(te.__webglDepthbuffer),te.__webglMultisampledFramebuffer&&i.deleteFramebuffer(te.__webglMultisampledFramebuffer),te.__webglColorRenderbuffer&&i.deleteRenderbuffer(te.__webglColorRenderbuffer),te.__webglDepthRenderbuffer&&i.deleteRenderbuffer(te.__webglDepthRenderbuffer);if(P.isWebGLMultipleRenderTargets)for(let Se=0,Pe=L.length;Se<Pe;Se++){let Fe=r.get(L[Se]);Fe.__webglTexture&&(i.deleteTexture(Fe.__webglTexture),o.memory.textures--),r.remove(L[Se])}r.remove(L),r.remove(P)}let z=0;function q(){z=0}function F(){let P=z;return P>=l&&console.warn("THREE.WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+l),z+=1,P}function ee(P){let L=[];return L.push(P.wrapS),L.push(P.wrapT),L.push(P.magFilter),L.push(P.minFilter),L.push(P.anisotropy),L.push(P.internalFormat),L.push(P.format),L.push(P.type),L.push(P.generateMipmaps),L.push(P.premultiplyAlpha),L.push(P.flipY),L.push(P.unpackAlignment),L.push(P.encoding),L.join()}function k(P,L){let te=r.get(P);if(P.isVideoTexture&&De(P),P.isRenderTargetTexture===!1&&P.version>0&&te.__version!==P.version){let ye=P.image;if(ye===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ye.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ae(te,P,L);return}}t.activeTexture(33984+L),t.bindTexture(3553,te.__webglTexture)}function V(P,L){let te=r.get(P);if(P.version>0&&te.__version!==P.version){ae(te,P,L);return}t.activeTexture(33984+L),t.bindTexture(35866,te.__webglTexture)}function U(P,L){let te=r.get(P);if(P.version>0&&te.__version!==P.version){ae(te,P,L);return}t.activeTexture(33984+L),t.bindTexture(32879,te.__webglTexture)}function J(P,L){let te=r.get(P);if(P.version>0&&te.__version!==P.version){le(te,P,L);return}t.activeTexture(33984+L),t.bindTexture(34067,te.__webglTexture)}let K={[Da]:10497,[_r]:33071,[rg]:33648},$={[lr]:9728,[wx]:9984,[Sx]:9986,[ct]:9729,[WT]:9985,[ks]:9987};function j(P,L,te){if(te?(i.texParameteri(P,10242,K[L.wrapS]),i.texParameteri(P,10243,K[L.wrapT]),(P===32879||P===35866)&&i.texParameteri(P,32882,K[L.wrapR]),i.texParameteri(P,10240,$[L.magFilter]),i.texParameteri(P,10241,$[L.minFilter])):(i.texParameteri(P,10242,33071),i.texParameteri(P,10243,33071),(P===32879||P===35866)&&i.texParameteri(P,32882,33071),(L.wrapS!==_r||L.wrapT!==_r)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),i.texParameteri(P,10240,C(L.magFilter)),i.texParameteri(P,10241,C(L.minFilter)),L.minFilter!==lr&&L.minFilter!==ct&&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 ye=e.get("EXT_texture_filter_anisotropic");if(L.type===Ts&&e.has("OES_texture_float_linear")===!1||a===!1&&L.type===La&&e.has("OES_texture_half_float_linear")===!1)return;(L.anisotropy>1||r.get(L).__currentAnisotropy)&&(i.texParameterf(P,ye.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,n.getMaxAnisotropy())),r.get(L).__currentAnisotropy=L.anisotropy)}}function ge(P,L){let te=!1;P.__webglInit===void 0&&(P.__webglInit=!0,L.addEventListener("dispose",M));let ye=L.source,Se=g.get(ye);Se===void 0&&(Se={},g.set(ye,Se));let Pe=ee(L);if(Pe!==P.__cacheKey){Se[Pe]===void 0&&(Se[Pe]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,te=!0),Se[Pe].usedTimes++;let Fe=Se[P.__cacheKey];Fe!==void 0&&(Se[P.__cacheKey].usedTimes--,Fe.usedTimes===0&&B(L)),P.__cacheKey=Pe,P.__webglTexture=Se[Pe].texture}return te}function ae(P,L,te){let ye=3553;L.isDataArrayTexture&&(ye=35866),L.isData3DTexture&&(ye=32879);let Se=ge(P,L),Pe=L.source;if(t.activeTexture(33984+te),t.bindTexture(ye,P.__webglTexture),Pe.version!==Pe.__currentVersion||Se===!0){i.pixelStorei(37440,L.flipY),i.pixelStorei(37441,L.premultiplyAlpha),i.pixelStorei(3317,L.unpackAlignment),i.pixelStorei(37443,0);let Fe=x(L)&&w(L.image)===!1,he=b(L.image,Fe,!1,u);he=ke(L,he);let rt=w(he)||a,st=s.convert(L.format,L.encoding),Ae=s.convert(L.type),G=S(L.internalFormat,st,Ae,L.encoding,L.isVideoTexture);j(ye,L,rt);let Me,Ce=L.mipmaps,Ke=a&&L.isVideoTexture!==!0,Oe=P.__version===void 0,Ze=I(L,he,rt);if(L.isDepthTexture)G=6402,a?L.type===Ts?G=36012:L.type===Ca?G=33190:L.type===_s?G=35056:G=33189:L.type===Ts&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===Ao&&G===6402&&L.type!==Vc&&L.type!==Ca&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=Vc,Ae=s.convert(L.type)),L.format===Ps&&G===6402&&(G=34041,L.type!==_s&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=_s,Ae=s.convert(L.type))),Ke&&Oe?t.texStorage2D(3553,1,G,he.width,he.height):t.texImage2D(3553,0,G,he.width,he.height,0,st,Ae,null);else if(L.isDataTexture)if(Ce.length>0&&rt){Ke&&Oe&&t.texStorage2D(3553,Ze,G,Ce[0].width,Ce[0].height);for(let _e=0,nt=Ce.length;_e<nt;_e++)Me=Ce[_e],Ke?t.texSubImage2D(3553,_e,0,0,Me.width,Me.height,st,Ae,Me.data):t.texImage2D(3553,_e,G,Me.width,Me.height,0,st,Ae,Me.data);L.generateMipmaps=!1}else Ke?(Oe&&t.texStorage2D(3553,Ze,G,he.width,he.height),t.texSubImage2D(3553,0,0,0,he.width,he.height,st,Ae,he.data)):t.texImage2D(3553,0,G,he.width,he.height,0,st,Ae,he.data);else if(L.isCompressedTexture){Ke&&Oe&&t.texStorage2D(3553,Ze,G,Ce[0].width,Ce[0].height);for(let _e=0,nt=Ce.length;_e<nt;_e++)Me=Ce[_e],L.format!==On?st!==null?Ke?t.compressedTexSubImage2D(3553,_e,0,0,Me.width,Me.height,st,Me.data):t.compressedTexImage2D(3553,_e,G,Me.width,Me.height,0,Me.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ke?t.texSubImage2D(3553,_e,0,0,Me.width,Me.height,st,Ae,Me.data):t.texImage2D(3553,_e,G,Me.width,Me.height,0,st,Ae,Me.data)}else if(L.isDataArrayTexture)Ke?(Oe&&t.texStorage3D(35866,Ze,G,he.width,he.height,he.depth),t.texSubImage3D(35866,0,0,0,0,he.width,he.height,he.depth,st,Ae,he.data)):t.texImage3D(35866,0,G,he.width,he.height,he.depth,0,st,Ae,he.data);else if(L.isData3DTexture)Ke?(Oe&&t.texStorage3D(32879,Ze,G,he.width,he.height,he.depth),t.texSubImage3D(32879,0,0,0,0,he.width,he.height,he.depth,st,Ae,he.data)):t.texImage3D(32879,0,G,he.width,he.height,he.depth,0,st,Ae,he.data);else if(L.isFramebufferTexture)Ke&&Oe?t.texStorage2D(3553,Ze,G,he.width,he.height):t.texImage2D(3553,0,G,he.width,he.height,0,st,Ae,null);else if(Ce.length>0&&rt){Ke&&Oe&&t.texStorage2D(3553,Ze,G,Ce[0].width,Ce[0].height);for(let _e=0,nt=Ce.length;_e<nt;_e++)Me=Ce[_e],Ke?t.texSubImage2D(3553,_e,0,0,st,Ae,Me):t.texImage2D(3553,_e,G,st,Ae,Me);L.generateMipmaps=!1}else Ke?(Oe&&t.texStorage2D(3553,Ze,G,he.width,he.height),t.texSubImage2D(3553,0,0,0,st,Ae,he)):t.texImage2D(3553,0,G,st,Ae,he);E(L,rt)&&T(ye),Pe.__currentVersion=Pe.version,L.onUpdate&&L.onUpdate(L)}P.__version=L.version}function le(P,L,te){if(L.image.length!==6)return;let ye=ge(P,L),Se=L.source;if(t.activeTexture(33984+te),t.bindTexture(34067,P.__webglTexture),Se.version!==Se.__currentVersion||ye===!0){i.pixelStorei(37440,L.flipY),i.pixelStorei(37441,L.premultiplyAlpha),i.pixelStorei(3317,L.unpackAlignment),i.pixelStorei(37443,0);let Pe=L.isCompressedTexture||L.image[0].isCompressedTexture,Fe=L.image[0]&&L.image[0].isDataTexture,he=[];for(let _e=0;_e<6;_e++)!Pe&&!Fe?he[_e]=b(L.image[_e],!1,!0,c):he[_e]=Fe?L.image[_e].image:L.image[_e],he[_e]=ke(L,he[_e]);let rt=he[0],st=w(rt)||a,Ae=s.convert(L.format,L.encoding),G=s.convert(L.type),Me=S(L.internalFormat,Ae,G,L.encoding),Ce=a&&L.isVideoTexture!==!0,Ke=P.__version===void 0,Oe=I(L,rt,st);j(34067,L,st);let Ze;if(Pe){Ce&&Ke&&t.texStorage2D(34067,Oe,Me,rt.width,rt.height);for(let _e=0;_e<6;_e++){Ze=he[_e].mipmaps;for(let nt=0;nt<Ze.length;nt++){let pt=Ze[nt];L.format!==On?Ae!==null?Ce?t.compressedTexSubImage2D(34069+_e,nt,0,0,pt.width,pt.height,Ae,pt.data):t.compressedTexImage2D(34069+_e,nt,Me,pt.width,pt.height,0,pt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ce?t.texSubImage2D(34069+_e,nt,0,0,pt.width,pt.height,Ae,G,pt.data):t.texImage2D(34069+_e,nt,Me,pt.width,pt.height,0,Ae,G,pt.data)}}}else{Ze=L.mipmaps,Ce&&Ke&&(Ze.length>0&&Oe++,t.texStorage2D(34067,Oe,Me,he[0].width,he[0].height));for(let _e=0;_e<6;_e++)if(Fe){Ce?t.texSubImage2D(34069+_e,0,0,0,he[_e].width,he[_e].height,Ae,G,he[_e].data):t.texImage2D(34069+_e,0,Me,he[_e].width,he[_e].height,0,Ae,G,he[_e].data);for(let nt=0;nt<Ze.length;nt++){let ht=Ze[nt].image[_e].image;Ce?t.texSubImage2D(34069+_e,nt+1,0,0,ht.width,ht.height,Ae,G,ht.data):t.texImage2D(34069+_e,nt+1,Me,ht.width,ht.height,0,Ae,G,ht.data)}}else{Ce?t.texSubImage2D(34069+_e,0,0,0,Ae,G,he[_e]):t.texImage2D(34069+_e,0,Me,Ae,G,he[_e]);for(let nt=0;nt<Ze.length;nt++){let pt=Ze[nt];Ce?t.texSubImage2D(34069+_e,nt+1,0,0,Ae,G,pt.image[_e]):t.texImage2D(34069+_e,nt+1,Me,Ae,G,pt.image[_e])}}}E(L,st)&&T(34067),Se.__currentVersion=Se.version,L.onUpdate&&L.onUpdate(L)}P.__version=L.version}function W(P,L,te,ye,Se){let Pe=s.convert(te.format,te.encoding),Fe=s.convert(te.type),he=S(te.internalFormat,Pe,Fe,te.encoding);r.get(L).__hasExternalTextures||(Se===32879||Se===35866?t.texImage3D(Se,0,he,L.width,L.height,L.depth,0,Pe,Fe,null):t.texImage2D(Se,0,he,L.width,L.height,0,Pe,Fe,null)),t.bindFramebuffer(36160,P),me(L)?f.framebufferTexture2DMultisampleEXT(36160,ye,Se,r.get(te).__webglTexture,0,ve(L)):i.framebufferTexture2D(36160,ye,Se,r.get(te).__webglTexture,0),t.bindFramebuffer(36160,null)}function ue(P,L,te){if(i.bindRenderbuffer(36161,P),L.depthBuffer&&!L.stencilBuffer){let ye=33189;if(te||me(L)){let Se=L.depthTexture;Se&&Se.isDepthTexture&&(Se.type===Ts?ye=36012:Se.type===Ca&&(ye=33190));let Pe=ve(L);me(L)?f.renderbufferStorageMultisampleEXT(36161,Pe,ye,L.width,L.height):i.renderbufferStorageMultisample(36161,Pe,ye,L.width,L.height)}else i.renderbufferStorage(36161,ye,L.width,L.height);i.framebufferRenderbuffer(36160,36096,36161,P)}else if(L.depthBuffer&&L.stencilBuffer){let ye=ve(L);te&&me(L)===!1?i.renderbufferStorageMultisample(36161,ye,35056,L.width,L.height):me(L)?f.renderbufferStorageMultisampleEXT(36161,ye,35056,L.width,L.height):i.renderbufferStorage(36161,34041,L.width,L.height),i.framebufferRenderbuffer(36160,33306,36161,P)}else{let ye=L.isWebGLMultipleRenderTargets===!0?L.texture[0]:L.texture,Se=s.convert(ye.format,ye.encoding),Pe=s.convert(ye.type),Fe=S(ye.internalFormat,Se,Pe,ye.encoding),he=ve(L);te&&me(L)===!1?i.renderbufferStorageMultisample(36161,he,Fe,L.width,L.height):me(L)?f.renderbufferStorageMultisampleEXT(36161,he,Fe,L.width,L.height):i.renderbufferStorage(36161,Fe,L.width,L.height)}i.bindRenderbuffer(36161,null)}function Y(P,L){if(L&&L.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,P),!(L.depthTexture&&L.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(L.depthTexture).__webglTexture||L.depthTexture.image.width!==L.width||L.depthTexture.image.height!==L.height)&&(L.depthTexture.image.width=L.width,L.depthTexture.image.height=L.height,L.depthTexture.needsUpdate=!0),k(L.depthTexture,0);let ye=r.get(L.depthTexture).__webglTexture,Se=ve(L);if(L.depthTexture.format===Ao)me(L)?f.framebufferTexture2DMultisampleEXT(36160,36096,3553,ye,0,Se):i.framebufferTexture2D(36160,36096,3553,ye,0);else if(L.depthTexture.format===Ps)me(L)?f.framebufferTexture2DMultisampleEXT(36160,33306,3553,ye,0,Se):i.framebufferTexture2D(36160,33306,3553,ye,0);else throw new Error("Unknown depthTexture format")}function H(P){let L=r.get(P),te=P.isWebGLCubeRenderTarget===!0;if(P.depthTexture&&!L.__autoAllocateDepthBuffer){if(te)throw new Error("target.depthTexture not supported in Cube render targets");Y(L.__webglFramebuffer,P)}else if(te){L.__webglDepthbuffer=[];for(let ye=0;ye<6;ye++)t.bindFramebuffer(36160,L.__webglFramebuffer[ye]),L.__webglDepthbuffer[ye]=i.createRenderbuffer(),ue(L.__webglDepthbuffer[ye],P,!1)}else t.bindFramebuffer(36160,L.__webglFramebuffer),L.__webglDepthbuffer=i.createRenderbuffer(),ue(L.__webglDepthbuffer,P,!1);t.bindFramebuffer(36160,null)}function Q(P,L,te){let ye=r.get(P);L!==void 0&&W(ye.__webglFramebuffer,P,P.texture,36064,3553),te!==void 0&&H(P)}function ce(P){let L=P.texture,te=r.get(P),ye=r.get(L);P.addEventListener("dispose",_),P.isWebGLMultipleRenderTargets!==!0&&(ye.__webglTexture===void 0&&(ye.__webglTexture=i.createTexture()),ye.__version=L.version,o.memory.textures++);let Se=P.isWebGLCubeRenderTarget===!0,Pe=P.isWebGLMultipleRenderTargets===!0,Fe=w(P)||a;if(Se){te.__webglFramebuffer=[];for(let he=0;he<6;he++)te.__webglFramebuffer[he]=i.createFramebuffer()}else if(te.__webglFramebuffer=i.createFramebuffer(),Pe)if(n.drawBuffers){let he=P.texture;for(let rt=0,st=he.length;rt<st;rt++){let Ae=r.get(he[rt]);Ae.__webglTexture===void 0&&(Ae.__webglTexture=i.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(a&&P.samples>0&&me(P)===!1){te.__webglMultisampledFramebuffer=i.createFramebuffer(),te.__webglColorRenderbuffer=i.createRenderbuffer(),i.bindRenderbuffer(36161,te.__webglColorRenderbuffer);let he=s.convert(L.format,L.encoding),rt=s.convert(L.type),st=S(L.internalFormat,he,rt,L.encoding),Ae=ve(P);i.renderbufferStorageMultisample(36161,Ae,st,P.width,P.height),t.bindFramebuffer(36160,te.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(36160,36064,36161,te.__webglColorRenderbuffer),i.bindRenderbuffer(36161,null),P.depthBuffer&&(te.__webglDepthRenderbuffer=i.createRenderbuffer(),ue(te.__webglDepthRenderbuffer,P,!0)),t.bindFramebuffer(36160,null)}if(Se){t.bindTexture(34067,ye.__webglTexture),j(34067,L,Fe);for(let he=0;he<6;he++)W(te.__webglFramebuffer[he],P,L,36064,34069+he);E(L,Fe)&&T(34067),t.unbindTexture()}else if(Pe){let he=P.texture;for(let rt=0,st=he.length;rt<st;rt++){let Ae=he[rt],G=r.get(Ae);t.bindTexture(3553,G.__webglTexture),j(3553,Ae,Fe),W(te.__webglFramebuffer,P,Ae,36064+rt,3553),E(Ae,Fe)&&T(3553)}t.unbindTexture()}else{let he=3553;(P.isWebGL3DRenderTarget||P.isWebGLArrayRenderTarget)&&(a?he=P.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(he,ye.__webglTexture),j(he,L,Fe),W(te.__webglFramebuffer,P,L,36064,he),E(L,Fe)&&T(he),t.unbindTexture()}P.depthBuffer&&H(P)}function ie(P){let L=w(P)||a,te=P.isWebGLMultipleRenderTargets===!0?P.texture:[P.texture];for(let ye=0,Se=te.length;ye<Se;ye++){let Pe=te[ye];if(E(Pe,L)){let Fe=P.isWebGLCubeRenderTarget?34067:3553,he=r.get(Pe).__webglTexture;t.bindTexture(Fe,he),T(Fe),t.unbindTexture()}}}function pe(P){if(a&&P.samples>0&&me(P)===!1){let L=P.width,te=P.height,ye=16384,Se=[36064],Pe=P.stencilBuffer?33306:36096;P.depthBuffer&&Se.push(Pe);let Fe=r.get(P),he=Fe.__ignoreDepthValues!==void 0?Fe.__ignoreDepthValues:!1;he===!1&&(P.depthBuffer&&(ye|=256),P.stencilBuffer&&(ye|=1024)),t.bindFramebuffer(36008,Fe.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,Fe.__webglFramebuffer),he===!0&&(i.invalidateFramebuffer(36008,[Pe]),i.invalidateFramebuffer(36009,[Pe])),i.blitFramebuffer(0,0,L,te,0,0,L,te,ye,9728),d&&i.invalidateFramebuffer(36008,Se),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,Fe.__webglMultisampledFramebuffer)}}function ve(P){return Math.min(h,P.samples)}function me(P){let L=r.get(P);return a&&P.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function De(P){let L=o.render.frame;m.get(P)!==L&&(m.set(P,L),P.update())}function ke(P,L){let te=P.encoding,ye=P.format,Se=P.type;return P.isCompressedTexture===!0||P.isVideoTexture===!0||P.format===ng||te!==rn&&(te===je?a===!1?e.has("EXT_sRGB")===!0&&ye===On?(P.format=ng,P.minFilter=ct,P.generateMipmaps=!1):L=es.sRGBToLinear(L):(ye!==On||Se!==Wt)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",te)),L}this.allocateTextureUnit=F,this.resetTextureUnits=q,this.setTexture2D=k,this.setTexture2DArray=V,this.setTexture3D=U,this.setTextureCube=J,this.rebindTextures=Q,this.setupRenderTarget=ce,this.updateRenderTargetMipmap=ie,this.updateMultisampleRenderTarget=pe,this.setupDepthRenderbuffer=H,this.setupFrameBufferTexture=W,this.useMultisampledRTT=me}function nP(i,e,t){let r=t.isWebGL2;function n(s,o=null){let a;if(s===Wt)return 5121;if(s===YT)return 32819;if(s===JT)return 32820;if(s===jT)return 5120;if(s===qT)return 5122;if(s===Vc)return 5123;if(s===XT)return 5124;if(s===Ca)return 5125;if(s===Ts)return 5126;if(s===La)return r?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===QT)return 6406;if(s===On)return 6408;if(s===ZT)return 6409;if(s===$T)return 6410;if(s===Ao)return 6402;if(s===Ps)return 34041;if(s===eE)return 6403;if(s===KT)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(s===ng)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===tE)return 36244;if(s===rE)return 33319;if(s===nE)return 33320;if(s===iE)return 36249;if(s===mm||s===gm||s===ym||s===vm)if(o===je)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===mm)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===gm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===ym)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===vm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===mm)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===gm)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===ym)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===vm)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Mx||s===Ax||s===Tx||s===Ex)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===Mx)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Ax)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Tx)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Ex)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===sE)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===_x||s===Cx)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===_x)return o===je?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Cx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Lx||s===Dx||s===Px||s===Ix||s===Rx||s===Bx||s===Nx||s===Ox||s===Fx||s===Ux||s===zx||s===Gx||s===kx||s===Vx)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Lx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Dx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Px)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Ix)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Rx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Bx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Nx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Ox)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Fx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Ux)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===zx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Gx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===kx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===Vx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Hx)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===Hx)return o===je?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===_s)return r?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:n}}var vf=class extends nr{constructor(e=[]){super(),this.cameras=e}};vf.prototype.isArrayCamera=!0;var Zi=class extends ot{constructor(){super(),this.type="Group"}};Zi.prototype.isGroup=!0;var iP={type:"move"},zc=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Zi,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 Zi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new A,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new A),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Zi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new A,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new A),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,r){let n=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(n=t.getPose(e.targetRaySpace,r),n!==null&&(a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),n.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(n.linearVelocity)):a.hasLinearVelocity=!1,n.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(n.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(iP))),c&&e.hand){o=!0;for(let p of e.hand.values()){let g=t.getJointPose(p,r);if(c.joints[p.jointName]===void 0){let v=new Zi;v.matrixAutoUpdate=!1,v.visible=!1,c.joints[p.jointName]=v,c.add(v)}let y=c.joints[p.jointName];g!==null&&(y.matrix.fromArray(g.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.jointRadius=g.radius),y.visible=g!==null}let u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),d=.02,m=.005;c.inputState.pinching&&f>d+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),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=n!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}},oi=class extends _t{constructor(e,t,r,n,s,o,a,l,c,u){if(u=u!==void 0?u:Ao,u!==Ao&&u!==Ps)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&u===Ao&&(r=Vc),r===void 0&&u===Ps&&(r=_s),super(null,n,s,o,a,l,u,r,c),this.image={width:e,height:t},this.magFilter=a!==void 0?a:lr,this.minFilter=l!==void 0?l:lr,this.flipY=!1,this.generateMipmaps=!1}};oi.prototype.isDepthTexture=!0;var fg=class extends jt{constructor(e,t){super();let r=this,n=null,s=1,o=null,a="local-floor",l=null,c=null,u=null,h=null,f=null,d=t.getContextAttributes(),m=null,p=null,g=[],y=new Map,v=new nr;v.layers.enable(1),v.viewport=new Qe;let b=new nr;b.layers.enable(2),b.viewport=new Qe;let w=[v,b],x=new vf;x.layers.enable(1),x.layers.enable(2);let E=null,T=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(F){let ee=g[F];return ee===void 0&&(ee=new zc,g[F]=ee),ee.getTargetRaySpace()},this.getControllerGrip=function(F){let ee=g[F];return ee===void 0&&(ee=new zc,g[F]=ee),ee.getGripSpace()},this.getHand=function(F){let ee=g[F];return ee===void 0&&(ee=new zc,g[F]=ee),ee.getHandSpace()};function S(F){let ee=y.get(F.inputSource);ee&&ee.dispatchEvent({type:F.type,data:F.inputSource})}function I(){y.forEach(function(F,ee){F.disconnect(ee)}),y.clear(),E=null,T=null,e.setRenderTarget(m),h=null,u=null,c=null,n=null,p=null,q.stop(),r.isPresenting=!1,r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(F){s=F,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(F){a=F,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o},this.getBaseLayer=function(){return u!==null?u:h},this.getBinding=function(){return c},this.getFrame=function(){return f},this.getSession=function(){return n},this.setSession=async function(F){if(n=F,n!==null){if(m=e.getRenderTarget(),n.addEventListener("select",S),n.addEventListener("selectstart",S),n.addEventListener("selectend",S),n.addEventListener("squeeze",S),n.addEventListener("squeezestart",S),n.addEventListener("squeezeend",S),n.addEventListener("end",I),n.addEventListener("inputsourceschange",C),d.xrCompatible!==!0&&await t.makeXRCompatible(),n.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let ee={antialias:n.renderState.layers===void 0?d.antialias:!0,alpha:d.alpha,depth:d.depth,stencil:d.stencil,framebufferScaleFactor:s};h=new XRWebGLLayer(n,t,ee),n.updateRenderState({baseLayer:h}),p=new mt(h.framebufferWidth,h.framebufferHeight,{format:On,type:Wt,encoding:e.outputEncoding})}else{let ee=null,k=null,V=null;d.depth&&(V=d.stencil?35056:33190,ee=d.stencil?Ps:Ao,k=d.stencil?_s:Vc);let U={colorFormat:e.outputEncoding===je?35907:32856,depthFormat:V,scaleFactor:s};c=new XRWebGLBinding(n,t),u=c.createProjectionLayer(U),n.updateRenderState({layers:[u]}),p=new mt(u.textureWidth,u.textureHeight,{format:On,type:Wt,depthTexture:new oi(u.textureWidth,u.textureHeight,k,void 0,void 0,void 0,void 0,void 0,void 0,ee),stencilBuffer:d.stencil,encoding:e.outputEncoding,samples:d.antialias?4:0});let J=e.properties.get(p);J.__ignoreDepthValues=u.ignoreDepthValues}p.isXRRenderTarget=!0,this.setFoveation(1),o=await n.requestReferenceSpace(a),q.setContext(n),q.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}};function C(F){let ee=n.inputSources;for(let k=0;k<g.length;k++)y.set(ee[k],g[k]);for(let k=0;k<F.removed.length;k++){let V=F.removed[k],U=y.get(V);U&&(U.dispatchEvent({type:"disconnected",data:V}),y.delete(V))}for(let k=0;k<F.added.length;k++){let V=F.added[k],U=y.get(V);U&&U.dispatchEvent({type:"connected",data:V})}}let M=new A,_=new A;function R(F,ee,k){M.setFromMatrixPosition(ee.matrixWorld),_.setFromMatrixPosition(k.matrixWorld);let V=M.distanceTo(_),U=ee.projectionMatrix.elements,J=k.projectionMatrix.elements,K=U[14]/(U[10]-1),$=U[14]/(U[10]+1),j=(U[9]+1)/U[5],ge=(U[9]-1)/U[5],ae=(U[8]-1)/U[0],le=(J[8]+1)/J[0],W=K*ae,ue=K*le,Y=V/(-ae+le),H=Y*-ae;ee.matrixWorld.decompose(F.position,F.quaternion,F.scale),F.translateX(H),F.translateZ(Y),F.matrixWorld.compose(F.position,F.quaternion,F.scale),F.matrixWorldInverse.copy(F.matrixWorld).invert();let Q=K+Y,ce=$+Y,ie=W-H,pe=ue+(V-H),ve=j*$/ce*Q,me=ge*$/ce*Q;F.projectionMatrix.makePerspective(ie,pe,ve,me,Q,ce)}function B(F,ee){ee===null?F.matrixWorld.copy(F.matrix):F.matrixWorld.multiplyMatrices(ee.matrixWorld,F.matrix),F.matrixWorldInverse.copy(F.matrixWorld).invert()}this.updateCamera=function(F){if(n===null)return;x.near=b.near=v.near=F.near,x.far=b.far=v.far=F.far,(E!==x.near||T!==x.far)&&(n.updateRenderState({depthNear:x.near,depthFar:x.far}),E=x.near,T=x.far);let ee=F.parent,k=x.cameras;B(x,ee);for(let U=0;U<k.length;U++)B(k[U],ee);x.matrixWorld.decompose(x.position,x.quaternion,x.scale),F.position.copy(x.position),F.quaternion.copy(x.quaternion),F.scale.copy(x.scale),F.matrix.copy(x.matrix),F.matrixWorld.copy(x.matrixWorld);let V=F.children;for(let U=0,J=V.length;U<J;U++)V[U].updateMatrixWorld(!0);k.length===2?R(x,v,b):x.projectionMatrix.copy(v.projectionMatrix)},this.getCamera=function(){return x},this.getFoveation=function(){if(u!==null)return u.fixedFoveation;if(h!==null)return h.fixedFoveation},this.setFoveation=function(F){u!==null&&(u.fixedFoveation=F),h!==null&&h.fixedFoveation!==void 0&&(h.fixedFoveation=F)};let O=null;function z(F,ee){if(l=ee.getViewerPose(o),f=ee,l!==null){let V=l.views;h!==null&&(e.setRenderTargetFramebuffer(p,h.framebuffer),e.setRenderTarget(p));let U=!1;V.length!==x.cameras.length&&(x.cameras.length=0,U=!0);for(let J=0;J<V.length;J++){let K=V[J],$=null;if(h!==null)$=h.getViewport(K);else{let ge=c.getViewSubImage(u,K);$=ge.viewport,J===0&&(e.setRenderTargetTextures(p,ge.colorTexture,u.ignoreDepthValues?void 0:ge.depthStencilTexture),e.setRenderTarget(p))}let j=w[J];j.matrix.fromArray(K.transform.matrix),j.projectionMatrix.fromArray(K.projectionMatrix),j.viewport.set($.x,$.y,$.width,$.height),J===0&&x.matrix.copy(j.matrix),U===!0&&x.cameras.push(j)}}let k=n.inputSources;for(let V=0;V<g.length;V++){let U=g[V],J=k[V];U.update(J,ee,o)}O&&O(F,ee),f=null}let q=new cb;q.setAnimationLoop(z),this.setAnimationLoop=function(F){O=F},this.dispose=function(){}}};function sP(i,e){function t(p,g){p.fogColor.value.copy(g.color),g.isFog?(p.fogNear.value=g.near,p.fogFar.value=g.far):g.isFogExp2&&(p.fogDensity.value=g.density)}function r(p,g,y,v,b){g.isMeshBasicMaterial||g.isMeshLambertMaterial?n(p,g):g.isMeshToonMaterial?(n(p,g),u(p,g)):g.isMeshPhongMaterial?(n(p,g),c(p,g)):g.isMeshStandardMaterial?(n(p,g),h(p,g),g.isMeshPhysicalMaterial&&f(p,g,b)):g.isMeshMatcapMaterial?(n(p,g),d(p,g)):g.isMeshDepthMaterial?n(p,g):g.isMeshDistanceMaterial?(n(p,g),m(p,g)):g.isMeshNormalMaterial?n(p,g):g.isLineBasicMaterial?(s(p,g),g.isLineDashedMaterial&&o(p,g)):g.isPointsMaterial?a(p,g,y,v):g.isSpriteMaterial?l(p,g):g.isShadowMaterial?(p.color.value.copy(g.color),p.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function n(p,g){p.opacity.value=g.opacity,g.color&&p.diffuse.value.copy(g.color),g.emissive&&p.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(p.map.value=g.map),g.alphaMap&&(p.alphaMap.value=g.alphaMap),g.bumpMap&&(p.bumpMap.value=g.bumpMap,p.bumpScale.value=g.bumpScale,g.side===Cr&&(p.bumpScale.value*=-1)),g.displacementMap&&(p.displacementMap.value=g.displacementMap,p.displacementScale.value=g.displacementScale,p.displacementBias.value=g.displacementBias),g.emissiveMap&&(p.emissiveMap.value=g.emissiveMap),g.normalMap&&(p.normalMap.value=g.normalMap,p.normalScale.value.copy(g.normalScale),g.side===Cr&&p.normalScale.value.negate()),g.specularMap&&(p.specularMap.value=g.specularMap),g.alphaTest>0&&(p.alphaTest.value=g.alphaTest);let y=e.get(g).envMap;if(y&&(p.envMap.value=y,p.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,p.reflectivity.value=g.reflectivity,p.ior.value=g.ior,p.refractionRatio.value=g.refractionRatio),g.lightMap){p.lightMap.value=g.lightMap;let w=i.physicallyCorrectLights!==!0?Math.PI:1;p.lightMapIntensity.value=g.lightMapIntensity*w}g.aoMap&&(p.aoMap.value=g.aoMap,p.aoMapIntensity.value=g.aoMapIntensity);let v;g.map?v=g.map:g.specularMap?v=g.specularMap:g.displacementMap?v=g.displacementMap:g.normalMap?v=g.normalMap:g.bumpMap?v=g.bumpMap:g.roughnessMap?v=g.roughnessMap:g.metalnessMap?v=g.metalnessMap:g.alphaMap?v=g.alphaMap:g.emissiveMap?v=g.emissiveMap:g.clearcoatMap?v=g.clearcoatMap:g.clearcoatNormalMap?v=g.clearcoatNormalMap:g.clearcoatRoughnessMap?v=g.clearcoatRoughnessMap:g.specularIntensityMap?v=g.specularIntensityMap:g.specularColorMap?v=g.specularColorMap:g.transmissionMap?v=g.transmissionMap:g.thicknessMap?v=g.thicknessMap:g.sheenColorMap?v=g.sheenColorMap:g.sheenRoughnessMap&&(v=g.sheenRoughnessMap),v!==void 0&&(v.isWebGLRenderTarget&&(v=v.texture),v.matrixAutoUpdate===!0&&v.updateMatrix(),p.uvTransform.value.copy(v.matrix));let b;g.aoMap?b=g.aoMap:g.lightMap&&(b=g.lightMap),b!==void 0&&(b.isWebGLRenderTarget&&(b=b.texture),b.matrixAutoUpdate===!0&&b.updateMatrix(),p.uv2Transform.value.copy(b.matrix))}function s(p,g){p.diffuse.value.copy(g.color),p.opacity.value=g.opacity}function o(p,g){p.dashSize.value=g.dashSize,p.totalSize.value=g.dashSize+g.gapSize,p.scale.value=g.scale}function a(p,g,y,v){p.diffuse.value.copy(g.color),p.opacity.value=g.opacity,p.size.value=g.size*y,p.scale.value=v*.5,g.map&&(p.map.value=g.map),g.alphaMap&&(p.alphaMap.value=g.alphaMap),g.alphaTest>0&&(p.alphaTest.value=g.alphaTest);let b;g.map?b=g.map:g.alphaMap&&(b=g.alphaMap),b!==void 0&&(b.matrixAutoUpdate===!0&&b.updateMatrix(),p.uvTransform.value.copy(b.matrix))}function l(p,g){p.diffuse.value.copy(g.color),p.opacity.value=g.opacity,p.rotation.value=g.rotation,g.map&&(p.map.value=g.map),g.alphaMap&&(p.alphaMap.value=g.alphaMap),g.alphaTest>0&&(p.alphaTest.value=g.alphaTest);let y;g.map?y=g.map:g.alphaMap&&(y=g.alphaMap),y!==void 0&&(y.matrixAutoUpdate===!0&&y.updateMatrix(),p.uvTransform.value.copy(y.matrix))}function c(p,g){p.specular.value.copy(g.specular),p.shininess.value=Math.max(g.shininess,1e-4)}function u(p,g){g.gradientMap&&(p.gradientMap.value=g.gradientMap)}function h(p,g){p.roughness.value=g.roughness,p.metalness.value=g.metalness,g.roughnessMap&&(p.roughnessMap.value=g.roughnessMap),g.metalnessMap&&(p.metalnessMap.value=g.metalnessMap),e.get(g).envMap&&(p.envMapIntensity.value=g.envMapIntensity)}function f(p,g,y){p.ior.value=g.ior,g.sheen>0&&(p.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),p.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(p.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(p.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(p.clearcoat.value=g.clearcoat,p.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(p.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(p.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),p.clearcoatNormalMap.value=g.clearcoatNormalMap,g.side===Cr&&p.clearcoatNormalScale.value.negate())),g.transmission>0&&(p.transmission.value=g.transmission,p.transmissionSamplerMap.value=y.texture,p.transmissionSamplerSize.value.set(y.width,y.height),g.transmissionMap&&(p.transmissionMap.value=g.transmissionMap),p.thickness.value=g.thickness,g.thicknessMap&&(p.thicknessMap.value=g.thicknessMap),p.attenuationDistance.value=g.attenuationDistance,p.attenuationColor.value.copy(g.attenuationColor)),p.specularIntensity.value=g.specularIntensity,p.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(p.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(p.specularColorMap.value=g.specularColorMap)}function d(p,g){g.matcap&&(p.matcap.value=g.matcap)}function m(p,g){p.referencePosition.value.copy(g.referencePosition),p.nearDistance.value=g.nearDistance,p.farDistance.value=g.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:r}}function oP(){let i=jc("canvas");return i.style.display="block",i}function Ct(i={}){let e=i.canvas!==void 0?i.canvas:oP(),t=i.context!==void 0?i.context:null,r=i.depth!==void 0?i.depth:!0,n=i.stencil!==void 0?i.stencil:!0,s=i.antialias!==void 0?i.antialias:!1,o=i.premultipliedAlpha!==void 0?i.premultipliedAlpha:!0,a=i.preserveDrawingBuffer!==void 0?i.preserveDrawingBuffer:!1,l=i.powerPreference!==void 0?i.powerPreference:"default",c=i.failIfMajorPerformanceCaveat!==void 0?i.failIfMajorPerformanceCaveat:!1,u;i.context!==void 0?u=t.getContextAttributes().alpha:u=i.alpha!==void 0?i.alpha:!1;let h=null,f=null,d=[],m=[];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.outputEncoding=rn,this.physicallyCorrectLights=!1,this.toneMapping=$i,this.toneMappingExposure=1;let p=this,g=!1,y=0,v=0,b=null,w=-1,x=null,E=new Qe,T=new Qe,S=null,I=e.width,C=e.height,M=1,_=null,R=null,B=new Qe(0,0,I,C),O=new Qe(0,0,I,C),z=!1,q=new Ra,F=!1,ee=!1,k=null,V=new Ee,U=new N,J=new A,K={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function $(){return b===null?M:1}let j=t;function ge(D,X){for(let ne=0;ne<D.length;ne++){let re=D[ne],fe=e.getContext(re,X);if(fe!==null)return fe}return null}try{let D={alpha:!0,depth:r,stencil:n,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:a,powerPreference:l,failIfMajorPerformanceCaveat:c};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Oo}`),e.addEventListener("webglcontextlost",G,!1),e.addEventListener("webglcontextrestored",Me,!1),j===null){let X=["webgl2","webgl","experimental-webgl"];if(p.isWebGL1Renderer===!0&&X.shift(),j=ge(X,D),j===null)throw ge(X)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}j.getShaderPrecisionFormat===void 0&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(D){throw console.error("THREE.WebGLRenderer: "+D.message),D}let ae,le,W,ue,Y,H,Q,ce,ie,pe,ve,me,De,ke,P,L,te,ye,Se,Pe,Fe,he,rt;function st(){ae=new _L(j),le=new wL(j,ae,i),ae.init(le),he=new nP(j,ae,le),W=new tP(j,ae,le),ue=new DL(j),Y=new WD,H=new rP(j,ae,W,Y,le,he,ue),Q=new ML(p),ce=new EL(p),ie=new WE(j,le),rt=new xL(j,ae,ie,le),pe=new CL(j,ie,ue,rt),ve=new BL(j,pe,ie,ue),Se=new RL(j,le,H),L=new SL(Y),me=new HD(p,Q,ce,ae,le,rt,L),De=new sP(p,Y),ke=new qD,P=new ZD(ae,le),ye=new vL(p,Q,W,ve,u,o),te=new yb(p,ve,le),Pe=new bL(j,ae,ue,le),Fe=new LL(j,ae,ue,le),ue.programs=me.programs,p.capabilities=le,p.extensions=ae,p.properties=Y,p.renderLists=ke,p.shadowMap=te,p.state=W,p.info=ue}st();let Ae=new fg(p,j);this.xr=Ae,this.getContext=function(){return j},this.getContextAttributes=function(){return j.getContextAttributes()},this.forceContextLoss=function(){let D=ae.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){let D=ae.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return M},this.setPixelRatio=function(D){D!==void 0&&(M=D,this.setSize(I,C,!1))},this.getSize=function(D){return D.set(I,C)},this.setSize=function(D,X,ne){if(Ae.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}I=D,C=X,e.width=Math.floor(D*M),e.height=Math.floor(X*M),ne!==!1&&(e.style.width=D+"px",e.style.height=X+"px"),this.setViewport(0,0,D,X)},this.getDrawingBufferSize=function(D){return D.set(I*M,C*M).floor()},this.setDrawingBufferSize=function(D,X,ne){I=D,C=X,M=ne,e.width=Math.floor(D*ne),e.height=Math.floor(X*ne),this.setViewport(0,0,D,X)},this.getCurrentViewport=function(D){return D.copy(E)},this.getViewport=function(D){return D.copy(B)},this.setViewport=function(D,X,ne,re){D.isVector4?B.set(D.x,D.y,D.z,D.w):B.set(D,X,ne,re),W.viewport(E.copy(B).multiplyScalar(M).floor())},this.getScissor=function(D){return D.copy(O)},this.setScissor=function(D,X,ne,re){D.isVector4?O.set(D.x,D.y,D.z,D.w):O.set(D,X,ne,re),W.scissor(T.copy(O).multiplyScalar(M).floor())},this.getScissorTest=function(){return z},this.setScissorTest=function(D){W.setScissorTest(z=D)},this.setOpaqueSort=function(D){_=D},this.setTransparentSort=function(D){R=D},this.getClearColor=function(D){return D.copy(ye.getClearColor())},this.setClearColor=function(){ye.setClearColor.apply(ye,arguments)},this.getClearAlpha=function(){return ye.getClearAlpha()},this.setClearAlpha=function(){ye.setClearAlpha.apply(ye,arguments)},this.clear=function(D=!0,X=!0,ne=!0){let re=0;D&&(re|=16384),X&&(re|=256),ne&&(re|=1024),j.clear(re)},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",G,!1),e.removeEventListener("webglcontextrestored",Me,!1),ke.dispose(),P.dispose(),Y.dispose(),Q.dispose(),ce.dispose(),ve.dispose(),rt.dispose(),me.dispose(),Ae.dispose(),Ae.removeEventListener("sessionstart",nt),Ae.removeEventListener("sessionend",pt),k&&(k.dispose(),k=null),ht.stop()};function G(D){D.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function Me(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;let D=ue.autoReset,X=te.enabled,ne=te.autoUpdate,re=te.needsUpdate,fe=te.type;st(),ue.autoReset=D,te.enabled=X,te.autoUpdate=ne,te.needsUpdate=re,te.type=fe}function Ce(D){let X=D.target;X.removeEventListener("dispose",Ce),Ke(X)}function Ke(D){Oe(D),Y.remove(D)}function Oe(D){let X=Y.get(D).programs;X!==void 0&&(X.forEach(function(ne){me.releaseProgram(ne)}),D.isShaderMaterial&&me.releaseShaderCache(D))}this.renderBufferDirect=function(D,X,ne,re,fe,Ve){X===null&&(X=K);let $e=fe.isMesh&&fe.matrixWorld.determinant()<0,it=vt(D,X,ne,re,fe);W.setMaterial(re,$e);let lt=ne.index,Bt=ne.attributes.position;if(lt===null){if(Bt===void 0||Bt.count===0)return}else if(lt.count===0)return;let wt=1;re.wireframe===!0&&(lt=pe.getWireframeAttribute(ne),wt=2),rt.setup(fe,re,it,ne,lt);let Tt,tr=Pe;lt!==null&&(Tt=ie.get(lt),tr=Fe,tr.setIndex(Tt));let yo=lt!==null?lt.count:Bt.count,ra=ne.drawRange.start*wt,na=ne.drawRange.count*wt,xi=Ve!==null?Ve.start*wt:0,Dt=Ve!==null?Ve.count*wt:1/0,ia=Math.max(ra,xi),mr=Math.min(yo,ra+na,xi+Dt)-1,bi=Math.max(0,mr-ia+1);if(bi!==0){if(fe.isMesh)re.wireframe===!0?(W.setLineWidth(re.wireframeLinewidth*$()),tr.setMode(1)):tr.setMode(4);else if(fe.isLine){let gs=re.linewidth;gs===void 0&&(gs=1),W.setLineWidth(gs*$()),fe.isLineSegments?tr.setMode(1):fe.isLineLoop?tr.setMode(2):tr.setMode(3)}else fe.isPoints?tr.setMode(0):fe.isSprite&&tr.setMode(4);if(fe.isInstancedMesh)tr.renderInstances(ia,bi,fe.count);else if(ne.isInstancedBufferGeometry){let gs=Math.min(ne.instanceCount,ne._maxInstanceCount);tr.renderInstances(ia,bi,gs)}else tr.render(ia,bi)}},this.compile=function(D,X){f=P.get(D),f.init(),m.push(f),D.traverseVisible(function(ne){ne.isLight&&ne.layers.test(X.layers)&&(f.pushLight(ne),ne.castShadow&&f.pushShadow(ne))}),f.setupLights(p.physicallyCorrectLights),D.traverse(function(ne){let re=ne.material;if(re)if(Array.isArray(re))for(let fe=0;fe<re.length;fe++){let Ve=re[fe];at(Ve,D,ne)}else at(re,D,ne)}),m.pop(),f=null};let Ze=null;function _e(D){Ze&&Ze(D)}function nt(){ht.stop()}function pt(){ht.start()}let ht=new cb;ht.setAnimationLoop(_e),typeof self<"u"&&ht.setContext(self),this.setAnimationLoop=function(D){Ze=D,Ae.setAnimationLoop(D),D===null?ht.stop():ht.start()},Ae.addEventListener("sessionstart",nt),Ae.addEventListener("sessionend",pt),this.render=function(D,X){if(X!==void 0&&X.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(g===!0)return;D.autoUpdate===!0&&D.updateMatrixWorld(),X.parent===null&&X.updateMatrixWorld(),Ae.enabled===!0&&Ae.isPresenting===!0&&(Ae.cameraAutoUpdate===!0&&Ae.updateCamera(X),X=Ae.getCamera()),D.isScene===!0&&D.onBeforeRender(p,D,X,b),f=P.get(D,m.length),f.init(),m.push(f),V.multiplyMatrices(X.projectionMatrix,X.matrixWorldInverse),q.setFromProjectionMatrix(V),ee=this.localClippingEnabled,F=L.init(this.clippingPlanes,ee,X),h=ke.get(D,d.length),h.init(),d.push(h),Ot(D,X,0,p.sortObjects),h.finish(),p.sortObjects===!0&&h.sort(_,R),F===!0&&L.beginShadows();let ne=f.state.shadowsArray;if(te.render(ne,D,X),F===!0&&L.endShadows(),this.info.autoReset===!0&&this.info.reset(),ye.render(h,D),f.setupLights(p.physicallyCorrectLights),X.isArrayCamera){let re=X.cameras;for(let fe=0,Ve=re.length;fe<Ve;fe++){let $e=re[fe];Nr(h,D,$e,$e.viewport)}}else Nr(h,D,X);b!==null&&(H.updateMultisampleRenderTarget(b),H.updateRenderTargetMipmap(b)),D.isScene===!0&&D.onAfterRender(p,D,X),rt.resetDefaultState(),w=-1,x=null,m.pop(),m.length>0?f=m[m.length-1]:f=null,d.pop(),d.length>0?h=d[d.length-1]:h=null};function Ot(D,X,ne,re){if(D.visible===!1)return;if(D.layers.test(X.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(X);else if(D.isLight)f.pushLight(D),D.castShadow&&f.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||q.intersectsSprite(D)){re&&J.setFromMatrixPosition(D.matrixWorld).applyMatrix4(V);let $e=ve.update(D),it=D.material;it.visible&&h.push(D,$e,it,ne,J.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(D.isSkinnedMesh&&D.skeleton.frame!==ue.render.frame&&(D.skeleton.update(),D.skeleton.frame=ue.render.frame),!D.frustumCulled||q.intersectsObject(D))){re&&J.setFromMatrixPosition(D.matrixWorld).applyMatrix4(V);let $e=ve.update(D),it=D.material;if(Array.isArray(it)){let lt=$e.groups;for(let Bt=0,wt=lt.length;Bt<wt;Bt++){let Tt=lt[Bt],tr=it[Tt.materialIndex];tr&&tr.visible&&h.push(D,$e,tr,ne,J.z,Tt)}}else it.visible&&h.push(D,$e,it,ne,J.z,null)}}let Ve=D.children;for(let $e=0,it=Ve.length;$e<it;$e++)Ot(Ve[$e],X,ne,re)}function Nr(D,X,ne,re){let fe=D.opaque,Ve=D.transmissive,$e=D.transparent;f.setupLightsView(ne),Ve.length>0&&ta(fe,X,ne),re&&W.viewport(E.copy(re)),fe.length>0&&We(fe,X,ne),Ve.length>0&&We(Ve,X,ne),$e.length>0&&We($e,X,ne),W.buffers.depth.setTest(!0),W.buffers.depth.setMask(!0),W.buffers.color.setMask(!0),W.setPolygonOffset(!1)}function ta(D,X,ne){let re=le.isWebGL2;k===null&&(k=new mt(1,1,{generateMipmaps:!0,type:he.convert(La)!==null?La:Wt,minFilter:ks,samples:re&&s===!0?4:0})),p.getDrawingBufferSize(U),re?k.setSize(U.x,U.y):k.setSize(df(U.x),df(U.y));let fe=p.getRenderTarget();p.setRenderTarget(k),p.clear();let Ve=p.toneMapping;p.toneMapping=$i,We(D,X,ne),p.toneMapping=Ve,H.updateMultisampleRenderTarget(k),H.updateRenderTargetMipmap(k),p.setRenderTarget(fe)}function We(D,X,ne){let re=X.isScene===!0?X.overrideMaterial:null;for(let fe=0,Ve=D.length;fe<Ve;fe++){let $e=D[fe],it=$e.object,lt=$e.geometry,Bt=re===null?$e.material:re,wt=$e.group;it.layers.test(ne.layers)&&dt(it,X,ne,lt,Bt,wt)}}function dt(D,X,ne,re,fe,Ve){D.onBeforeRender(p,X,ne,re,fe,Ve),D.modelViewMatrix.multiplyMatrices(ne.matrixWorldInverse,D.matrixWorld),D.normalMatrix.getNormalMatrix(D.modelViewMatrix),fe.onBeforeRender(p,X,ne,re,D,Ve),fe.transparent===!0&&fe.side===ir?(fe.side=Cr,fe.needsUpdate=!0,p.renderBufferDirect(ne,X,re,fe,D,Ve),fe.side=ii,fe.needsUpdate=!0,p.renderBufferDirect(ne,X,re,fe,D,Ve),fe.side=ir):p.renderBufferDirect(ne,X,re,fe,D,Ve),D.onAfterRender(p,X,ne,re,fe,Ve)}function at(D,X,ne){X.isScene!==!0&&(X=K);let re=Y.get(D),fe=f.state.lights,Ve=f.state.shadowsArray,$e=fe.state.version,it=me.getParameters(D,fe.state,Ve,X,ne),lt=me.getProgramCacheKey(it),Bt=re.programs;re.environment=D.isMeshStandardMaterial?X.environment:null,re.fog=X.fog,re.envMap=(D.isMeshStandardMaterial?ce:Q).get(D.envMap||re.environment),Bt===void 0&&(D.addEventListener("dispose",Ce),Bt=new Map,re.programs=Bt);let wt=Bt.get(lt);if(wt!==void 0){if(re.currentProgram===wt&&re.lightsStateVersion===$e)return ut(D,it),wt}else it.uniforms=me.getUniforms(D),D.onBuild(ne,it,p),D.onBeforeCompile(it,p),wt=me.acquireProgram(it,lt),Bt.set(lt,wt),re.uniforms=it.uniforms;let Tt=re.uniforms;(!D.isShaderMaterial&&!D.isRawShaderMaterial||D.clipping===!0)&&(Tt.clippingPlanes=L.uniform),ut(D,it),re.needsLights=Ft(D),re.lightsStateVersion=$e,re.needsLights&&(Tt.ambientLightColor.value=fe.state.ambient,Tt.lightProbe.value=fe.state.probe,Tt.directionalLights.value=fe.state.directional,Tt.directionalLightShadows.value=fe.state.directionalShadow,Tt.spotLights.value=fe.state.spot,Tt.spotLightShadows.value=fe.state.spotShadow,Tt.rectAreaLights.value=fe.state.rectArea,Tt.ltc_1.value=fe.state.rectAreaLTC1,Tt.ltc_2.value=fe.state.rectAreaLTC2,Tt.pointLights.value=fe.state.point,Tt.pointLightShadows.value=fe.state.pointShadow,Tt.hemisphereLights.value=fe.state.hemi,Tt.directionalShadowMap.value=fe.state.directionalShadowMap,Tt.directionalShadowMatrix.value=fe.state.directionalShadowMatrix,Tt.spotShadowMap.value=fe.state.spotShadowMap,Tt.spotShadowMatrix.value=fe.state.spotShadowMatrix,Tt.pointShadowMap.value=fe.state.pointShadowMap,Tt.pointShadowMatrix.value=fe.state.pointShadowMatrix);let tr=wt.getUniforms(),yo=Cs.seqWithValue(tr.seq,Tt);return re.currentProgram=wt,re.uniformsList=yo,wt}function ut(D,X){let ne=Y.get(D);ne.outputEncoding=X.outputEncoding,ne.instancing=X.instancing,ne.skinning=X.skinning,ne.morphTargets=X.morphTargets,ne.morphNormals=X.morphNormals,ne.morphColors=X.morphColors,ne.morphTargetsCount=X.morphTargetsCount,ne.numClippingPlanes=X.numClippingPlanes,ne.numIntersection=X.numClipIntersection,ne.vertexAlphas=X.vertexAlphas,ne.vertexTangents=X.vertexTangents,ne.toneMapping=X.toneMapping}function vt(D,X,ne,re,fe){X.isScene!==!0&&(X=K),H.resetTextureUnits();let Ve=X.fog,$e=re.isMeshStandardMaterial?X.environment:null,it=b===null?p.outputEncoding:b.isXRRenderTarget===!0?b.texture.encoding:rn,lt=(re.isMeshStandardMaterial?ce:Q).get(re.envMap||$e),Bt=re.vertexColors===!0&&!!ne.attributes.color&&ne.attributes.color.itemSize===4,wt=!!re.normalMap&&!!ne.attributes.tangent,Tt=!!ne.morphAttributes.position,tr=!!ne.morphAttributes.normal,yo=!!ne.morphAttributes.color,ra=re.toneMapped?p.toneMapping:$i,na=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,xi=na!==void 0?na.length:0,Dt=Y.get(re),ia=f.state.lights;if(F===!0&&(ee===!0||D!==x)){let Zn=D===x&&re.id===w;L.setState(re,D,Zn)}let mr=!1;re.version===Dt.__version?(Dt.needsLights&&Dt.lightsStateVersion!==ia.state.version||Dt.outputEncoding!==it||fe.isInstancedMesh&&Dt.instancing===!1||!fe.isInstancedMesh&&Dt.instancing===!0||fe.isSkinnedMesh&&Dt.skinning===!1||!fe.isSkinnedMesh&&Dt.skinning===!0||Dt.envMap!==lt||re.fog&&Dt.fog!==Ve||Dt.numClippingPlanes!==void 0&&(Dt.numClippingPlanes!==L.numPlanes||Dt.numIntersection!==L.numIntersection)||Dt.vertexAlphas!==Bt||Dt.vertexTangents!==wt||Dt.morphTargets!==Tt||Dt.morphNormals!==tr||Dt.morphColors!==yo||Dt.toneMapping!==ra||le.isWebGL2===!0&&Dt.morphTargetsCount!==xi)&&(mr=!0):(mr=!0,Dt.__version=re.version);let bi=Dt.currentProgram;mr===!0&&(bi=at(re,X,fe));let gs=!1,Tc=!1,fm=!1,qr=bi.getUniforms(),Ec=Dt.uniforms;if(W.useProgram(bi.program)&&(gs=!0,Tc=!0,fm=!0),re.id!==w&&(w=re.id,Tc=!0),gs||x!==D){if(qr.setValue(j,"projectionMatrix",D.projectionMatrix),le.logarithmicDepthBuffer&&qr.setValue(j,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),x!==D&&(x=D,Tc=!0,fm=!0),re.isShaderMaterial||re.isMeshPhongMaterial||re.isMeshToonMaterial||re.isMeshStandardMaterial||re.envMap){let Zn=qr.map.cameraPosition;Zn!==void 0&&Zn.setValue(j,J.setFromMatrixPosition(D.matrixWorld))}(re.isMeshPhongMaterial||re.isMeshToonMaterial||re.isMeshLambertMaterial||re.isMeshBasicMaterial||re.isMeshStandardMaterial||re.isShaderMaterial)&&qr.setValue(j,"isOrthographic",D.isOrthographicCamera===!0),(re.isMeshPhongMaterial||re.isMeshToonMaterial||re.isMeshLambertMaterial||re.isMeshBasicMaterial||re.isMeshStandardMaterial||re.isShaderMaterial||re.isShadowMaterial||fe.isSkinnedMesh)&&qr.setValue(j,"viewMatrix",D.matrixWorldInverse)}if(fe.isSkinnedMesh){qr.setOptional(j,fe,"bindMatrix"),qr.setOptional(j,fe,"bindMatrixInverse");let Zn=fe.skeleton;Zn&&(le.floatVertexTextures?(Zn.boneTexture===null&&Zn.computeBoneTexture(),qr.setValue(j,"boneTexture",Zn.boneTexture,H),qr.setValue(j,"boneTextureSize",Zn.boneTextureSize)):qr.setOptional(j,Zn,"boneMatrices"))}let dm=ne.morphAttributes;return(dm.position!==void 0||dm.normal!==void 0||dm.color!==void 0&&le.isWebGL2===!0)&&Se.update(fe,ne,re,bi),(Tc||Dt.receiveShadow!==fe.receiveShadow)&&(Dt.receiveShadow=fe.receiveShadow,qr.setValue(j,"receiveShadow",fe.receiveShadow)),Tc&&(qr.setValue(j,"toneMappingExposure",p.toneMappingExposure),Dt.needsLights&&Lt(Ec,fm),Ve&&re.fog&&De.refreshFogUniforms(Ec,Ve),De.refreshMaterialUniforms(Ec,re,M,C,k),Cs.upload(j,Dt.uniformsList,Ec,H)),re.isShaderMaterial&&re.uniformsNeedUpdate===!0&&(Cs.upload(j,Dt.uniformsList,Ec,H),re.uniformsNeedUpdate=!1),re.isSpriteMaterial&&qr.setValue(j,"center",fe.center),qr.setValue(j,"modelViewMatrix",fe.modelViewMatrix),qr.setValue(j,"normalMatrix",fe.normalMatrix),qr.setValue(j,"modelMatrix",fe.matrixWorld),bi}function Lt(D,X){D.ambientLightColor.needsUpdate=X,D.lightProbe.needsUpdate=X,D.directionalLights.needsUpdate=X,D.directionalLightShadows.needsUpdate=X,D.pointLights.needsUpdate=X,D.pointLightShadows.needsUpdate=X,D.spotLights.needsUpdate=X,D.spotLightShadows.needsUpdate=X,D.rectAreaLights.needsUpdate=X,D.hemisphereLights.needsUpdate=X}function Ft(D){return D.isMeshLambertMaterial||D.isMeshToonMaterial||D.isMeshPhongMaterial||D.isMeshStandardMaterial||D.isShadowMaterial||D.isShaderMaterial&&D.lights===!0}this.getActiveCubeFace=function(){return y},this.getActiveMipmapLevel=function(){return v},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(D,X,ne){Y.get(D.texture).__webglTexture=X,Y.get(D.depthTexture).__webglTexture=ne;let re=Y.get(D);re.__hasExternalTextures=!0,re.__hasExternalTextures&&(re.__autoAllocateDepthBuffer=ne===void 0,re.__autoAllocateDepthBuffer||ae.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),re.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(D,X){let ne=Y.get(D);ne.__webglFramebuffer=X,ne.__useDefaultFramebuffer=X===void 0},this.setRenderTarget=function(D,X=0,ne=0){b=D,y=X,v=ne;let re=!0;if(D){let lt=Y.get(D);lt.__useDefaultFramebuffer!==void 0?(W.bindFramebuffer(36160,null),re=!1):lt.__webglFramebuffer===void 0?H.setupRenderTarget(D):lt.__hasExternalTextures&&H.rebindTextures(D,Y.get(D.texture).__webglTexture,Y.get(D.depthTexture).__webglTexture)}let fe=null,Ve=!1,$e=!1;if(D){let lt=D.texture;(lt.isData3DTexture||lt.isDataArrayTexture)&&($e=!0);let Bt=Y.get(D).__webglFramebuffer;D.isWebGLCubeRenderTarget?(fe=Bt[X],Ve=!0):le.isWebGL2&&D.samples>0&&H.useMultisampledRTT(D)===!1?fe=Y.get(D).__webglMultisampledFramebuffer:fe=Bt,E.copy(D.viewport),T.copy(D.scissor),S=D.scissorTest}else E.copy(B).multiplyScalar(M).floor(),T.copy(O).multiplyScalar(M).floor(),S=z;if(W.bindFramebuffer(36160,fe)&&le.drawBuffers&&re&&W.drawBuffers(D,fe),W.viewport(E),W.scissor(T),W.setScissorTest(S),Ve){let lt=Y.get(D.texture);j.framebufferTexture2D(36160,36064,34069+X,lt.__webglTexture,ne)}else if($e){let lt=Y.get(D.texture),Bt=X||0;j.framebufferTextureLayer(36160,36064,lt.__webglTexture,ne||0,Bt)}w=-1},this.readRenderTargetPixels=function(D,X,ne,re,fe,Ve,$e){if(!(D&&D.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let it=Y.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&$e!==void 0&&(it=it[$e]),it){W.bindFramebuffer(36160,it);try{let lt=D.texture,Bt=lt.format,wt=lt.type;if(Bt!==On&&he.convert(Bt)!==j.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Tt=wt===La&&(ae.has("EXT_color_buffer_half_float")||le.isWebGL2&&ae.has("EXT_color_buffer_float"));if(wt!==Wt&&he.convert(wt)!==j.getParameter(35738)&&!(wt===Ts&&(le.isWebGL2||ae.has("OES_texture_float")||ae.has("WEBGL_color_buffer_float")))&&!Tt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}X>=0&&X<=D.width-re&&ne>=0&&ne<=D.height-fe&&j.readPixels(X,ne,re,fe,he.convert(Bt),he.convert(wt),Ve)}finally{let lt=b!==null?Y.get(b).__webglFramebuffer:null;W.bindFramebuffer(36160,lt)}}},this.copyFramebufferToTexture=function(D,X,ne=0){if(X.isFramebufferTexture!==!0){console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");return}let re=Math.pow(2,-ne),fe=Math.floor(X.image.width*re),Ve=Math.floor(X.image.height*re);H.setTexture2D(X,0),j.copyTexSubImage2D(3553,ne,0,0,D.x,D.y,fe,Ve),W.unbindTexture()},this.copyTextureToTexture=function(D,X,ne,re=0){let fe=X.image.width,Ve=X.image.height,$e=he.convert(ne.format),it=he.convert(ne.type);H.setTexture2D(ne,0),j.pixelStorei(37440,ne.flipY),j.pixelStorei(37441,ne.premultiplyAlpha),j.pixelStorei(3317,ne.unpackAlignment),X.isDataTexture?j.texSubImage2D(3553,re,D.x,D.y,fe,Ve,$e,it,X.image.data):X.isCompressedTexture?j.compressedTexSubImage2D(3553,re,D.x,D.y,X.mipmaps[0].width,X.mipmaps[0].height,$e,X.mipmaps[0].data):j.texSubImage2D(3553,re,D.x,D.y,$e,it,X.image),re===0&&ne.generateMipmaps&&j.generateMipmap(3553),W.unbindTexture()},this.copyTextureToTexture3D=function(D,X,ne,re,fe=0){if(p.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Ve=D.max.x-D.min.x+1,$e=D.max.y-D.min.y+1,it=D.max.z-D.min.z+1,lt=he.convert(re.format),Bt=he.convert(re.type),wt;if(re.isData3DTexture)H.setTexture3D(re,0),wt=32879;else if(re.isDataArrayTexture)H.setTexture2DArray(re,0),wt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}j.pixelStorei(37440,re.flipY),j.pixelStorei(37441,re.premultiplyAlpha),j.pixelStorei(3317,re.unpackAlignment);let Tt=j.getParameter(3314),tr=j.getParameter(32878),yo=j.getParameter(3316),ra=j.getParameter(3315),na=j.getParameter(32877),xi=ne.isCompressedTexture?ne.mipmaps[0]:ne.image;j.pixelStorei(3314,xi.width),j.pixelStorei(32878,xi.height),j.pixelStorei(3316,D.min.x),j.pixelStorei(3315,D.min.y),j.pixelStorei(32877,D.min.z),ne.isDataTexture||ne.isData3DTexture?j.texSubImage3D(wt,fe,X.x,X.y,X.z,Ve,$e,it,lt,Bt,xi.data):ne.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),j.compressedTexSubImage3D(wt,fe,X.x,X.y,X.z,Ve,$e,it,lt,xi.data)):j.texSubImage3D(wt,fe,X.x,X.y,X.z,Ve,$e,it,lt,Bt,xi),j.pixelStorei(3314,Tt),j.pixelStorei(32878,tr),j.pixelStorei(3316,yo),j.pixelStorei(3315,ra),j.pixelStorei(32877,na),fe===0&&re.generateMipmaps&&j.generateMipmap(wt),W.unbindTexture()},this.initTexture=function(D){H.setTexture2D(D,0),W.unbindTexture()},this.resetState=function(){y=0,v=0,b=null,W.reset(),rt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Ct.prototype.isWebGLRenderer=!0;var dg=class extends Ct{};dg.prototype.isWebGL1Renderer=!0;var Kc=class{constructor(e,t=25e-5){this.name="",this.color=new xe(e),this.density=t}clone(){return new Kc(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}};Kc.prototype.isFogExp2=!0;var _o=class{constructor(e,t=1,r=1e3){this.name="",this.color=new xe(e),this.near=t,this.far=r}clone(){return new _o(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}};_o.prototype.isFog=!0;var sn=class extends ot{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}};sn.prototype.isScene=!0;var rs=class{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Hc,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Fn()}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,r){e*=this.stride,r*=t.stride;for(let n=0,s=this.stride;n<s;n++)this.array[e+n]=t.array[r+n];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fn()),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]),r=new this.constructor(t,this.stride);return r.setUsage(this.usage),r}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=Fn()),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}}};rs.prototype.isInterleavedBuffer=!0;var en=new A,Ai=class{constructor(e,t,r,n=!1){this.name="",this.data=e,this.itemSize=t,this.offset=r,this.normalized=n===!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,r=this.data.count;t<r;t++)en.fromBufferAttribute(this,t),en.applyMatrix4(e),this.setXYZ(t,en.x,en.y,en.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)en.fromBufferAttribute(this,t),en.applyNormalMatrix(e),this.setXYZ(t,en.x,en.y,en.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)en.fromBufferAttribute(this,t),en.transformDirection(e),this.setXYZ(t,en.x,en.y,en.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,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this}setXYZ(e,t,r,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,this}setXYZW(e,t,r,n,s){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,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 r=0;r<this.count;r++){let n=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[n+s])}return new Ue(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 Ai(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 r=0;r<this.count;r++){let n=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[n+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}};Ai.prototype.isInterleavedBufferAttribute=!0;var Zc=class extends cr{constructor(e){super(),this.type="SpriteMaterial",this.color=new xe(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}};Zc.prototype.isSpriteMaterial=!0;var xa,Dc=new A,ba=new A,wa=new A,Sa=new N,Pc=new N,vb=new Ee,qh=new A,Ic=new A,Xh=new A,A0=new N,qm=new N,T0=new N,pg=class extends ot{constructor(e){if(super(),this.type="Sprite",xa===void 0){xa=new Ie;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new rs(t,5);xa.setIndex([0,1,2,0,2,3]),xa.setAttribute("position",new Ai(r,3,0,!1)),xa.setAttribute("uv",new Ai(r,2,3,!1))}this.geometry=xa,this.material=e!==void 0?e:new Zc,this.center=new N(.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),vb.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 r=this.material.rotation,n,s;r!==0&&(s=Math.cos(r),n=Math.sin(r));let o=this.center;Yh(qh.set(-.5,-.5,0),wa,o,ba,n,s),Yh(Ic.set(.5,-.5,0),wa,o,ba,n,s),Yh(Xh.set(.5,.5,0),wa,o,ba,n,s),A0.set(0,0),qm.set(1,0),T0.set(1,1);let a=e.ray.intersectTriangle(qh,Ic,Xh,!1,Dc);if(a===null&&(Yh(Ic.set(-.5,.5,0),wa,o,ba,n,s),qm.set(0,1),a=e.ray.intersectTriangle(qh,Xh,Ic,!1,Dc),a===null))return;let l=e.ray.origin.distanceTo(Dc);l<e.near||l>e.far||t.push({distance:l,point:Dc.clone(),uv:Jt.getUV(Dc,qh,Ic,Xh,A0,qm,T0,new N),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};pg.prototype.isSprite=!0;function Yh(i,e,t,r,n,s){Sa.subVectors(i,t).addScalar(.5).multiply(r),n!==void 0?(Pc.x=s*Sa.x-n*Sa.y,Pc.y=n*Sa.x+s*Sa.y):Pc.copy(Sa),i.copy(e),i.x+=Pc.x,i.y+=Pc.y,i.applyMatrix4(vb)}var E0=new A,_0=new Qe,C0=new Qe,aP=new A,L0=new Ee,xf=class extends Gt{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Ee,this.bindMatrixInverse=new Ee}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 r=0,n=t.count;r<n;r++){e.fromBufferAttribute(t,r);let s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(r,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 r=this.skeleton,n=this.geometry;_0.fromBufferAttribute(n.attributes.skinIndex,e),C0.fromBufferAttribute(n.attributes.skinWeight,e),E0.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){let o=C0.getComponent(s);if(o!==0){let a=_0.getComponent(s);L0.multiplyMatrices(r.bones[a].matrixWorld,r.boneInverses[a]),t.addScaledVector(aP.copy(E0).applyMatrix4(L0),o)}}return t.applyMatrix4(this.bindMatrixInverse)}};xf.prototype.isSkinnedMesh=!0;var mg=class extends ot{constructor(){super(),this.type="Bone"}};mg.prototype.isBone=!0;var bf=class extends _t{constructor(e=null,t=1,r=1,n,s,o,a,l,c=lr,u=lr,h,f){super(null,o,a,l,c,u,n,s,h,f),this.image={data:e,width:t,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};bf.prototype.isDataTexture=!0;var Ba=class extends Ue{constructor(e,t,r,n=1){typeof r=="number"&&(n=r,r=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,r),this.meshPerAttribute=n}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}};Ba.prototype.isInstancedBufferAttribute=!0;var D0=new Ee,P0=new Ee,Jh=[],Rc=new Gt,gg=class extends Gt{constructor(e,t,r){super(e,t),this.instanceMatrix=new Ba(new Float32Array(r*16),16),this.instanceColor=null,this.count=r,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 r=this.matrixWorld,n=this.count;if(Rc.geometry=this.geometry,Rc.material=this.material,Rc.material!==void 0)for(let s=0;s<n;s++){this.getMatrixAt(s,D0),P0.multiplyMatrices(r,D0),Rc.matrixWorld=P0,Rc.raycast(e,Jh);for(let o=0,a=Jh.length;o<a;o++){let l=Jh[o];l.instanceId=s,l.object=this,t.push(l)}Jh.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Ba(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"})}};gg.prototype.isInstancedMesh=!0;var Ur=class extends cr{constructor(e){super(),this.type="LineBasicMaterial",this.color=new xe(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}};Ur.prototype.isLineBasicMaterial=!0;var I0=new A,R0=new A,B0=new Ee,Xm=new si,Qh=new Yr,ns=class extends ot{constructor(e=new Ie,t=new Ur){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,r=[0];for(let n=1,s=t.count;n<s;n++)I0.fromBufferAttribute(t,n-1),R0.fromBufferAttribute(t,n),r[n]=r[n-1],r[n]+=I0.distanceTo(R0);e.setAttribute("lineDistance",new Le(r,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 r=this.geometry,n=this.matrixWorld,s=e.params.Line.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),Qh.copy(r.boundingSphere),Qh.applyMatrix4(n),Qh.radius+=s,e.ray.intersectsSphere(Qh)===!1)return;B0.copy(n).invert(),Xm.copy(e.ray).applyMatrix4(B0);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new A,u=new A,h=new A,f=new A,d=this.isLineSegments?2:1;if(r.isBufferGeometry){let m=r.index,g=r.attributes.position;if(m!==null){let y=Math.max(0,o.start),v=Math.min(m.count,o.start+o.count);for(let b=y,w=v-1;b<w;b+=d){let x=m.getX(b),E=m.getX(b+1);if(c.fromBufferAttribute(g,x),u.fromBufferAttribute(g,E),Xm.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);let S=e.ray.origin.distanceTo(f);S<e.near||S>e.far||t.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else{let y=Math.max(0,o.start),v=Math.min(g.count,o.start+o.count);for(let b=y,w=v-1;b<w;b+=d){if(c.fromBufferAttribute(g,b),u.fromBufferAttribute(g,b+1),Xm.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);let E=e.ray.origin.distanceTo(f);E<e.near||E>e.far||t.push({distance:E,point:h.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}else r.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,r=Object.keys(t);if(r.length>0){let n=t[r[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=n.length;s<o;s++){let a=n[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.")}}};ns.prototype.isLine=!0;var N0=new A,O0=new A,ai=class extends ns{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,r=[];for(let n=0,s=t.count;n<s;n+=2)N0.fromBufferAttribute(t,n),O0.fromBufferAttribute(t,n+1),r[n]=n===0?0:r[n-1],r[n+1]=r[n]+N0.distanceTo(O0);e.setAttribute("lineDistance",new Le(r,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}};ai.prototype.isLineSegments=!0;var yg=class extends ns{constructor(e,t){super(e,t),this.type="LineLoop"}};yg.prototype.isLineLoop=!0;var $c=class extends cr{constructor(e){super(),this.type="PointsMaterial",this.color=new xe(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}};$c.prototype.isPointsMaterial=!0;var F0=new Ee,vg=new si,Kh=new Yr,Zh=new A,xg=class extends ot{constructor(e=new Ie,t=new $c){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 r=this.geometry,n=this.matrixWorld,s=e.params.Points.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),Kh.copy(r.boundingSphere),Kh.applyMatrix4(n),Kh.radius+=s,e.ray.intersectsSphere(Kh)===!1)return;F0.copy(n).invert(),vg.copy(e.ray).applyMatrix4(F0);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a;if(r.isBufferGeometry){let c=r.index,h=r.attributes.position;if(c!==null){let f=Math.max(0,o.start),d=Math.min(c.count,o.start+o.count);for(let m=f,p=d;m<p;m++){let g=c.getX(m);Zh.fromBufferAttribute(h,g),U0(Zh,g,l,n,e,t,this)}}else{let f=Math.max(0,o.start),d=Math.min(h.count,o.start+o.count);for(let m=f,p=d;m<p;m++)Zh.fromBufferAttribute(h,m),U0(Zh,m,l,n,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,r=Object.keys(t);if(r.length>0){let n=t[r[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=n.length;s<o;s++){let a=n[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.")}}};xg.prototype.isPoints=!0;function U0(i,e,t,r,n,s,o){let a=vg.distanceSqToPoint(i);if(a<t){let l=new A;vg.closestPointToPoint(i,l),l.applyMatrix4(r);let c=n.ray.origin.distanceTo(l);if(c<n.near||c>n.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}var eu=class extends _t{constructor(e,t,r,n,s,o,a,l,c){super(e,t,r,n,s,o,a,l,c),this.minFilter=o!==void 0?o:ct,this.magFilter=s!==void 0?s:ct,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)}};eu.prototype.isVideoTexture=!0;var bg=class extends _t{constructor(e,t,r){super({width:e,height:t}),this.format=r,this.magFilter=lr,this.minFilter=lr,this.generateMipmaps=!1,this.needsUpdate=!0}};bg.prototype.isFramebufferTexture=!0;var wg=class extends _t{constructor(e,t,r,n,s,o,a,l,c,u,h,f){super(null,o,a,l,c,u,n,s,h,f),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};wg.prototype.isCompressedTexture=!0;var Sg=class extends _t{constructor(e,t,r,n,s,o,a,l,c){super(e,t,r,n,s,o,a,l,c),this.needsUpdate=!0}};Sg.prototype.isCanvasTexture=!0;var gn=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){let t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){let t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/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=[],r,n=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(n),t.push(s),n=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let r=this.getLengths(),n=0,s=r.length,o;t?o=t:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),c=r[n]-o,c<0)a=n+1;else if(c>0)l=n-1;else{l=n;break}if(n=l,r[n]===o)return n/(s-1);let u=r[n],f=r[n+1]-u,d=(o-u)/f;return(n+d)/(s-1)}getTangent(e,t){let n=e-1e-4,s=e+1e-4;n<0&&(n=0),s>1&&(s=1);let o=this.getPoint(n),a=this.getPoint(s),l=t||(o.isVector2?new N:new A);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){let r=new A,n=[],s=[],o=[],a=new A,l=new Ee;for(let d=0;d<=e;d++){let m=d/e;n[d]=this.getTangentAt(m,new A)}s[0]=new A,o[0]=new A;let c=Number.MAX_VALUE,u=Math.abs(n[0].x),h=Math.abs(n[0].y),f=Math.abs(n[0].z);u<=c&&(c=u,r.set(1,0,0)),h<=c&&(c=h,r.set(0,1,0)),f<=c&&r.set(0,0,1),a.crossVectors(n[0],r).normalize(),s[0].crossVectors(n[0],a),o[0].crossVectors(n[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(n[d-1],n[d]),a.length()>Number.EPSILON){a.normalize();let m=Math.acos(yr(n[d-1].dot(n[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(a,m))}o[d].crossVectors(n[d],s[d])}if(t===!0){let d=Math.acos(yr(s[0].dot(s[e]),-1,1));d/=e,n[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(n[m],d*m)),o[m].crossVectors(n[m],s[m])}return{tangents:n,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}},Bs=class extends gn{constructor(e=0,t=0,r=1,n=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=n,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){let r=t||new N,n=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=n;for(;s>n;)s-=n;s<Number.EPSILON&&(o?s=0:s=n),this.aClockwise===!0&&!o&&(s===n?s=-n:s=s-n);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),f=l-this.aX,d=c-this.aY;l=f*u-d*h+this.aX,c=f*h+d*u+this.aY}return r.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}};Bs.prototype.isEllipseCurve=!0;var wf=class extends Bs{constructor(e,t,r,n,s,o){super(e,t,r,r,n,s,o),this.type="ArcCurve"}};wf.prototype.isArcCurve=!0;function ey(){let i=0,e=0,t=0,r=0;function n(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,r=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){n(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,h){let f=(o-s)/c-(a-s)/(c+u)+(a-o)/u,d=(a-o)/u-(l-o)/(u+h)+(l-a)/h;f*=u,d*=u,n(o,a,f,d)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+r*a}}}var $h=new A,Ym=new ey,Jm=new ey,Qm=new ey,Sf=class extends gn{constructor(e=[],t=!1,r="centripetal",n=.5){super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=n}getPoint(e,t=new A){let r=t,n=this.points,s=n.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=n[(a-1)%s]:($h.subVectors(n[0],n[1]).add(n[0]),c=$h);let h=n[a%s],f=n[(a+1)%s];if(this.closed||a+2<s?u=n[(a+2)%s]:($h.subVectors(n[s-1],n[s-2]).add(n[s-1]),u=$h),this.curveType==="centripetal"||this.curveType==="chordal"){let d=this.curveType==="chordal"?.5:.25,m=Math.pow(c.distanceToSquared(h),d),p=Math.pow(h.distanceToSquared(f),d),g=Math.pow(f.distanceToSquared(u),d);p<1e-4&&(p=1),m<1e-4&&(m=p),g<1e-4&&(g=p),Ym.initNonuniformCatmullRom(c.x,h.x,f.x,u.x,m,p,g),Jm.initNonuniformCatmullRom(c.y,h.y,f.y,u.y,m,p,g),Qm.initNonuniformCatmullRom(c.z,h.z,f.z,u.z,m,p,g)}else this.curveType==="catmullrom"&&(Ym.initCatmullRom(c.x,h.x,f.x,u.x,this.tension),Jm.initCatmullRom(c.y,h.y,f.y,u.y,this.tension),Qm.initCatmullRom(c.z,h.z,f.z,u.z,this.tension));return r.set(Ym.calc(l),Jm.calc(l),Qm.calc(l)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(n.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,r=this.points.length;t<r;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(new A().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};Sf.prototype.isCatmullRomCurve3=!0;function z0(i,e,t,r,n){let s=(r-e)*.5,o=(n-t)*.5,a=i*i,l=i*a;return(2*t-2*r+s+o)*l+(-3*t+3*r-2*s-o)*a+s*i+t}function lP(i,e){let t=1-i;return t*t*e}function cP(i,e){return 2*(1-i)*i*e}function uP(i,e){return i*i*e}function Gc(i,e,t,r){return lP(i,e)+cP(i,t)+uP(i,r)}function hP(i,e){let t=1-i;return t*t*t*e}function fP(i,e){let t=1-i;return 3*t*t*i*e}function dP(i,e){return 3*(1-i)*i*i*e}function pP(i,e){return i*i*i*e}function kc(i,e,t,r,n){return hP(i,e)+fP(i,t)+dP(i,r)+pP(i,n)}var on=class extends gn{constructor(e=new N,t=new N,r=new N,n=new N){super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=n}getPoint(e,t=new N){let r=t,n=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(kc(e,n.x,s.x,o.x,a.x),kc(e,n.y,s.y,o.y,a.y)),r}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}};on.prototype.isCubicBezierCurve=!0;var Mf=class extends gn{constructor(e=new A,t=new A,r=new A,n=new A){super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=n}getPoint(e,t=new A){let r=t,n=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(kc(e,n.x,s.x,o.x,a.x),kc(e,n.y,s.y,o.y,a.y),kc(e,n.z,s.z,o.z,a.z)),r}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}};Mf.prototype.isCubicBezierCurve3=!0;var an=class extends gn{constructor(e=new N,t=new N){super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new N){let r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){let r=t||new N;return r.copy(this.v2).sub(this.v1).normalize(),r}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}};an.prototype.isLineCurve=!0;var tu=class extends gn{constructor(e=new A,t=new A){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new A){let r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}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}},Gn=class extends gn{constructor(e=new N,t=new N,r=new N){super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new N){let r=t,n=this.v0,s=this.v1,o=this.v2;return r.set(Gc(e,n.x,s.x,o.x),Gc(e,n.y,s.y,o.y)),r}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}};Gn.prototype.isQuadraticBezierCurve=!0;var Af=class extends gn{constructor(e=new A,t=new A,r=new A){super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new A){let r=t,n=this.v0,s=this.v1,o=this.v2;return r.set(Gc(e,n.x,s.x,o.x),Gc(e,n.y,s.y,o.y),Gc(e,n.z,s.z,o.z)),r}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}};Af.prototype.isQuadraticBezierCurve3=!0;var Co=class extends gn{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new N){let r=t,n=this.points,s=(n.length-1)*e,o=Math.floor(s),a=s-o,l=n[o===0?o:o-1],c=n[o],u=n[o>n.length-2?n.length-1:o+1],h=n[o>n.length-3?n.length-1:o+2];return r.set(z0(a,l.x,c.x,u.x,h.x),z0(a,l.y,c.y,u.y,h.y)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(new N().fromArray(n))}return this}};Co.prototype.isSplineCurve=!0;var xb=Object.freeze({__proto__:null,ArcCurve:wf,CatmullRomCurve3:Sf,CubicBezierCurve:on,CubicBezierCurve3:Mf,EllipseCurve:Bs,LineCurve:an,LineCurve3:tu,QuadraticBezierCurve:Gn,QuadraticBezierCurve3:Af,SplineCurve:Co}),Mg=class extends gn{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 an(t,e))}getPoint(e,t){let r=e*this.getLength(),n=this.getCurveLengths(),s=0;for(;s<n.length;){if(n[s]>=r){let o=n[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}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 r=0,n=this.curves.length;r<n;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],r;for(let n=0,s=this.curves;n<s.length;n++){let o=s[n],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){let u=l[c];r&&r.equals(u)||(t.push(u),r=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,r=e.curves.length;t<r;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,r=this.curves.length;t<r;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){let n=e.curves[t];this.curves.push(new xb[n.type]().fromJSON(n))}return this}},Na=class extends Mg{constructor(e){super(),this.type="Path",this.currentPoint=new N,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,r=e.length;t<r;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 r=new an(this.currentPoint.clone(),new N(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,n){let s=new Gn(this.currentPoint.clone(),new N(e,t),new N(r,n));return this.curves.push(s),this.currentPoint.set(r,n),this}bezierCurveTo(e,t,r,n,s,o){let a=new on(this.currentPoint.clone(),new N(e,t),new N(r,n),new N(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),r=new Co(t);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,n,s,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,r,n,s,o),this}absarc(e,t,r,n,s,o){return this.absellipse(e,t,r,r,n,s,o),this}ellipse(e,t,r,n,s,o,a,l){let c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,r,n,s,o,a,l),this}absellipse(e,t,r,n,s,o,a,l){let c=new Bs(e,t,r,n,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}},Oa=class extends Ie{constructor(e=[new N(0,.5),new N(.5,0),new N(0,-.5)],t=12,r=0,n=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},t=Math.floor(t),n=yr(n,0,Math.PI*2);let s=[],o=[],a=[],l=[],c=[],u=1/t,h=new A,f=new N,d=new A,m=new A,p=new A,g=0,y=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:g=e[v+1].x-e[v].x,y=e[v+1].y-e[v].y,d.x=y*1,d.y=-g,d.z=y*0,p.copy(d),d.normalize(),l.push(d.x,d.y,d.z);break;case e.length-1:l.push(p.x,p.y,p.z);break;default:g=e[v+1].x-e[v].x,y=e[v+1].y-e[v].y,d.x=y*1,d.y=-g,d.z=y*0,m.copy(d),d.x+=p.x,d.y+=p.y,d.z+=p.z,d.normalize(),l.push(d.x,d.y,d.z),p.copy(m)}for(let v=0;v<=t;v++){let b=r+v*u*n,w=Math.sin(b),x=Math.cos(b);for(let E=0;E<=e.length-1;E++){h.x=e[E].x*w,h.y=e[E].y,h.z=e[E].x*x,o.push(h.x,h.y,h.z),f.x=v/t,f.y=E/(e.length-1),a.push(f.x,f.y);let T=l[3*E+0]*w,S=l[3*E+1],I=l[3*E+0]*x;c.push(T,S,I)}}for(let v=0;v<t;v++)for(let b=0;b<e.length-1;b++){let w=b+v*e.length,x=w,E=w+e.length,T=w+e.length+1,S=w+1;s.push(x,E,S),s.push(T,S,E)}this.setIndex(s),this.setAttribute("position",new Le(o,3)),this.setAttribute("uv",new Le(a,2)),this.setAttribute("normal",new Le(c,3))}static fromJSON(e){return new Oa(e.points,e.segments,e.phiStart,e.phiLength)}};var Lo=class extends Ie{constructor(e=1,t=1,r=1,n=8,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;n=Math.floor(n),s=Math.floor(s);let u=[],h=[],f=[],d=[],m=0,p=[],g=r/2,y=0;v(),o===!1&&(e>0&&b(!0),t>0&&b(!1)),this.setIndex(u),this.setAttribute("position",new Le(h,3)),this.setAttribute("normal",new Le(f,3)),this.setAttribute("uv",new Le(d,2));function v(){let w=new A,x=new A,E=0,T=(t-e)/r;for(let S=0;S<=s;S++){let I=[],C=S/s,M=C*(t-e)+e;for(let _=0;_<=n;_++){let R=_/n,B=R*l+a,O=Math.sin(B),z=Math.cos(B);x.x=M*O,x.y=-C*r+g,x.z=M*z,h.push(x.x,x.y,x.z),w.set(O,T,z).normalize(),f.push(w.x,w.y,w.z),d.push(R,1-C),I.push(m++)}p.push(I)}for(let S=0;S<n;S++)for(let I=0;I<s;I++){let C=p[I][S],M=p[I+1][S],_=p[I+1][S+1],R=p[I][S+1];u.push(C,M,R),u.push(M,_,R),E+=6}c.addGroup(y,E,0),y+=E}function b(w){let x=m,E=new N,T=new A,S=0,I=w===!0?e:t,C=w===!0?1:-1;for(let _=1;_<=n;_++)h.push(0,g*C,0),f.push(0,C,0),d.push(.5,.5),m++;let M=m;for(let _=0;_<=n;_++){let B=_/n*l+a,O=Math.cos(B),z=Math.sin(B);T.x=I*z,T.y=g*C,T.z=I*O,h.push(T.x,T.y,T.z),f.push(0,C,0),E.x=O*.5+.5,E.y=z*.5*C+.5,d.push(E.x,E.y),m++}for(let _=0;_<n;_++){let R=x+_,B=M+_;w===!0?u.push(B,B+1,R):u.push(B+1,B,R),S+=3}c.addGroup(y,S,w===!0?1:2),y+=S}}static fromJSON(e){return new Lo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Fa=class extends Lo{constructor(e=1,t=1,r=8,n=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,r,n,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:n,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new Fa(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Ua=class extends Ie{constructor(e=[],t=[],r=1,n=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:n};let s=[],o=[];a(n),c(r),u(),this.setAttribute("position",new Le(s,3)),this.setAttribute("normal",new Le(s.slice(),3)),this.setAttribute("uv",new Le(o,2)),n===0?this.computeVertexNormals():this.normalizeNormals();function a(v){let b=new A,w=new A,x=new A;for(let E=0;E<t.length;E+=3)d(t[E+0],b),d(t[E+1],w),d(t[E+2],x),l(b,w,x,v)}function l(v,b,w,x){let E=x+1,T=[];for(let S=0;S<=E;S++){T[S]=[];let I=v.clone().lerp(w,S/E),C=b.clone().lerp(w,S/E),M=E-S;for(let _=0;_<=M;_++)_===0&&S===E?T[S][_]=I:T[S][_]=I.clone().lerp(C,_/M)}for(let S=0;S<E;S++)for(let I=0;I<2*(E-S)-1;I++){let C=Math.floor(I/2);I%2===0?(f(T[S][C+1]),f(T[S+1][C]),f(T[S][C])):(f(T[S][C+1]),f(T[S+1][C+1]),f(T[S+1][C]))}}function c(v){let b=new A;for(let w=0;w<s.length;w+=3)b.x=s[w+0],b.y=s[w+1],b.z=s[w+2],b.normalize().multiplyScalar(v),s[w+0]=b.x,s[w+1]=b.y,s[w+2]=b.z}function u(){let v=new A;for(let b=0;b<s.length;b+=3){v.x=s[b+0],v.y=s[b+1],v.z=s[b+2];let w=g(v)/2/Math.PI+.5,x=y(v)/Math.PI+.5;o.push(w,1-x)}m(),h()}function h(){for(let v=0;v<o.length;v+=6){let b=o[v+0],w=o[v+2],x=o[v+4],E=Math.max(b,w,x),T=Math.min(b,w,x);E>.9&&T<.1&&(b<.2&&(o[v+0]+=1),w<.2&&(o[v+2]+=1),x<.2&&(o[v+4]+=1))}}function f(v){s.push(v.x,v.y,v.z)}function d(v,b){let w=v*3;b.x=e[w+0],b.y=e[w+1],b.z=e[w+2]}function m(){let v=new A,b=new A,w=new A,x=new A,E=new N,T=new N,S=new N;for(let I=0,C=0;I<s.length;I+=9,C+=6){v.set(s[I+0],s[I+1],s[I+2]),b.set(s[I+3],s[I+4],s[I+5]),w.set(s[I+6],s[I+7],s[I+8]),E.set(o[C+0],o[C+1]),T.set(o[C+2],o[C+3]),S.set(o[C+4],o[C+5]),x.copy(v).add(b).add(w).divideScalar(3);let M=g(x);p(E,C+0,v,M),p(T,C+2,b,M),p(S,C+4,w,M)}}function p(v,b,w,x){x<0&&v.x===1&&(o[b]=v.x-1),w.x===0&&w.z===0&&(o[b]=x/2/Math.PI+.5)}function g(v){return Math.atan2(v.z,-v.x)}function y(v){return Math.atan2(-v.y,Math.sqrt(v.x*v.x+v.z*v.z))}}static fromJSON(e){return new Ua(e.vertices,e.indices,e.radius,e.details)}},za=class extends Ua{constructor(e=1,t=0){let r=(1+Math.sqrt(5))/2,n=1/r,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],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 za(e.radius,e.detail)}},Oz=new A,Fz=new A,Uz=new A,zz=new Jt;var tn=class extends Na{constructor(e){super(e),this.uuid=Fn(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let r=0,n=this.holes.length;r<n;r++)t[r]=this.holes[r].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,r=e.holes.length;t<r;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,r=this.holes.length;t<r;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){let n=e.holes[t];this.holes.push(new Na().fromJSON(n))}return this}},mP={triangulate:function(i,e,t=2){let r=e&&e.length,n=r?e[0]*t:i.length,s=bb(i,0,n,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,h,f,d;if(r&&(s=bP(i,e,s,t)),i.length>80*t){a=c=i[0],l=u=i[1];for(let m=t;m<n;m+=t)h=i[m],f=i[m+1],h<a&&(a=h),f<l&&(l=f),h>c&&(c=h),f>u&&(u=f);d=Math.max(c-a,u-l),d=d!==0?1/d:0}return ru(s,o,t,a,l,d),o}};function bb(i,e,t,r,n){let s,o;if(n===PP(i,e,t,r)>0)for(s=e;s<t;s+=r)o=G0(s,i[s],i[s+1],o);else for(s=t-r;s>=e;s-=r)o=G0(s,i[s],i[s+1],o);return o&&$f(o,o.next)&&(iu(o),o=o.next),o}function Ns(i,e){if(!i)return i;e||(e=i);let t=i,r;do if(r=!1,!t.steiner&&($f(t,t.next)||$t(t.prev,t,t.next)===0)){if(iu(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function ru(i,e,t,r,n,s,o){if(!i)return;!o&&s&&TP(i,r,n,s);let a=i,l,c;for(;i.prev!==i.next;){if(l=i.prev,c=i.next,s?yP(i,r,n,s):gP(i)){e.push(l.i/t),e.push(i.i/t),e.push(c.i/t),iu(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=vP(Ns(i),e,t),ru(i,e,t,r,n,s,2)):o===2&&xP(i,e,t,r,n,s):ru(Ns(i),e,t,r,n,s,1);break}}}function gP(i){let e=i.prev,t=i,r=i.next;if($t(e,t,r)>=0)return!1;let n=i.next.next;for(;n!==i.prev;){if(_a(e.x,e.y,t.x,t.y,r.x,r.y,n.x,n.y)&&$t(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function yP(i,e,t,r){let n=i.prev,s=i,o=i.next;if($t(n,s,o)>=0)return!1;let a=n.x<s.x?n.x<o.x?n.x:o.x:s.x<o.x?s.x:o.x,l=n.y<s.y?n.y<o.y?n.y:o.y:s.y<o.y?s.y:o.y,c=n.x>s.x?n.x>o.x?n.x:o.x:s.x>o.x?s.x:o.x,u=n.y>s.y?n.y>o.y?n.y:o.y:s.y>o.y?s.y:o.y,h=Ag(a,l,e,t,r),f=Ag(c,u,e,t,r),d=i.prevZ,m=i.nextZ;for(;d&&d.z>=h&&m&&m.z<=f;){if(d!==i.prev&&d!==i.next&&_a(n.x,n.y,s.x,s.y,o.x,o.y,d.x,d.y)&&$t(d.prev,d,d.next)>=0||(d=d.prevZ,m!==i.prev&&m!==i.next&&_a(n.x,n.y,s.x,s.y,o.x,o.y,m.x,m.y)&&$t(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;d&&d.z>=h;){if(d!==i.prev&&d!==i.next&&_a(n.x,n.y,s.x,s.y,o.x,o.y,d.x,d.y)&&$t(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=f;){if(m!==i.prev&&m!==i.next&&_a(n.x,n.y,s.x,s.y,o.x,o.y,m.x,m.y)&&$t(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function vP(i,e,t){let r=i;do{let n=r.prev,s=r.next.next;!$f(n,s)&&wb(n,r,r.next,s)&&nu(n,s)&&nu(s,n)&&(e.push(n.i/t),e.push(r.i/t),e.push(s.i/t),iu(r),iu(r.next),r=i=s),r=r.next}while(r!==i);return Ns(r)}function xP(i,e,t,r,n,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&CP(o,a)){let l=Sb(o,a);o=Ns(o,o.next),l=Ns(l,l.next),ru(o,e,t,r,n,s),ru(l,e,t,r,n,s);return}a=a.next}o=o.next}while(o!==i)}function bP(i,e,t,r){let n=[],s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*r,l=s<o-1?e[s+1]*r:i.length,c=bb(i,a,l,r,!1),c===c.next&&(c.steiner=!0),n.push(_P(c));for(n.sort(wP),s=0;s<n.length;s++)SP(n[s],t),t=Ns(t,t.next);return t}function wP(i,e){return i.x-e.x}function SP(i,e){if(e=MP(i,e),e){let t=Sb(e,i);Ns(e,e.next),Ns(t,t.next)}}function MP(i,e){let t=e,r=i.x,n=i.y,s=-1/0,o;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){let f=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=r&&f>s){if(s=f,f===r){if(n===t.y)return t;if(n===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(r===s)return o;let a=o,l=o.x,c=o.y,u=1/0,h;t=o;do r>=t.x&&t.x>=l&&r!==t.x&&_a(n<c?r:s,n,l,c,n<c?s:r,n,t.x,t.y)&&(h=Math.abs(n-t.y)/(r-t.x),nu(t,i)&&(h<u||h===u&&(t.x>o.x||t.x===o.x&&AP(o,t)))&&(o=t,u=h)),t=t.next;while(t!==a);return o}function AP(i,e){return $t(i.prev,i,e.prev)<0&&$t(e.next,i,i.next)<0}function TP(i,e,t,r){let n=i;do n.z===null&&(n.z=Ag(n.x,n.y,e,t,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==i);n.prevZ.nextZ=null,n.prevZ=null,EP(n)}function EP(i){let e,t,r,n,s,o,a,l,c=1;do{for(t=i,i=null,s=null,o=0;t;){for(o++,r=t,a=0,e=0;e<c&&(a++,r=r.nextZ,!!r);e++);for(l=c;a>0||l>0&&r;)a!==0&&(l===0||!r||t.z<=r.z)?(n=t,t=t.nextZ,a--):(n=r,r=r.nextZ,l--),s?s.nextZ=n:i=n,n.prevZ=s,s=n;t=r}s.nextZ=null,c*=2}while(o>1);return i}function Ag(i,e,t,r,n){return i=32767*(i-t)*n,e=32767*(e-r)*n,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function _P(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function _a(i,e,t,r,n,s,o,a){return(n-o)*(e-a)-(i-o)*(s-a)>=0&&(i-o)*(r-a)-(t-o)*(e-a)>=0&&(t-o)*(s-a)-(n-o)*(r-a)>=0}function CP(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!LP(i,e)&&(nu(i,e)&&nu(e,i)&&DP(i,e)&&($t(i.prev,i,e.prev)||$t(i,e.prev,e))||$f(i,e)&&$t(i.prev,i,i.next)>0&&$t(e.prev,e,e.next)>0)}function $t(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function $f(i,e){return i.x===e.x&&i.y===e.y}function wb(i,e,t,r){let n=tf($t(i,e,t)),s=tf($t(i,e,r)),o=tf($t(t,r,i)),a=tf($t(t,r,e));return!!(n!==s&&o!==a||n===0&&ef(i,t,e)||s===0&&ef(i,r,e)||o===0&&ef(t,i,r)||a===0&&ef(t,e,r))}function ef(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function tf(i){return i>0?1:i<0?-1:0}function LP(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&wb(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function nu(i,e){return $t(i.prev,i,i.next)<0?$t(i,e,i.next)>=0&&$t(i,i.prev,e)>=0:$t(i,e,i.prev)<0||$t(i,i.next,e)<0}function DP(i,e){let t=i,r=!1,n=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&n<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==i);return r}function Sb(i,e){let t=new Tg(i.i,i.x,i.y),r=new Tg(e.i,e.x,e.y),n=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=n,n.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function G0(i,e,t,r){let n=new Tg(i,e,t);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function iu(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Tg(i,e,t){this.i=i,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 PP(i,e,t,r){let n=0;for(let s=e,o=t-r;s<t;s+=r)n+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return n}var ni=class{static area(e){let t=e.length,r=0;for(let n=t-1,s=0;s<t;n=s++)r+=e[n].x*e[s].y-e[s].x*e[n].y;return r*.5}static isClockWise(e){return ni.area(e)<0}static triangulateShape(e,t){let r=[],n=[],s=[];k0(e),V0(r,e);let o=e.length;t.forEach(k0);for(let l=0;l<t.length;l++)n.push(o),o+=t[l].length,V0(r,t[l]);let a=mP.triangulate(r,n);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function k0(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function V0(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var Os=class extends Ie{constructor(e=new tn([new N(.5,.5),new N(-.5,.5),new N(-.5,-.5),new N(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let r=this,n=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new Le(n,3)),this.setAttribute("uv",new Le(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:1,f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,m=t.bevelSize!==void 0?t.bevelSize:d-.1,p=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3,y=t.extrudePath,v=t.UVGenerator!==void 0?t.UVGenerator:IP;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),h=t.amount);let b,w=!1,x,E,T,S;y&&(b=y.getSpacedPoints(u),w=!0,f=!1,x=y.computeFrenetFrames(u,!1),E=new A,T=new A,S=new A),f||(g=0,d=0,m=0,p=0);let I=a.extractPoints(c),C=I.shape,M=I.holes;if(!ni.isClockWise(C)){C=C.reverse();for(let Y=0,H=M.length;Y<H;Y++){let Q=M[Y];ni.isClockWise(Q)&&(M[Y]=Q.reverse())}}let R=ni.triangulateShape(C,M),B=C;for(let Y=0,H=M.length;Y<H;Y++){let Q=M[Y];C=C.concat(Q)}function O(Y,H,Q){return H||console.error("THREE.ExtrudeGeometry: vec does not exist"),H.clone().multiplyScalar(Q).add(Y)}let z=C.length,q=R.length;function F(Y,H,Q){let ce,ie,pe,ve=Y.x-H.x,me=Y.y-H.y,De=Q.x-Y.x,ke=Q.y-Y.y,P=ve*ve+me*me,L=ve*ke-me*De;if(Math.abs(L)>Number.EPSILON){let te=Math.sqrt(P),ye=Math.sqrt(De*De+ke*ke),Se=H.x-me/te,Pe=H.y+ve/te,Fe=Q.x-ke/ye,he=Q.y+De/ye,rt=((Fe-Se)*ke-(he-Pe)*De)/(ve*ke-me*De);ce=Se+ve*rt-Y.x,ie=Pe+me*rt-Y.y;let st=ce*ce+ie*ie;if(st<=2)return new N(ce,ie);pe=Math.sqrt(st/2)}else{let te=!1;ve>Number.EPSILON?De>Number.EPSILON&&(te=!0):ve<-Number.EPSILON?De<-Number.EPSILON&&(te=!0):Math.sign(me)===Math.sign(ke)&&(te=!0),te?(ce=-me,ie=ve,pe=Math.sqrt(P)):(ce=ve,ie=me,pe=Math.sqrt(P/2))}return new N(ce/pe,ie/pe)}let ee=[];for(let Y=0,H=B.length,Q=H-1,ce=Y+1;Y<H;Y++,Q++,ce++)Q===H&&(Q=0),ce===H&&(ce=0),ee[Y]=F(B[Y],B[Q],B[ce]);let k=[],V,U=ee.concat();for(let Y=0,H=M.length;Y<H;Y++){let Q=M[Y];V=[];for(let ce=0,ie=Q.length,pe=ie-1,ve=ce+1;ce<ie;ce++,pe++,ve++)pe===ie&&(pe=0),ve===ie&&(ve=0),V[ce]=F(Q[ce],Q[pe],Q[ve]);k.push(V),U=U.concat(V)}for(let Y=0;Y<g;Y++){let H=Y/g,Q=d*Math.cos(H*Math.PI/2),ce=m*Math.sin(H*Math.PI/2)+p;for(let ie=0,pe=B.length;ie<pe;ie++){let ve=O(B[ie],ee[ie],ce);ge(ve.x,ve.y,-Q)}for(let ie=0,pe=M.length;ie<pe;ie++){let ve=M[ie];V=k[ie];for(let me=0,De=ve.length;me<De;me++){let ke=O(ve[me],V[me],ce);ge(ke.x,ke.y,-Q)}}}let J=m+p;for(let Y=0;Y<z;Y++){let H=f?O(C[Y],U[Y],J):C[Y];w?(T.copy(x.normals[0]).multiplyScalar(H.x),E.copy(x.binormals[0]).multiplyScalar(H.y),S.copy(b[0]).add(T).add(E),ge(S.x,S.y,S.z)):ge(H.x,H.y,0)}for(let Y=1;Y<=u;Y++)for(let H=0;H<z;H++){let Q=f?O(C[H],U[H],J):C[H];w?(T.copy(x.normals[Y]).multiplyScalar(Q.x),E.copy(x.binormals[Y]).multiplyScalar(Q.y),S.copy(b[Y]).add(T).add(E),ge(S.x,S.y,S.z)):ge(Q.x,Q.y,h/u*Y)}for(let Y=g-1;Y>=0;Y--){let H=Y/g,Q=d*Math.cos(H*Math.PI/2),ce=m*Math.sin(H*Math.PI/2)+p;for(let ie=0,pe=B.length;ie<pe;ie++){let ve=O(B[ie],ee[ie],ce);ge(ve.x,ve.y,h+Q)}for(let ie=0,pe=M.length;ie<pe;ie++){let ve=M[ie];V=k[ie];for(let me=0,De=ve.length;me<De;me++){let ke=O(ve[me],V[me],ce);w?ge(ke.x,ke.y+b[u-1].y,b[u-1].x+Q):ge(ke.x,ke.y,h+Q)}}}K(),$();function K(){let Y=n.length/3;if(f){let H=0,Q=z*H;for(let ce=0;ce<q;ce++){let ie=R[ce];ae(ie[2]+Q,ie[1]+Q,ie[0]+Q)}H=u+g*2,Q=z*H;for(let ce=0;ce<q;ce++){let ie=R[ce];ae(ie[0]+Q,ie[1]+Q,ie[2]+Q)}}else{for(let H=0;H<q;H++){let Q=R[H];ae(Q[2],Q[1],Q[0])}for(let H=0;H<q;H++){let Q=R[H];ae(Q[0]+z*u,Q[1]+z*u,Q[2]+z*u)}}r.addGroup(Y,n.length/3-Y,0)}function $(){let Y=n.length/3,H=0;j(B,H),H+=B.length;for(let Q=0,ce=M.length;Q<ce;Q++){let ie=M[Q];j(ie,H),H+=ie.length}r.addGroup(Y,n.length/3-Y,1)}function j(Y,H){let Q=Y.length;for(;--Q>=0;){let ce=Q,ie=Q-1;ie<0&&(ie=Y.length-1);for(let pe=0,ve=u+g*2;pe<ve;pe++){let me=z*pe,De=z*(pe+1),ke=H+ce+me,P=H+ie+me,L=H+ie+De,te=H+ce+De;le(ke,P,L,te)}}}function ge(Y,H,Q){l.push(Y),l.push(H),l.push(Q)}function ae(Y,H,Q){W(Y),W(H),W(Q);let ce=n.length/3,ie=v.generateTopUV(r,n,ce-3,ce-2,ce-1);ue(ie[0]),ue(ie[1]),ue(ie[2])}function le(Y,H,Q,ce){W(Y),W(H),W(ce),W(H),W(Q),W(ce);let ie=n.length/3,pe=v.generateSideWallUV(r,n,ie-6,ie-3,ie-2,ie-1);ue(pe[0]),ue(pe[1]),ue(pe[3]),ue(pe[1]),ue(pe[2]),ue(pe[3])}function W(Y){n.push(l[Y*3+0]),n.push(l[Y*3+1]),n.push(l[Y*3+2])}function ue(Y){s.push(Y.x),s.push(Y.y)}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,r=this.parameters.options;return RP(t,r,e)}static fromJSON(e,t){let r=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];r.push(a)}let n=e.options.extrudePath;return n!==void 0&&(e.options.extrudePath=new xb[n.type]().fromJSON(n)),new Os(r,e.options)}},IP={generateTopUV:function(i,e,t,r,n){let s=e[t*3],o=e[t*3+1],a=e[r*3],l=e[r*3+1],c=e[n*3],u=e[n*3+1];return[new N(s,o),new N(a,l),new N(c,u)]},generateSideWallUV:function(i,e,t,r,n,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[r*3],u=e[r*3+1],h=e[r*3+2],f=e[n*3],d=e[n*3+1],m=e[n*3+2],p=e[s*3],g=e[s*3+1],y=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new N(o,1-l),new N(c,1-h),new N(f,1-m),new N(p,1-y)]:[new N(a,1-l),new N(u,1-h),new N(d,1-m),new N(g,1-y)]}};function RP(i,e,t){if(t.shapes=[],Array.isArray(i))for(let r=0,n=i.length;r<n;r++){let s=i[r];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var Ga=class extends Ua{constructor(e=1,t=0){let r=(1+Math.sqrt(5))/2,n=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(n,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ga(e.radius,e.detail)}};var Do=class extends Ie{constructor(e=new tn([new N(0,.5),new N(-.5,-.5),new N(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let r=[],n=[],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(r),this.setAttribute("position",new Le(n,3)),this.setAttribute("normal",new Le(s,3)),this.setAttribute("uv",new Le(o,2));function c(u){let h=n.length/3,f=u.extractPoints(t),d=f.shape,m=f.holes;ni.isClockWise(d)===!1&&(d=d.reverse());for(let g=0,y=m.length;g<y;g++){let v=m[g];ni.isClockWise(v)===!0&&(m[g]=v.reverse())}let p=ni.triangulateShape(d,m);for(let g=0,y=m.length;g<y;g++){let v=m[g];d=d.concat(v)}for(let g=0,y=d.length;g<y;g++){let v=d[g];n.push(v.x,v.y,0),s.push(0,0,1),o.push(v.x,v.y)}for(let g=0,y=p.length;g<y;g++){let v=p[g],b=v[0]+h,w=v[1]+h,x=v[2]+h;r.push(b,w,x),l+=3}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return BP(t,e)}static fromJSON(e,t){let r=[];for(let n=0,s=e.shapes.length;n<s;n++){let o=t[e.shapes[n]];r.push(o)}return new Do(r,e.curveSegments)}};function BP(i,e){if(e.shapes=[],Array.isArray(i))for(let t=0,r=i.length;t<r;t++){let n=i[t];e.shapes.push(n.uuid)}else e.shapes.push(i.uuid);return e}var Po=class extends Ie{constructor(e=1,t=32,r=16,n=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),r=Math.max(2,Math.floor(r));let l=Math.min(o+a,Math.PI),c=0,u=[],h=new A,f=new A,d=[],m=[],p=[],g=[];for(let y=0;y<=r;y++){let v=[],b=y/r,w=0;y==0&&o==0?w=.5/t:y==r&&l==Math.PI&&(w=-.5/t);for(let x=0;x<=t;x++){let E=x/t;h.x=-e*Math.cos(n+E*s)*Math.sin(o+b*a),h.y=e*Math.cos(o+b*a),h.z=e*Math.sin(n+E*s)*Math.sin(o+b*a),m.push(h.x,h.y,h.z),f.copy(h).normalize(),p.push(f.x,f.y,f.z),g.push(E+w,1-b),v.push(c++)}u.push(v)}for(let y=0;y<r;y++)for(let v=0;v<t;v++){let b=u[y][v+1],w=u[y][v],x=u[y+1][v],E=u[y+1][v+1];(y!==0||o>0)&&d.push(b,w,E),(y!==r-1||l<Math.PI)&&d.push(w,x,E)}this.setIndex(d),this.setAttribute("position",new Le(m,3)),this.setAttribute("normal",new Le(p,3)),this.setAttribute("uv",new Le(g,2))}static fromJSON(e){return new Po(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var ka=class extends Ie{constructor(e=1,t=.4,r=64,n=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:n,p:s,q:o},r=Math.floor(r),n=Math.floor(n);let a=[],l=[],c=[],u=[],h=new A,f=new A,d=new A,m=new A,p=new A,g=new A,y=new A;for(let b=0;b<=r;++b){let w=b/r*s*Math.PI*2;v(w,s,o,e,d),v(w+.01,s,o,e,m),g.subVectors(m,d),y.addVectors(m,d),p.crossVectors(g,y),y.crossVectors(p,g),p.normalize(),y.normalize();for(let x=0;x<=n;++x){let E=x/n*Math.PI*2,T=-t*Math.cos(E),S=t*Math.sin(E);h.x=d.x+(T*y.x+S*p.x),h.y=d.y+(T*y.y+S*p.y),h.z=d.z+(T*y.z+S*p.z),l.push(h.x,h.y,h.z),f.subVectors(h,d).normalize(),c.push(f.x,f.y,f.z),u.push(b/r),u.push(x/n)}}for(let b=1;b<=r;b++)for(let w=1;w<=n;w++){let x=(n+1)*(b-1)+(w-1),E=(n+1)*b+(w-1),T=(n+1)*b+w,S=(n+1)*(b-1)+w;a.push(x,E,S),a.push(E,T,S)}this.setIndex(a),this.setAttribute("position",new Le(l,3)),this.setAttribute("normal",new Le(c,3)),this.setAttribute("uv",new Le(u,2));function v(b,w,x,E,T){let S=Math.cos(b),I=Math.sin(b),C=x/w*b,M=Math.cos(C);T.x=E*(2+M)*.5*S,T.y=E*(2+M)*I*.5,T.z=E*Math.sin(C)*.5}}static fromJSON(e){return new ka(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}};var Tf=class extends cr{constructor(e){super(),this.type="ShadowMaterial",this.color=new xe(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}};Tf.prototype.isShadowMaterial=!0;var Ef=class extends St{constructor(e){super(e),this.type="RawShaderMaterial"}};Ef.prototype.isRawShaderMaterial=!0;var su=class extends cr{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new xe(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 xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qa,this.normalScale=new N(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.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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}};su.prototype.isMeshStandardMaterial=!0;var _f=class extends su{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new N(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return yr(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new xe(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}};_f.prototype.isMeshPhysicalMaterial=!0;var Cf=class extends cr{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new xe(16777215),this.specular=new xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qa,this.normalScale=new N(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Kf,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}};Cf.prototype.isMeshPhongMaterial=!0;var Lf=class extends cr{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qa,this.normalScale=new N(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}};Lf.prototype.isMeshToonMaterial=!0;var Df=class extends cr{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qa,this.normalScale=new N(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}};Df.prototype.isMeshNormalMaterial=!0;var Pf=class extends cr{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Kf,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}};Pf.prototype.isMeshLambertMaterial=!0;var If=class extends cr{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qa,this.normalScale=new N(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}};If.prototype.isMeshMatcapMaterial=!0;var Rf=class extends Ur{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}};Rf.prototype.isLineDashedMaterial=!0;var NP={ShadowMaterial:Tf,SpriteMaterial:Zc,RawShaderMaterial:Ef,ShaderMaterial:St,PointsMaterial:$c,MeshPhysicalMaterial:_f,MeshStandardMaterial:su,MeshPhongMaterial:Cf,MeshToonMaterial:Lf,MeshNormalMaterial:Df,MeshLambertMaterial:Pf,MeshDepthMaterial:Jc,MeshDistanceMaterial:Qc,MeshBasicMaterial:Un,MeshMatcapMaterial:If,LineDashedMaterial:Rf,LineBasicMaterial:Ur,Material:cr};cr.fromType=function(i){return new NP[i]};var Yt={arraySlice:function(i,e,t){return Yt.isTypedArray(i)?new i.constructor(i.subarray(e,t!==void 0?t:i.length)):i.slice(e,t)},convertArray:function(i,e,t){return!i||!t&&i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)},isTypedArray:function(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)},getKeyframeOrder:function(i){function e(n,s){return i[n]-i[s]}let t=i.length,r=new Array(t);for(let n=0;n!==t;++n)r[n]=n;return r.sort(e),r},sortedArray:function(i,e,t){let r=i.length,n=new i.constructor(r);for(let s=0,o=0;o!==r;++s){let a=t[s]*e;for(let l=0;l!==e;++l)n[o++]=i[a+l]}return n},flattenJSON:function(i,e,t,r){let n=1,s=i[0];for(;s!==void 0&&s[r]===void 0;)s=i[n++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=i[n++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=i[n++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),t.push(o)),s=i[n++];while(s!==void 0)},subclip:function(i,e,t,r,n=30){let s=i.clone();s.name=e;let o=[];for(let l=0;l<s.tracks.length;++l){let c=s.tracks[l],u=c.getValueSize(),h=[],f=[];for(let d=0;d<c.times.length;++d){let m=c.times[d]*n;if(!(m<t||m>=r)){h.push(c.times[d]);for(let p=0;p<u;++p)f.push(c.values[d*u+p])}}h.length!==0&&(c.times=Yt.convertArray(h,c.times.constructor),c.values=Yt.convertArray(f,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(i,e=0,t=i,r=30){r<=0&&(r=30);let n=t.tracks.length,s=e/r;for(let o=0;o<n;++o){let a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;let c=i.tracks.find(function(y){return y.name===a.name&&y.ValueTypeName===l});if(c===void 0)continue;let u=0,h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let f=0,d=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);let m=a.times.length-1,p;if(s<=a.times[0]){let y=u,v=h-u;p=Yt.arraySlice(a.values,y,v)}else if(s>=a.times[m]){let y=m*h+u,v=y+h-u;p=Yt.arraySlice(a.values,y,v)}else{let y=a.createInterpolant(),v=u,b=h-u;y.evaluate(s),p=Yt.arraySlice(y.resultBuffer,v,b)}l==="quaternion"&&new Ut().fromArray(p).normalize().conjugate().toArray(p);let g=c.times.length;for(let y=0;y<g;++y){let v=y*d+f;if(l==="quaternion")Ut.multiplyQuaternionsFlat(c.values,v,p,0,c.values,v);else{let b=d-f*2;for(let w=0;w<b;++w)c.values[v+w]-=p[w]}}}return i.blendMode=sb,i}},Ti=class{constructor(e,t,r,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=n!==void 0?n:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,r=this._cachedIndex,n=t[r],s=t[r-1];e:{t:{let o;r:{n:if(!(e<n)){for(let a=r+2;;){if(n===void 0){if(e<s)break n;return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,e,s)}if(r===a)break;if(s=n,n=t[++r],e<n)break t}o=t.length;break r}if(!(e>=s)){let a=t[1];e<a&&(r=2,s=a);for(let l=r-2;;){if(s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(r===l)break;if(n=s,s=t[--r-1],e>=s)break t}o=r,r=0;break r}break e}for(;r<o;){let a=r+o>>>1;e<t[a]?o=a:r=a+1}if(n=t[r],s=t[r-1],s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(n===void 0)return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,s,e)}this._cachedIndex=r,this.intervalChanged_(r,s,n)}return this.interpolate_(r,s,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,s=e*n;for(let o=0;o!==n;++o)t[o]=r[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}};Ti.prototype.beforeStart_=Ti.prototype.copySampleValue_;Ti.prototype.afterEnd_=Ti.prototype.copySampleValue_;var Eg=class extends Ti{constructor(e,t,r,n){super(e,t,r,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Aa,endingEnd:Aa}}intervalChanged_(e,t,r){let n=this.parameterPositions,s=e-2,o=e+1,a=n[s],l=n[o];if(a===void 0)switch(this.getSettings_().endingStart){case Ta:s=e,a=2*t-r;break;case hf:s=n.length-2,a=t+n[s]-n[s+1];break;default:s=e,a=r}if(l===void 0)switch(this.getSettings_().endingEnd){case Ta:o=e,l=2*r-t;break;case hf:o=1,l=r+n[1]-n[0];break;default:o=e-1,l=t}let c=(r-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-r),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,d=this._weightNext,m=(r-t)/(n-t),p=m*m,g=p*m,y=-f*g+2*f*p-f*m,v=(1+f)*g+(-1.5-2*f)*p+(-.5+f)*m+1,b=(-1-d)*g+(1.5+d)*p+.5*m,w=d*g-d*p;for(let x=0;x!==a;++x)s[x]=y*o[u+x]+v*o[c+x]+b*o[l+x]+w*o[h+x];return s}},Bf=class extends Ti{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(r-t)/(n-t),h=1-u;for(let f=0;f!==a;++f)s[f]=o[c+f]*h+o[l+f]*u;return s}},_g=class extends Ti{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e){return this.copySampleValue_(e-1)}},kn=class{constructor(e,t,r,n){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Yt.convertArray(t,this.TimeBufferType),this.values=Yt.convertArray(r,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,r;if(t.toJSON!==this.toJSON)r=t.toJSON(e);else{r={name:e.name,times:Yt.convertArray(e.times,Array),values:Yt.convertArray(e.values,Array)};let n=e.getInterpolation();n!==e.DefaultInterpolation&&(r.interpolation=n)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new _g(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Bf(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Eg(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case cf:t=this.InterpolantFactoryMethodDiscrete;break;case uf:t=this.InterpolantFactoryMethodLinear;break;case xm:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let r="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(r);return console.warn("THREE.KeyframeTrack:",r),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return cf;case this.InterpolantFactoryMethodLinear:return uf;case this.InterpolantFactoryMethodSmooth:return xm}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let r=0,n=t.length;r!==n;++r)t[r]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let r=0,n=t.length;r!==n;++r)t[r]*=e}return this}trim(e,t){let r=this.times,n=r.length,s=0,o=n-1;for(;s!==n&&r[s]<e;)++s;for(;o!==-1&&r[o]>t;)--o;if(++o,s!==0||o!==n){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=Yt.arraySlice(r,s,o),this.values=Yt.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 r=this.times,n=this.values,s=r.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=r[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(n!==void 0&&Yt.isTypedArray(n))for(let a=0,l=n.length;a!==l;++a){let c=n[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=Yt.arraySlice(this.times),t=Yt.arraySlice(this.values),r=this.getValueSize(),n=this.getInterpolation()===xm,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(n)l=!0;else{let h=a*r,f=h-r,d=h+r;for(let m=0;m!==r;++m){let p=t[h+m];if(p!==t[f+m]||p!==t[d+m]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let h=a*r,f=o*r;for(let d=0;d!==r;++d)t[f+d]=t[h+d]}++o}}if(s>0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=Yt.arraySlice(e,0,o),this.values=Yt.arraySlice(t,0,o*r)):(this.times=e,this.values=t),this}clone(){let e=Yt.arraySlice(this.times,0),t=Yt.arraySlice(this.values,0),r=this.constructor,n=new r(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}};kn.prototype.TimeBufferType=Float32Array;kn.prototype.ValueBufferType=Float32Array;kn.prototype.DefaultInterpolation=uf;var Fs=class extends kn{};Fs.prototype.ValueTypeName="bool";Fs.prototype.ValueBufferType=Array;Fs.prototype.DefaultInterpolation=cf;Fs.prototype.InterpolantFactoryMethodLinear=void 0;Fs.prototype.InterpolantFactoryMethodSmooth=void 0;var Nf=class extends kn{};Nf.prototype.ValueTypeName="color";var Va=class extends kn{};Va.prototype.ValueTypeName="number";var Cg=class extends Ti{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-t)/(n-t),c=e*a;for(let u=c+a;c!==u;c+=4)Ut.slerpFlat(s,0,o,c-a,o,c,l);return s}},Io=class extends kn{InterpolantFactoryMethodLinear(e){return new Cg(this.times,this.values,this.getValueSize(),e)}};Io.prototype.ValueTypeName="quaternion";Io.prototype.DefaultInterpolation=uf;Io.prototype.InterpolantFactoryMethodSmooth=void 0;var Us=class extends kn{};Us.prototype.ValueTypeName="string";Us.prototype.ValueBufferType=Array;Us.prototype.DefaultInterpolation=cf;Us.prototype.InterpolantFactoryMethodLinear=void 0;Us.prototype.InterpolantFactoryMethodSmooth=void 0;var Ha=class extends kn{};Ha.prototype.ValueTypeName="vector";var Of=class{constructor(e,t=-1,r,n=Kg){this.name=e,this.tracks=r,this.duration=t,this.blendMode=n,this.uuid=Fn(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],r=e.tracks,n=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)t.push(FP(r[o]).scale(n));let s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){let t=[],r=e.tracks,n={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)t.push(kn.toJSON(r[s]));return n}static CreateFromMorphTargetSequence(e,t,r,n){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=Yt.getKeyframeOrder(l);l=Yt.sortedArray(l,1,u),c=Yt.sortedArray(c,1,u),!n&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new Va(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/r))}return new this(e,-1,o)}static findByName(e,t){let r=e;if(!Array.isArray(e)){let n=e;r=n.geometry&&n.geometry.animations||n.animations}for(let n=0;n<r.length;n++)if(r[n].name===t)return r[n];return null}static CreateClipsFromMorphTargetSequences(e,t,r){let n={},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],f=n[h];f||(n[h]=f=[]),f.push(c)}}let o=[];for(let a in n)o.push(this.CreateFromMorphTargetSequence(a,n[a],t,r));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let r=function(h,f,d,m,p){if(d.length!==0){let g=[],y=[];Yt.flattenJSON(d,g,y,m),g.length!==0&&p.push(new h(f,g,y))}},n=[],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 f=c[h].keys;if(!(!f||f.length===0))if(f[0].morphTargets){let d={},m;for(m=0;m<f.length;m++)if(f[m].morphTargets)for(let p=0;p<f[m].morphTargets.length;p++)d[f[m].morphTargets[p]]=-1;for(let p in d){let g=[],y=[];for(let v=0;v!==f[m].morphTargets.length;++v){let b=f[m];g.push(b.time),y.push(b.morphTarget===p?1:0)}n.push(new Va(".morphTargetInfluence["+p+"]",g,y))}l=d.length*o}else{let d=".bones["+t[h].name+"]";r(Ha,d+".position",f,"pos",n),r(Io,d+".quaternion",f,"rot",n),r(Ha,d+".scale",f,"scl",n)}}return n.length===0?null:new this(s,l,n,a)}resetDuration(){let e=this.tracks,t=0;for(let r=0,n=e.length;r!==n;++r){let s=this.tracks[r];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 OP(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Va;case"vector":case"vector2":case"vector3":case"vector4":return Ha;case"color":return Nf;case"quaternion":return Io;case"bool":case"boolean":return Fs;case"string":return Us}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function FP(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=OP(i.type);if(i.times===void 0){let t=[],r=[];Yt.flattenJSON(i.keys,t,r,"value"),i.times=t,i.values=r}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}var Wa={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}},Ro=class{constructor(e,t,r){let n=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(u){a++,s===!1&&n.onStart!==void 0&&n.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,n.onProgress!==void 0&&n.onProgress(u,o,a),o===a&&(s=!1,n.onLoad!==void 0&&n.onLoad())},this.itemError=function(u){n.onError!==void 0&&n.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,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,f=c.length;h<f;h+=2){let d=c[h],m=c[h+1];if(d.global&&(d.lastIndex=0),d.test(u))return m}return null}}},UP=new Ro,ln=class{constructor(e){this.manager=e!==void 0?e:UP,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let r=this;return new Promise(function(n,s){r.load(e,n,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}},Qi={},is=class extends ln{constructor(e){super(e)}load(e,t,r,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=Wa.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Qi[e]!==void 0){Qi[e].push({onLoad:t,onProgress:r,onError:n});return}Qi[e]=[],Qi[e].push({onLoad:t,onProgress:r,onError:n});let o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;let u=Qi[e],h=c.body.getReader(),f=c.headers.get("Content-Length"),d=f?parseInt(f):0,m=d!==0,p=0,g=new ReadableStream({start(y){v();function v(){h.read().then(({done:b,value:w})=>{if(b)y.close();else{p+=w.byteLength;let x=new ProgressEvent("progress",{lengthComputable:m,loaded:p,total:d});for(let E=0,T=u.length;E<T;E++){let S=u[E];S.onProgress&&S.onProgress(x)}y.enqueue(w),v()}})}}});return new Response(g)}else throw Error(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{let h=/charset="?([^;"\s]*)"?/i.exec(a),f=h&&h[1]?h[1].toLowerCase():void 0,d=new TextDecoder(f);return c.arrayBuffer().then(m=>d.decode(m))}}}).then(c=>{Wa.add(e,c);let u=Qi[e];delete Qi[e];for(let h=0,f=u.length;h<f;h++){let d=u[h];d.onLoad&&d.onLoad(c)}}).catch(c=>{let u=Qi[e];if(u===void 0)throw this.manager.itemError(e),c;delete Qi[e];for(let h=0,f=u.length;h<f;h++){let d=u[h];d.onError&&d.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}};var Ff=class extends ln{constructor(e){super(e)}load(e,t,r,n){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=Wa.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;let a=jc("img");function l(){u(),Wa.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),n&&n(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}},Lg=class extends ln{constructor(e){super(e)}load(e,t,r,n){let s=new Rs,o=new Ff(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,n)}for(let c=0;c<e.length;++c)l(c);return s}};var Dg=class extends ln{constructor(e){super(e)}load(e,t,r,n){let s=new _t,o=new Ff(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},r,n),s}},yn=class extends ot{constructor(e,t=1){super(),this.type="Light",this.color=new xe(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}};yn.prototype.isLight=!0;var zs=class extends yn{constructor(e,t,r){super(e,r),this.type="HemisphereLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.groundColor=new xe(t)}copy(e){return yn.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}};zs.prototype.isHemisphereLight=!0;var H0=new Ee,W0=new A,j0=new A,ou=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new N(512,512),this.map=null,this.mapPass=null,this.matrix=new Ee,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ra,this._frameExtents=new N(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,r=this.matrix;W0.setFromMatrixPosition(e.matrixWorld),t.position.copy(W0),j0.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(j0),t.updateMatrixWorld(),H0.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(H0),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(t.projectionMatrix),r.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}},Uf=class extends ou{constructor(){super(new nr(50,1,.5,500)),this.focus=1}updateMatrices(e){let t=this.camera,r=Wc*2*e.angle*this.focus,n=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(r!==t.fov||n!==t.aspect||s!==t.far)&&(t.fov=r,t.aspect=n,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}};Uf.prototype.isSpotLightShadow=!0;var au=class extends yn{constructor(e,t,r=0,n=Math.PI/3,s=0,o=1){super(e,t),this.type="SpotLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.target=new ot,this.distance=r,this.angle=n,this.penumbra=s,this.decay=o,this.shadow=new Uf}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}};au.prototype.isSpotLight=!0;var q0=new Ee,Bc=new A,Km=new A,zf=class extends ou{constructor(){super(new nr(90,1,.5,500)),this._frameExtents=new N(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 A(1,0,0),new A(-1,0,0),new A(0,0,1),new A(0,0,-1),new A(0,1,0),new A(0,-1,0)],this._cubeUps=[new A(0,1,0),new A(0,1,0),new A(0,1,0),new A(0,1,0),new A(0,0,1),new A(0,0,-1)]}updateMatrices(e,t=0){let r=this.camera,n=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),Bc.setFromMatrixPosition(e.matrixWorld),r.position.copy(Bc),Km.copy(r.position),Km.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(Km),r.updateMatrixWorld(),n.makeTranslation(-Bc.x,-Bc.y,-Bc.z),q0.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(q0)}};zf.prototype.isPointLightShadow=!0;var lu=class extends yn{constructor(e,t,r=0,n=1){super(e,t),this.type="PointLight",this.distance=r,this.decay=n,this.shadow=new zf}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}};lu.prototype.isPointLight=!0;var Gf=class extends ou{constructor(){super(new Eo(-5,5,5,-5,.5,500))}};Gf.prototype.isDirectionalLightShadow=!0;var cu=class extends yn{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.target=new ot,this.shadow=new Gf}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};cu.prototype.isDirectionalLight=!0;var Pg=class extends yn{constructor(e,t){super(e,t),this.type="AmbientLight"}};Pg.prototype.isAmbientLight=!0;var Ig=class extends yn{constructor(e,t,r=10,n=10){super(e,t),this.type="RectAreaLight",this.width=r,this.height=n}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}};Ig.prototype.isRectAreaLight=!0;var kf=class{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new A)}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 r=e.x,n=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*n),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*r),t.addScaledVector(o[4],1.092548*(r*n)),t.addScaledVector(o[5],1.092548*(n*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(r*s)),t.addScaledVector(o[8],.546274*(r*r-n*n)),t}getIrradianceAt(e,t){let r=e.x,n=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*n),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*r),t.addScaledVector(o[4],2*.429043*r*n),t.addScaledVector(o[5],2*.429043*n*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*r*s),t.addScaledVector(o[8],.429043*(r*r-n*n)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],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 r=this.coefficients;for(let n=0;n<9;n++)r[n].fromArray(e,t+n*3);return this}toArray(e=[],t=0){let r=this.coefficients;for(let n=0;n<9;n++)r[n].toArray(e,t+n*3);return e}static getBasisAt(e,t){let r=e.x,n=e.y,s=e.z;t[0]=.282095,t[1]=.488603*n,t[2]=.488603*s,t[3]=.488603*r,t[4]=1.092548*r*n,t[5]=1.092548*n*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*r*s,t[8]=.546274*(r*r-n*n)}};kf.prototype.isSphericalHarmonics3=!0;var uu=class extends yn{constructor(e=new kf,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}};uu.prototype.isLightProbe=!0;var Rg=class{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,n=e.length;r<n;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},Vf=class extends Ie{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}};Vf.prototype.isInstancedBufferGeometry=!0;var Gs=class extends ln{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new is(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){n?n(l):console.error(l),s.manager.itemError(e)}},r,n)}parse(e){let t={},r={};function n(d,m){if(t[m]!==void 0)return t[m];let g=d.interleavedBuffers[m],y=s(d,g.buffer),v=Th(g.type,y),b=new rs(v,g.stride);return b.uuid=g.uuid,t[m]=b,b}function s(d,m){if(r[m]!==void 0)return r[m];let g=d.arrayBuffers[m],y=new Uint32Array(g).buffer;return r[m]=y,y}let o=e.isInstancedBufferGeometry?new Vf:new Ie,a=e.data.index;if(a!==void 0){let d=Th(a.type,a.array);o.setIndex(new Ue(d,1))}let l=e.data.attributes;for(let d in l){let m=l[d],p;if(m.isInterleavedBufferAttribute){let g=n(e.data,m.data);p=new Ai(g,m.itemSize,m.offset,m.normalized)}else{let g=Th(m.type,m.array),y=m.isInstancedBufferAttribute?Ba:Ue;p=new y(g,m.itemSize,m.normalized)}m.name!==void 0&&(p.name=m.name),m.usage!==void 0&&p.setUsage(m.usage),m.updateRange!==void 0&&(p.updateRange.offset=m.updateRange.offset,p.updateRange.count=m.updateRange.count),o.setAttribute(d,p)}let c=e.data.morphAttributes;if(c)for(let d in c){let m=c[d],p=[];for(let g=0,y=m.length;g<y;g++){let v=m[g],b;if(v.isInterleavedBufferAttribute){let w=n(e.data,v.data);b=new Ai(w,v.itemSize,v.offset,v.normalized)}else{let w=Th(v.type,v.array);b=new Ue(w,v.itemSize,v.normalized)}v.name!==void 0&&(b.name=v.name),p.push(b)}o.morphAttributes[d]=p}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);let h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let d=0,m=h.length;d!==m;++d){let p=h[d];o.addGroup(p.start,p.count,p.materialIndex)}let f=e.data.boundingSphere;if(f!==void 0){let d=new A;f.center!==void 0&&d.fromArray(f.center),o.boundingSphere=new Yr(d,f.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}};var Bg=class extends ln{constructor(e){super(e),typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=Wa.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){Wa.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){n&&n(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}};Bg.prototype.isImageBitmapLoader=!0;var rf,zP={getContext:function(){return rf===void 0&&(rf=new(window.AudioContext||window.webkitAudioContext)),rf},setContext:function(i){rf=i}},Ng=class extends ln{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new is(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);zP.getContext().decodeAudioData(l,function(u){t(u)})}catch(l){n?n(l):console.error(l),s.manager.itemError(e)}},r,n)}},Og=class extends uu{constructor(e,t,r=1){super(void 0,r);let n=new xe().set(e),s=new xe().set(t),o=new A(n.r,n.g,n.b),a=new A(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)}};Og.prototype.isHemisphereLightProbe=!0;var Fg=class extends uu{constructor(e,t=1){super(void 0,t);let r=new xe().set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}};Fg.prototype.isAmbientLightProbe=!0;var Hf=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=X0(),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=X0();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function X0(){return(typeof performance>"u"?Date:performance).now()}var Ug=class extends ot{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 zg=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 r=0;r<t.length;r++)e+=t[r];return e/t.length}},Gg=class{constructor(e,t,r){this.binding=e,this.valueSize=r;let n,s,o;switch(t){case"quaternion":n=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":n=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:n=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=n,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 r=this.buffer,n=this.valueSize,s=e*n+n,o=this.cumulativeWeight;if(o===0){for(let a=0;a!==n;++a)r[s+a]=r[a];o=t}else{o+=t;let a=t/o;this._mixBufferRegion(r,s,0,a,n)}this.cumulativeWeight=o}accumulateAdditive(e){let t=this.buffer,r=this.valueSize,n=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,n,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,r=this.buffer,n=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(r,n,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(r,n,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(r[l]!==r[l+t]){a.setValue(r,n);break}}saveOriginalState(){let e=this.binding,t=this.buffer,r=this.valueSize,n=r*this._origIndex;e.getValue(t,n);for(let s=r,o=n;s!==o;++s)t[s]=t[n+s%r];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 r=e;r<t;r++)this.buffer[r]=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 r=0;r<this.valueSize;r++)this.buffer[t+r]=this.buffer[e+r]}_select(e,t,r,n,s){if(n>=.5)for(let o=0;o!==s;++o)e[t+o]=e[r+o]}_slerp(e,t,r,n){Ut.slerpFlat(e,t,e,t,e,r,n)}_slerpAdditive(e,t,r,n,s){let o=this._workIndex*s;Ut.multiplyQuaternionsFlat(e,o,e,t,e,r),Ut.slerpFlat(e,t,e,t,e,o,n)}_lerp(e,t,r,n,s){let o=1-n;for(let a=0;a!==s;++a){let l=t+a;e[l]=e[l]*o+e[r+a]*n}}_lerpAdditive(e,t,r,n,s){for(let o=0;o!==s;++o){let a=t+o;e[a]=e[a]+e[r+o]*n}}},ty="\\[\\]\\.:\\/",GP=new RegExp("["+ty+"]","g"),ry="[^"+ty+"]",kP="[^"+ty.replace("\\.","")+"]",VP=/((?:WC+[\/:])*)/.source.replace("WC",ry),HP=/(WCOD+)?/.source.replace("WCOD",kP),WP=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ry),jP=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ry),qP=new RegExp("^"+VP+HP+WP+jP+"$"),XP=["material","materials","bones"],kg=class{constructor(e,t,r){let n=r||xt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}getValue(e,t){this.bind();let r=this._targetGroup.nCachedObjects_,n=this._bindings[r];n!==void 0&&n.getValue(e,t)}setValue(e,t){let r=this._bindings;for(let n=this._targetGroup.nCachedObjects_,s=r.length;n!==s;++n)r[n].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}},xt=class{constructor(e,t,r){this.path=t,this.parsedPath=r||xt.parseTrackName(t),this.node=xt.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new xt.Composite(e,t,r):new xt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(GP,"")}static parseTrackName(e){let t=qP.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=r.nodeName&&r.nodeName.lastIndexOf(".");if(n!==void 0&&n!==-1){let s=r.nodeName.substring(n+1);XP.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,n),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){let r=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=r(a.children);if(l)return l}return null},n=r(e.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)e[t++]=r[n]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,r=t.objectName,n=t.propertyName,s=t.propertyIndex;if(e||(e=xt.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(r){let c=t.objectIndex;switch(r){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[r]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}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[n];if(o===void 0){let c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+n+" 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(n==="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=n;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}};xt.Composite=kg;xt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};xt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};xt.prototype.GetterByBindingType=[xt.prototype._getValue_direct,xt.prototype._getValue_array,xt.prototype._getValue_arrayElement,xt.prototype._getValue_toArray];xt.prototype.SetterByBindingTypeAndVersioning=[[xt.prototype._setValue_direct,xt.prototype._setValue_direct_setNeedsUpdate,xt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[xt.prototype._setValue_array,xt.prototype._setValue_array_setNeedsUpdate,xt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[xt.prototype._setValue_arrayElement,xt.prototype._setValue_arrayElement_setNeedsUpdate,xt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[xt.prototype._setValue_fromArray,xt.prototype._setValue_fromArray_setNeedsUpdate,xt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Vg=class{constructor(){this.uuid=Fn(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let e={};this._indicesByUUID=e;for(let r=0,n=arguments.length;r!==n;++r)e[arguments[r].uuid]=r;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,r=this._paths,n=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 f=arguments[u],d=f.uuid,m=t[d];if(m===void 0){m=l++,t[d]=m,e.push(f);for(let p=0,g=o;p!==g;++p)s[p].push(new xt(f,r[p],n[p]))}else if(m<c){a=e[m];let p=--c,g=e[p];t[g.uuid]=m,e[m]=g,t[d]=p,e[p]=f;for(let y=0,v=o;y!==v;++y){let b=s[y],w=b[p],x=b[m];b[m]=w,x===void 0&&(x=new xt(f,r[y],n[y])),b[p]=x}}else e[m]!==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,r=this._bindings,n=r.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++,f=e[h];t[f.uuid]=u,e[u]=f,t[c]=h,e[h]=l;for(let d=0,m=n;d!==m;++d){let p=r[d],g=p[h],y=p[u];p[u]=g,p[h]=y}}}this.nCachedObjects_=s}uncache(){let e=this._objects,t=this._indicesByUUID,r=this._bindings,n=r.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 f=--s,d=e[f],m=--o,p=e[m];t[d.uuid]=h,e[h]=d,t[p.uuid]=f,e[f]=p,e.pop();for(let g=0,y=n;g!==y;++g){let v=r[g],b=v[f],w=v[m];v[h]=b,v[f]=w,v.pop()}}else{let f=--o,d=e[f];f>0&&(t[d.uuid]=h),e[h]=d,e.pop();for(let m=0,p=n;m!==p;++m){let g=r[m];g[h]=g[f],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){let r=this._bindingsIndicesByPath,n=r[e],s=this._bindings;if(n!==void 0)return s[n];let o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);n=s.length,r[e]=n,o.push(e),a.push(t),s.push(h);for(let f=u,d=l.length;f!==d;++f){let m=l[f];h[f]=new xt(m,e,t)}return h}unsubscribe_(e){let t=this._bindingsIndicesByPath,r=t[e];if(r!==void 0){let n=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),n[r]=n[a],n.pop()}}};Vg.prototype.isAnimationObjectGroup=!0;var Hg=class{constructor(e,t,r=null,n=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=n;let s=t.tracks,o=s.length,a=new Array(o),l={endingStart:Aa,endingEnd:Aa};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=aE,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,r){if(e.fadeOut(t),this.fadeIn(t),r){let n=this._clip.duration,s=e._clip.duration,o=s/n,a=n/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,r){return e.crossFadeFrom(this,t,r)}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,r){let n=this._mixer,s=n.time,o=this.timeScale,a=this._timeScaleInterpolant;a===null&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);let l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+r,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,r,n){if(!this.enabled){this._updateWeight(e);return}let s=this._startTime;if(s!==null){let l=(e-s)*r;if(l<0||r===0)return;this._startTime=null,t=r*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 sb:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case Kg:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(n,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let r=this._weightInterpolant;if(r!==null){let n=r.evaluate(e)[0];t*=n,e>r.parameterPositions[1]&&(this.stopFading(),n===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let r=this._timeScaleInterpolant;r!==null&&(t*=r.evaluate(e)[0],e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,r=this.loop,n=this.time+e,s=this._loopCount,o=r===lE;if(e===0)return s===-1?n:o&&(s&1)===1?t-n:n;if(r===oE){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(n>=t)n=t;else if(n<0)n=0;else{this.time=n;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),n>=t||n<0){let a=Math.floor(n/t);n-=t*a,s+=Math.abs(a);let l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=e>0?t:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){let c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=n;if(o&&(s&1)===1)return t-n}return n}_setEndings(e,t,r){let n=this._interpolantSettings;r?(n.endingStart=Ta,n.endingEnd=Ta):(e?n.endingStart=this.zeroSlopeAtStart?Ta:Aa:n.endingStart=hf,t?n.endingEnd=this.zeroSlopeAtEnd?Ta:Aa:n.endingEnd=hf)}_scheduleFading(e,t,r){let n=this._mixer,s=n.time,o=this._weightInterpolant;o===null&&(o=n._lendControlInterpolant(),this._weightInterpolant=o);let a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=r,this}},Wg=class extends jt{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let r=e._localRoot||this._root,n=e._clip.tracks,s=n.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName,u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){let f=n[h],d=f.name,m=u[d];if(m!==void 0)++m.referenceCount,o[h]=m;else{if(m=o[h],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,d));continue}let p=t&&t._propertyBindings[h].binding.parsedPath;m=new Gg(xt.create(r,d,p),f.ValueTypeName,f.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,d),o[h]=m}a[h].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let r=(e._localRoot||this._root).uuid,n=e._clip.uuid,s=this._actionsByClip[n];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,n,r)}let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];--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,r){let n=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=n.length,n.push(e),o.actionByRoot[r]=e}_removeInactiveAction(e){let t=this._actions,r=t[t.length-1],n=e._cacheIndex;r._cacheIndex=n,t[n]=r,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,f=(e._localRoot||this._root).uuid;delete h[f],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){let t=this._actions,r=e._cacheIndex,n=this._nActiveActions++,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_takeBackAction(e){let t=this._actions,r=e._cacheIndex,n=--this._nActiveActions,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_addInactiveBinding(e,t,r){let n=this._bindingsByRootAndName,s=this._bindings,o=n[t];o===void 0&&(o={},n[t]=o),o[r]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){let t=this._bindings,r=e.binding,n=r.rootNode.uuid,s=r.path,o=this._bindingsByRootAndName,a=o[n],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[n]}_lendBinding(e){let t=this._bindings,r=e._cacheIndex,n=this._nActiveBindings++,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_takeBackBinding(e){let t=this._bindings,r=e._cacheIndex,n=--this._nActiveBindings,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return r===void 0&&(r=new Bf(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=t,e[t]=r),r}_takeBackControlInterpolant(e){let t=this._controlInterpolants,r=e.__cacheIndex,n=--this._nActiveControlInterpolants,s=t[n];e.__cacheIndex=n,t[n]=e,s.__cacheIndex=r,t[r]=s}clipAction(e,t,r){let n=t||this._root,s=n.uuid,o=typeof e=="string"?Of.findByName(n,e):e,a=o!==null?o.uuid:e,l=this._actionsByClip[a],c=null;if(r===void 0&&(o!==null?r=o.blendMode:r=Kg),l!==void 0){let h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===r)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;let u=new Hg(this,o,t,r);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){let r=t||this._root,n=r.uuid,s=typeof e=="string"?Of.findByName(r,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[n]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let r=t-1;r>=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;let t=this._actions,r=this._nActiveActions,n=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)t[c]._update(n,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,r=e.uuid,n=this._actionsByClip,s=n[r];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 n[r]}}uncacheRoot(e){let t=e.uuid,r=this._actionsByClip;for(let o in r){let a=r[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}let n=this._bindingsByRootAndName,s=n[t];if(s!==void 0)for(let o in s){let a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){let r=this.existingAction(e,t);r!==null&&(this._deactivateAction(r),this._removeInactiveAction(r))}};Wg.prototype._controlInterpolantsResultBuffer=new Float32Array(1);var Te=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 Te(this.value.clone===void 0?this.value:this.value.clone())}},jg=class extends rs{constructor(e,t,r=1){super(e,t),this.meshPerAttribute=r}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}};jg.prototype.isInstancedInterleavedBuffer=!0;var qg=class{constructor(e,t,r,n,s){this.buffer=e,this.type=t,this.itemSize=r,this.elementSize=n,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}};qg.prototype.isGLBufferAttribute=!0;var Wf=class{constructor(e,t,r=0,n=1/0){this.ray=new si(e,t),this.near=r,this.far=n,this.camera=null,this.layers=new Xc,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,r=[]){return Xg(e,this,r,t),r.sort(Y0),r}intersectObjects(e,t=!0,r=[]){for(let n=0,s=e.length;n<s;n++)Xg(e[n],this,r,t);return r.sort(Y0),r}};function Y0(i,e){return i.distance-e.distance}function Xg(i,e,t,r){if(i.layers.test(e.layers)&&i.raycast(e,t),r===!0){let n=i.children;for(let s=0,o=n.length;s<o;s++)Xg(n[s],e,t,!0)}}var hu=class{constructor(e=1,t=0,r=0){return this.radius=e,this.phi=t,this.theta=r,this}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(yr(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var J0=new N,Bo=class{constructor(e=new N(1/0,1/0),t=new N(-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,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=J0.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),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 J0.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)}};Bo.prototype.isBox2=!0;var Q0=new A,nf=new A,Qr=class{constructor(e=new A,t=new A){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){Q0.subVectors(e,this.start),nf.subVectors(this.end,this.start);let r=nf.dot(nf),s=nf.dot(Q0)/r;return t&&(s=yr(s,0,1)),s}closestPointToPoint(e,t,r){let n=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(n).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)}},K0=new A,jf=class extends ot{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;let r=new Ie,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){let c=o/l*Math.PI*2,u=a/l*Math.PI*2;n.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}r.setAttribute("position",new Le(n,3));let s=new Ur({fog:!1,toneMapped:!1});this.cone=new ai(r,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),K0.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(K0),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},As=new A,sf=new Ee,Zm=new Ee,Yg=class extends ai{constructor(e){let t=Mb(e),r=new Ie,n=[],s=[],o=new xe(0,0,1),a=new xe(0,1,0);for(let c=0;c<t.length;c++){let u=t[c];u.parent&&u.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}r.setAttribute("position",new Le(n,3)),r.setAttribute("color",new Le(s,3));let l=new Ur({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(r,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,r=this.geometry,n=r.getAttribute("position");Zm.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){let a=t[s];a.parent&&a.parent.isBone&&(sf.multiplyMatrices(Zm,a.matrixWorld),As.setFromMatrixPosition(sf),n.setXYZ(o,As.x,As.y,As.z),sf.multiplyMatrices(Zm,a.parent.matrixWorld),As.setFromMatrixPosition(sf),n.setXYZ(o+1,As.x,As.y,As.z),o+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}};function Mb(i){let e=[];i.isBone===!0&&e.push(i);for(let t=0;t<i.children.length;t++)e.push.apply(e,Mb(i.children[t]));return e}var qf=class extends Gt{constructor(e,t,r){let n=new Po(t,4,2),s=new Un({wireframe:!0,fog:!1,toneMapped:!1});super(n,s),this.light=e,this.light.updateMatrixWorld(),this.color=r,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 Jg=class extends ai{constructor(e=10,t=10,r=4473924,n=8947848){r=new xe(r),n=new xe(n);let s=t/2,o=e/t,a=e/2,l=[],c=[];for(let f=0,d=0,m=-a;f<=t;f++,m+=o){l.push(-a,0,m,a,0,m),l.push(m,0,-a,m,0,a);let p=f===s?r:n;p.toArray(c,d),d+=3,p.toArray(c,d),d+=3,p.toArray(c,d),d+=3,p.toArray(c,d),d+=3}let u=new Ie;u.setAttribute("position",new Le(l,3)),u.setAttribute("color",new Le(c,3));let h=new Ur({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}};var Z0=new A,of=new A,$0=new A,Xf=class extends ot{constructor(e,t,r){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,t===void 0&&(t=1);let n=new Ie;n.setAttribute("position",new Le([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let s=new Ur({fog:!1,toneMapped:!1});this.lightPlane=new ns(n,s),this.add(this.lightPlane),n=new Ie,n.setAttribute("position",new Le([0,0,0,0,0,1],3)),this.targetLine=new ns(n,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){Z0.setFromMatrixPosition(this.light.matrixWorld),of.setFromMatrixPosition(this.light.target.matrixWorld),$0.subVectors(of,Z0),this.lightPlane.lookAt(of),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(of),this.targetLine.scale.z=$0.length()}},af=new A,rr=new zn,Vn=class extends ai{constructor(e){let t=new Ie,r=new Ur({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],s=[],o={},a=new xe(16755200),l=new xe(16711680),c=new xe(43775),u=new xe(16777215),h=new xe(3355443);f("n1","n2",a),f("n2","n4",a),f("n4","n3",a),f("n3","n1",a),f("f1","f2",a),f("f2","f4",a),f("f4","f3",a),f("f3","f1",a),f("n1","f1",a),f("n2","f2",a),f("n3","f3",a),f("n4","f4",a),f("p","n1",l),f("p","n2",l),f("p","n3",l),f("p","n4",l),f("u1","u2",c),f("u2","u3",c),f("u3","u1",c),f("c","t",u),f("p","c",h),f("cn1","cn2",h),f("cn3","cn4",h),f("cf1","cf2",h),f("cf3","cf4",h);function f(m,p,g){d(m,g),d(p,g)}function d(m,p){n.push(0,0,0),s.push(p.r,p.g,p.b),o[m]===void 0&&(o[m]=[]),o[m].push(n.length/3-1)}t.setAttribute("position",new Le(n,3)),t.setAttribute("color",new Le(s,3)),super(t,r),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,r=1,n=1;rr.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),ar("c",t,e,rr,0,0,-1),ar("t",t,e,rr,0,0,1),ar("n1",t,e,rr,-r,-n,-1),ar("n2",t,e,rr,r,-n,-1),ar("n3",t,e,rr,-r,n,-1),ar("n4",t,e,rr,r,n,-1),ar("f1",t,e,rr,-r,-n,1),ar("f2",t,e,rr,r,-n,1),ar("f3",t,e,rr,-r,n,1),ar("f4",t,e,rr,r,n,1),ar("u1",t,e,rr,r*.7,n*1.1,-1),ar("u2",t,e,rr,-r*.7,n*1.1,-1),ar("u3",t,e,rr,0,n*2,-1),ar("cf1",t,e,rr,-r,0,1),ar("cf2",t,e,rr,r,0,1),ar("cf3",t,e,rr,0,-n,1),ar("cf4",t,e,rr,0,n,1),ar("cn1",t,e,rr,-r,0,-1),ar("cn2",t,e,rr,r,0,-1),ar("cn3",t,e,rr,0,-n,-1),ar("cn4",t,e,rr,0,n,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function ar(i,e,t,r,n,s,o){af.set(n,s,o).unproject(r);let a=e[i];if(a!==void 0){let l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],af.x,af.y,af.z)}}var No=class extends ai{constructor(e,t=16776960){let r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Ie;s.setIndex(new Ue(r,1)),s.setAttribute("position",new Le(n,3)),super(s,new Ur({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 Yf=class extends ai{constructor(e=1){let t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],n=new Ie;n.setAttribute("position",new Le(t,3)),n.setAttribute("color",new Le(r,3));let s=new Ur({vertexColors:!0,toneMapped:!1});super(n,s),this.type="AxesHelper"}setColors(e,t,r){let n=new xe,s=this.geometry.attributes.color.array;return n.set(e),n.toArray(s,0),n.toArray(s,3),n.set(t),n.toArray(s,6),n.toArray(s,9),n.set(r),n.toArray(s,12),n.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},Jf=class{constructor(){this.type="ShapePath",this.color=new xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Na,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,n){return this.currentPath.quadraticCurveTo(e,t,r,n),this}bezierCurveTo(e,t,r,n,s,o){return this.currentPath.bezierCurveTo(e,t,r,n,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function r(v){let b=[];for(let w=0,x=v.length;w<x;w++){let E=v[w],T=new tn;T.curves=E.curves,b.push(T)}return b}function n(v,b){let w=b.length,x=!1;for(let E=w-1,T=0;T<w;E=T++){let S=b[E],I=b[T],C=I.x-S.x,M=I.y-S.y;if(Math.abs(M)>Number.EPSILON){if(M<0&&(S=b[T],C=-C,I=b[E],M=-M),v.y<S.y||v.y>I.y)continue;if(v.y===S.y){if(v.x===S.x)return!0}else{let _=M*(v.x-S.x)-C*(v.y-S.y);if(_===0)return!0;if(_<0)continue;x=!x}}else{if(v.y!==S.y)continue;if(I.x<=v.x&&v.x<=S.x||S.x<=v.x&&v.x<=I.x)return!0}}return x}let s=ni.isClockWise,o=this.subPaths;if(o.length===0)return[];if(t===!0)return r(o);let a,l,c,u=[];if(o.length===1)return l=o[0],c=new tn,c.curves=l.curves,u.push(c),u;let h=!s(o[0].getPoints());h=e?!h:h;let f=[],d=[],m=[],p=0,g;d[p]=void 0,m[p]=[];for(let v=0,b=o.length;v<b;v++)l=o[v],g=l.getPoints(),a=s(g),a=e?!a:a,a?(!h&&d[p]&&p++,d[p]={s:new tn,p:g},d[p].s.curves=l.curves,h&&p++,m[p]=[]):m[p].push({h:l,p:g[0]});if(!d[0])return r(o);if(d.length>1){let v=!1,b=0;for(let w=0,x=d.length;w<x;w++)f[w]=[];for(let w=0,x=d.length;w<x;w++){let E=m[w];for(let T=0;T<E.length;T++){let S=E[T],I=!0;for(let C=0;C<d.length;C++)n(S.p,d[C].p)&&(w!==C&&b++,I?(I=!1,f[C].push(S)):v=!0);I&&f[w].push(S)}}b>0&&v===!1&&(m=f)}let y;for(let v=0,b=d.length;v<b;v++){c=d[v].s,u.push(c),y=m[v];for(let w=0,x=y.length;w<x;w++)c.holes.push(y[w].h)}return u}};var Ab=new ArrayBuffer(4),Gz=new Float32Array(Ab),kz=new Uint32Array(Ab),wi=new Uint32Array(512),Si=new Uint32Array(512);for(let i=0;i<256;++i){let e=i-127;e<-27?(wi[i]=0,wi[i|256]=32768,Si[i]=24,Si[i|256]=24):e<-14?(wi[i]=1024>>-e-14,wi[i|256]=1024>>-e-14|32768,Si[i]=-e-1,Si[i|256]=-e-1):e<=15?(wi[i]=e+15<<10,wi[i|256]=e+15<<10|32768,Si[i]=13,Si[i|256]=13):e<128?(wi[i]=31744,wi[i|256]=64512,Si[i]=24,Si[i|256]=24):(wi[i]=31744,wi[i|256]=64512,Si[i]=13,Si[i|256]=13)}var Tb=new Uint32Array(2048),fu=new Uint32Array(64),YP=new Uint32Array(64);for(let i=1;i<1024;++i){let e=i<<13,t=0;for(;(e&8388608)===0;)e<<=1,t-=8388608;e&=-8388609,t+=947912704,Tb[i]=e|t}for(let i=1024;i<2048;++i)Tb[i]=939524096+(i-1024<<13);for(let i=1;i<31;++i)fu[i]=i<<23;fu[31]=1199570944;fu[32]=2147483648;for(let i=33;i<63;++i)fu[i]=2147483648+(i-32<<23);fu[63]=3347054592;for(let i=1;i<64;++i)i!==32&&(YP[i]=1024);gn.create=function(i,e){return console.log("THREE.Curve.create() has been deprecated"),i.prototype=Object.create(gn.prototype),i.prototype.constructor=i,i.prototype.getPoint=e,i};Na.prototype.fromPoints=function(i){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(i)};Jg.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Yg.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};ln.prototype.extractUrlBase=function(i){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Rg.extractUrlBase(i)};ln.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.")}};Bo.prototype.center=function(i){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(i)};Bo.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Bo.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};Bo.prototype.size=function(i){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(i)};Qt.prototype.center=function(i){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(i)};Qt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Qt.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};Qt.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};Qt.prototype.size=function(i){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(i)};pn.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")};Yr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Ra.prototype.setFromMatrix=function(i){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(i)};Qr.prototype.center=function(i){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(i)};Nt.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};Nt.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Nt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};Nt.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Nt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};Nt.prototype.getInverse=function(i){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};Ee.prototype.extractPosition=function(i){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(i)};Ee.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};Ee.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new A().setFromMatrixColumn(this,3)};Ee.prototype.setRotationFromQuaternion=function(i){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(i)};Ee.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};Ee.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Ee.prototype.multiplyVector4=function(i){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Ee.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};Ee.prototype.rotateAxis=function(i){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),i.transformDirection(this)};Ee.prototype.crossVector=function(i){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Ee.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};Ee.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};Ee.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};Ee.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};Ee.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};Ee.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Ee.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};Ee.prototype.makeFrustum=function(i,e,t,r,n,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(i,e,r,t,n,s)};Ee.prototype.getInverse=function(i){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};Fr.prototype.isIntersectionLine=function(i){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(i)};Ut.prototype.multiplyVector3=function(i){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),i.applyQuaternion(this)};Ut.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};si.prototype.isIntersectionBox=function(i){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};si.prototype.isIntersectionPlane=function(i){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(i)};si.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};Jt.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};Jt.prototype.barycoordFromPoint=function(i,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(i,e)};Jt.prototype.midpoint=function(i){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(i)};Jt.prototypenormal=function(i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(i)};Jt.prototype.plane=function(i){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(i)};Jt.barycoordFromPoint=function(i,e,t,r,n){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Jt.getBarycoord(i,e,t,r,n)};Jt.normal=function(i,e,t,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Jt.getNormal(i,e,t,r)};tn.prototype.extractAllPoints=function(i){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(i)};tn.prototype.extrude=function(i){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Os(this,i)};tn.prototype.makeGeometry=function(i){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Do(this,i)};N.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};N.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};N.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};A.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};A.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};A.prototype.getPositionFromMatrix=function(i){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(i)};A.prototype.getScaleFromMatrix=function(i){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(i)};A.prototype.getColumnFromMatrix=function(i,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,i)};A.prototype.applyProjection=function(i){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(i)};A.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};A.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};A.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Qe.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};Qe.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};ot.prototype.getChildByName=function(i){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(i)};ot.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};ot.prototype.translate=function(i,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,i)};ot.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};ot.prototype.applyMatrix=function(i){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(ot.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(i){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=i}},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."),ob},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.")}}});xf.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};nr.prototype.setLens=function(i,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(i)};Object.defineProperties(yn.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(i){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=i}},shadowCameraLeft:{set:function(i){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=i}},shadowCameraRight:{set:function(i){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=i}},shadowCameraTop:{set:function(i){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=i}},shadowCameraBottom:{set:function(i){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=i}},shadowCameraNear:{set:function(i){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=i}},shadowCameraFar:{set:function(i){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=i}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(i){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=i}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(i){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=i}},shadowMapHeight:{set:function(i){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=i}}});Object.defineProperties(Ue.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===ff},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(ff)}}});Ue.prototype.setDynamic=function(i){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?ff:Hc),this};Ue.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Ue.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Ie.prototype.addIndex=function(i){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(i)};Ie.prototype.addAttribute=function(i,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(i,new Ue(arguments[1],arguments[2]))):i==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(i,e)};Ie.prototype.addDrawCall=function(i,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(i,e)};Ie.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};Ie.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};Ie.prototype.removeAttribute=function(i){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(i)};Ie.prototype.applyMatrix=function(i){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(Ie.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}}});rs.prototype.setDynamic=function(i){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?ff:Hc),this};rs.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Os.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};Os.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};Os.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};sn.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};Te.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this};Object.defineProperties(cr.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 xe}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(i){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=i===tb}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(i){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=i}},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(St.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(i){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=i}}});Ct.prototype.clearTarget=function(i,e,t,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(i),this.clear(e,t,r)};Ct.prototype.animate=function(i){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(i)};Ct.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};Ct.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};Ct.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};Ct.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};Ct.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};Ct.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};Ct.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};Ct.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};Ct.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};Ct.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};Ct.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};Ct.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};Ct.prototype.enableScissorTest=function(i){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(i)};Ct.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};Ct.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};Ct.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};Ct.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};Ct.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};Ct.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};Ct.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};Ct.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};Ct.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};Ct.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(Ct.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(i){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=i}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(i){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=i}},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(i){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=i===!0?je:rn}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});Object.defineProperties(yb.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(mt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(i){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=i}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(i){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=i}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(i){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=i}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(i){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=i}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(i){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=i}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(i){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=i}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(i){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=i}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(i){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=i}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(i){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=i}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(i){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=i}}});Ug.prototype.load=function(i){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");let e=this;return new Ng().load(i,function(r){e.setBuffer(r)}),this};zg.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};Yc.prototype.updateCubeMap=function(i,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(i,e)};Yc.prototype.clear=function(i,e,t,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(i,e,t,r)};es.crossOrigin=void 0;es.loadTexture=function(i,e,t,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");let n=new Dg;n.setCrossOrigin(this.crossOrigin);let s=n.load(i,t,void 0,r);return e&&(s.mapping=e),s};es.loadTextureCube=function(i,e,t,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");let n=new Lg;n.setCrossOrigin(this.crossOrigin);let s=n.load(i,t,void 0,r);return e&&(s.mapping=e),s};es.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};es.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var Qf=class extends mt{constructor(e,t,r){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,r),this.samples=4}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Oo}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Oo);var Ya=".",du=Symbol("target"),ny=Symbol("unsubscribe");function pu(i){return i instanceof Date||i instanceof Set||i instanceof Map||i instanceof WeakSet||i instanceof WeakMap||ArrayBuffer.isView(i)}function Eb(i){return(typeof i=="object"?i===null:typeof i!="function")||i instanceof RegExp}var _n=Array.isArray;function Fo(i){return typeof i=="symbol"}var JP={after:(i,e)=>_n(i)?i.slice(e.length):e===""?i:i.slice(e.length+1),concat:(i,e)=>_n(i)?(i=[...i],e&&i.push(e),i):e&&e.toString!==void 0?(i!==""&&(i+=Ya),Fo(e)?i+e.toString():i+e):i,initial:i=>{if(_n(i))return i.slice(0,-1);if(i==="")return i;let e=i.lastIndexOf(Ya);return e===-1?"":i.slice(0,e)},last:i=>{if(_n(i))return i[i.length-1]||"";if(i==="")return i;let e=i.lastIndexOf(Ya);return e===-1?i:i.slice(e+1)},walk:(i,e)=>{if(_n(i))for(let t of i)e(t);else if(i!==""){let t=0,r=i.indexOf(Ya);if(r===-1)e(i);else for(;t<i.length;)r===-1&&(r=i.length),e(i.slice(t,r)),t=r+1,r=i.indexOf(Ya,t)}},get(i,e){return this.walk(e,t=>{i&&(i=i[t])}),i}},cn=JP;function iy(i){return typeof i=="object"&&typeof i.next=="function"}function sy(i,e,t,r,n){let s=i.next;if(e.name==="entries")i.next=function(){let o=s.call(this);return o.done===!1&&(o.value[0]=n(o.value[0],e,o.value[0],r),o.value[1]=n(o.value[1],e,o.value[0],r)),o};else if(e.name==="values"){let o=t[du].keys();i.next=function(){let a=s.call(this);return a.done===!1&&(a.value=n(a.value,e,o.next().value,r)),a}}else i.next=function(){let o=s.call(this);return o.done===!1&&(o.value=n(o.value,e,o.value,r)),o};return i}function ed(i,e,t){return i.isUnsubscribed||e.ignoreSymbols&&Fo(t)||e.ignoreUnderscores&&t.charAt(0)==="_"||"ignoreKeys"in e&&e.ignoreKeys.includes(t)}var mu=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return this._descriptorCache===void 0&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),r=t.get(e);return r===void 0&&(r={},t.set(e,r)),r}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let r=this._getProperties(e),n=r[t];return n===void 0&&(n=Reflect.getOwnPropertyDescriptor(e,t),r[t]=n),n}getProxy(e,t,r,n){if(this.isUnsubscribed)return e;let s=e[n],o=s||e;this._pathCache.set(o,t);let a=this._proxyCache.get(o);return a===void 0&&(a=s===void 0?new Proxy(e,r):e,this._proxyCache.set(o,a)),a}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,cn.get(t,this.getPath(e)))}defineProperty(e,t,r){return Reflect.defineProperty(e,t,r)?(this.isUnsubscribed||(this._getProperties(e)[t]=r),!0):!1}setProperty(e,t,r,n,s){if(!this._equals(s,r)||!(t in e)){let o=this._getOwnPropertyDescriptor(e,t);return o!==void 0&&"set"in o?Reflect.set(e,t,r,n):Reflect.set(e,t,r)}return!0}deleteProperty(e,t,r){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let n=this._getDescriptorCache().get(e);n&&(delete n[t],this._pathCache.delete(r))}return!0}return!1}isSameDescriptor(e,t,r){let n=this._getOwnPropertyDescriptor(t,r);return e!==void 0&&n!==void 0&&Object.is(e.value,n.value)&&(e.writable||!1)===(n.writable||!1)&&(e.enumerable||!1)===(n.enumerable||!1)&&(e.configurable||!1)===(n.configurable||!1)&&e.get===n.get&&e.set===n.set}isGetInvariant(e,t){let r=this._getOwnPropertyDescriptor(e,t);return r!==void 0&&r.configurable!==!0&&r.writable!==!0}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function Ja(i){return toString.call(i)==="[object Object]"}function Qa(){return!0}function Vs(i,e){return i.length!==e.length||i.some((t,r)=>e[r]!==t)}var td=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]);var QP=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),oy={push:Qa,pop:Qa,shift:Qa,unshift:Qa,copyWithin:Vs,reverse:Vs,sort:Vs,splice:Vs,flat:Vs,fill:Vs},_b=new Set([...td,...QP,...Object.keys(oy)]);function Ka(i,e){if(i.size!==e.size)return!0;for(let t of i)if(!e.has(t))return!0;return!1}var ay=["keys","values","entries"],ly=new Set(["has","toString"]),cy={add:Ka,clear:Ka,delete:Ka,forEach:Ka},Cb=new Set([...ly,...Object.keys(cy),...ay]);function Za(i,e){if(i.size!==e.size)return!0;let t;for(let[r,n]of i)if(t=e.get(r),t!==n||t===void 0&&!e.has(r))return!0;return!1}var KP=new Set([...ly,"get"]),uy={set:Za,clear:Za,delete:Za,forEach:Za},Lb=new Set([...KP,...Object.keys(uy),...ay]);var Dr=class{constructor(e,t,r,n){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=n,this._changes=n?[]:null,this.clone=t===void 0?e:this._shallowClone(e)}static isHandledMethod(e){return td.has(e)}_shallowClone(e){let t=e;if(Ja(e))t=se({},e);else if(_n(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(r=>this._shallowClone(r)));else if(e instanceof Map){t=new Map;for(let[r,n]of e.entries())t.set(r,this._shallowClone(n))}return this._clonedCache.add(t),t}preferredThisArg(e,t,r,n){return e?(_n(n)?this._onIsChanged=oy[t]:n instanceof Set?this._onIsChanged=cy[t]:n instanceof Map&&(this._onIsChanged=uy[t]),n):r}update(e,t,r){let n=cn.after(e,this._path);if(t!=="length"){let s=this.clone;cn.walk(n,o=>{s&&s[o]&&(this._clonedCache.has(s[o])||(s[o]=this._shallowClone(s[o])),s=s[o])}),this._hasOnValidate&&this._changes.push({path:n,property:t,previous:r}),s&&s[t]&&(s[t]=r)}this._isChanged=!0}undo(e){let t;for(let r=this._changes.length-1;r!==-1;r--)t=this._changes[r],cn.get(e,t.path)[t.property]=t.previous}isChanged(e){return this._onIsChanged===void 0?this._isChanged:this._onIsChanged(this.clone,e)}};var $a=class extends Dr{static isHandledMethod(e){return _b.has(e)}};var gu=class extends Dr{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}};var el=class extends Dr{static isHandledMethod(e){return Cb.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}};var tl=class extends Dr{static isHandledMethod(e){return Lb.has(e)}undo(e){for(let[t,r]of this.clone.entries())e.set(t,r);for(let t of e.keys())this.clone.has(t)||e.delete(t)}};var yu=class extends Dr{constructor(e,t,r,n){super(void 0,t,r,n),this._arg1=r[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}};var vu=class extends Dr{constructor(e,t,r,n){super(void 0,t,r,n),this._weakKey=r[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}};var ci=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return Ja(e)||_n(e)||pu(e)}static isHandledMethod(e,t){return Ja(e)?Dr.isHandledMethod(t):_n(e)?$a.isHandledMethod(t):e instanceof Set?el.isHandledMethod(t):e instanceof Map?tl.isHandledMethod(t):pu(e)}get isCloning(){return this._stack.length>0}start(e,t,r){let n=Dr;_n(e)?n=$a:e instanceof Date?n=gu:e instanceof Set?n=el:e instanceof Map?n=tl:e instanceof WeakSet?n=yu:e instanceof WeakMap&&(n=vu),this._stack.push(new n(e,t,r,this._hasOnValidate))}update(e,t,r){this._stack[this._stack.length-1].update(e,t,r)}preferredThisArg(e,t,r){let{name:n}=e,s=ci.isHandledMethod(r,n);return this._stack[this._stack.length-1].preferredThisArg(s,n,t,r)}isChanged(e,t,r){return this._stack[this._stack.length-1].isChanged(e,t,r)}undo(e){this._previousClone!==void 0&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}};var ZP={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},hy=(i,e,t={})=>{t=se(se({},ZP),t);let r=Symbol("ProxyTarget"),{equals:n,isShallow:s,ignoreDetached:o,details:a}=t,l=new mu(n),c=typeof t.onValidate=="function",u=new ci(c),h=(v,b,w,x,E)=>!c||u.isCloning||t.onValidate(cn.concat(l.getPath(v),b),w,x,E)===!0,f=(v,b,w,x)=>{!ed(l,t,b)&&!(o&&l.isDetached(v,i))&&d(l.getPath(v),b,w,x)},d=(v,b,w,x,E)=>{u.isCloning?u.update(v,b,x):e(cn.concat(v,b),w,x,E)},m=v=>v&&(v[r]||v),p=(v,b,w,x)=>Eb(v)||w==="constructor"||s&&!ci.isHandledMethod(b,w)||ed(l,t,w)||l.isGetInvariant(b,w)||o&&l.isDetached(b,i)?v:(x===void 0&&(x=l.getPath(b)),l.getProxy(v,cn.concat(x,w),g,r)),g={get(v,b,w){if(Fo(b)){if(b===r||b===du)return v;if(b===ny&&!l.isUnsubscribed&&l.getPath(v).length===0)return l.unsubscribe(),v}let x=pu(v)?Reflect.get(v,b):Reflect.get(v,b,w);return p(x,v,b)},set(v,b,w,x){w=m(w);let E=v[r]||v,T=E[b];if(n(T,w)&&b in v)return!0;let S=h(v,b,w,T);return S&&l.setProperty(E,b,w,x,T)?(f(v,b,v[b],T),!0):!S},defineProperty(v,b,w){if(!l.isSameDescriptor(w,v,b)){let x=v[b];h(v,b,w.value,x)&&l.defineProperty(v,b,w,x)&&f(v,b,w.value,x)}return!0},deleteProperty(v,b){if(!Reflect.has(v,b))return!0;let w=Reflect.get(v,b),x=h(v,b,void 0,w);return x&&l.deleteProperty(v,b,w)?(f(v,b,void 0,w),!0):!x},apply(v,b,w){let x=b[r]||b;if(l.isUnsubscribed)return Reflect.apply(v,x,w);if((a===!1||a!==!0&&!a.includes(v.name))&&ci.isHandledType(x)){let E=cn.initial(l.getPath(v)),T=ci.isHandledMethod(x,v.name);u.start(x,E,w);let S=Reflect.apply(v,u.preferredThisArg(v,b,x),T?w.map(M=>m(M)):w),I=u.isChanged(x,n),C=u.stop();if(ci.isHandledType(S)&&T&&(b instanceof Map&&v.name==="get"&&(E=cn.concat(E,w[0])),S=l.getProxy(S,E,g)),I){let M={name:v.name,args:w,result:S},_=u.isCloning?cn.initial(E):E,R=u.isCloning?cn.last(E):"";h(cn.get(i,_),R,x,C,M)?d(_,R,x,C,M):u.undo(x)}return(b instanceof Map||b instanceof Set)&&iy(S)?sy(S,v,b,E,p):S}return Reflect.apply(v,b,w)}},y=l.getProxy(i,t.pathAsArray?[]:"",g);return e=e.bind(y),c&&(t.onValidate=t.onValidate.bind(y)),y};hy.target=i=>i&&i[du]||i;hy.unsubscribe=i=>i[ny]||i;var fy=hy;var $P=typeof global=="object"&&global&&global.Object===Object&&global,rd=$P;var e2=typeof self=="object"&&self&&self.Object===Object&&self,t2=rd||e2||Function("return this")(),sr=t2;var r2=sr.Symbol,un=r2;var Db=Object.prototype,n2=Db.hasOwnProperty,i2=Db.toString,xu=un?un.toStringTag:void 0;function s2(i){var e=n2.call(i,xu),t=i[xu];try{i[xu]=void 0;var r=!0}catch{}var n=i2.call(i);return r&&(e?i[xu]=t:delete i[xu]),n}var Pb=s2;var o2=Object.prototype,a2=o2.toString;function l2(i){return a2.call(i)}var Ib=l2;var c2="[object Null]",u2="[object Undefined]",Rb=un?un.toStringTag:void 0;function h2(i){return i==null?i===void 0?u2:c2:Rb&&Rb in Object(i)?Pb(i):Ib(i)}var Cn=h2;function f2(i){return i!=null&&typeof i=="object"}var Kr=f2;var d2="[object Symbol]";function p2(i){return typeof i=="symbol"||Kr(i)&&Cn(i)==d2}var Hs=p2;function m2(i,e){for(var t=-1,r=i==null?0:i.length,n=Array(r);++t<r;)n[t]=e(i[t],t,i);return n}var nd=m2;var g2=Array.isArray,zr=g2;var y2=1/0,Bb=un?un.prototype:void 0,Nb=Bb?Bb.toString:void 0;function Ob(i){if(typeof i=="string")return i;if(zr(i))return nd(i,Ob)+"";if(Hs(i))return Nb?Nb.call(i):"";var e=i+"";return e=="0"&&1/i==-y2?"-0":e}var Fb=Ob;var v2=/\s/;function x2(i){for(var e=i.length;e--&&v2.test(i.charAt(e)););return e}var Ub=x2;var b2=/^\s+/;function w2(i){return i&&i.slice(0,Ub(i)+1).replace(b2,"")}var zb=w2;function S2(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var ur=S2;var Gb=0/0,M2=/^[-+]0x[0-9a-f]+$/i,A2=/^0b[01]+$/i,T2=/^0o[0-7]+$/i,E2=parseInt;function _2(i){if(typeof i=="number")return i;if(Hs(i))return Gb;if(ur(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=ur(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=zb(i);var t=A2.test(i);return t||T2.test(i)?E2(i.slice(2),t?2:8):M2.test(i)?Gb:+i}var dy=_2;function C2(i){return i}var id=C2;var L2="[object AsyncFunction]",D2="[object Function]",P2="[object GeneratorFunction]",I2="[object Proxy]";function R2(i){if(!ur(i))return!1;var e=Cn(i);return e==D2||e==P2||e==L2||e==I2}var rl=R2;var B2=sr["__core-js_shared__"],sd=B2;var kb=function(){var i=/[^.]+$/.exec(sd&&sd.keys&&sd.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function N2(i){return!!kb&&kb in i}var Vb=N2;var O2=Function.prototype,F2=O2.toString;function U2(i){if(i!=null){try{return F2.call(i)}catch{}try{return i+""}catch{}}return""}var ss=U2;var z2=/[\\^$.*+?()[\]{}|]/g,G2=/^\[object .+?Constructor\]$/,k2=Function.prototype,V2=Object.prototype,H2=k2.toString,W2=V2.hasOwnProperty,j2=RegExp("^"+H2.call(W2).replace(z2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function q2(i){if(!ur(i)||Vb(i))return!1;var e=rl(i)?j2:G2;return e.test(ss(i))}var Hb=q2;function X2(i,e){return i==null?void 0:i[e]}var Wb=X2;function Y2(i,e){var t=Wb(i,e);return Hb(t)?t:void 0}var vn=Y2;var J2=vn(sr,"WeakMap"),od=J2;var jb=Object.create,Q2=function(){function i(){}return function(e){if(!ur(e))return{};if(jb)return jb(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}}(),qb=Q2;function K2(i,e,t){switch(t.length){case 0:return i.call(e);case 1:return i.call(e,t[0]);case 2:return i.call(e,t[0],t[1]);case 3:return i.call(e,t[0],t[1],t[2])}return i.apply(e,t)}var Xb=K2;function Z2(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e}var ad=Z2;var $2=800,eI=16,tI=Date.now;function rI(i){var e=0,t=0;return function(){var r=tI(),n=eI-(r-t);if(t=r,n>0){if(++e>=$2)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}var Yb=rI;function nI(i){return function(){return i}}var Jb=nI;var iI=function(){try{var i=vn(Object,"defineProperty");return i({},"",{}),i}catch{}}(),nl=iI;var sI=nl?function(i,e){return nl(i,"toString",{configurable:!0,enumerable:!1,value:Jb(e),writable:!0})}:id,Qb=sI;var oI=Yb(Qb),ld=oI;function aI(i,e){for(var t=-1,r=i==null?0:i.length;++t<r&&e(i[t],t,i)!==!1;);return i}var Kb=aI;var lI=9007199254740991,cI=/^(?:0|[1-9]\d*)$/;function uI(i,e){var t=typeof i;return e=e==null?lI:e,!!e&&(t=="number"||t!="symbol"&&cI.test(i))&&i>-1&&i%1==0&&i<e}var cd=uI;function hI(i,e,t){e=="__proto__"&&nl?nl(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}var il=hI;function fI(i,e){return i===e||i!==i&&e!==e}var Ws=fI;var dI=Object.prototype,pI=dI.hasOwnProperty;function mI(i,e,t){var r=i[e];(!(pI.call(i,e)&&Ws(r,t))||t===void 0&&!(e in i))&&il(i,e,t)}var ud=mI;function gI(i,e,t,r){var n=!t;t||(t={});for(var s=-1,o=e.length;++s<o;){var a=e[s],l=r?r(t[a],i[a],a,t,i):void 0;l===void 0&&(l=i[a]),n?il(t,a,l):ud(t,a,l)}return t}var Hn=gI;var Zb=Math.max;function yI(i,e,t){return e=Zb(e===void 0?i.length-1:e,0),function(){for(var r=arguments,n=-1,s=Zb(r.length-e,0),o=Array(s);++n<s;)o[n]=r[e+n];n=-1;for(var a=Array(e+1);++n<e;)a[n]=r[n];return a[e]=t(o),Xb(i,this,a)}}var hd=yI;function vI(i,e){return ld(hd(i,e,id),i+"")}var $b=vI;var xI=9007199254740991;function bI(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=xI}var fd=bI;function wI(i){return i!=null&&fd(i.length)&&!rl(i)}var js=wI;function SI(i,e,t){if(!ur(t))return!1;var r=typeof e;return(r=="number"?js(t)&&cd(e,t.length):r=="string"&&e in t)?Ws(t[e],i):!1}var ew=SI;function MI(i){return $b(function(e,t){var r=-1,n=t.length,s=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(s=i.length>3&&typeof s=="function"?(n--,s):void 0,o&&ew(t[0],t[1],o)&&(s=n<3?void 0:s,n=1),e=Object(e);++r<n;){var a=t[r];a&&i(e,a,r,s)}return e})}var tw=MI;var AI=Object.prototype;function TI(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||AI;return i===t}var sl=TI;function EI(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r}var rw=EI;var _I="[object Arguments]";function CI(i){return Kr(i)&&Cn(i)==_I}var py=CI;var nw=Object.prototype,LI=nw.hasOwnProperty,DI=nw.propertyIsEnumerable,PI=py(function(){return arguments}())?py:function(i){return Kr(i)&&LI.call(i,"callee")&&!DI.call(i,"callee")},Uo=PI;function II(){return!1}var iw=II;var aw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,sw=aw&&typeof module=="object"&&module&&!module.nodeType&&module,RI=sw&&sw.exports===aw,ow=RI?sr.Buffer:void 0,BI=ow?ow.isBuffer:void 0,NI=BI||iw,ol=NI;var OI="[object Arguments]",FI="[object Array]",UI="[object Boolean]",zI="[object Date]",GI="[object Error]",kI="[object Function]",VI="[object Map]",HI="[object Number]",WI="[object Object]",jI="[object RegExp]",qI="[object Set]",XI="[object String]",YI="[object WeakMap]",JI="[object ArrayBuffer]",QI="[object DataView]",KI="[object Float32Array]",ZI="[object Float64Array]",$I="[object Int8Array]",eR="[object Int16Array]",tR="[object Int32Array]",rR="[object Uint8Array]",nR="[object Uint8ClampedArray]",iR="[object Uint16Array]",sR="[object Uint32Array]",qt={};qt[KI]=qt[ZI]=qt[$I]=qt[eR]=qt[tR]=qt[rR]=qt[nR]=qt[iR]=qt[sR]=!0;qt[OI]=qt[FI]=qt[JI]=qt[UI]=qt[QI]=qt[zI]=qt[GI]=qt[kI]=qt[VI]=qt[HI]=qt[WI]=qt[jI]=qt[qI]=qt[XI]=qt[YI]=!1;function oR(i){return Kr(i)&&fd(i.length)&&!!qt[Cn(i)]}var lw=oR;function aR(i){return function(e){return i(e)}}var al=aR;var cw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,bu=cw&&typeof module=="object"&&module&&!module.nodeType&&module,lR=bu&&bu.exports===cw,my=lR&&rd.process,cR=function(){try{var i=bu&&bu.require&&bu.require("util").types;return i||my&&my.binding&&my.binding("util")}catch{}}(),os=cR;var uw=os&&os.isTypedArray,uR=uw?al(uw):lw,dd=uR;var hR=Object.prototype,fR=hR.hasOwnProperty;function dR(i,e){var t=zr(i),r=!t&&Uo(i),n=!t&&!r&&ol(i),s=!t&&!r&&!n&&dd(i),o=t||r||n||s,a=o?rw(i.length,String):[],l=a.length;for(var c in i)(e||fR.call(i,c))&&!(o&&(c=="length"||n&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||cd(c,l)))&&a.push(c);return a}var pd=dR;function pR(i,e){return function(t){return i(e(t))}}var md=pR;var mR=md(Object.keys,Object),hw=mR;var gR=Object.prototype,yR=gR.hasOwnProperty;function vR(i){if(!sl(i))return hw(i);var e=[];for(var t in Object(i))yR.call(i,t)&&t!="constructor"&&e.push(t);return e}var fw=vR;function xR(i){return js(i)?pd(i):fw(i)}var ll=xR;function bR(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var dw=bR;var wR=Object.prototype,SR=wR.hasOwnProperty;function MR(i){if(!ur(i))return dw(i);var e=sl(i),t=[];for(var r in i)r=="constructor"&&(e||!SR.call(i,r))||t.push(r);return t}var pw=MR;function AR(i){return js(i)?pd(i,!0):pw(i)}var Ei=AR;var TR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ER=/^\w*$/;function _R(i,e){if(zr(i))return!1;var t=typeof i;return t=="number"||t=="symbol"||t=="boolean"||i==null||Hs(i)?!0:ER.test(i)||!TR.test(i)||e!=null&&i in Object(e)}var mw=_R;var CR=vn(Object,"create"),as=CR;function LR(){this.__data__=as?as(null):{},this.size=0}var gw=LR;function DR(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var yw=DR;var PR="__lodash_hash_undefined__",IR=Object.prototype,RR=IR.hasOwnProperty;function BR(i){var e=this.__data__;if(as){var t=e[i];return t===PR?void 0:t}return RR.call(e,i)?e[i]:void 0}var vw=BR;var NR=Object.prototype,OR=NR.hasOwnProperty;function FR(i){var e=this.__data__;return as?e[i]!==void 0:OR.call(e,i)}var xw=FR;var UR="__lodash_hash_undefined__";function zR(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=as&&e===void 0?UR:e,this}var bw=zR;function cl(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}cl.prototype.clear=gw;cl.prototype.delete=yw;cl.prototype.get=vw;cl.prototype.has=xw;cl.prototype.set=bw;var gy=cl;function GR(){this.__data__=[],this.size=0}var ww=GR;function kR(i,e){for(var t=i.length;t--;)if(Ws(i[t][0],e))return t;return-1}var qs=kR;var VR=Array.prototype,HR=VR.splice;function WR(i){var e=this.__data__,t=qs(e,i);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():HR.call(e,t,1),--this.size,!0}var Sw=WR;function jR(i){var e=this.__data__,t=qs(e,i);return t<0?void 0:e[t][1]}var Mw=jR;function qR(i){return qs(this.__data__,i)>-1}var Aw=qR;function XR(i,e){var t=this.__data__,r=qs(t,i);return r<0?(++this.size,t.push([i,e])):t[r][1]=e,this}var Tw=XR;function ul(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}ul.prototype.clear=ww;ul.prototype.delete=Sw;ul.prototype.get=Mw;ul.prototype.has=Aw;ul.prototype.set=Tw;var Xs=ul;var YR=vn(sr,"Map"),Ys=YR;function JR(){this.size=0,this.__data__={hash:new gy,map:new(Ys||Xs),string:new gy}}var Ew=JR;function QR(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}var _w=QR;function KR(i,e){var t=i.__data__;return _w(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Js=KR;function ZR(i){var e=Js(this,i).delete(i);return this.size-=e?1:0,e}var Cw=ZR;function $R(i){return Js(this,i).get(i)}var Lw=$R;function eB(i){return Js(this,i).has(i)}var Dw=eB;function tB(i,e){var t=Js(this,i),r=t.size;return t.set(i,e),this.size+=t.size==r?0:1,this}var Pw=tB;function hl(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}hl.prototype.clear=Ew;hl.prototype.delete=Cw;hl.prototype.get=Lw;hl.prototype.has=Dw;hl.prototype.set=Pw;var wu=hl;var rB="Expected a function";function yy(i,e){if(typeof i!="function"||e!=null&&typeof e!="function")throw new TypeError(rB);var t=function(){var r=arguments,n=e?e.apply(this,r):r[0],s=t.cache;if(s.has(n))return s.get(n);var o=i.apply(this,r);return t.cache=s.set(n,o)||s,o};return t.cache=new(yy.Cache||wu),t}yy.Cache=wu;var Iw=yy;var nB=500;function iB(i){var e=Iw(i,function(r){return t.size===nB&&t.clear(),r}),t=e.cache;return e}var Rw=iB;var sB=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,oB=/\\(\\)?/g,aB=Rw(function(i){var e=[];return i.charCodeAt(0)===46&&e.push(""),i.replace(sB,function(t,r,n,s){e.push(n?s.replace(oB,"$1"):r||t)}),e}),Bw=aB;function lB(i){return i==null?"":Fb(i)}var Nw=lB;function cB(i,e){return zr(i)?i:mw(i,e)?[i]:Bw(Nw(i))}var fl=cB;var uB=1/0;function hB(i){if(typeof i=="string"||Hs(i))return i;var e=i+"";return e=="0"&&1/i==-uB?"-0":e}var gd=hB;function fB(i,e){e=fl(e,i);for(var t=0,r=e.length;i!=null&&t<r;)i=i[gd(e[t++])];return t&&t==r?i:void 0}var Ow=fB;function dB(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i}var dl=dB;var Fw=un?un.isConcatSpreadable:void 0;function pB(i){return zr(i)||Uo(i)||!!(Fw&&i&&i[Fw])}var Uw=pB;function zw(i,e,t,r,n){var s=-1,o=i.length;for(t||(t=Uw),n||(n=[]);++s<o;){var a=i[s];e>0&&t(a)?e>1?zw(a,e-1,t,r,n):dl(n,a):r||(n[n.length]=a)}return n}var Gw=zw;function mB(i){var e=i==null?0:i.length;return e?Gw(i,1):[]}var kw=mB;function gB(i){return ld(hd(i,void 0,kw),i+"")}var Vw=gB;var yB=md(Object.getPrototypeOf,Object),pl=yB;var vB="[object Object]",xB=Function.prototype,bB=Object.prototype,Hw=xB.toString,wB=bB.hasOwnProperty,SB=Hw.call(Object);function MB(i){if(!Kr(i)||Cn(i)!=vB)return!1;var e=pl(i);if(e===null)return!0;var t=wB.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Hw.call(t)==SB}var yd=MB;function AB(i,e,t){var r=-1,n=i.length;e<0&&(e=-e>n?0:n+e),t=t>n?n:t,t<0&&(t+=n),n=e>t?0:t-e>>>0,e>>>=0;for(var s=Array(n);++r<n;)s[r]=i[r+e];return s}var Ww=AB;function TB(){this.__data__=new Xs,this.size=0}var jw=TB;function EB(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}var qw=EB;function _B(i){return this.__data__.get(i)}var Xw=_B;function CB(i){return this.__data__.has(i)}var Yw=CB;var LB=200;function DB(i,e){var t=this.__data__;if(t instanceof Xs){var r=t.__data__;if(!Ys||r.length<LB-1)return r.push([i,e]),this.size=++t.size,this;t=this.__data__=new wu(r)}return t.set(i,e),this.size=t.size,this}var Jw=DB;function ml(i){var e=this.__data__=new Xs(i);this.size=e.size}ml.prototype.clear=jw;ml.prototype.delete=qw;ml.prototype.get=Xw;ml.prototype.has=Yw;ml.prototype.set=Jw;var vd=ml;function PB(i,e){return i&&Hn(e,ll(e),i)}var Qw=PB;function IB(i,e){return i&&Hn(e,Ei(e),i)}var Kw=IB;var tS=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zw=tS&&typeof module=="object"&&module&&!module.nodeType&&module,RB=Zw&&Zw.exports===tS,$w=RB?sr.Buffer:void 0,eS=$w?$w.allocUnsafe:void 0;function BB(i,e){if(e)return i.slice();var t=i.length,r=eS?eS(t):new i.constructor(t);return i.copy(r),r}var xd=BB;function NB(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var o=i[t];e(o,t,i)&&(s[n++]=o)}return s}var rS=NB;function OB(){return[]}var bd=OB;var FB=Object.prototype,UB=FB.propertyIsEnumerable,nS=Object.getOwnPropertySymbols,zB=nS?function(i){return i==null?[]:(i=Object(i),rS(nS(i),function(e){return UB.call(i,e)}))}:bd,gl=zB;function GB(i,e){return Hn(i,gl(i),e)}var iS=GB;var kB=Object.getOwnPropertySymbols,VB=kB?function(i){for(var e=[];i;)dl(e,gl(i)),i=pl(i);return e}:bd,wd=VB;function HB(i,e){return Hn(i,wd(i),e)}var sS=HB;function WB(i,e,t){var r=e(i);return zr(i)?r:dl(r,t(i))}var Sd=WB;function jB(i){return Sd(i,ll,gl)}var oS=jB;function qB(i){return Sd(i,Ei,wd)}var Md=qB;var XB=vn(sr,"DataView"),Ad=XB;var YB=vn(sr,"Promise"),Td=YB;var JB=vn(sr,"Set"),Ed=JB;var aS="[object Map]",QB="[object Object]",lS="[object Promise]",cS="[object Set]",uS="[object WeakMap]",hS="[object DataView]",KB=ss(Ad),ZB=ss(Ys),$B=ss(Td),eN=ss(Ed),tN=ss(od),zo=Cn;(Ad&&zo(new Ad(new ArrayBuffer(1)))!=hS||Ys&&zo(new Ys)!=aS||Td&&zo(Td.resolve())!=lS||Ed&&zo(new Ed)!=cS||od&&zo(new od)!=uS)&&(zo=function(i){var e=Cn(i),t=e==QB?i.constructor:void 0,r=t?ss(t):"";if(r)switch(r){case KB:return hS;case ZB:return aS;case $B:return lS;case eN:return cS;case tN:return uS}return e});var yl=zo;var rN=Object.prototype,nN=rN.hasOwnProperty;function iN(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&nN.call(i,"index")&&(t.index=i.index,t.input=i.input),t}var fS=iN;var sN=sr.Uint8Array,vy=sN;function oN(i){var e=new i.constructor(i.byteLength);return new vy(e).set(new vy(i)),e}var vl=oN;function aN(i,e){var t=e?vl(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength)}var dS=aN;var lN=/\w*$/;function cN(i){var e=new i.constructor(i.source,lN.exec(i));return e.lastIndex=i.lastIndex,e}var pS=cN;var mS=un?un.prototype:void 0,gS=mS?mS.valueOf:void 0;function uN(i){return gS?Object(gS.call(i)):{}}var yS=uN;function hN(i,e){var t=e?vl(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length)}var _d=hN;var fN="[object Boolean]",dN="[object Date]",pN="[object Map]",mN="[object Number]",gN="[object RegExp]",yN="[object Set]",vN="[object String]",xN="[object Symbol]",bN="[object ArrayBuffer]",wN="[object DataView]",SN="[object Float32Array]",MN="[object Float64Array]",AN="[object Int8Array]",TN="[object Int16Array]",EN="[object Int32Array]",_N="[object Uint8Array]",CN="[object Uint8ClampedArray]",LN="[object Uint16Array]",DN="[object Uint32Array]";function PN(i,e,t){var r=i.constructor;switch(e){case bN:return vl(i);case fN:case dN:return new r(+i);case wN:return dS(i,t);case SN:case MN:case AN:case TN:case EN:case _N:case CN:case LN:case DN:return _d(i,t);case pN:return new r;case mN:case vN:return new r(i);case gN:return pS(i);case yN:return new r;case xN:return yS(i)}}var vS=PN;function IN(i){return typeof i.constructor=="function"&&!sl(i)?qb(pl(i)):{}}var Cd=IN;var RN="[object Map]";function BN(i){return Kr(i)&&yl(i)==RN}var xS=BN;var bS=os&&os.isMap,NN=bS?al(bS):xS,wS=NN;var ON="[object Set]";function FN(i){return Kr(i)&&yl(i)==ON}var SS=FN;var MS=os&&os.isSet,UN=MS?al(MS):SS,AS=UN;var zN=1,GN=2,kN=4,TS="[object Arguments]",VN="[object Array]",HN="[object Boolean]",WN="[object Date]",jN="[object Error]",ES="[object Function]",qN="[object GeneratorFunction]",XN="[object Map]",YN="[object Number]",_S="[object Object]",JN="[object RegExp]",QN="[object Set]",KN="[object String]",ZN="[object Symbol]",$N="[object WeakMap]",e3="[object ArrayBuffer]",t3="[object DataView]",r3="[object Float32Array]",n3="[object Float64Array]",i3="[object Int8Array]",s3="[object Int16Array]",o3="[object Int32Array]",a3="[object Uint8Array]",l3="[object Uint8ClampedArray]",c3="[object Uint16Array]",u3="[object Uint32Array]",Vt={};Vt[TS]=Vt[VN]=Vt[e3]=Vt[t3]=Vt[HN]=Vt[WN]=Vt[r3]=Vt[n3]=Vt[i3]=Vt[s3]=Vt[o3]=Vt[XN]=Vt[YN]=Vt[_S]=Vt[JN]=Vt[QN]=Vt[KN]=Vt[ZN]=Vt[a3]=Vt[l3]=Vt[c3]=Vt[u3]=!0;Vt[jN]=Vt[ES]=Vt[$N]=!1;function Ld(i,e,t,r,n,s){var o,a=e&zN,l=e&GN,c=e&kN;if(t&&(o=n?t(i,r,n,s):t(i)),o!==void 0)return o;if(!ur(i))return i;var u=zr(i);if(u){if(o=fS(i),!a)return ad(i,o)}else{var h=yl(i),f=h==ES||h==qN;if(ol(i))return xd(i,a);if(h==_S||h==TS||f&&!n){if(o=l||f?{}:Cd(i),!a)return l?sS(i,Kw(o,i)):iS(i,Qw(o,i))}else{if(!Vt[h])return n?i:{};o=vS(i,h,a)}}s||(s=new vd);var d=s.get(i);if(d)return d;s.set(i,o),AS(i)?i.forEach(function(g){o.add(Ld(g,e,t,g,i,s))}):wS(i)&&i.forEach(function(g,y){o.set(y,Ld(g,e,t,y,i,s))});var m=c?l?Md:oS:l?Ei:ll,p=u?void 0:m(i);return Kb(p||i,function(g,y){p&&(y=g,g=i[y]),ud(o,y,Ld(g,e,t,y,i,s))}),o}var Dd=Ld;var h3=1,f3=4;function d3(i){return Dd(i,h3|f3)}var Su=d3;function p3(i){return function(e,t,r){for(var n=-1,s=Object(e),o=r(e),a=o.length;a--;){var l=o[i?a:++n];if(t(s[l],l,s)===!1)break}return e}}var CS=p3;var m3=CS(),LS=m3;var g3=function(){return sr.Date.now()},Pd=g3;var y3="Expected a function",v3=Math.max,x3=Math.min;function b3(i,e,t){var r,n,s,o,a,l,c=0,u=!1,h=!1,f=!0;if(typeof i!="function")throw new TypeError(y3);e=dy(e)||0,ur(t)&&(u=!!t.leading,h="maxWait"in t,s=h?v3(dy(t.maxWait)||0,e):s,f="trailing"in t?!!t.trailing:f);function d(E){var T=r,S=n;return r=n=void 0,c=E,o=i.apply(S,T),o}function m(E){return c=E,a=setTimeout(y,e),u?d(E):o}function p(E){var T=E-l,S=E-c,I=e-T;return h?x3(I,s-S):I}function g(E){var T=E-l,S=E-c;return l===void 0||T>=e||T<0||h&&S>=s}function y(){var E=Pd();if(g(E))return v(E);a=setTimeout(y,p(E))}function v(E){return a=void 0,f&&r?d(E):(r=n=void 0,o)}function b(){a!==void 0&&clearTimeout(a),c=0,r=l=n=a=void 0}function w(){return a===void 0?o:v(Pd())}function x(){var E=Pd(),T=g(E);if(r=arguments,n=this,l=E,T){if(a===void 0)return m(l);if(h)return clearTimeout(a),a=setTimeout(y,e),d(l)}return a===void 0&&(a=setTimeout(y,e)),o}return x.cancel=b,x.flush=w,x}var Mu=b3;function w3(i,e,t){(t!==void 0&&!Ws(i[e],t)||t===void 0&&!(e in i))&&il(i,e,t)}var Au=w3;function S3(i){return Kr(i)&&js(i)}var DS=S3;function M3(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}var Tu=M3;function A3(i){return Hn(i,Ei(i))}var PS=A3;function T3(i,e,t,r,n,s,o){var a=Tu(i,t),l=Tu(e,t),c=o.get(l);if(c){Au(i,t,c);return}var u=s?s(a,l,t+"",i,e,o):void 0,h=u===void 0;if(h){var f=zr(l),d=!f&&ol(l),m=!f&&!d&&dd(l);u=l,f||d||m?zr(a)?u=a:DS(a)?u=ad(a):d?(h=!1,u=xd(l,!0)):m?(h=!1,u=_d(l,!0)):u=[]:yd(l)||Uo(l)?(u=a,Uo(a)?u=PS(a):(!ur(a)||rl(a))&&(u=Cd(l))):h=!1}h&&(o.set(l,u),n(u,l,r,s,o),o.delete(l)),Au(i,t,u)}var IS=T3;function RS(i,e,t,r,n){i!==e&&LS(e,function(s,o){if(n||(n=new vd),ur(s))IS(i,e,o,t,RS,r,n);else{var a=r?r(Tu(i,o),s,o+"",i,e,n):void 0;a===void 0&&(a=s),Au(i,o,a)}},Ei)}var BS=RS;function E3(i){var e=i==null?0:i.length;return e?i[e-1]:void 0}var NS=E3;function _3(i,e){return e.length<2?i:Ow(i,Ww(e,0,-1))}var OS=_3;var C3=tw(function(i,e,t){BS(i,e,t)}),Go=C3;function L3(i,e){return e=fl(e,i),i=OS(i,e),i==null||delete i[gd(NS(e))]}var FS=L3;function D3(i){return yd(i)?void 0:i}var US=D3;var P3=1,I3=2,R3=4,B3=Vw(function(i,e){var t={};if(i==null)return t;var r=!1;e=nd(e,function(s){return s=fl(s,i),r||(r=s.length>1),s}),Hn(i,Md(i),t),r&&(t=Dd(t,P3|I3|R3,US));for(var n=e.length;n--;)FS(t,e[n]);return t}),xl=B3;var N3=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().includes(" electron/"),O3=()=>typeof window>"u"?!1:window.navigator.platform.toUpperCase().includes("MAC"),F3=()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(window.navigator.userAgent)||Eu&&"ontouchend"in document,U3=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,z3=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0,Sj=N3(),Eu=O3(),_u=F3(),zS=U3(),Id=z3();function GS(i){return Array.isArray(i)?i:[i]}function Cu(i){return Eu?i.metaKey:i.ctrlKey}var Qs;(t=>{t.all=["PerspectiveCamera","OrthographicCamera"];function e(r){return t.all.includes(r)}t.is=e})(Qs||(Qs={}));var ko;(n=>{n.DefaultUp=[0,1,0],n.DefaultTargetOffset=1e3,n.defaultData={far:1e5,type:"OrthographicCamera",perspective:{near:5,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:n.DefaultUp,isUpVectorFlipped:!1,targetOffset:n.DefaultTargetOffset};function r(s){return s.type==="PerspectiveCamera"?s.perspective.zoom:s.orthographic.zoom}n.getZoom=r})(ko||(ko={}));var ls;(t=>{function i(r,n){return r[0]===n[0]&&r[1]===n[1]}t.isEqual=i;function e(r,n,s){return[r[0]+(n[0]-r[0])*s,r[1]+(n[1]-r[1])*s]}t.lerp=e})(ls||(ls={}));var vr;(n=>{function i(s,o){return s[0]===o[0]&&s[1]===o[1]&&s[2]===o[2]}n.isEqual=i;function e(s,o){return[s[0]+o[0],s[1]+o[1],s[2]+o[2]]}n.add=e;function t(s,o){return[s[0]-o[0],s[1]-o[1],s[2]-o[2]]}n.sub=t;function r(s,o,a){return[s[0]+(o[0]-s[0])*a,s[1]+(o[1]-s[1])*a,s[2]+(o[2]-s[2])*a]}n.lerp=r})(vr||(vr={}));var Lu;(t=>{function i(r,n){return r[0]===n[0]&&r[1]===n[1]&&r[2]===n[2]&&r[3]===n[3]}t.isEqual=i;function e(r,n,s){return[r[0]+(n[0]-r[0])*s,r[1]+(n[1]-r[1])*s,r[2]+(n[2]-r[2])*s,r[3]+(n[3]-r[3])*s]}t.lerp=e})(Lu||(Lu={}));var _i;(s=>{s.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function e(o,a){for(let l=0;l<16;l++)if(o[l]!==a[l])return!1;return!0}s.isEqual=e;function t(o){return o!=null?o:s.identity}s.simplify=t;function r(o,a){let l=a.slice(0);for(var c=0,u=a.length;c<u;c+=3){let h=1/(o[3]*a[c]+o[7]*a[c+1]+o[11]*a[c+2]+o[15]);l[c]=(o[0]*a[c]+o[4]*a[c+1]+o[8]*a[c+2]+o[12])*h,l[c+1]=(o[1]*a[c]+o[5]*a[c+1]+o[9]*a[c+2]+o[13])*h,l[c+2]=(o[2]*a[c]+o[6]*a[c+1]+o[10]*a[c+2]+o[14])*h}return l}s.applyMatrix4=r;function n(o,a){let l=a.slice(0);for(var c=0,u=a.length;c<u;c+=3)l[c]=o[0]*a[c]+o[4]*a[c+1]+o[8]*a[c+2],l[c+1]=o[1]*a[c]+o[5]*a[c+1]+o[9]*a[c+2],l[c+2]=o[2]*a[c]+o[6]*a[c+1]+o[10]*a[c+2];return l}s.applyMatrix3Components=n})(_i||(_i={}));var Sr;(l=>{l.white={r:1,g:1,b:1},l.red={r:1,g:0,b:0},l.black={r:0,g:0,b:0};function r(c){return{r:Math.round(c.r*255),g:Math.round(c.g*255),b:Math.round(c.b*255),a:1}}l.toRgb255a1=r;function n(c){return{r:c.r,g:c.g,b:c.b}}l.clone=n;function s(c){return c=Math.floor(c),{r:(c>>16&255)/255,g:(c>>8&255)/255,b:(c&255)/255}}l.fromHex=s;function o(c,u){return c.r===u.r&&c.g===u.g&&c.b===u.b}l.equals=o;function a(c,u,h){return{r:c.r+(u.r-c.r)*h,g:c.g+(u.g-c.g)*h,b:c.b+(u.b-c.b)*h}}l.lerp=a})(Sr||(Sr={}));var Ln;(o=>{o.white=be(se({},Sr.white),{a:1});function e(a){return{r:a[0],g:a[1],b:a[2],a:a[3]}}o.from0to1=e;function t(a,l){return be(se({},Sr.fromHex(a)),{a:l})}o.fromHexAndA=t;function r(a){return{r:Math.round(a.r*255),g:Math.round(a.g*255),b:Math.round(a.b*255),a:a.a}}o.toRgb255a1=r;function n(a,l){return Sr.equals(a,l)&&a.a===l.a}o.equals=n;function s(a,l,c){return{r:a.r+(l.r-a.r)*c,g:a.g+(l.g-a.g)*c,b:a.b+(l.b-a.b)*c,a:a.a+(l.a-a.a)*c}}o.lerp=s})(Ln||(Ln={}));var Rd;(e=>e.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]})(Rd||(Rd={}));var Bd;(e=>e.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(Bd||(Bd={}));var Nd;(e=>e.defaultData={control1:[.5,.05],control2:[.1,.3]})(Nd||(Nd={}));var Od;(e=>{function i(t,r=.1){return{type:"radial",hideBase:!1,count:3,radial:{radius:Math.max(t[0],t[1])*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[t[0]+t[0]*r,0,0]},grid:{count:[2,2,2],size:t.map(n=>n*(1+r)),useCenter:!0}}}e.defaultData=i})(Od||(Od={}));var Wn=class{modifyById(e,t){let r=this;if(r[e]===void 0)throw new Error("not expected");{let s=be(se({},r),{[e]:t});return Object.setPrototypeOf(s,Wn.prototype),s}}add(e,t){var n;let r=this.runOp({type:1,id:e,data:t});return(n=r==null?void 0:r.data)!=null?n:this}runOp(e){let t=this;if(e.type===1){let r=t[e.id],n;r===void 0?n={type:2,id:e.id}:n={type:1,id:e.id,data:r};let{id:s,data:o}=e,a=be(se({},t),{[s]:o});return Object.setPrototypeOf(a,Wn.prototype),{data:a,actual:e,reverse:n}}else if(e.type===2){let{id:r}=e,n=t[r];if(n===void 0)return null;{let s=se({},t);return Object.setPrototypeOf(s,Wn.prototype),delete s[r],{data:s,actual:e,reverse:{type:1,id:r,data:n}}}}throw new Error("illegal arg")}};function Du(i){if(i.deepFreeze!==void 0){i.deepFreeze(i);return}let e=Object.getOwnPropertyNames(i);for(let t of e){let r=i[t];r&&typeof r=="object"&&Du(r)}return Object.freeze(i)}function kS(i,e){let t=0;for(;t<i.length&&t<e.length;){if(i[t]<e[t])return-1;if(i[t]>e[t])return 1;t+=1}return t!==e.length?-1:t!==i.length?1:0}var Fd=class extends Error{};function Ci(i,e,t){if(i===void 0?e===void 0?(i=0,e=10):i=e-10:e===void 0&&(e=i+10),i>e){let s=i;i=e,e=s}let r=[],n=1/(t+1);for(let s=0;s<t;s++){let o=i+(e-i)*(s+.75+Math.random()*.5)*n;r.push(o)}return r}function VS(i){return i instanceof Uint8Array||i instanceof Uint16Array||i instanceof Uint32Array||i instanceof Int8Array||i instanceof Int16Array||i instanceof Int32Array||i instanceof Float32Array||i instanceof Float64Array}function HS(){return typeof process<"u"}function WS(i,e){for(let t of i)e(t.id,t.data),WS(t.children,e)}function jS(i,e){e(i.id,i.data);for(let t of i.children)jS(t,e)}var jn=class extends Array{constructor(...t){super(...t);Object.setPrototypeOf(this,jn.prototype)}deepFreeze(){let t=0;for(;t<this.length;)Du(this[t]),t++}fillCaches0(t,r){var n;if((n=this.objCaches)!=null&&n.has(t.id))throw new Error("duplicated item");this.objCaches.set(t.id,t),this.parentCaches.set(t.id,r);for(let s of t.children)this.fillCaches0(s,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}isDescendantOf(t,r){for(;t;){let n=this.parent(t);if(n===r)return!0;t=n}return!1}data(t){var r;return(r=this.get(t))==null?void 0:r.data}has(t){return this.childrenOf(t)!==void 0}get(t){return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){var r;return t===null?this:(r=this.get(t))==null?void 0:r.children}traverseFrom(t,r){if(t===null)this.traverse(r);else{let n=this.get(t);n&&jS(n,r)}}traverse(t){WS(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,r){if(this.get(t)===void 0)throw new Error("not expected");{let s=this.parent(t),o=this.childrenArray(s),a=o.findIndex(u=>u.id===t);if(a<0)throw new Error("not expected");let l=o[a];return o=[...o],o[a]=be(se({},l),{data:r}),this.modifyArrayBy(s,o)}}modifyArrayBy(t,r){let n=t,s=r;for(;n!==null;){let a=s,l=n;if(n=this.parent(n),n===void 0)throw new Error;s=this.childrenArray(n);let c=s.findIndex(u=>u.id===l);if(c<0)throw new Error;s=[...s],s[c]=be(se({},s[c]),{children:a})}Object.setPrototypeOf(s,jn.prototype);let o=s;return o.fillCaches(),o}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}}addOp(t){let{parent:r,fi:n,id:s,data:o,children:a}=t;if(r!==null&&this.get(r)===void 0)return null;if(this.get(s)!==void 0)return null;{let l=r,c=this.childrenArray(l),u={fi:n,id:s,data:o,children:a};return c=[...c,u],c.sort((f,d)=>f.fi-d.fi),t.localIndex=c.indexOf(u),{data:this.modifyArrayBy(l,c),actual:t,reverse:{type:8,id:s}}}}deleteOp(t){let{id:r}=t;if(this.get(r)===null)return null;{let n=this.parent(r);if(n===void 0)return null;let s=this.childrenArray(n),o=s.findIndex(c=>c.id===r);t.localIndex=o,s=[...s];let a=s.splice(o,1)[0];return{data:this.modifyArrayBy(n,s),actual:t,reverse:be(se({type:7},a),{parent:n})}}}moveOp(t){let{parent:r,fi:n,id:s}=t;if(r!==null&&this.get(r)===void 0)return this.deleteOp({type:8,id:s});if(r!==null){let d=r;for(;d!==null;){if(d===void 0)throw new Error;if(d===s)throw new Fd("cyclic tree");d=this.parent(d)}}let o=this.parent(s);if(o===void 0)return null;let a=o,l=this.childrenArray(o),c=l.findIndex(d=>d.id===s);l=[...l];let u=l.splice(c,1)[0],h=this.modifyArrayBy(o,l);o=r,l=h.childrenArray(o);let f=u.fi;return u=be(se({},u),{fi:n}),l=[...l,u],l.sort((d,m)=>d.fi-m.fi),t.localIndex=l.indexOf(u),h=h.modifyArrayBy(o,l),{data:h,actual:t,reverse:{type:9,parent:a,fi:f,id:s}}}previous(t,r){if(r===null){let s=this.childrenArray(t);return s.length===0?null:s[s.length-1].id}let n=null;for(let s of this.childrenArray(t)){if(s.id===r)return n;n=s.id}return null}traverseSortNext(t){let r=this.parent(t);if(r!==void 0){let n=this.childrenArray(r),s=n.findIndex(o=>o.id===t)+1;if(s<n.length)return n[s].id;if(r)return this.traverseSortNext(r)}}sortNext(t){let r=this.childrenArray(t);return r.length>0?r[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let r=this.childrenArray(t);return r.length>0?this.traverseSortPrevious(r[r.length-1].id):t}sortPrevious(t){let r=this.parent(t);if(r!==void 0){let n=this.childrenArray(r),s=n.findIndex(o=>o.id===t)-1;return s>=0?this.traverseSortPrevious(n[s].id):r}}getAllSorted(t){let r=[];for(let n of t){let s=this.getWithSortKey(n.id);s!==void 0&&r.push(se(se({},n),s))}r.sort((n,s)=>kS(n.sortKey,s.sortKey));for(let n of r)delete n.sortKey;return r}getWithSortKey(t){var r=t;let n=[],s=this.get(r),o=s;if(s!==void 0){for(;r;)n.splice(0,0,s.fi),r=this.parent(r),r!==null&&(s=this.get(r));return be(se({},o),{sortKey:n})}}insertBeforeHelper(t,r,n){return this.insertAfterHelper(t,this.previous(t,r),n)}insertAfterHelper(t,r,n){let s=this.childrenArray(t);if(r===null){if(s.length===0)return Ci(0,n,n);{let o=s[0].fi;return Ci(o-n,o,n)}}else{let o=this.get(r);if(o===void 0||this.parent(r)!==t)throw new Error("illegal args");let a=s.find(l=>l.fi>o.fi);if(a===void 0){let l=s[s.length-1].fi;return Ci(l,l+n,n)}else return Ci(o.fi,a.fi,n)}}};var Ud;(e=>{function i(t,r){if(Array.isArray(t)){let n=r.props,s={},o=[...t],a=!1;if(n)for(let l of Object.keys(n)){let c=parseInt(l);if(isNaN(c))throw new Error("wrong index");s[l]=o[c],o[c]=n[l],a=!0}return a?{data:o,actual:r,reverse:{type:0,props:s}}:null}else{let n=r.props,s={},o=se({},t),a=!1;if(n)for(let l of Object.keys(n)){s[l]=o[l];let c=n[l];c===void 0?delete o[l]:o[l]=c,a=!0}return a?{data:o,actual:r,reverse:{type:0,props:s}}:null}}e.runOp=i})(Ud||(Ud={}));var er=class extends Array{constructor(...t){super(...t);Object.setPrototypeOf(this,er.prototype)}deepFreeze(){let t=0;for(;t<this.length;)Du(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){var r;return(r=this.get(t))==null?void 0:r.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,r){if(this.get(t)===void 0)throw new Error("not expected");{let s=this,o=s.findIndex(c=>c.id===t);if(o<0)throw new Error("not expected");let a=s[o];return s=[...s],s[o]=be(se({},a),{data:r}),this.modifyArrayBy(s)}}modifyArrayBy(t){Object.setPrototypeOf(t,er.prototype);let r=t;return HS()||r.fillCaches(),r}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}}addOp(t){let{fi:r,id:n,data:s}=t,o=this,a={fi:r,id:n,data:s};return o=[...o,a],o.sort((c,u)=>c.fi-u.fi),t.localIndex=o.indexOf(a),{data:this.modifyArrayBy(o),actual:t,reverse:{type:5,id:n}}}deleteOp(t){let{id:r}=t,n=this,s=n.findIndex(l=>l.id===r);if(s===-1)return null;t.localIndex=s,n=[...n];let o=n.splice(s,1)[0];return{data:this.modifyArrayBy(n),actual:t,reverse:se({type:4},o)}}moveOp(t){let{fi:r,id:n}=t,s=this;s=[...s];let o=s.findIndex(u=>u.id===n);if(o===-1)return null;let a=s[o].fi,l=be(se({},s[o]),{fi:r});return s[o]=l,s.sort((u,h)=>u.fi-h.fi),t.localIndex=s.indexOf(l),{data:this.modifyArrayBy(s),actual:t,reverse:{type:6,fi:a,id:n}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let r=null;for(let n of this){if(n.id===t)return r;r=n.id}return null}insertBeforeHelper(t,r){return this.insertAfterHelper(this.previous(t),r)}insertAfterHelper(t,r){let n=this;if(t===null){if(n.length===0)return Ci(0,r,r);{let s=n[0].fi;return Ci(s-r,s,r)}}else{let s=this.get(t);if(s===void 0)throw new Error("illegal args");let o=n.find(a=>a.fi>s.fi);if(o===void 0){let a=n[n.length-1].fi;return Ci(a,a+r,r)}else return Ci(s.fi,o.fi,r)}}};var qS=Symbol(),Gd=Symbol(),bl=class{reportOp(e,t){let r=this;if(t===null)return;r._current=t.data;let n=[];for(;!(r instanceof zd);){let s=r._path,o=r._current;if(s!==""&&n.splice(0,0,s),r=r._parent,r===null)return;r.update(s,o)}r.push(n,e,t.actual,t.reverse)}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let r=t[Gd];r&&r(),delete this._children[e]}}}},by=class extends bl{constructor(e,t,r){super(),this._parent=e,this._path=t,this._current=r}update(e,t){if(Array.isArray(this._current)){if(typeof e=="string"&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid path");this._current=[...this._current],this._current[e]=t}else this._current=be(se({},this._current),{[e]:t})}runOp(e){this.reportOp(e,Ud.runOp(this._current,e))}},wy=class extends bl{constructor(e,t,r){super(),this._parent=e,this._path=t,this._current=r}update(e,t){this._current=be(se({},this._current),{[e]:t}),Object.setPrototypeOf(this._current,Wn.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},XS={get(i,e){if(e===Gd)return()=>{i._parent=null};if(e===qS)return i._current;let{_current:t,_children:r}=i;if(e==="push"&&Array.isArray(t))throw new Error("not supported to expand array");let n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=t[e],o=kd(i,e,s);return o!==s?(r===void 0&&(r={},i._children=r),r[e]=o,o):s},has(i,e){return e in i._current},ownKeys(i){return Reflect.ownKeys(i._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(i){return Object.getPrototypeOf(i._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(i,e){let t=i._current,r=Reflect.getOwnPropertyDescriptor(t,e);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:t[e]}}},G3=be(se({},XS),{set(i,e,t){var n;let r={type:0,props:{[e]:(n=Ay(t))!=null?n:t}};return i.deleteChildren(e),i.runOp(r),!0},deleteProperty(i,e){let t={type:0,props:{[e]:void 0}};return i.deleteChildren(e),i.runOp(t),!0}}),k3=be(se({},XS),{set(i,e,t){return t===void 0?this.deleteProperty(i,e):(i.deleteChildren(e),i.runOp({type:1,id:e,data:t})),!0},deleteProperty(i,e){return i.runOp({type:2,id:e}),!0}}),wl=class extends bl{constructor(e,t,r){super(),this._children={},this._parent=e,this._path=t,this._current=r,this[Gd]=()=>{this._parent=null}}unproxy(){return this._current}update(e,t){this._current=this._current.modifyById(e,t)}runOp(e){this.reportOp(e,this._current.runOp(e))}randomId(){return this._current.randomId()}isDescendantOf(e,t){return this._current.isDescendantOf(e,t)}childrenOf(e){return this._current.childrenOf(e)}traverse(e){return this._current.traverse(e)}get(e){return this._current.get(e)}parent(e){return this._current.parent(e)}traverse(e){this._current.traverse((t,r)=>{e(t,this.data(t))})}data(e){var a;let{_current:t,_children:r}=this,n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=(a=t.get(e))==null?void 0:a.data,o=kd(this,e,s);return o!==s?(r===void 0&&(r={},this._children=r),r[e]=o,o):s}add(e,t,r,n,s){this.runOp({type:7,parent:e,fi:t,id:r,data:n,children:s})}move(e,t,r){this.runOp({type:9,parent:e,fi:t,id:r})}insertAfter(e,t,r){let n=this._current.insertAfterHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.add(e,n[s],o.id,o.data,o.children)}}insertBefore(e,t,r){let n=this._current.insertBeforeHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.add(e,n[s],o.id,o.data,o.children)}}moveAfter(e,t,r){let n=this._current.insertAfterHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.move(e,n[s],o)}}moveBefore(e,t,r){let n=this._current.insertBeforeHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.move(e,n[s],o)}}delete(e){this.deleteChildren(e),this.runOp({type:8,id:e})}sortNext(e){return this._current.sortNext(e)}sortPrevious(e){return this._current.sortPrevious(e)}getAllSorted(e){return this._current.getAllSorted(e)}},Sl=class extends bl{constructor(e,t,r){super(),this._children={},this._parent=e,this._path=t,this._current=r,this[Gd]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(e){let t=this.length;for(let r=0;r<t;r++){let n=this._current[r].id;e(this.data(this._current[r].id),n)}}update(e,t){this._current=this._current.modifyById(e,t)}randomId(){return this._current.randomId()}get(e){return be(se({},this._current.get(e)),{data:this.data(e)})}data(e){var a;let{_current:t,_children:r}=this,n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=(a=t.get(e))==null?void 0:a.data,o=kd(this,e,s);return o!==s?(r===void 0&&(r={},this._children=r),r[e]=o,o):s}runOp(e){this.reportOp(e,this._current.runOp(e))}add(e,t,r){this.runOp({type:4,fi:e,id:t,data:r})}move(e,t){this.runOp({type:6,fi:e,id:t})}insertAfter(e,t){let r=this._current.insertAfterHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.add(r[n],s.id,s.data)}}insertBefore(e,t){let r=this._current.insertBeforeHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.add(r[n],s.id,s.data)}}moveAfter(e,t){let r=this._current.insertAfterHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.move(r[n],s)}}moveBefore(e,t){let r=this._current.insertBeforeHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.move(r[n],s)}}delete(e){this.deleteChildren(e),this.runOp({type:5,id:e})}};function xy(i,e,t){if(i.length>0){let r=i[i.length-1];if(r.type===0&&e.type===0&&Vd.equal(r.path,t)){Object.assign(r.props,e.props);return}}i.push(be(se({},e),{path:t}))}var zd=class{constructor(e){this.ts=[],this.actual=[],this.reverse=[],this._current=e}update(e,t){if(e!=="")throw new Error("");this._current=t}push(e,t,r,n){xy(this.ts,t,e),xy(this.actual,r,e),xy(this.reverse,n,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function kd(i,e,t){return t instanceof jn?new wl(i,e,t):t instanceof er?new Sl(i,e,t):t instanceof Wn?new Proxy(new wy(i,e,t),k3):t!==null&&typeof t=="object"?VS(t)?t:new Proxy(new by(i,e,t),G3):t}function Sy(i){let e=new zd(i);return[kd(e,"",i),e]}function My(i,e){let[t,r]=Sy(i);return e(t),r.result()}function Ay(i){return i instanceof wl||i instanceof Sl?i._current:i!==null&&typeof i=="object"?i[qS]:i}var Vd;(r=>{function i(n,s){if(s.length===n.length)for(var o=0;o<n.length;){if(n[o]!==s[o])return!1;o+=1}else return!1;return!0}r.equal=i;function e(n,s,o){let a=t(o,n);if(a!==void 0&&typeof a=="object"&&a!==null){let l=se({},s);return Object.keys(a).forEach(c=>{delete l[c]}),l}else return s}r.removeOverridden=e;function t(n,s,o=0){if(s.length<=o)return n;if((n instanceof jn||n instanceof wl)&&typeof s[o]=="string")return t(n.data(s[o]),s,o+1);if((n instanceof er||n instanceof Sl)&&typeof s[o]=="string")return t(n.data(s[o]),s,o+1);if(typeof s[o]=="number"&&Array.isArray(n))return t(n[s[o]],s,o+1);if(typeof s[o]=="string"&&typeof n=="object")return t(n[s[o]],s,o+1)}r.zoom=t})(Vd||(Vd={}));var Hd=class{},Pu=class extends Hd{constructor(t){super();this.id=t}},Iu=class extends Hd{constructor(t){super();this.data=t}};var Ey;try{Ey=new TextDecoder}catch{}var Re,Zs,Z=0;var tM=[],_y=tM,Cy=0,xn={},Et,Ks,qn=0,Li=0,Dn,cs,hn=[],Pt,YS={useRecords:!1,mapsAsObjects:!0},Ru=class{},Dy=new Ru;Dy.name="MessagePack 0xC1";var Ml=!1,Di=class{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0)),Object.assign(this,e)}unpack(e,t){if(Re)return oM(()=>(jd(),this?this.unpack(e,t):Di.prototype.unpack.call(YS,e,t)));Zs=t>-1?t:e.length,Z=0,Cy=0,Li=0,Ks=null,_y=tM,Dn=null,Re=e;try{Pt=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(r){throw Re=null,e instanceof Uint8Array?r:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof Di){if(xn=this,this.structures)return Et=this.structures,Wd();(!Et||Et.length>0)&&(Et=[])}else xn=YS,(!Et||Et.length>0)&&(Et=[]);return Wd()}unpackMultiple(e,t){let r,n=0;try{Ml=!0;let s=e.length,o=this?this.unpack(e,s):Yd.unpack(e,s);if(t){for(t(o);Z<s;)if(n=Z,t(Wd())===!1)return}else{for(r=[o];Z<s;)n=Z,r.push(Wd());return r}}catch(s){throw s.lastPosition=n,s.values=r,s}finally{Ml=!1,jd()}}_mergeStructures(e,t){e=e||[];for(let r=0,n=e.length;r<n;r++){let s=e[r];s&&(s.isShared=!0,r>=32&&(s.highByte=r-32>>5))}e.sharedLength=e.length;for(let r in t||[])if(r>=0){let n=e[r],s=t[r];s&&(n&&((e.restoreStructures||(e.restoreStructures=[]))[r]=n),e[r]=s)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function Wd(){try{if(!xn.trusted&&!Ml){let e=Et.sharedLength||0;e<Et.length&&(Et.length=e)}let i=or();if(Z==Zs)Et.restoreStructures&&JS(),Et=null,Re=null,cs&&(cs=null);else if(Z>Zs){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}else if(!Ml)throw new Error("Data read, but end of buffer not reached");return i}catch(i){throw Et.restoreStructures&&JS(),jd(),(i instanceof RangeError||i.message.startsWith("Unexpected end of buffer"))&&(i.incomplete=!0),i}}function JS(){for(let i in Et.restoreStructures)Et[i]=Et.restoreStructures[i];Et.restoreStructures=null}function or(){let i=Re[Z++];if(i<160)if(i<128){if(i<64)return i;{let e=Et[i&63]||xn.getStructures&&rM()[i&63];return e?(e.read||(e.read=Py(e,i&63)),e.read()):i}}else if(i<144)if(i-=128,xn.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[iM()]=or();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(or(),or());return e}else{i-=144;let e=new Array(i);for(let t=0;t<i;t++)e[t]=or();return e}else if(i<192){let e=i-160;if(Li>=Z)return Ks.slice(Z-qn,(Z+=e)-qn);if(Li==0&&Zs<140){let t=e<16?Iy(e):nM(e);if(t!=null)return t}return Ly(e)}else{let e;switch(i){case 192:return null;case 193:return Dn?(e=or(),e>0?Dn[1].slice(Dn.position1,Dn.position1+=e):Dn[0].slice(Dn.position0,Dn.position0-=e)):Dy;case 194:return!1;case 195:return!0;case 196:return Ty(Re[Z++]);case 197:return e=Pt.getUint16(Z),Z+=2,Ty(e);case 198:return e=Pt.getUint32(Z),Z+=4,Ty(e);case 199:return Vo(Re[Z++]);case 200:return e=Pt.getUint16(Z),Z+=2,Vo(e);case 201:return e=Pt.getUint32(Z),Z+=4,Vo(e);case 202:if(e=Pt.getFloat32(Z),xn.useFloat32>2){let t=Xd[(Re[Z]&127)<<1|Re[Z+1]>>7];return Z+=4,(t*e+(e>0?.5:-.5)>>0)/t}return Z+=4,e;case 203:return e=Pt.getFloat64(Z),Z+=8,e;case 204:return Re[Z++];case 205:return e=Pt.getUint16(Z),Z+=2,e;case 206:return e=Pt.getUint32(Z),Z+=4,e;case 207:return xn.int64AsNumber?(e=Pt.getUint32(Z)*4294967296,e+=Pt.getUint32(Z+4)):e=Pt.getBigUint64(Z),Z+=8,e;case 208:return Pt.getInt8(Z++);case 209:return e=Pt.getInt16(Z),Z+=2,e;case 210:return e=Pt.getInt32(Z),Z+=4,e;case 211:return xn.int64AsNumber?(e=Pt.getInt32(Z)*4294967296,e+=Pt.getUint32(Z+4)):e=Pt.getBigInt64(Z),Z+=8,e;case 212:if(e=Re[Z++],e==114)return eM(Re[Z++]&63);{let t=hn[e];if(t)return t.read?(Z++,t.read(or())):t.noBuffer?(Z++,t()):t(Re.subarray(Z,++Z));throw new Error("Unknown extension "+e)}case 213:return e=Re[Z],e==114?(Z++,eM(Re[Z++]&63,Re[Z++])):Vo(2);case 214:return Vo(4);case 215:return Vo(8);case 216:return Vo(16);case 217:return e=Re[Z++],Li>=Z?Ks.slice(Z-qn,(Z+=e)-qn):H3(e);case 218:return e=Pt.getUint16(Z),Z+=2,Li>=Z?Ks.slice(Z-qn,(Z+=e)-qn):W3(e);case 219:return e=Pt.getUint32(Z),Z+=4,Li>=Z?Ks.slice(Z-qn,(Z+=e)-qn):j3(e);case 220:return e=Pt.getUint16(Z),Z+=2,KS(e);case 221:return e=Pt.getUint32(Z),Z+=4,KS(e);case 222:return e=Pt.getUint16(Z),Z+=2,ZS(e);case 223:return e=Pt.getUint32(Z),Z+=4,ZS(e);default:if(i>=224)return i-256;if(i===void 0){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}throw new Error("Unknown MessagePack token "+i)}}}var V3=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Py(i,e){function t(){if(t.count++>2){let n=i.read=new Function("r","return function(){return {"+i.map(s=>V3.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"}}")(or);return i.highByte===0&&(i.read=QS(e,i.read)),n()}let r={};for(let n=0,s=i.length;n<s;n++){let o=i[n];r[o]=or()}return r}return t.count=0,i.highByte===0?QS(e,t):t}var QS=(i,e)=>function(){let t=Re[Z++];if(t===0)return e();let r=i<32?-(i+(t<<5)):i+(t<<5),n=Et[r]||rM()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=Py(n,i)),n.read()};function rM(){let i=oM(()=>(Re=null,xn.getStructures()));return Et=xn._mergeStructures(i,Et)}var Ly=qd,H3=qd,W3=qd,j3=qd;function qd(i){let e;if(i<16&&(e=Iy(i)))return e;if(i>64&&Ey)return Ey.decode(Re.subarray(Z,Z+=i));let t=Z+i,r=[];for(e="";Z<t;){let n=Re[Z++];if((n&128)===0)r.push(n);else if((n&224)===192){let s=Re[Z++]&63;r.push((n&31)<<6|s)}else if((n&240)===224){let s=Re[Z++]&63,o=Re[Z++]&63;r.push((n&31)<<12|s<<6|o)}else if((n&248)===240){let s=Re[Z++]&63,o=Re[Z++]&63,a=Re[Z++]&63,l=(n&7)<<18|s<<12|o<<6|a;l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|l&1023),r.push(l)}else r.push(n);r.length>=4096&&(e+=Pr.apply(String,r),r.length=0)}return r.length>0&&(e+=Pr.apply(String,r)),e}function KS(i){let e=new Array(i);for(let t=0;t<i;t++)e[t]=or();return e}function ZS(i){if(xn.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[iM()]=or();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(or(),or());return e}}var Pr=String.fromCharCode;function nM(i){let e=Z,t=new Array(i);for(let r=0;r<i;r++){let n=Re[Z++];if((n&128)>0){Z=e;return}t[r]=n}return Pr.apply(String,t)}function Iy(i){if(i<4)if(i<2){if(i===0)return"";{let e=Re[Z++];if((e&128)>1){Z-=1;return}return Pr(e)}}else{let e=Re[Z++],t=Re[Z++];if((e&128)>0||(t&128)>0){Z-=2;return}if(i<3)return Pr(e,t);let r=Re[Z++];if((r&128)>0){Z-=3;return}return Pr(e,t,r)}else{let e=Re[Z++],t=Re[Z++],r=Re[Z++],n=Re[Z++];if((e&128)>0||(t&128)>0||(r&128)>0||(n&128)>0){Z-=4;return}if(i<6){if(i===4)return Pr(e,t,r,n);{let s=Re[Z++];if((s&128)>0){Z-=5;return}return Pr(e,t,r,n,s)}}else if(i<8){let s=Re[Z++],o=Re[Z++];if((s&128)>0||(o&128)>0){Z-=6;return}if(i<7)return Pr(e,t,r,n,s,o);let a=Re[Z++];if((a&128)>0){Z-=7;return}return Pr(e,t,r,n,s,o,a)}else{let s=Re[Z++],o=Re[Z++],a=Re[Z++],l=Re[Z++];if((s&128)>0||(o&128)>0||(a&128)>0||(l&128)>0){Z-=8;return}if(i<10){if(i===8)return Pr(e,t,r,n,s,o,a,l);{let c=Re[Z++];if((c&128)>0){Z-=9;return}return Pr(e,t,r,n,s,o,a,l,c)}}else if(i<12){let c=Re[Z++],u=Re[Z++];if((c&128)>0||(u&128)>0){Z-=10;return}if(i<11)return Pr(e,t,r,n,s,o,a,l,c,u);let h=Re[Z++];if((h&128)>0){Z-=11;return}return Pr(e,t,r,n,s,o,a,l,c,u,h)}else{let c=Re[Z++],u=Re[Z++],h=Re[Z++],f=Re[Z++];if((c&128)>0||(u&128)>0||(h&128)>0||(f&128)>0){Z-=12;return}if(i<14){if(i===12)return Pr(e,t,r,n,s,o,a,l,c,u,h,f);{let d=Re[Z++];if((d&128)>0){Z-=13;return}return Pr(e,t,r,n,s,o,a,l,c,u,h,f,d)}}else{let d=Re[Z++],m=Re[Z++];if((d&128)>0||(m&128)>0){Z-=14;return}if(i<15)return Pr(e,t,r,n,s,o,a,l,c,u,h,f,d,m);let p=Re[Z++];if((p&128)>0){Z-=15;return}return Pr(e,t,r,n,s,o,a,l,c,u,h,f,d,m,p)}}}}}function Ty(i){return xn.copyBuffers?Uint8Array.prototype.slice.call(Re,Z,Z+=i):Re.subarray(Z,Z+=i)}function Vo(i){let e=Re[Z++];if(hn[e])return hn[e](Re.subarray(Z,Z+=i));throw new Error("Unknown extension type "+e)}var $S=new Array(4096);function iM(){let i=Re[Z++];if(i>=160&&i<192){if(i=i-160,Li>=Z)return Ks.slice(Z-qn,(Z+=i)-qn);if(!(Li==0&&Zs<180))return Ly(i)}else return Z--,or();let e=(i<<5^(i>1?Pt.getUint16(Z):i>0?Re[Z]:0))&4095,t=$S[e],r=Z,n=Z+i-3,s,o=0;if(t&&t.bytes==i){for(;r<n;){if(s=Pt.getUint32(r),s!=t[o++]){r=1879048192;break}r+=4}for(n+=3;r<n;)if(s=Re[r++],s!=t[o++]){r=1879048192;break}if(r===n)return Z=r,t.string;n-=3,r=Z}for(t=[],$S[e]=t,t.bytes=i;r<n;)s=Pt.getUint32(r),t.push(s),r+=4;for(n+=3;r<n;)s=Re[r++],t.push(s);let a=i<16?Iy(i):nM(i);return a!=null?t.string=a:t.string=Ly(i)}var eM=(i,e)=>{var t=or();let r=i;e!==void 0&&(i=i<32?-((e<<5)+i):(e<<5)+i,t.highByte=e);let n=Et[i];return n&&n.isShared&&((Et.restoreStructures||(Et.restoreStructures=[]))[i]=n),Et[i]=t,t.read=Py(t,r),t.read()},sM=typeof self=="object"?self:global;hn[0]=()=>{};hn[0].noBuffer=!0;hn[101]=()=>{let i=or();return(sM[i[0]]||Error)(i[1])};hn[105]=i=>{let e=Pt.getUint32(Z-4);cs||(cs=new Map);let t=Re[Z],r;t>=144&&t<160||t==220||t==221?r=[]:r={};let n={target:r};cs.set(e,n);let s=or();return n.used?Object.assign(r,s):(n.target=s,s)};hn[112]=i=>{let e=Pt.getUint32(Z-4),t=cs.get(e);return t.used=!0,t.target};hn[115]=()=>new Set(or());var Ry=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array");hn[116]=i=>{let e=i[0],t=Ry[e];if(!t)throw new Error("Could not find typed array for code "+e);return new sM[t](Uint8Array.prototype.slice.call(i,1).buffer)};hn[120]=()=>{let i=or();return new RegExp(i[0],i[1])};hn[98]=i=>{let e=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],t=Z;Z+=e-4,Dn=[or(),or()],Dn.position0=0,Dn.position1=0;let r=Z;Z=t;try{return or()}finally{Z=r}};hn[255]=i=>i.length==4?new Date((i[0]*16777216+(i[1]<<16)+(i[2]<<8)+i[3])*1e3):i.length==8?new Date(((i[0]<<22)+(i[1]<<14)+(i[2]<<6)+(i[3]>>2))/1e6+((i[3]&3)*4294967296+i[4]*16777216+(i[5]<<16)+(i[6]<<8)+i[7])*1e3):i.length==12?new Date(((i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3])/1e6+((i[4]&128?-281474976710656:0)+i[6]*1099511627776+i[7]*4294967296+i[8]*16777216+(i[9]<<16)+(i[10]<<8)+i[11])*1e3):new Date("invalid");function oM(i){let e=Zs,t=Z,r=Cy,n=qn,s=Li,o=Ks,a=_y,l=cs,c=Dn,u=new Uint8Array(Re.slice(0,Zs)),h=Et,f=Et.slice(0,Et.length),d=xn,m=Ml,p=i();return Zs=e,Z=t,Cy=r,qn=n,Li=s,Ks=o,_y=a,cs=l,Dn=c,Re=u,Ml=m,Et=h,Et.splice(0,Et.length,...f),xn=d,Pt=new DataView(Re.buffer,Re.byteOffset,Re.byteLength),p}function jd(){Re=null,cs=null,Et=null}function aM(i){i.unpack?hn[i.type]=i.unpack:hn[i.type]=i}var Xd=new Array(147);for(let i=0;i<256;i++)Xd[i]=+("1e"+Math.floor(45.15-i*.30103));var Yd=new Di({useRecords:!1}),q3=Yd.unpack,X3=Yd.unpackMultiple,Y3=Yd.unpack,Jd={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},J3=new Float32Array(1),e9=new Uint8Array(J3.buffer,0,4);var Qd;try{Qd=new TextEncoder}catch{}var Kd,Ny,Zd=typeof Buffer<"u",By=Zd?Buffer.allocUnsafeSlow:Uint8Array,hM=Zd?Buffer:Uint8Array,lM=Zd?4294967296:2144337920,de,hr,oe=0,Pi,Ii=null,Q3=/[\u0080-\uFFFF]/,Bu=Symbol("record-id"),Ho=class extends Di{constructor(e){super(e),this.offset=0;let t,r,n,s,o,a,l=0,c=hM.prototype.utf8Write?function(S,I,C){return de.utf8Write(S,I,C)}:Qd&&Qd.encodeInto?function(S,I){return Qd.encodeInto(S,de.subarray(I)).written}:!1,u=this;e||(e={});let h=e&&e.sequential,f=e.structures||e.saveStructures,d=e.maxSharedStructures;if(d==null&&(d=f?32:0),d>8160)throw new Error("Maximum maxSharedStructure is 8160");let m=e.maxOwnStructures;m==null&&(m=f?32:64),h&&!e.saveStructures&&(this.structures=[]);let p=d>32||m+d>64,g=d+64,y=d+m+64;if(y>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let v=[],b=0,w=0;this.pack=this.encode=function(S,I){if(de||(de=new By(8192),hr=new DataView(de.buffer,0,8192),oe=0),Pi=de.length-10,Pi-oe<2048?(de=new By(de.length),hr=new DataView(de.buffer,0,de.length),Pi=de.length-10,oe=0):oe=oe+7&2147483640,r=oe,a=u.structuredClone?new Map:null,u.bundleStrings?(Ii=["",""],de[oe++]=214,de[oe++]=98,Ii.position=oe-r,oe+=4):Ii=null,n=u.structures,n){n.uninitialized&&(n=u._mergeStructures(u.getStructures()));let C=n.sharedLength||0;if(C>d)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+n.sharedLength);if(!n.transitions){n.transitions=Object.create(null);for(let M=0;M<C;M++){let _=n[M];if(!_)continue;let R,B=n.transitions;for(let O=0,z=_.length;O<z;O++){let q=_[O];R=B[q],R||(R=B[q]=Object.create(null)),B=R}B[Bu]=M+64}l=C}h||(n.nextId=C+64)}s&&(s=!1),o=n||[];try{if(x(S),Ii){hr.setUint32(Ii.position+r,oe-Ii.position-r);let C=Ii;Ii=null,x(C[0]),x(C[1])}if(u.offset=oe,a&&a.idsToInsert){oe+=a.idsToInsert.length*6,oe>Pi&&T(oe),u.offset=oe;let C=Z3(de.subarray(r,oe),a.idsToInsert);return a=null,C}return I&dM?(de.start=r,de.end=oe,de):de.subarray(r,oe)}finally{if(n){if(w<10&&w++,b>1e4)n.transitions=null,w=0,b=0,v.length>0&&(v=[]);else if(v.length>0&&!h){for(let C=0,M=v.length;C<M;C++)v[C][Bu]=0;v=[]}if(s&&u.saveStructures){let C=n.sharedLength||d;n.length>C&&(n=n.slice(0,C));let M=de.subarray(r,oe);return u.saveStructures(n,l)===!1?(u._mergeStructures(u.getStructures()),u.pack(S)):(l=C,M)}}I&sO&&(oe=r)}};let x=S=>{oe>Pi&&(de=T(oe));var I=typeof S,C;if(I==="string"){let M=S.length;if(Ii&&M>=8&&M<4096){let B=Q3.test(S);Ii[B?0:1]+=S,de[oe++]=193,x(B?-M:M);return}let _;M<32?_=1:M<256?_=2:M<65536?_=3:_=5;let R=M*3;if(oe+R>Pi&&(de=T(oe+R)),M<64||!c){let B,O,z,q=oe+_;for(B=0;B<M;B++)O=S.charCodeAt(B),O<128?de[q++]=O:O<2048?(de[q++]=O>>6|192,de[q++]=O&63|128):(O&64512)===55296&&((z=S.charCodeAt(B+1))&64512)===56320?(O=65536+((O&1023)<<10)+(z&1023),B++,de[q++]=O>>18|240,de[q++]=O>>12&63|128,de[q++]=O>>6&63|128,de[q++]=O&63|128):(de[q++]=O>>12|224,de[q++]=O>>6&63|128,de[q++]=O&63|128);C=q-oe-_}else C=c(S,oe+_,R);C<32?de[oe++]=160|C:C<256?(_<2&&de.copyWithin(oe+2,oe+1,oe+1+C),de[oe++]=217,de[oe++]=C):C<65536?(_<3&&de.copyWithin(oe+3,oe+2,oe+2+C),de[oe++]=218,de[oe++]=C>>8,de[oe++]=C&255):(_<5&&de.copyWithin(oe+5,oe+3,oe+3+C),de[oe++]=219,hr.setUint32(oe,C),oe+=4),oe+=C}else if(I==="number")if(S>>>0===S)S<64?de[oe++]=S:S<256?(de[oe++]=204,de[oe++]=S):S<65536?(de[oe++]=205,de[oe++]=S>>8,de[oe++]=S&255):(de[oe++]=206,hr.setUint32(oe,S),oe+=4);else if(S>>0===S)S>=-32?de[oe++]=256+S:S>=-128?(de[oe++]=208,de[oe++]=S+256):S>=-32768?(de[oe++]=209,hr.setInt16(oe,S),oe+=2):(de[oe++]=210,hr.setInt32(oe,S),oe+=4);else{let M;if((M=this.useFloat32)>0&&S<4294967296&&S>=-2147483648){de[oe++]=202,hr.setFloat32(oe,S);let _;if(M<4||(_=S*Xd[(de[oe]&127)<<1|de[oe+1]>>7])>>0===_){oe+=4;return}else oe--}de[oe++]=203,hr.setFloat64(oe,S),oe+=8}else if(I==="object")if(!S)de[oe++]=192;else{if(a){let _=a.get(S);if(_){if(!_.id){let R=a.idsToInsert||(a.idsToInsert=[]);_.id=R.push(_)}de[oe++]=214,de[oe++]=112,hr.setUint32(oe,_.id),oe+=4;return}else a.set(S,{offset:oe-r})}let M=S.constructor;if(M===Object)E(S,!0);else if(M===Array){C=S.length,C<16?de[oe++]=144|C:C<65536?(de[oe++]=220,de[oe++]=C>>8,de[oe++]=C&255):(de[oe++]=221,hr.setUint32(oe,C),oe+=4);for(let _=0;_<C;_++)x(S[_])}else if(M===Map){C=S.size,C<16?de[oe++]=128|C:C<65536?(de[oe++]=222,de[oe++]=C>>8,de[oe++]=C&255):(de[oe++]=223,hr.setUint32(oe,C),oe+=4);for(let[_,R]of S)x(_),x(R)}else{for(let _=0,R=Kd.length;_<R;_++){let B=Ny[_];if(S instanceof B){let O=Kd[_];if(O.write){O.type&&(de[oe++]=212,de[oe++]=O.type,de[oe++]=0),x(O.write.call(this,S));return}let z=de,q=hr,F=oe;de=null;let ee;try{ee=O.pack.call(this,S,k=>(de=z,z=null,oe+=k,oe>Pi&&T(oe),{target:de,targetView:hr,position:oe-k}),x)}finally{z&&(de=z,hr=q,oe=F,Pi=de.length-10)}ee&&(ee.length+oe>Pi&&T(ee.length+oe),oe=K3(ee,de,oe,O.type));return}}E(S,!S.hasOwnProperty)}}else if(I==="boolean")de[oe++]=S?195:194;else if(I==="bigint"){if(S<BigInt(1)<<BigInt(63)&&S>=-(BigInt(1)<<BigInt(63)))de[oe++]=211,hr.setBigInt64(oe,S);else if(S<BigInt(1)<<BigInt(64)&&S>0)de[oe++]=207,hr.setBigUint64(oe,S);else if(this.largeBigIntToFloat)de[oe++]=203,hr.setFloat64(oe,Number(S));else throw new RangeError(S+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");oe+=8}else if(I==="undefined")this.encodeUndefinedAsNil?de[oe++]=192:(de[oe++]=212,de[oe++]=0,de[oe++]=0);else if(I==="function")x(this.writeFunction&&this.writeFunction());else throw new Error("Unknown type: "+I)},E=this.useRecords===!1?this.variableMapSize?S=>{let I=Object.keys(S),C=I.length;C<16?de[oe++]=128|C:C<65536?(de[oe++]=222,de[oe++]=C>>8,de[oe++]=C&255):(de[oe++]=223,hr.setUint32(oe,C),oe+=4);let M;for(let _=0;_<C;_++)x(M=I[_]),x(S[M])}:(S,I)=>{de[oe++]=222;let C=oe-r;oe+=2;let M=0;for(let _ in S)(I||S.hasOwnProperty(_))&&(x(_),x(S[_]),M++);de[C+++r]=M>>8,de[C+r]=M&255}:S=>{let I=Object.keys(S),C,M=o.transitions||(o.transitions=Object.create(null)),_=0;for(let B=0,O=I.length;B<O;B++){let z=I[B];C=M[z],C||(C=M[z]=Object.create(null),_++),M=C}let R=M[Bu];if(R)R>=96&&p?(de[oe++]=((R-=96)&31)+96,de[oe++]=R>>5):de[oe++]=R;else{R=o.nextId,R||(R=64),R<g&&this.shouldShareStructure&&!this.shouldShareStructure(I)?(R=o.nextOwnId,R<y||(R=g),o.nextOwnId=R+1):(R>=y&&(R=g),o.nextId=R+1);let B=I.highByte=R>=96&&p?R-96>>5:-1;M[Bu]=R,o[R-64]=I,R<g?(I.isShared=!0,o.sharedLength=R-63,s=!0,B>=0?(de[oe++]=(R&31)+96,de[oe++]=B):de[oe++]=R):(B>=0?(de[oe++]=213,de[oe++]=114,de[oe++]=(R&31)+96,de[oe++]=B):(de[oe++]=212,de[oe++]=114,de[oe++]=R),_&&(b+=w*_),v.length>=m&&(v.shift()[Bu]=0),v.push(M),x(I))}for(let B=0,O=I.length;B<O;B++)x(S[I[B]])},T=S=>{let I;if(S>16777216){if(S-r>lM)throw new Error("Packed buffer would be larger than maximum buffer size");I=Math.min(lM,Math.round(Math.max((S-r)*(S>67108864?1.25:2),4194304)/4096)*4096)}else I=(Math.max(S-r<<2,de.length-1)>>12)+1<<12;let C=new By(I);return hr=new DataView(C.buffer,0,I),de.copy?de.copy(C,0,r,S):C.set(de.slice(r,S)),oe-=r,r=0,Pi=C.length-10,de=C}}useBuffer(e){de=e,hr=new DataView(de.buffer,de.byteOffset,de.byteLength),oe=0}};Ny=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Ru];Kd=[{pack(i,e,t){let r=i.getTime()/1e3;if((this.useTimestamp32||i.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:n,targetView:s,position:o}=e(6);n[o++]=214,n[o++]=255,s.setUint32(o,r)}else if(r>0&&r<17179869184){let{target:n,targetView:s,position:o}=e(10);n[o++]=215,n[o++]=255,s.setUint32(o,i.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),s.setUint32(o+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return e(0),t(this.onInvalidDate());let{target:n,targetView:s,position:o}=e(3);n[o++]=212,n[o++]=255,n[o++]=255}else{let{target:n,targetView:s,position:o}=e(15);n[o++]=199,n[o++]=12,n[o++]=255,s.setUint32(o,i.getMilliseconds()*1e6),s.setBigInt64(o+4,BigInt(Math.floor(r)))}}},{pack(i,e,t){let r=Array.from(i),{target:n,position:s}=e(this.structuredClone?3:0);this.structuredClone&&(n[s++]=212,n[s++]=115,n[s++]=0),t(r)}},{pack(i,e,t){let{target:r,position:n}=e(this.structuredClone?3:0);this.structuredClone&&(r[n++]=212,r[n++]=101,r[n++]=0),t([i.name,i.message])}},{pack(i,e,t){let{target:r,position:n}=e(this.structuredClone?3:0);this.structuredClone&&(r[n++]=212,r[n++]=120,r[n++]=0),t([i.source,i.flags])}},{pack(i,e){this.structuredClone?cM(i,16,e):uM(Zd?Buffer.from(i):new Uint8Array(i),e)}},{pack(i,e){let t=i.constructor;t!==hM&&this.structuredClone?cM(i,Ry.indexOf(t.name),e):uM(i,e)}},{pack(i,e){let{target:t,position:r}=e(1);t[r]=193}}];function cM(i,e,t,r){let n=i.byteLength;if(n+1<256){var{target:s,position:o}=t(4+n);s[o++]=199,s[o++]=n+1}else if(n+1<65536){var{target:s,position:o}=t(5+n);s[o++]=200,s[o++]=n+1>>8,s[o++]=n+1&255}else{var{target:s,position:o,targetView:a}=t(7+n);s[o++]=201,a.setUint32(o,n+1),o+=4}s[o++]=116,s[o++]=e,s.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),o)}function uM(i,e){let t=i.byteLength;var r,n;if(t<256){var{target:r,position:n}=e(t+2);r[n++]=196,r[n++]=t}else if(t<65536){var{target:r,position:n}=e(t+3);r[n++]=197,r[n++]=t>>8,r[n++]=t&255}else{var{target:r,position:n,targetView:s}=e(t+5);r[n++]=198,s.setUint32(n,t),n+=4}r.set(i,n)}function K3(i,e,t,r){let n=i.length;switch(n){case 1:e[t++]=212;break;case 2:e[t++]=213;break;case 4:e[t++]=214;break;case 8:e[t++]=215;break;case 16:e[t++]=216;break;default:n<256?(e[t++]=199,e[t++]=n):n<65536?(e[t++]=200,e[t++]=n>>8,e[t++]=n&255):(e[t++]=201,e[t++]=n>>24,e[t++]=n>>16&255,e[t++]=n>>8&255,e[t++]=n&255)}return e[t++]=r,e.set(i,t),t+=n,t}function Z3(i,e){let t,r=e.length*6,n=i.length-r;for(e.sort((s,o)=>s.offset>o.offset?1:-1);t=e.pop();){let s=t.offset,o=t.id;i.copyWithin(s+r,s,n),r-=6;let a=s+r;i[a++]=214,i[a++]=105,i[a++]=o>>24,i[a++]=o>>16&255,i[a++]=o>>8&255,i[a++]=o&255,n=s}return i}function Wo(i){if(i.Class){if(!i.pack&&!i.write)throw new Error("Extension has no pack or write function");if(i.pack&&!i.type)throw new Error("Extension has no type (numeric code to identify the extension)");Ny.unshift(i.Class),Kd.unshift(i)}aM(i)}var fM=new Ho({useRecords:!1}),$3=fM.pack,eO=fM.pack;var{NEVER:tO,ALWAYS:rO,DECIMAL_ROUND:nO,DECIMAL_FIT:iO}=Jd,dM=512,sO=1024;var pM=new Ho({structuredClone:!0});Wo({Class:Wn.prototype.constructor,type:1,write(i){return se({},i)},read(i){return Object.setPrototypeOf(i,Wn.prototype),i}});Wo({Class:er.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,er.prototype),i}});Wo({Class:jn.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,jn.prototype),i}});Wo({Class:Pu.prototype.constructor,type:4,write(i){return i.id},read(i){return new Pu(i)}});Wo({Class:Iu.prototype.constructor,type:5,write(i){return i.data},read(i){return new Iu(i)}});function oO(i){var e=0;if(i.length===0)return e;for(let t=0;t<i.length;t++){let r=i[t];e=(e<<5)-e+r,e=e&e}return e}var $d;(r=>{function i(n){return pM.pack(n)}r.serialize=i;function e(n){return pM.unpack(n)}r.deserialize=e;function t(n){return oO(i(n)).toString()}r.checksum=t})($d||($d={}));var ep;(t=>{t.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function e(r){return t.all.includes(r)}t.is=e})(ep||(ep={}));var tp;(t=>{function i(r){return e(r)}t.defaultData=i;function e(r){if(r==="PointLight")return{type:r,color:Ln.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,depth:2500,helper:!0};if(r==="SpotLight")return{type:r,color:Ln.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:2500,helper:!0};if(r==="DirectionalLight")return{type:r,color:Ln.white,intensity:1,shadows:!0,size:2500,depth:2500,helper:!0};throw new Error("not implemented")}})(tp||(tp={}));var Oy;(t=>{t.defaultData={castShadow:!0,receiveShadow:!0};function e(r,n){return r.castShadow===n.castShadow&&r.receiveShadow===n.receiveShadow}t.equals=e})(Oy||(Oy={}));var Fy;(t=>{t.defaultData={flatShading:!1,wireframe:!1,side:0};function e(r,n){return r.flatShading===n.flatShading&&r.side===n.side&&r.wireframe===n.wireframe}t.equals=e})(Fy||(Fy={}));var rp;(e=>e.defaultData=be(se(se({},Fy.defaultData),Oy.defaultData),{cloner:null}))(rp||(rp={}));var Uy=(n=>(n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.Center=3]="Center",n[n.Justify=4]="Justify",n))(Uy||{}),zy=(r=>(r[r.Top=1]="Top",r[r.Center=2]="Center",r[r.Bottom=3]="Bottom",r))(zy||{}),Gy=(r=>(r[r.None=1]="None",r[r.Upper=2]="Upper",r[r.Lower=3]="Lower",r))(Gy||{}),np;(e=>e.defaultData={width:100,height:100,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.5,letterSpacing:1,text:"",textTransform:1,color:Ln.fromHexAndA(6974058,1),alpha:1,font:"roboto_regular"})(np||(np={}));var mM=["mode","gradientType","noiseType","displacementType","projection","cnormal","crop","axis"];var Al;(r=>{function i(n,s){return n==="light"&&s?e(s):t(n)}r.defaultData=i;function e(n){switch(n){case"basic":return{type:"light",category:"basic",alpha:1,visible:!0,mode:0};case"phong":return{category:"phong",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"toon":return{category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"lambert":return{category:"lambert",emissive:{r:0,g:0,b:0,a:1},type:"light",alpha:1,visible:!0,mode:0};case"physical":return{category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0}}}function t(n){switch(n){case"texture":return{alpha:1,visible:!0,size:[128,128],mode:0,axis:"x",type:"texture",projection:0,texture:{image:"image_0",wrapping:1001,repeat:[1,1],offset:[0,0]},crop:!0};case"color":return{type:"color",alpha:1,visible:!0,mode:0,color:Sr.fromHex(4737101)};case"depth":return{type:"depth",alpha:1,visible:!0,mode:0,gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,near:50,far:200};case"normal":return{type:"normal",alpha:1,visible:!0,mode:0,cnormal:[1,1,1]};case"gradient":return{type:"gradient",alpha:1,visible:!0,mode:0,gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{type:"noise",alpha:1,visible:!0,mode:0,size:[100,100,100],noiseType:0,scale:1,move:1,colorA:be(se({},Sr.fromHex(6710886)),{a:1}),colorB:be(se({},Sr.fromHex(6710886)),{a:1}),colorC:be(se({},Sr.fromHex(16777215)),{a:1}),colorD:be(se({},Sr.fromHex(16777215)),{a:1}),distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8]};case"fresnel":return{type:"fresnel",alpha:1,visible:!0,mode:0,color:Ln.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"rainbow":return{type:"rainbow",alpha:1,visible:!0,mode:0,filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"matcap":return{type:"matcap",alpha:1,visible:!0,mode:0,texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0]}};case"transmission":return{type:"transmission",alpha:1,visible:!0,mode:0,thickness:10,ior:1.5,roughness:1};case"displace":return{type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,visible:!0}}}})(Al||(Al={}));var Ri;(a=>{function i(l){return!l.layers.some(u=>{if(u.data.type==="texture"&&u.data.projection!==0||u.data.type==="depth"&&!u.data.isWorldSpace||u.data.type==="noise"||u.data.type==="displace")return!0})&&!t(l)}a.isMergable=i;function e(l){let c="";return l.layers.forEach(u=>{Object.entries(u.data).forEach(([h,f])=>{c+=`${h}${f}`,Array.isArray(f)?f.forEach(d=>c+=`${d}`):typeof f=="object"?Object.values(f).forEach(d=>{typeof d=="number"?c+=`${d.toFixed(4)}`:c+=`${d}`}):c+=`${f}`})}),c}a.getHash=e;function t(l){let c=0;for(let u of l.layers)"alpha"in u.data&&u.data.type!=="light"&&u.data.type!=="fresnel"&&(c+=(1-c)*u.data.alpha);return c<1}a.isTransparent=t;function r(){return{layers:new er}}a.defaultEmptyData=r;function n(l="layer1",c="layer2"){return s("phong",l,c)}a.defaultData=n;function s(l,c="layer1",u="layer2"){let h=new er;return h.push({fi:0,data:Al.defaultData("light",l),id:c}),h.push({fi:1,data:Al.defaultData("color"),id:u}),{layers:h}}a.defaultTwoLayerData=s;function o(l,c="basic",u="layer1",h="layer2"){let f=Al.defaultData("texture");Object.assign(f.texture,{image:l});let d=new er;return d.push({fi:0,data:f,id:u}),d.push({fi:1,data:Al.defaultData("light",c),id:h}),{layers:d}}a.defaultTwoLayerTextureData=o})(Ri||(Ri={}));var Tl;(r=>{function i(){return{points:new er,roundness:0,shapeHoles:[],isClosed:!1}}r.defaultData=i;function e(n,s){let{points:o}=s;if(o){for(let a of o)if(a.data.position[0]===n[0]&&a.data.position[1]===n[1])return!0}return!1}r.isOverlappingExistingPoint=e;function t(n,s){let o=n.controlNext,a=s.controlPrevious;return n.position[0]===o.position[0]&&n.position[1]===o.position[1]&&s.position[0]===a.position[0]&&s.position[1]===a.position[1]}r.isStraightLine=t})(Tl||(Tl={}));var ip;(e=>{function i(t){return t==="PolygonGeometry"||t==="RectangleGeometry"||t==="StarGeometry"||t==="TriangleGeometry"||t==="EllipseGeometry"}e.is2DParametricMesh=i})(ip||(ip={}));var sp;(e=>{function i(t){if(t==="RectangleGeometry")return{width:320,height:320,type:t,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1};if(t==="VectorGeometry")return{width:100,height:100,type:t,subdivisions:12,shape:Tl.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1};throw new Error("not implemented")}e.defaultData=i})(sp||(sp={}));var Nu;(n=>{n.identity=be(se({},Rd.identity),{hiddenMatrix:_i.identity});function e(s){return{position:s.position,rotation:s.rotation,scale:s.scale,hiddenMatrix:s.hiddenMatrix}}n.fromObject=e;function t(s,o){return{position:(o==null?void 0:o.position)||s.position,rotation:(o==null?void 0:o.rotation)||s.rotation,scale:(o==null?void 0:o.scale)||s.scale,hiddenMatrix:(o==null?void 0:o.hiddenMatrix)||s.hiddenMatrix}}n.merge=t;function r(s,o){return{position:vr.isEqual(s.position,o.position)?null:o.position,rotation:vr.isEqual(s.rotation,o.rotation)?null:o.rotation,scale:vr.isEqual(s.scale,o.scale)?null:o.scale,hiddenMatrix:_i.isEqual(s.hiddenMatrix,o.hiddenMatrix)?null:o.hiddenMatrix}}n.diff=r})(Nu||(Nu={}));var $s;(e=>e.defaultData=se({states:new er,events:new er,visible:!0,raycastLock:!1},Nu.identity))($s||($s={}));var gM;(e=>e.defaultData=se({type:"Empty"},$s.defaultData))(gM||(gM={}));var ky;(e=>e.defaultData=se(se({type:"Mesh"},$s.defaultData),rp.defaultData))(ky||(ky={}));var yM;(e=>e.defaultData=se(se({type:"TextFrame"},$s.defaultData),np.defaultData))(yM||(yM={}));var op;(e=>e.defaultData=se(se(se({},$s.defaultData),Nu.identity),ko.defaultData))(op||(op={}));var vM;(e=>{function i(t){return se(se({},$s.defaultData),tp.defaultData(t))}e.defaultData=i})(vM||(vM={}));var xM;(t=>(t.defaultCamera=se({position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],hiddenMatrix:_i.identity,name:"Play Camera",visible:!0,raycastLock:!1,states:new er,events:new er},ko.defaultData),t.defaultMeshObject=be(se(se({name:"Rectangle"},$s.defaultData),ky.defaultData),{geometry:sp.defaultData("RectangleGeometry"),material:Ri.defaultTwoLayerData("basic","layer1","layer2")})))(xM||(xM={}));var Ou;(t=>{function i(r,n){if(n===void 0)return r;let s=se({},r);return"material"in s&&"material"in n&&n.material&&(s.material=My(s.material,o=>{if(typeof o!="string")for(let[a,l]of Object.entries(n.material.layers)){let c=o.layers.data(a);c&&Go(c,l)}}).data),s.materials&&n.materials&&(s.materials=My(s.materials,o=>{var a,l;for(let c=0;c<s.materials.length;c++){let u=n.materials[c];if(typeof u!="string")for(let[h,f]of Object.entries(u.layers)){let d=(l=(a=o[c])==null?void 0:a.layers)==null?void 0:l.data(h);d&&Go(d,f)}}}).data),s}t.patchMaterialState=i;function e(r,n){var o,a;if(n===void 0)return r;let s=se({},r);if(Object.assign(s,Nu.merge(s,n)),Qs.is(r.type)){s.orthographic=se({},s.orthographic),s.perspective=se({},s.perspective);let l=n;((o=l.orthographic)==null?void 0:o.zoom)!==void 0&&(s.orthographic.zoom=l.orthographic.zoom),((a=l.perspective)==null?void 0:a.zoom)!==void 0&&(s.perspective.zoom=l.perspective.zoom)}else if(r.type==="Mesh")s.geometry=se({},s.geometry),Object.assign(s.geometry,n.geometry),s=i(s,n);else if(ep.is(r.type)){let l=n;s.intensity!==void 0&&(s.intensity=l.intensity),l.color!==void 0&&(typeof l.color=="string"?s.color=l.color:s.color=Sr.clone(l.color))}return s}t.patch=e})(Ou||(Ou={}));function wM(i,e=!1){let t=i[0].index!==null,r=new Set(Object.keys(i[0].attributes)),n=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Ie,c=0;for(let u=0;u<i.length;++u){let h=i[u],f=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let d in h.attributes){if(!r.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;s[d]===void 0&&(s[d]=[]),s[d].push(h.attributes[d]),f++}if(f!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let d in h.morphAttributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(h.morphAttributes[d])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(h.userData),e){let d;if(t)d=h.index.count;else if(h.attributes.position!==void 0)d=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,d,u),c+=d}}if(t){let u=0,h=[];for(let f=0;f<i.length;++f){let d=i[f].index;for(let m=0;m<d.count;++m)h.push(d.getX(m)+u);u+=i[f].attributes.position.count}l.setIndex(h)}for(let u in s){let h=bM(s[u]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,h)}for(let u in o){let h=o[u][0].length;if(h===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let f=0;f<h;++f){let d=[];for(let p=0;p<o[u].length;++p)d.push(o[u][p][f]);let m=bM(d);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(m)}}return l}function bM(i){let e,t,r,n=0;for(let a=0;a<i.length;++a){let l=i[a];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(r===void 0&&(r=l.normalized),r!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;n+=l.array.length}let s=new e(n),o=0;for(let a=0;a<i.length;++a)s.set(i[a].array,o),o+=i[a].array.length;return new Ue(s,t,r)}function SM(i,e=1e-4){e=Math.max(e,Number.EPSILON);let t={},r=i.getIndex(),n=i.getAttribute("position"),s=r?r.count:n.count,o=0,a=Object.keys(i.attributes),l={},c={},u=[],h=["getX","getY","getZ","getW"];for(let p=0,g=a.length;p<g;p++){let y=a[p];l[y]=[];let v=i.morphAttributes[y];v&&(c[y]=new Array(v.length).fill().map(()=>[]))}let f=Math.log10(1/e),d=Math.pow(10,f);for(let p=0;p<s;p++){let g=r?r.getX(p):p,y="";for(let v=0,b=a.length;v<b;v++){let w=a[v],x=i.getAttribute(w),E=x.itemSize;for(let T=0;T<E;T++)y+=`${~~(x[h[T]](g)*d)},`}if(y in t)u.push(t[y]);else{for(let v=0,b=a.length;v<b;v++){let w=a[v],x=i.getAttribute(w),E=i.morphAttributes[w],T=x.itemSize,S=l[w],I=c[w];for(let C=0;C<T;C++){let M=h[C];if(S.push(x[M](g)),E)for(let _=0,R=E.length;_<R;_++)I[_].push(E[_][M](g))}}t[y]=o,u.push(o),o++}}let m=i.clone();for(let p=0,g=a.length;p<g;p++){let y=a[p],v=i.getAttribute(y),b=new v.array.constructor(l[y]),w=new Ue(b,v.itemSize,v.normalized);if(m.setAttribute(y,w),y in c)for(let x=0;x<c[y].length;x++){let E=i.morphAttributes[y][x],T=new E.array.constructor(c[y][x]),S=new Ue(T,E.itemSize,E.normalized);m.morphAttributes[y][x]=S}}return m.setIndex(u),m}var Vy={type:"change"},MM={type:"changeZoom"},aO={type:"changePan"},El={type:"start"},Fu={type:"end"},Hy=new Ut,lO=new N,cO=2*Math.PI,uO=1e-8,hO=.01,AM=2,Wy=.125,TM=2,jy=1,qy=1,Xy=.1;var ap=class extends jt{constructor(t,r){super();this.object=t;this.domElement=r;this.enabled=!0;this.useKeyEvents=!0;this.enableDamping=!1;this.enableZoom=!0;this.enableRotate=!0;this.enablePan=!0;this.autoRotate=!1;this.rotationLimitsMode=0;this.panLimitsMode=0;this.rotationSoftLimit=2;this.panSoftLimit=2;this.hoverRotatePanMode=0;this.zoomLimitsEnabled=!1;this.preventScroll=!0;this.mouseButtons=[0,5];this.mouseButtonsPlay=[3,4,5];this.touches=[null,En.DOLLY_ROTATE,En.PAN];this.offset=new A;this.eye=new A;this.lastPosition=new A;this.lastQuaternion=new Ut;this.current=new N;this.overShoot=new N;this.overRatio=new N;this.spherical=new hu;this.sphericalDelta=new hu;this.panOffset=new A;this.panLeftV=new A;this.panUpV=new A;this.panV=new A;this.rotateStart=new N;this.rotateEnd=new N;this.rotateDelta=new N;this.panStart=new N;this.panEnd=new N;this.panDelta=new N;this.dollyStart=new N;this.dollyEnd=new N;this.dollyDelta=new N;this.rotationRangeFactor=new N;this.panRangeFactor=new N;this.state=-1;this.zoomChanged=!1;this.isPointerDown=!1;this.isFirstHover=!0;this.isThetaFlipped=!1;this.prevScale=0;this.scale=1;this.gesture=!1;this.timer=-1;this.timerHover=-1;this.minDistance=0;this.maxDistance=1/0;this.minZoom=0;this.maxZoom=1/0;this.minPhi=0;this.maxPhi=Math.PI;this.minTheta=-1/0;this.maxTheta=1/0;this.minH=0;this.maxH=Math.PI;this.minV=-1/0;this.maxV=1/0;this.autoRotateClockwise=!0;this.isPanOverShoot=!1;this.isRotateOverShoot=!1;this.update=()=>{let t=this.object.position;this.offset.copy(t).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.autoRotate&&this.state===-1&&this.rotateLeft((this.autoRotateClockwise===!0?1:-1)*this.getAutoRotationAngle()),this.rotationLimitsMode!==0&&this.applyLimits(this.sphericalDelta,this.rotationLimitsMode,this.rotationSoftLimit,this.maxTheta,this.minTheta,this.maxPhi,this.minPhi,this.rotationRangeFactor),this.rotationLimitsMode!==2&&(this.spherical.phi+=this.sphericalDelta.phi),(this.rotationLimitsMode!==1||this.autoRotate===!0)&&(this.spherical.theta+=this.sphericalDelta.theta),this.spherical.radius*=this.scale,this.zoomLimitsEnabled&&(this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius))),this.panLimitsMode!==0&&(this.target.applyQuaternion(Hy.copy(this.object.quaternion).invert()),this.panOffset.applyQuaternion(Hy),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(this.object.quaternion),this.panOffset.applyQuaternion(this.object.quaternion)),this.panLimitsMode===2&&(this.panOffset.y=0),this.panLimitsMode===1&&(this.panOffset.x=0),this.state===-1&&!this.gesture?(this.panOffset.multiplyScalar(1-Wy),this.target.add(this.panOffset)):(this.target.add(this.panOffset),this.panOffset.set(0,0,0)),this.offset.setFromSpherical(this.spherical),t.copy(this.target).add(this.offset);let r=this.spherical.phi%cO;return this.eye.copy(this.offset).normalize(),this.object.up.copy(ot.DefaultUp).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),r>0&&r>Math.PI||r<0&&r>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),this.state===-1||this.enableDamping===!0?(this.sphericalDelta.theta*=1-Wy,this.sphericalDelta.phi*=1-Wy):this.sphericalDelta.set(0,0,0),this.scale=1,this.zoomChanged||this.lastPosition.distanceToSquared(this.object.position)>hO||8*(1-this.lastQuaternion.dot(this.object.quaternion))>uO?(this.dispatchEvent(Vy),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),this.zoomChanged=!1,!0):(this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),!1)};this.onPointerDown=t=>{this.enabled!==!1&&(this.isPointerDown=!0,Mt.length===0&&(this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)),dO(t),t.pointerType==="touch"?this.onPointerDownTouch(t):this.onPointerDownMouse(t))};this.onPointerMove=t=>{this.enabled!==!1&&(t.pointerType==="touch"?this.onPointerMoveTouch(t):this.onPointerMoveMouse(t))};this.onPointerUp=t=>{_M(t),this.isPointerDown=!1,Mt.length===0&&(this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp)),this.dispatchEvent(Fu),this.state=-1};this.onPointerCancel=t=>{_M(t)};this.onPointerDownMouse=t=>{let r;switch(this.useKeyEvents?r=this.mouseButtons[t.button]:r=this.mouseButtonsPlay[t.button],r){case 0:if(t.altKey===!0&&!t.shiftKey&&!Cu(t)){if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}else if(this.key===" "){if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}break;case 4:if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2;break;case 3:if(Cu(t)||t.shiftKey){if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}break;case 5:if(Cu(t)||t.shiftKey){if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}else{if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}break;default:this.state=-1}this.state!==-1&&this.dispatchEvent(El)};this.onPointerMoveMouse=t=>{switch(this.state){case 0:if(this.enableRotate===!1)return;this.handleMouseMoveRotate(t);break;case 1:if(this.enableZoom===!1)return;this.handleMouseMoveDolly(t);break;case 2:if(this.enablePan===!1)return;this.handleMouseMovePan(t);break}};this.onPointerDownTouch=t=>{switch(CM(t),this.touches[Mt.length-1]){case En.ROTATE:if(this.enableRotate===!1){this.state=-1;return}this.handleTouchStartRotate(),this.state=3;break;case En.PAN:if(this.enablePan===!1){this.state=-1;return}this.handleTouchStartPan(),this.state=4;break;case En.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchStartDollyPan(),this.state=5;break;case En.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}this.state!==-1&&this.dispatchEvent(El)};this.onPointerMoveTouch=t=>{switch(CM(t),this.state){case 3:if(this.enableRotate===!1)return;this.handleTouchMoveRotate(t),this.update();break;case 4:if(this.enablePan===!1)return;this.handleTouchMovePan(t),this.update();break;case 5:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchMoveDollyPan(t),this.update();break;case 6:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchMoveDollyRotate(t),this.update();break;default:this.state=-1}};this.dispatchEndDebounced=Mu(()=>this.dispatchEvent(Fu),33);this.onMouseWheel=t=>{this.enabled===!1||this.enableZoom===!1&&this.enablePan===!1||((this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth||this.preventScroll)&&t.preventDefault(),this.dispatchEvent(El),this.handleMouseWheel(t),this.dispatchEndDebounced())};this.onGesture=t=>{if(this.enabled!==!1)if(t.preventDefault(),t.type==="gesturechange"){if(this.enableZoom===!1)return;this.dispatchEvent(El),t.scale>this.prevScale?this.dollyIn(this.getZoomScale()):t.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=t.scale,this.update()}else this.dispatchEvent(Fu)};this.onContextMenu=t=>{this.enabled!==!1&&t.preventDefault()};this.onTouchMove=t=>{(t.touches.length>1||this.preventScroll)&&t.preventDefault()};this.onTouchEnd=t=>{t.preventDefault()};this.onKeyDown=t=>{this.enabled!==!1&&(this.key=t.key)};this.onKeyUp=()=>{this.enabled!==!1&&(this.key=void 0,this.state!==-1&&this.onPointerUp(Mt[0]))};this.onPointerHover=t=>{if(!(Id||this.enabled===!1||this.state!==-1||this.hoverRotatePanMode===2&&this.isPanOverShoot||this.hoverRotatePanMode===1&&this.isRotateOverShoot)){if(window.clearTimeout(this.timerHover),this.isPointerDown=!0,this.isFirstHover){let r={clientX:window.innerWidth/2,clientY:window.innerHeight/2};this.hoverRotatePanMode===2?this.handleMouseDownPan(r):this.hoverRotatePanMode===1&&this.handleMouseDownRotate(r),this.isFirstHover=!1}this.hoverRotatePanMode===2?this.handleMouseMovePan(t,Xy):this.hoverRotatePanMode===1&&this.handleMouseMoveRotate(t,Xy),this.timerHover=window.setTimeout(()=>{this.isPointerDown=!1},30)}};this.object=t,this.domElement=r,this.target=this.object.getTarget(),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.connect(),this.update()}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Vy),this.isFirstHover=!0,this.update(),this.state=-1}resetTo(t,r,n){this.target.copy(t),this.object.position.copy(r),this.object.zoom=n,this.object.updateProjectionMatrix(),this.dispatchEvent(Vy),this.update(),this.state=-1}fromJSON(t){this.setEnableDampingSpeed(t.enableDamping),this.enablePan=t.enablePan,this.enableZoom=t.enableZoom,this.enableRotate=t.enableRotate,this.rotationLimitsMode=t.rotationLimitsMode,this.panLimitsMode=t.panLimitsMode,this.panSoftLimit=t.panSoftLimit,this.rotationSoftLimit=t.rotationSoftLimit,this.hoverRotatePanMode=t.hoverRotatePanMode,this.isFirstHover=!0,this.hoverRotatePanMode!==0&&this.domElement.addEventListener("pointermove",this.onPointerHover),Xy=(t.hoverRotatePanStrength/100)**2,this.zoomLimitsEnabled=t.zoomLimitsEnabled,this.minZoom=t.zoomLimits.min,this.maxZoom=Math.max(t.zoomLimits.min,t.zoomLimits.max),this.minDistance=1e3/t.zoomLimits.max,this.maxDistance=Math.max(this.minDistance,1e3/t.zoomLimits.min),this.autoRotate=t.autoRotate,AM=t.autoRotateSpeed,this.autoRotateClockwise=t.autoRotateClockwise;let n=this.object.getTarget().applyQuaternion(Hy.copy(this.object.quaternion).invert());this.minV=-t.panVerticalOffset.min+n.y,this.maxV=t.panVerticalOffset.max+n.y,this.minH=-t.panHorizontalOffset.min+n.x,this.maxH=t.panHorizontalOffset.max+n.x,this.panRangeFactor.set(this.maxH-this.minH,this.maxV-this.minV).divideScalar(2),this.rotationRangeFactor.setScalar(Math.PI).divideScalar(4),this.minPhi=eo(this.spherical.phi-t.rotationVerticalOffset.min),this.maxPhi=eo(this.spherical.phi+t.rotationVerticalOffset.max),this.minTheta=eo(this.spherical.theta-t.rotationHorizontalOffset.min),this.maxTheta=eo(this.spherical.theta+t.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,this.preventScroll=t.preventScroll,t.orbitTouches===1&&(this.touches[0]=En.ROTATE),t.panTouches===1&&(this.touches[0]=En.PAN),t.orbitTouches===2&&(this.touches[1]=En.DOLLY_ROTATE),t.panTouches===2&&(this.touches[1]=En.DOLLY_PAN),t.orbitTouches===3&&(this.touches[2]=En.ROTATE),t.panTouches===3&&(this.touches[2]=En.PAN)}connect(){this.domElement.addEventListener("contextmenu",this.onContextMenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointercancel",this.onPointerCancel),this.domElement.addEventListener("wheel",this.onMouseWheel),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keyup",this.onKeyUp,!1),_u||(this.domElement.addEventListener("gesturestart",this.onGesture),this.domElement.addEventListener("gesturechange",this.onGesture),this.domElement.addEventListener("gestureend",this.onGesture)),this.domElement.addEventListener("touchmove",this.onTouchMove),this.domElement.addEventListener("touchend",this.onTouchEnd)}dispose(){this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointercancel",this.onPointerCancel),this.domElement.removeEventListener("wheel",this.onMouseWheel),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keyup",this.onKeyUp,!1),this.domElement.removeEventListener("pointermove",this.onPointerHover),_u||(this.domElement.removeEventListener("gesturestart",this.onGesture),this.domElement.removeEventListener("gesturechange",this.onGesture),this.domElement.removeEventListener("gestureend",this.onGesture)),this.domElement.removeEventListener("touchmove",this.onTouchMove),this.domElement.removeEventListener("touchend",this.onTouchEnd),this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp)}applyLimits(t,r,n,s,o,a,l,c){this.overShoot.set(0,0);let u,h,f;t instanceof A?(u=t.x,h=t.y,this.current.set(this.target.x,this.target.y),f=!0):(u=t.theta,h=t.phi,this.current.set(eo(this.spherical.theta),eo(this.spherical.phi)),f=!1),n===0&&(this.current.x+=u,this.current.y+=h),(r===3||r===2)&&(!f&&this.isThetaFlipped?this.current.x>s&&this.current.x<0?this.overShoot.x=s-this.current.x:this.current.x<o&&this.current.x>0&&(this.overShoot.x=o-this.current.x):this.current.x>s?this.overShoot.x=s-this.current.x:this.current.x<o&&(this.overShoot.x=o-this.current.x),s===o&&(u=0)),(r===3||r===1)&&(this.current.y>a?this.overShoot.y=a-this.current.y:this.current.y<l&&(this.overShoot.y=l-this.current.y),a===l&&(h=0)),f||(this.overShoot.x=eo(this.overShoot.x),this.overShoot.y=eo(this.overShoot.y)),n!==0?(this.overRatio.copy(this.overShoot).divide(c),this.overRatio.x=Math.min(Math.abs(this.overRatio.x),1),this.overRatio.y=Math.min(Math.abs(this.overRatio.y),1),n===1&&(this.overRatio.x=EM(Math.abs(this.overRatio.x)),this.overRatio.y=EM(Math.abs(this.overRatio.y))),this.isPointerDown||n===1?n===2&&(this.overRatio.x>.9||this.overRatio.y>.9)?this.isPointerDown=!1:(u*this.overShoot.x<0&&(u*=1-this.overRatio.x),h*this.overShoot.y<0&&(h*=1-this.overRatio.y)):n===2&&(!f&&(this.overRatio.x>.002||this.overRatio.y>.002)||f&&(Math.abs(this.overShoot.x)>2||Math.abs(this.overShoot.y)>2)?(u=this.overShoot.x*.05,h=this.overShoot.y*.05,f?this.isPanOverShoot=!0:this.isRotateOverShoot=!0):f?this.isPanOverShoot=!1:this.isRotateOverShoot=!1)):(u+=this.overShoot.x,h+=this.overShoot.y),t instanceof A?(t.x=u,t.y=h):(t.theta=u,t.phi=h)}setEnableDampingSpeed(t){this.enableDamping=t,jy=t===!0?.2:1}stopDamping(){this.sphericalDelta.theta=0,this.sphericalDelta.phi=0}getAutoRotationAngle(){return 2*Math.PI/60/60*AM}getZoomScale(){return Math.pow(.95,TM)}rotateLeft(t){this.sphericalDelta.theta-=t}rotateUp(t){this.sphericalDelta.phi-=t}panLeft(t,r){this.panLeftV.setFromMatrixColumn(r,0),this.panLeftV.multiplyScalar(-t),this.panOffset.add(this.panLeftV)}panUp(t,r){this.panUpV.setFromMatrixColumn(r,1),this.panUpV.multiplyScalar(t),this.panOffset.add(this.panUpV)}pan(t,r){let n=this.domElement;if(n&&this.object.isPerspectiveCamera){let s=this.object.position;this.panV.copy(s).sub(this.target);let o=this.panV.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*t*o/n.clientHeight,this.object.matrix),this.panUp(2*r*o/n.clientHeight,this.object.matrix)}else n&&this.object.isOrthographicCamera&&(this.panLeft(t*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this.panUp(r*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix));this.dispatchEvent(aO)}dollyOut(t){this.object.isPerspectiveCamera?this.scale/=t:this.object.isOrthographicCamera&&(this.object.zoom*=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(MM)}dollyIn(t){this.object.isPerspectiveCamera?this.scale*=t:this.object.isOrthographicCamera&&(this.object.zoom/=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(MM)}zoomOut(t=this.getZoomScale()){this.dispatchEvent(El),this.dollyOut(t),this.dispatchEvent(Fu)}zoomIn(t=this.getZoomScale()){this.dispatchEvent(El),this.dollyIn(t),this.dispatchEvent(Fu)}handleMouseDownRotate(t){this.rotateStart.set(t.clientX,t.clientY)}handleMouseDownDolly(t){this.dollyStart.set(t.clientX,t.clientY)}handleMouseDownPan(t){this.panStart.set(t.clientX,t.clientY)}handleMouseMoveRotate(t,r=1){this.rotateEnd.set(t.clientX,t.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(jy*r).rotateAround(lO,-this.object.angleOffsetFromUp);let n=this.domElement;this.rotateLeft(2*Math.PI*this.rotateDelta.x/n.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/n.clientHeight),this.rotateStart.copy(this.rotateEnd),this.update()}handleMouseMoveDolly(t){this.dollyEnd.set(t.clientX,t.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyOut(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyIn(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()}handleMouseMovePan(t,r=1){this.panEnd.set(t.clientX,t.clientY),this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(qy*r),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd),this.update()}handleMouseWheel(t){if(zS===!1&&Cu(t)===!1&&fO(t)===!0){if(this.enablePan===!1)return;this.gesture?(this.panDelta.set(-t.deltaX,-t.deltaY).multiplyScalar(qy),this.panDelta.x=Math.min(Math.abs(this.panDelta.x),100)*(this.panDelta.x<0?-1:1),this.panDelta.y=Math.min(Math.abs(this.panDelta.y),100)*(this.panDelta.y<0?-1:1),t.altKey?this.pan(0,this.panDelta.y):t.shiftKey?this.pan(this.panDelta.x,0):this.pan(this.panDelta.x,this.panDelta.y),this.update()):(this.gesture=!0,this.isPointerDown=!0),window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.gesture=!1,this.isPointerDown=!1},30)}else{if(this.enableZoom===!1)return;t.deltaY===0?t.deltaX<0?this.dollyIn(this.getZoomScale()):t.deltaX>0&&this.dollyOut(this.getZoomScale()):t.deltaY<0?this.dollyIn(this.getZoomScale()):t.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update(),this.gesture=!1,this.isPointerDown=!1}}handleTouchStartRotate(){if(Mt.length===2){let t=.5*(Mt[0].pageX+Mt[1].pageX),r=.5*(Mt[0].pageY+Mt[1].pageY);this.rotateStart.set(t,r)}else this.rotateStart.set(Mt[0].pageX,Mt[0].pageY)}handleTouchStartPan(){if(Mt.length===2){let t=.5*(Mt[0].pageX+Mt[1].pageX),r=.5*(Mt[0].pageY+Mt[1].pageY);this.panStart.set(t,r)}else this.panStart.set(Mt[0].pageX,Mt[0].pageY)}handleTouchStartDolly(){let t=Mt[0].pageX-Mt[1].pageX,r=Mt[0].pageY-Mt[1].pageY,n=Math.sqrt(t*t+r*r);this.dollyStart.set(0,n)}handleTouchStartDollyPan(){this.enableZoom&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(t){if(Mt.length===2){let n=Yy(t),s=.5*(t.pageX+n.x),o=.5*(t.pageY+n.y);this.rotateEnd.set(s,o)}else{if(t.pointerId!==Mt[0].pointerId)return;this.rotateEnd.set(t.pageX,t.pageY)}this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(jy);let r=this.domElement;r&&(this.rotateLeft(2*Math.PI*this.rotateDelta.x/r.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/r.clientHeight)),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(t){if(Mt.length===2){let r=Yy(t),n=.5*(t.pageX+r.x),s=.5*(t.pageY+r.y);this.panEnd.set(n,s)}else{if(t.pointerId!==Mt[0].pointerId)return;this.panEnd.set(t.pageX,t.pageY)}this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(qy),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(t){let r=Yy(t),n=t.pageX-r.x,s=t.pageY-r.y,o=Math.sqrt(n*n+s*s);this.dollyEnd.set(0,o),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,TM)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enablePan&&this.handleTouchMovePan(t)}handleTouchMoveDollyRotate(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enableRotate&&this.handleTouchMoveRotate(t)}};function eo(i){let e=Math.PI*2;for(;i<=-Math.PI;)i+=e;for(;i>Math.PI;)i-=e;return i}function EM(i){return 1-Math.pow(1-i,4)}function fO(i){return i.wheelDeltaY===0||i.deltaY===0?Eu&&i.shiftKey&&Math.abs(i.wheelDeltaX)>=120?!1:i.wheelDeltaX?i.wheelDeltaX===-3*i.deltaX:i.deltaMode===0:i.wheelDeltaY?i.wheelDeltaY===-3*i.deltaY:i.deltaMode===0}var Mt=[],lp={};function dO(i){Mt.push(i)}function _M(i){delete lp[i.pointerId];for(let e=0;e<Mt.length;e++)if(Mt[e].pointerId===i.pointerId){Mt.splice(e,1);return}}function CM(i){let e=lp[i.pointerId];e===void 0&&(e=new N,lp[i.pointerId]=e),e.set(i.pageX,i.pageY)}function Yy(i){let e=i.pointerId===Mt[0].pointerId?Mt[1]:Mt[0];return lp[e.pointerId]}var to=class extends Wf{constructor(){super(),this.layers.enable(3)}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,r=[]){return e.forEach(n=>{n.visible&&this.intersectObject(n,t,r)}),r}createRaycastLineHelper(){let e=new Ur({color:65280,linewidth:10}),t=new A(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),r=new A(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),n=this.camera.far-this.camera.near,s=new A().addVectors(t,r.multiplyScalar(n)),o=new Ie;return o.setFromPoints([t,s]),new ns(o,e)}};var DM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,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},i.parameters),r=t.width/2,n=(a=t.radiusTop)!=null?a:r,s=(l=t.radiusBottom)!=null?l:r;return n===s?(n=r,s=r):n>s?(n=r,s=s*r/n):(n=n*r/s,s=r),{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:n,radiusBottom:s})}}static build(i){let{width:e,depth:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,radiusTop:c,radiusBottom:u,cornerRadius:h,cornerSegments:f,hollow:d}=i.parameters,m;return h||d?m=new Uu(c,u,r,n,s,o,a,l*Math.PI/180,h,h,f,d):m=new Lo(c,u,r,n,s,o,a,l*Math.PI/180),m.scale(1,1,t/e),Object.assign(m,{userData:be(se({},i),{type:"CylinderGeometry"})})}};function ro(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function LM(i){return new N(i.y,-i.x)}var Uu=class extends Ie{constructor(e,t,r,n,s,o,a,l,c,u,h,f,d=!1){super(),this.type="RoundedCylinderBufferGeometry",e=e!==void 0?e:1,t=t!==void 0?t:1,r=r||1,n=Math.floor(n)||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 m=[],p=[],g=[],y=[],v=0,b=r/2,w=new A,x=new A;d&&e==0&&(e=c),d&&t==0&&(t=u);let E=new N(e,b),T=new N(t,-b),S=null,I=null,C=null,M=null,_=E.clone().sub(T),R=0,B=0,O=0;f>0&&(R=Math.min(e,t)*(1-f),B=e-R,O=t-R);let z=E.clone();z.x-=R;let q=Math.PI-_.angle(),F=_.angle(),ee=Math.tan(F/2),k=Math.tan(q/2),V=ee+k,U=f?V:k,J=f?V:ee;if(c=Math.min(c,(e-B)/U,_.length()/V),u=Math.min(u,(t-O)/J,_.length()/V),c>0){let le=c/ee;S=E.clone().sub(new N(le,c)),f&&(C=S.clone(),C.x-=R-V*c),E.sub(_.clone().setLength(le))}if(u>0){let le=u/k;I=T.clone().sub(new N(le,-u)),T.add(_.clone().setLength(le)),f&&(M=I.clone(),M.x-=R-V*u,z.sub(_.clone().setLength(le)))}_=E.clone().sub(T);let K=_.length()<.5,$=[];for(let le=0;le<=n;le++){let W=[],ue=le/n,Y=ue*l+a,H=new N(Math.sin(Y),Math.cos(Y));M&&I?(j(W,ue,H,q,u,M,-1,!0),j(W,ue,H,F,u,I,-1,!1)):I?(ge(W,H,I.x,0,-1),j(W,ue,H,F,u,I,-1,!1)):o||ge(W,H,t,O,-1);let Q=LM(_).normalize();if(ro(Q,H,w),!K)for(let ce=0;ce<=s;ce++){let ie=ce/s,pe=_.clone().multiplyScalar(ie).add(T);ro(pe,H,x),p.push(x.x,x.y,x.z),g.push(w.x,w.y,w.z),y.push(ue,.5+x.y/r),W.push(v++)}if(C&&S?(j(W,ue,H,q,c,S,1,!1),j(W,ue,H,F,c,C,1,!0)):S?(j(W,ue,H,q,c,S,1,!1),ge(W,H,S.x,0,1)):o||ge(W,H,e,B,1),f&&!K){let ce=LM(_).multiplyScalar(-1).normalize();ro(ce,H,w);for(let ie=0;ie<=s;ie++){let pe=ie/s,ve=_.clone().multiplyScalar(-pe).add(z);ro(ve,H,x),p.push(x.x,x.y,x.z),g.push(w.x,w.y,w.z),y.push(ue,.5+x.y/r),W.push(v++)}}f&&!o&&W.push(W[0]),$.push(W)}for(let le=0;le<$.length-1;le++)for(let W=0;W<$[0].length-1;W++){if(o&&f&&W==s)continue;let ue=$[le][W],Y=$[le+1][W],H=$[le+1][W+1],Q=$[le][W+1],ce=p[H*3+0],ie=p[H*3+2];m.push(ue,Y,Q),(ce!=0||ie!=0)&&m.push(Y,H,Q)}l<Math.PI*2&&(ae(-1,$[0],a),ae(1,$[$.length-1],a+l)),this.setIndex(m),this.setAttribute("position",new Le(p,3)),this.setAttribute("normal",new Le(g,3)),this.setAttribute("uv",new Le(y,2));function j(le,W,ue,Y,H,Q,ce,ie){for(let pe=0;pe<h+1;pe++){let ve=pe/h,me=ce<0?ve:1-ve;ie&&(me-=1),me*=Y;let De=new N(Math.sin(me),Math.cos(me)*ce),ke=De.clone().multiplyScalar(H).add(Q);ro(ke,ue,x),p.push(x.x,x.y,x.z),ro(De,ue,w),g.push(w.x,w.y,w.z),y.push(W,.5+x.y/r),le.push(v++)}}function ge(le,W,ue,Y,H){let Q=new A,ce=new N,ie=[ue,Y];H<0&&ie.reverse();for(let pe of ie)ce.set(pe,b*H),ro(ce,W,Q),p.push(Q.x,Q.y,Q.z),g.push(0,H,0),y.push(.5,.5),le.push(v++)}function ae(le,W,ue){let Y=new N(Math.sin(ue),Math.cos(ue)),H=new N(-Math.cos(ue),Math.sin(ue)),Q=new A,ce=le<0?(ve,me,De)=>m.push(ve,me,De):(ve,me,De)=>m.push(ve,De,me),ie=new N((e+t+B+O)/4,0);ro(ie,Y,Q),p.push(Q.x,Q.y,Q.z),g.push(H.x,0,H.y),y.push(.5,.5);let pe=v++;for(let ve of W){let me=p.slice(ve*3,ve*3+3);p.push(...me),g.push(H.x,0,H.y);let De=y.slice(ve*2,ve*2+2);y.push(...De),v++}for(let ve=pe+1;ve<v-1;ve++)ce(pe,ve,ve+1);ce(pe,v-1,pe+1)}}};var PM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:0,cornerRadiusBottom:0,cornerSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,depth:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,cornerRadiusTop:c,cornerRadiusBottom:u,cornerSegments:h}=i.parameters,f;return c>0||u>0||l<360?f=new Uu(0,e/2,r,n,s,o,a,l*Math.PI/180,c,u,h,0,!0):f=new Fa(e/2,r,n,s,o),f.scale(1,1,t/e),Object.assign(f,{userData:be(se({},i),{type:"ConeGeometry"})})}};var IM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:0,cornerSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,widthSegments:n,heightSegments:s,depthSegments:o,cornerRadius:a,cornerSegments:l}=i.parameters,c;return a==0?c=new mn(e,t,r,n,s,o):c=new Qy(e,t,r,n,s,o,a,l),Object.assign(c,{userData:be(se({},i),{type:"CubeGeometry"})})}},Jy=Math.PI/2,Qy=class extends Ie{constructor(e=1,t=1,r=1,n=1,s=1,o=1,a=0,l=4){super(),this.type="BoxBufferGeometry";let c=this;n=Math.floor(n),s=Math.floor(s),o=Math.floor(o),l=Math.floor(l),a=Math.min(a,e/2,t/2,r/2);let u=[],h=[],f=[],d=[],m=0,p=0;g("z","y","x",-1,-1,r,t,e,o,s,0),g("z","y","x",1,-1,r,t,-e,o,s,1),g("x","z","y",1,1,e,r,t,n,o,2),g("x","z","y",1,-1,e,r,-t,n,o,3),g("x","y","z",1,-1,e,t,r,n,s,4),g("x","y","z",-1,-1,e,t,-r,n,s,5),a>0&&(y("z","y","x",-1,-1,1,r,t,e,o,0),y("z","y","x",1,-1,-1,r,t,e,o,1),y("z","y","x",-1,1,-1,r,t,e,o,1),y("z","y","x",1,1,1,r,t,e,o,0),y("x","y","z",-1,-1,-1,e,t,r,n,0),y("x","y","z",1,-1,1,e,t,r,n,1),y("x","y","z",-1,1,1,e,t,r,n,0),y("x","y","z",1,1,-1,e,t,r,n,1),y("y","x","z",-1,-1,1,t,e,r,s,0),y("y","x","z",1,-1,-1,t,e,r,s,1),y("y","x","z",1,1,1,t,e,r,s,1),y("y","x","z",-1,1,-1,t,e,r,s,0),v(1,1,1),v(-1,1,1),v(1,-1,1),v(-1,-1,1),v(1,1,-1),v(-1,1,-1),v(1,-1,-1),v(-1,-1,-1)),this.setIndex(u),this.setAttribute("position",new Le(h,3)),this.setAttribute("normal",new Le(f,3)),this.setAttribute("uv",new Le(d,2));function g(b,w,x,E,T,S,I,C,M,_,R){let B=(S-2*a)/M,O=(I-2*a)/_,z=S/2-a,q=I/2-a,F=C/2,ee=M+1,k=_+1,V=0,U=0,J=new A;for(let K=0;K<k;K++){let $=K*O-q;for(let j=0;j<ee;j++){let ge=j*B-z;J[b]=ge*E,J[w]=$*T,J[x]=F,h.push(J.x,J.y,J.z),J[b]=0,J[w]=0,J[x]=C>0?1:-1,f.push(J.x,J.y,J.z),d.push(j/M),d.push(1-K/_),V+=1}}for(let K=0;K<_;K++)for(let $=0;$<M;$++){let j=m+$+ee*K,ge=m+$+ee*(K+1),ae=m+($+1)+ee*(K+1),le=m+($+1)+ee*K;u.push(j,ge,le),u.push(ge,ae,le),U+=6}c.addGroup(p,U,R),p+=U,m+=V}function y(b,w,x,E,T,S,I,C,M,_,R){let B=(I-2*a)/_,O=I/2-a,z=C/2-a,q=M/2,F=_+1,ee=0,k=0,V=new A,U=new A;for(let J=0;J<l+1;J++){let K=J/l*Jy,$=Math.sin(K)*a,j=(1-Math.cos(K))*a,ge=Math.sin(K),ae=Math.cos(K);V[w]=(z+$)*T,V[x]=(q-j)*S,U[b]=0,U[w]=ge*Math.sign(V[w]),U[x]=ae*Math.sign(V[x]);for(let le=0;le<F;le++){let W=le*B-O;V[b]=W*E,h.push(V.x,V.y,V.z),f.push(U.x,U.y,U.z),d.push(le/_),d.push(0),ee+=1}}for(let J=0;J<l;J++)for(let K=0;K<_;K++){let $=m+K+F*J,j=m+K+F*(J+1),ge=m+(K+1)+F*(J+1),ae=m+(K+1)+F*J;u.push($,j,ae),u.push(j,ge,ae),k+=6}c.addGroup(p,k,R),p+=k,m+=ee}function v(b,w,x){let E=new A,T=new A(e/2,t/2,r/2);T.subScalar(a);let S=[],I=b*w*x>0?(M,_,R)=>u.push(M,_,R):(M,_,R)=>u.push(M,R,_);for(let M=0;M<=l;M++){let _=[],R=Jy*(1-M/l),B=Math.cos(R),O=Math.sin(R),z=0;for(let q=0;q<=M;q++){let F=Math.cos(z),ee=Math.sin(z);E.x=B*F,E.y=O,E.z=B*ee;let k=T.clone().addScaledVector(E,a);h.push(b*k.x,w*k.y,x*k.z),f.push(b*E.x,w*E.y,x*E.z),d.push(0,0),_.push(m++),z+=Jy/M}S.push(_)}let C=S.length-1;for(let M=0;M<C;M++){let _=S[M],R=S[M+1],B=_.length-1;I(_[0],R[1],R[0]);for(let O=1;O<=B;O++)I(_[O-1],_[O],R[O]),I(_[O],R[O+1],R[O])}}}};var no=class extends Ie{constructor(e=[],t=[],r="",n=1,s=.2,o=4){super(),this.type="PolyhedronGeometryRound";let a=[],l=[],c=[];u(),h(),this.setAttribute("position",new Le(a,3)),this.setAttribute("normal",new Le(c,3)),this.setAttribute("uv",new Le(l,2));return;function u(){var ee;s=Math.min(1-1e-5,s),s==0&&(o=0);let d={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[r],m=new A,p=m.clone(),g=new Jt,y=s*n,v=n-y,b=o+1,w=new A,x=(k,V)=>w.subVectors(k,V).normalize(),E=(k,V)=>Array(k).fill(void 0).map(V),T=E(e.length/3,(k,V)=>new A().fromArray(e,V*3).setLength(n)),S=[],I=1e6;for(let k=0;k<T.length;k++){let V=T[k],U=[],J,K,$,j=1e10,ge=-1;for(;(ge=t.indexOf(k,ge+1))!=-1;){let ue=ge-ge%3;J=t[ue+(ge+1)%3],K=t[ue+(ge+2)%3],$=V.distanceToSquared(T[J]),j=Math.min(j,$),U.push([J,K,$])}j+=1e-6;let ae=[],le=0,W=U.length;for(let ue=0;ue<W;ue++){[J,K,$]=U[le];let Y=((ee=S[J])==null?void 0:ee.includes(k))==!0;$<=j&&ae.push(J+ +Y*I),le=U.findIndex(H=>H[0]==K)}S.push(ae)}let C=[];{let k=0,V=0,U,J,K=d==3;for(let $=0;$<=o;$++){U=$*($+1)/2,J=($+1)*($+2)/2;for(let j=0;j<o-$;j++)[k,V]=[U+j+$+2,J+j+$+3],C.push(U,J,...K?[V,U]:[k,J],V,k),[U,J]=[k,V];C.push(U,J,U+o+2)}}let M=m.clone(),_=m.clone(),R=m.clone(),B=m.clone(),O=m.clone(),z=[],q=E(T.length,()=>E(d,()=>m.clone()));for(let k=0;k<T.length;k++){m.copy(T[k]).normalize(),M.copy(m).multiplyScalar(v);let V=S[k];for(let ae=0;ae<V.length;ae++){let le=V[ae],W=V[(ae+1)%d];g.setFromPointsAndIndices(T,k,le%I,W%I),g.b.sub(g.a).setLength(1e10).add(g.a),g.c.sub(g.a).setLength(1e10).add(g.a),g.closestPointToPoint(M,q[k][ae])}let U=[],J=[],K=[],$=new A;o==0&&[...q[k]].reduce((ae,le)=>ae.add(le),$).multiplyScalar(1/d);for(let ae=0;ae<d;ae++){let le=[],W=(ae-1+d)%d,ue=q[k][W],Y=q[k][ae];m.copy(ue).sub(M),p.copy(Y).sub(M);let H=M.angleTo(m),Q=m.angleTo(p),ce=Math.cos(H)*y;o==0?_.copy($):_.copy(M).setLength(v+ce),J.push(ce);let ie=[_,ue,Y];for(let pe=0;pe<2;pe++){let ve=ie[pe],me=ie[pe+1];B.subVectors(ve,M),O.subVectors(me,M),R.crossVectors(B,O).normalize();for(let De=0;De<b;De++){let ke=[H,Q][pe]*De/b;m.copy(B).applyAxisAngle(R,ke).add(M),U.push(m.clone()),pe&&(x(m,M),le.push([De==0?ve:m.clone(),w.clone()]))}pe&&(x(me,M),le.push([me,w.clone()]))}K.push(le)}z.push(K);let j=2*b,ge=2;for(let ae=0;ae<d;ae++){let le=j*ae,W=j*((ae+1)%d),ue=[U[le]];for(let H=1;H<b;H++){B=U[le+H],O=U[W+H],ue.push(B);for(let Q=1,ce=H-ge+1;Q<=ce;Q++)m.lerpVectors(B,O,Q/(ce+1)),m.sub(M).setLength(J[ae]).add(M),ue.push(m.clone());ue.push(O)}for(let H=0;H<b;H++)ue.push(U[H+b+le]);ue.push(U[W+b]);let Y=C.map(H=>ue[H]);a.push(...Y.map(H=>[H.x,H.y,H.z]).flat()),c.push(...Y.map(H=>(x(H,M),[w.x,w.y,w.z])).flat())}}let F=[];for(let k=0;k<S.length;k++)for(let V=0;V<d;V++){let U=S[k][V];if(U<I){let J=S[U].findIndex(j=>j%I==k),K=z[k][V],$=z[U][J];for(let j=0;j<b;j++){let ge=K[j],ae=$[b-j],le=K[j+1],W=$[b-(j+1)];[ge,ae,le,le,ae,W].forEach(ue=>{a.push(ue[0].x,ue[0].y,ue[0].z),c.push(ue[1].x,ue[1].y,ue[1].z)})}F.push(K[0][0],$[b][0],K[b][0],$[0][0])}}for(;F.length;){let k,V,U,J;[k,V]=F.splice(0,2);let K=[k];for(;k!=V;)K.push(V),U=F.indexOf(V),J=U%2,V=F.splice(U-J,2)[1-J];w.subVectors(K[0],K[1]).cross(m.subVectors(K[0],K[2])).normalize();let $=w.dot(K[0])<0;$&&w.negate();for(let j=1;j<=K.length-2;j++)[K[j+ +$],K[j+1-+$],K[0]].forEach(ge=>{a.push(ge.x,ge.y,ge.z),c.push(w.x,w.y,w.z)})}}function h(){let f=new A;for(let T=0;T<a.length;T+=3){f.x=a[T+0],f.y=a[T+1],f.z=a[T+2];let S=x(f)/2/Math.PI+.5,I=E(f)/Math.PI+.5;l.push(S,1-I)}let d=new A,m=new A,p=new A,g=new A,y=new N,v=new N,b=new N,w=(T,S,I,C)=>{C<0&&T.x===1&&(l[S]=T.x-1),I.x===0&&I.z===0&&(l[S]=C/2/Math.PI+.5)};for(let T=0,S=0;T<a.length;T+=9,S+=6){d.set(a[T+0],a[T+1],a[T+2]),m.set(a[T+3],a[T+4],a[T+5]),p.set(a[T+6],a[T+7],a[T+8]),y.set(l[S+0],l[S+1]),v.set(l[S+2],l[S+3]),b.set(l[S+4],l[S+5]),g.copy(d).add(m).add(p).divideScalar(3);let I=x(g);w(y,S+0,d,I),w(v,S+2,m,I),w(b,S+4,p,I)}for(let T=0;T<l.length;T+=6){let S=l[T+0],I=l[T+2],C=l[T+4],M=Math.max(S,I,C),_=Math.min(S,I,C);M>.9&&_<.1&&(S<.2&&(l[T+0]+=1),I<.2&&(l[T+2]+=1),C<.2&&(l[T+4]+=1))}function x(T){return Math.atan2(T.z,-T.x)}function E(T){return Math.atan2(-T.y,Math.sqrt(T.x*T.x+T.z*T.z))}}}static fromJSON(e){return new no(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}};var RM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:n,corner:s,cornerSides:o}=i.parameters,a=n===0&&s!==0?new zu(e*.5,s,o):new za(e*.5,n);return a.scale(1,t/e,r/e),Object.assign(a,{userData:be(se({},i),{type:"DodecahedronGeometry"})})}},zu=class extends no{constructor(e=1,t=.2,r=4){let n=(1+Math.sqrt(5))/2,s=1/n,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,-n,0,-s,n,0,s,-n,0,s,n,-s,-n,0,-s,n,0,s,-n,0,s,n,0,-n,0,-s,n,0,-s,-n,0,s,n,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,r),this.type=l}static fromJSON(e){return new zu(e.radius,e.corner,e.cornerSides)}};var Gu=1e-12,_l=class{constructor(e){this.position=new N;this.startPosition=new N;this.uuid=et.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 _l(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},Cl=class extends _l{constructor(t){super(t.position);this.parent=t}copy(t){return super.copy(t),this}clone(){return new Cl(this.parent).copy(this)}},ui=class extends _l{constructor(t,r){super(r);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=t,this.controls.push(new Cl(this),new Cl(this))}static create(t,r){let n=new ui(t,new N(...r.position));return n.controls[0].position.set(...r.controlPrevious.position),n.controls[1].position.set(...r.controlNext.position),n.roundness=r.roundness,n.areControlsDirectionsMirrored=r.areControlsDirectionsMirrored,n}getOppositeControl(t){let r=this.controls.indexOf(t);return r===0?this.controls[1]:r===1?this.controls[0]:null}applyOffsetToControls(t,r=1){for(let n=0,s=this.controls.length;n<s;n++){let o=this.controls[n];this.position.distanceTo(o.position)<=r?o.position.copy(this.position):o.applyOffset(t)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(t){return super.copy(t),this.controls[0].copy(t.controls[0]),this.controls[1].copy(t.controls[1]),this.roundness=t.roundness,this.uuid=t.uuid,this}clone(){return new ui(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}},Ky=i=>i,Vu=new N,Zy=new N,pO=new N,mO=new N,gO=new N,yO=new N,BM=new A,NM=new A;function OM(i){let e=new N;e.addVectors(i.v0,Vu.subVectors(i.v1,i.v0).multiplyScalar(2/3));let t=new N;return t.addVectors(i.v2,Zy.subVectors(i.v1,i.v2).multiplyScalar(2/3)),new on(i.v0,e,t,i.v2)}function ku(i,e,t=Number.EPSILON){return Math.abs(i-e)<t}function vO(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function xO(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function $y(i,e,t){let r=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),s=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2));return Math.acos((n*n+r*r-s*s)/(2*n*r))}function FM(i,e,t,r,n){let s=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),o=(i.y+e.y)/2,a=(i.x+e.x)/2,l=Math.sqrt(Math.pow(t,2)-Math.pow(s/2,2))*(i.y-e.y)/s,c=Math.sqrt(Math.pow(t,2)-Math.pow(s/2,2))*(e.x-i.x)/s;return r.set(a+l,o+c),n.set(a-l,o-c),[r,n]}function UM(i,e,t){let r=i.distanceTo(t),n=e.distanceTo(t);return r<n?e:i}function zM(i,e,t,r,n,s){let o=e.x-i.x,a=e.y-i.y,l=t.x-i.x,c=t.y-i.y,u=Math.sqrt((o+l)*(o+l)+(a+c)*(a+c)),h;return $y(e,i,t)>Math.PI&&(u*=-1),ku(c,a)?h=(a+c)*(r/u-.5)*8/3/(o-l):h=(o+l)*(r/u-.5)*8/3/(c-a),n.set(e.x-h*a,e.y+h*o),s.set(t.x+h*c,t.y-h*l),[n,s]}function ev(i,e){return i.position.equals(i.controls[1].position)&&e.position.equals(e.controls[0].position)}function GM(i,e,t,r,n=.5){let s=Vu.subVectors(e,i).multiplyScalar(n).add(i),o=Zy.subVectors(t,e).multiplyScalar(n).add(e),a=pO.subVectors(r,t).multiplyScalar(n).add(t),l=s,c=mO.subVectors(o,s).multiplyScalar(n).add(s),u=gO.subVectors(a,o).multiplyScalar(n).add(o),h=a,f=yO.subVectors(u,c).multiplyScalar(n).add(c);return[i.x,i.y,l.x,l.y,c.x,c.y,f.x,f.y,u.x,u.y,h.x,h.y,r.x,r.y]}function kM(i,e,t=12,r=!0){let n=NM.set(0,0,0),s,o=0,a=[];for(let l=0;l<e.length;l++){let c=Ky(e[l]),u=Vu,h=io(c,t);a.push(h);for(let f=0;f<=h;f++)if(c instanceof on||c instanceof Gn||c instanceof an){if(c.getPoint(f/h,u),n.set(u.x,u.y,0),s!==void 0&&xO(s,n))continue;s===void 0&&(s=BM),s.copy(n),i.setXYZ(o,n.x,n.y,n.z),o++}}return r&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),i}function VM(i,e,t,r=12,n=!0){let s=NM.set(0,0,0),o=0,a=[];for(let l=0;l<e.length;l++){if(t[l]===!1)continue;let c,u=Ky(e[l]),h=Vu,f=io(u,r);a.push(f);for(let d=0;d<=f;d++)if(u instanceof on||u instanceof Gn||u instanceof an){if(u.getPoint(d/f,h),s.set(h.x,h.y,0),c!=null&&c.equals(s))continue;c===void 0?c=BM:(i.setXYZ(o,c.x,c.y,c.z),o++,i.setXYZ(o,s.x,s.y,s.z),o++),c.copy(s)}}return n&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),a}function tv(i,e=12,t=!1){let r=[];for(let n=0,s=i.length;n<s;n++){let o=i[n],a=0;if(t&&o.roundedCurveCorner!==void 0){let l=io(o.roundedCurveCorner,e)*.5;n>0&&(r[n-1]+=l),a+=l}o.curveAfter!==void 0&&(a+=io(o.curveAfter,e)),r.push(a)}return i.length>0&&t&&i[0].roundedCurveCorner!==void 0&&(r[i.length-1]+=io(i[0].roundedCurveCorner,e)*.5),r}function io(i,e=12){return i&&i instanceof Bs?e*2:i&&(i instanceof an||i instanceof tu)?1:i&&i instanceof Co?e*i.points.length:e}function HM(i,e,t=12,r=!0){let n,s=0;for(let o=0;o<e.length;o++){let a=Ky(e[o]),l=io(a,t),c=Vu;for(let u=0;u<=l;u++)if(a instanceof on||a instanceof Gn||a instanceof an){if(a.getPoint(u/l,c),n!==void 0&&vO(n,c,Gu))continue;n===void 0&&(n=Zy),n.copy(c),i.push(c.x,c.y),s++}}return ku(i[0],i[i.length-2],Gu)&&ku(i[1],i[i.length-1],Gu)&&(i.pop(),i.pop()),r&&s>1&&!(ku(i[s-1],i[1],Gu)&&ku(i[s-2],i[0],Gu))&&(i.push(i[0],i[1]),s++),i}var rv=new N,bO=new N,wO=new N,SO=new N,MO=new N,AO=new N,At=class extends tn{constructor(t=100,r=100){super();this.points=[];this.shapeHoles=[];this.eventDispatcher=new jt;this.plane=new Fr(new A(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=et.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=t,this._height=r}static createFromState(t,r,n){let s=new At;return s.isClosed=t.isClosed,s.points=t.points.map(o=>ui.create(o.id,o.data)),typeof t.roundness=="number"&&(s.roundness=t.roundness),s.shapeHoles=t.shapeHoles.map(o=>At.createFromState(o)),r!==void 0&&n!==void 0&&s.applySize(r,n),s.update(),s}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(t){if(this._roundness!==t){this._roundness=t;for(let r=0,n=this.points.length;r<n;r++)this.points[r].roundness=t;this.needsUpdate=!0}}getPointsIndexesByIds(t){return t.map(r=>this.getPointIndexById(r)).filter(r=>r>=0)}getPointIndexById(t){return this.points.findIndex(r=>r.uuid===t)}getLineIndexById(t){return this.getPointIndexById(t)}getBezierPoint(t){if(t<=this.points.length-1)return this.points[t];if(this.shapeHoles.length>0)for(let r=0,n=this.shapeHoles.length;r<n;r++){let s=this.shapeHoles[r],o=t-this.points.length;if(o<=s.points.length-1)return s.points[o]}throw new Error("This shape does not have a point for this index: "+t)}getBezierPointIndex(t){let r=this.points.indexOf(t);if(r>=0)return r;if(r=this.points.length,this.shapeHoles.length>0)for(let n=0,s=this.shapeHoles.length;n<s;n++){let o=this.shapeHoles[n],a=o.points.indexOf(t);if(a>=0)return r+a;r+=o.points.length}return-1}getAllPoints(){let t=[].concat(...this.shapeHoles.map(r=>r.points));return[...this.points,...t]}applySize(t,r){t===0&&(t=.001),r===0&&(r=.001),this._width=t,this._height=r}applyScale(t,r){let n=rv.set(t,r);for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s];a.position.multiply(n),a.controls[0].position.multiply(n),a.controls[1].position.multiply(n)}for(let s=0,o=this.shapeHoles.length;s<o;s++)this.shapeHoles[s].applyScale(t,r);this._update(!1)}createPoint(t,r=0,n=et.generateUUID()){let s;t instanceof N?s=t:s=new N(t,r);let o=new ui(n,s);return o.roundness=this.roundness,o}addPoint(t){this.points.push(t),this.needsUpdate=!0}addPointAt(t,r){this.points.splice(r,0,t),this.needsUpdate=!0}getPointByUuid(t){for(let r=0,n=this.points.length;r<n;r++){let s=this.points[r];if(s.uuid===t)return s}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(t){let r=this.points.indexOf(t);r>=0&&this.points.splice(r,1),this.needsUpdate=!0}removePointById(t){let r=this.points.find(n=>n.uuid===t);r&&this.removePoint(r)}update(t=!0){for(let r=0,n=this.shapeHoles.length;r<n;r++)this.shapeHoles[r].update(!1);this._update(t)}extractShapePointsToBuffer(t,r=12,n=!1){this.subdivision=r,this.curveDivisions===void 0&&this.computeCurveDivisions(r);let s=n?this.roundedCurveDivisions:this.curveDivisions;return kM(t,n?this.roundedCurves:this.curves,r,this.autoClose),s.reduce((o,a)=>o+a,0)+1}computeCurveDivisions(t=12){return this.curveDivisions=tv(this.points,t,!1),this.roundedCurveDivisions=tv(this.points,t,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(t,r,n=12){return VM(t,this.curves,r,n,this.autoClose).reduce((o,a)=>o+a,0)*2}extractShapePointsToFlatArray(t,r=12){return this.subdivision=r,this.curveDivisions===void 0&&this.computeCurveDivisions(r),HM(t,this.roundedCurves,r,this.autoClose)}getCurveIndexFromVertexId(t,r=!1){let n=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let s=r?this.roundedCurveDivisions:this.curveDivisions,o=0;r&&this.points[0].roundedCurveCorner!==void 0&&(o=io(this.points[0].roundedCurveCorner,this.subdivision)*.5);let a=t-o;a<0&&(a+=s.reduce((l,c)=>l+c,0));for(let l=0,c=s.length;l<c;l++){let u=s[l];if(a<n+u)return[l,(a-n+1)/u];n+=u}return[0,1]}getCurveT(t,r,n){let s=this.points[t],o=this.points[t>=this.points.length-1?0:t+1],a=this.curveDivisions,l=a[t];if(ev(s,o)){let h=s.position.distanceTo(o.position);return s.position.distanceTo(rv.set(n.x,n.y))/h}let c=0;for(let h=0;h<t;h++)c+=a[h];return(r-c)/l}dispose(){this.eventDispatcher=null}_applyCurveForPoint(t,r){ev(r,t)?this.lineTo(t.position.x,t.position.y):this.bezierCurveTo(r.controls[1].position.x,r.controls[1].position.y,t.controls[0].position.x,t.controls[0].position.y,t.position.x,t.position.y);let n=this.curves[this.curves.length-1];t.curveBefore=n,r.curveAfter=n;let s=n.clone();t.roundedCurveBefore=s,r.roundedCurveAfter=s,t.roundedCurveCorner=void 0,this.roundedCurves.push(s)}_update(t=!0){var n;if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s];if(s===0)this.moveTo(a.position.x,a.position.y);else{let l=this.points[s-1];this._applyCurveForPoint(a,l)}}let r=this.getLastPoint();if(r!=null&&r.curveAfter&&(r.curveAfter=void 0),this.isClosed){let s=this.points[0],o=this.points[this.points.length-1];this._applyCurveForPoint(s,o)}if(this.points.length>2){let s=0;for(let o=0,a=this.points.length;o<a;o++){let l=this.points[o],c=l.roundness;if(!l.controlsMoved()&&c>0){let u=l.curveBefore,h=l.curveAfter;if(u===void 0||h===void 0)continue;let f=l.roundedCurveBefore,d=l.roundedCurveAfter,m=u.getLength(),p=h.getLength(),g=Math.min(c,m*.499),y=Math.min(c,p*.499),v=Math.min(g,y),b=1-v/m,w=v/p,x=u.getPointAt(b,rv),E=h.getPointAt(w,bO);this._subSplitCurve(u,f,b,x,void 0),this._subSplitCurve(h,d,w,void 0,E);let T;if(this.useCubicForRoundedCorners){let S=$y(x,l.position,E)/2,I=Math.tan(S)*x.distanceTo(l.position),[C,M]=FM(x,E,I,wO,SO),_=UM(C,M,l.position),[R,B]=zM(_,x,E,I,MO,AO);T=new on(x.clone(),R.clone(),B.clone(),E.clone())}else T=new Gn(x.clone(),l.position.clone(),E.clone());l.roundedCurveCorner=T,this.roundedCurves.splice(o+s,0,T),s++}}}t&&((n=this.eventDispatcher)==null||n.dispatchEvent({type:"update"}))}_subSplitCurve(t,r,n,s,o){if(t instanceof an)s!==void 0&&r.v2.copy(s),o!==void 0&&r.v1.copy(o);else{let a=t,l=r,c=a.getUtoTmapping(n,0),u=GM(a.v0,a.v1,a.v2,a.v3,c);return s!==void 0&&(l.v0.set(u[0],u[1]),l.v1.set(u[2],u[3]),l.v2.set(u[4],u[5]),l.v3.set(u[6],u[7])),o!==void 0&&(l.v0.set(u[6],u[7]),l.v1.set(u[8],u[9]),l.v2.set(u[10],u[11]),l.v3.set(u[12],u[13])),l}return r}clone(){let t=new At(this._width,this._height);return t.points=this.points.map(r=>r.clone()),t.isClosed=this.isClosed,t.roundness=this.roundness,t.isMesh2D=this.isMesh2D,t.shapeHoles=this.shapeHoles.map(r=>r.clone()),t}toJSON(){return{points:this.points.reduce((t,r)=>t.concat(r.toJSON()),[]),shapeHoles:this.shapeHoles.map(t=>t.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(t){var n;this.points=[],this.pointIDs=0;let r=t.points.length/7;for(let s=0;s<r;s++){let o=s*7,a=t.points[o+0],l=t.points[o+1],c=t.points[o+2],u=t.points[o+3],h=t.points[o+4],f=t.points[o+5],d=t.points[o+6],m=new ui(et.generateUUID(),new N(a,l));m.controls[0].position.set(c,u),m.controls[1].position.set(h,f),m.roundness=d,this.points.push(m)}return this.shapeHoles=(n=t.shapeHoles)!=null&&n.length?t.shapeHoles.map(s=>{let o=new At;return o.fromJSON(s),o}):[],this.isClosed=t.isClosed,this._roundness=t.roundness,this._update(),this}fromShape(t){let r=(s,o)=>{o instanceof on&&o.v3.equals(s.position)&&s.controls[0].position.copy(o.v2)},n=s=>{let o=[],a,l;for(a=0,l=s.length;a<l;a++)s[a]instanceof Gn&&(s[a]=OM(s[a]));for(a=0,l=s.length;a<l;a++){let h=s[a],f=a>0?s[a-1]:null,d;h instanceof on?(d=this.createPoint(h.v0),d.controls[1].position.copy(h.v1)):h instanceof an&&(d=this.createPoint(h.v1)),d!==void 0&&(f!==null&&r(d,f),o.push(d))}let c=s[s.length-1],u=!1;return c instanceof on?c.v3.equals(o[0].position)&&(o[0].controls[0].position.copy(c.v2),u=!0):c instanceof an&&c.v2.equals(o[0].position)&&(u=!0),this.isClosed=u,o};return this.points=n(t.curves),t instanceof tn&&(this.shapeHoles=t.holes.map(s=>{let o=new At;return o.fromShape(s),o})),this.update(),this}};var iv=Math.PI*2;function nv({x:i,y:e},t,r,n,s){return{x:i*t+n,y:e*r+s}}function TO(i,e){let t=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),r=Math.cos(i),n=Math.sin(i),s=Math.cos(i+e),o=Math.sin(i+e);return[{x:r-n*t,y:n+r*t},{x:s+o*t,y:o-s*t},{x:s,y:o}]}function WM(i,e,t,r){let n=i*r-e*t<0?-1:1,s=Math.min(1,Math.max(-1,i*t+e*r));return n*Math.acos(s)}function EO(i,e,t,r,n,s,o,a,l,c){let u=Math.pow(n,2),h=Math.pow(s,2),f=Math.pow(o,2),d=Math.pow(a,2),m=u*h-u*d-h*f;m<0&&(m=0),m/=u*d+h*f,m=Math.sqrt(m)*(l===c?-1:1);let p=m*n/s*a,g=m*-s/n*o,y=p+(i+t)/2,v=g+(e+r)/2,b=(o-p)/n,w=(a-g)/s,x=(-o-p)/n,E=(-a-g)/s,T=WM(1,0,b,w),S=WM(b,w,x,E);return!c&&S>0&&(S-=iv),c&&S<0&&(S+=iv),{centerx:y,centery:v,ang1:T,ang2:S}}function jM({px:i,py:e,cx:t,cy:r,rx:n,ry:s,largeArcFlag:o,sweepFlag:a}){let l=[];if(n===0||s===0)return[];let c=(i-t)/2,u=(e-r)/2;if(c===0&&u===0)return[];n=Math.abs(n),s=Math.abs(s);let h=Math.pow(c,2)/Math.pow(n,2)+Math.pow(u,2)/Math.pow(s,2);h>1&&(n*=Math.sqrt(h),s*=Math.sqrt(h));let f=EO(i,e,t,r,n,s,c,u,o,a),{ang1:d,ang2:m}=f,{centerx:p,centery:g}=f,y=Math.abs(m)/(iv/4);Math.abs(1-y)<1e-7&&(y=1);let v=Math.max(Math.ceil(y),1);m/=v;for(let b=0;b<v;b++)l.push(TO(d,m)),d+=m;return l.map(b=>{let{x:w,y:x}=nv(b[0],n,s,p,g),{x:E,y:T}=nv(b[1],n,s,p,g),{x:S,y:I}=nv(b[2],n,s,p,g);return{x1:w,y1:x,x2:E,y2:T,x:S,y:I}})}var Kt;(function(i){i[i.ODD=0]="ODD",i[i.NONZERO=1]="NONZERO",i[i.POSITIVE=2]="POSITIVE",i[i.NEGATIVE=3]="NEGATIVE",i[i.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(Kt||(Kt={}));var Mr;(function(i){i[i.POLYGONS=0]="POLYGONS",i[i.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",i[i.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(Mr||(Mr={}));function qe(i,e){if(!i)throw e||"Assertion Failed!"}var ze=function(){function i(){}return i.vertEq=function(e,t){return e.s===t.s&&e.t===t.t},i.vertLeq=function(e,t){return e.s<t.s||e.s===t.s&&e.t<=t.t},i.transLeq=function(e,t){return e.t<t.t||e.t===t.t&&e.s<=t.s},i.edgeGoesLeft=function(e){return i.vertLeq(e.Dst,e.Org)},i.edgeGoesRight=function(e){return i.vertLeq(e.Org,e.Dst)},i.vertL1dist=function(e,t){return Math.abs(e.s-t.s)+Math.abs(e.t-t.t)},i.edgeEval=function(e,t,r){qe(i.vertLeq(e,t)&&i.vertLeq(t,r));var n=t.s-e.s,s=r.s-t.s;return n+s>0?n<s?t.t-e.t+(e.t-r.t)*(n/(n+s)):t.t-r.t+(r.t-e.t)*(s/(n+s)):0},i.edgeSign=function(e,t,r){qe(i.vertLeq(e,t)&&i.vertLeq(t,r));var n=t.s-e.s,s=r.s-t.s;return n+s>0?(t.t-r.t)*n+(t.t-e.t)*s:0},i.transEval=function(e,t,r){qe(i.transLeq(e,t)&&i.transLeq(t,r));var n=t.t-e.t,s=r.t-t.t;return n+s>0?n<s?t.s-e.s+(e.s-r.s)*(n/(n+s)):t.s-r.s+(r.s-e.s)*(s/(n+s)):0},i.transSign=function(e,t,r){qe(i.transLeq(e,t)&&i.transLeq(t,r));var n=t.t-e.t,s=r.t-t.t;return n+s>0?(t.s-r.s)*n+(t.s-e.s)*s:0},i.vertCCW=function(e,t,r){return e.s*(t.t-r.t)+t.s*(r.t-e.t)+r.s*(e.t-t.t)>=0},i.interpolate=function(e,t,r,n){return e=e<0?0:e,r=r<0?0:r,e<=r?r===0?(t+n)/2:t+(n-t)*(e/(e+r)):n+(t-n)*(r/(e+r))},i.intersect=function(e,t,r,n,s){var o,a,l;i.vertLeq(e,t)||(l=e,e=t,t=l),i.vertLeq(r,n)||(l=r,r=n,n=l),i.vertLeq(e,r)||(l=e,e=r,r=l,l=t,t=n,n=l),i.vertLeq(r,t)?i.vertLeq(t,n)?(o=i.edgeEval(e,r,t),a=i.edgeEval(r,t,n),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,r.s,a,t.s)):(o=i.edgeSign(e,r,t),a=-i.edgeSign(e,n,t),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,r.s,a,n.s)):s.s=(r.s+t.s)/2,i.transLeq(e,t)||(l=e,e=t,t=l),i.transLeq(r,n)||(l=r,r=n,n=l),i.transLeq(e,r)||(l=e,e=r,r=l,l=t,t=n,n=l),i.transLeq(r,t)?i.transLeq(t,n)?(o=i.transEval(e,r,t),a=i.transEval(r,t,n),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,r.t,a,t.t)):(o=i.transSign(e,r,t),a=-i.transSign(e,n,t),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,r.t,a,n.t)):s.t=(r.t+t.t)/2},i}(),Hu=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}return i}(),cp=function(){function i(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(i.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),i}(),Ll=function(){function i(){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 i}(),qM=function(){function i(){var e=new Ll,t=new Hu,r=new cp(0),n=new cp(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,r.next=r,r.Sym=n,n.next=n,n.Sym=r,this.vHead=e,this.fHead=t,this.eHead=r,this.eHeadSym=n}return i.prototype.makeEdge_=function(e){var t=new cp(0),r=new cp(1);e.Sym.side<e.side&&(e=e.Sym);var n=e.Sym.next;return r.next=n,n.Sym.next=t,t.next=e,e.Sym.next=r,t.Sym=r,t.Onext=t,t.Lnext=r,t.Org=null,t.Lface=null,t.winding=0,t.activeRegion=null,r.Sym=t,r.Onext=r,r.Lnext=t,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,t},i.prototype.splice_=function(e,t){var r=e.Onext,n=t.Onext;r.Sym.Lnext=t,n.Sym.Lnext=e,e.Onext=n,t.Onext=r},i.prototype.makeVertex_=function(e,t,r){var n=e;qe(n,"Vertex can't be null!");var s=r.prev;n.prev=s,s.next=n,n.next=r,r.prev=n,n.anEdge=t;var o=t;do o.Org=n,o=o.Onext;while(o!==t)},i.prototype.makeFace_=function(e,t,r){var n=e;qe(n,"Face can't be null");var s=r.prev;n.prev=s,s.next=n,n.next=r,r.prev=n,n.anEdge=t,n.trail=null,n.marked=!1,n.inside=r.inside;var o=t;do o.Lface=n,o=o.Lnext;while(o!==t)},i.prototype.killEdge_=function(e){e.Sym.side<e.side&&(e=e.Sym);var t=e.next,r=e.Sym.next;t.Sym.next=r,r.Sym.next=t},i.prototype.killVertex_=function(e,t){var r=e.anEdge,n=r;do n.Org=t,n=n.Onext;while(n!==r);var s=e.prev,o=e.next;o.prev=s,s.next=o},i.prototype.killFace_=function(e,t){var r=e.anEdge,n=r;do n.Lface=t,n=n.Lnext;while(n!==r);var s=e.prev,o=e.next;o.prev=s,s.next=o},i.prototype.makeEdge=function(){var e=new Ll,t=new Ll,r=new Hu,n=this.makeEdge_(this.eHead);return this.makeVertex_(e,n,this.vHead),this.makeVertex_(t,n.Sym,this.vHead),this.makeFace_(r,n,this.fHead),n},i.prototype.splice=function(e,t){var r=!1,n=!1;if(e!==t){if(t.Org!==e.Org&&(n=!0,this.killVertex_(t.Org,e.Org)),t.Lface!==e.Lface&&(r=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(t,e),!n){var s=new Ll;this.makeVertex_(s,t,e.Org),e.Org.anEdge=e}if(!r){var o=new Hu;this.makeFace_(o,t,e.Lface),e.Lface.anEdge=e}}},i.prototype.delete=function(e){var t=e.Sym,r=!1;if(e.Lface!==e.Rface&&(r=!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),!r){var n=new Hu;this.makeFace_(n,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)},i.prototype.addEdgeVertex=function(e){var t=this.makeEdge_(e),r=t.Sym;this.splice_(t,e.Lnext),t.Org=e.Dst;var n=new Ll;return this.makeVertex_(n,r,t.Org),t.Lface=r.Lface=e.Lface,t},i.prototype.splitEdge=function(e){var t=this.addEdgeVertex(e),r=t.Sym;return this.splice_(e.Sym,e.Sym.Oprev),this.splice_(e.Sym,r),e.Dst=r.Org,r.Dst.anEdge=r.Sym,r.Rface=e.Rface,r.winding=e.winding,r.Sym.winding=e.Sym.winding,r.idx=e.idx,r.Sym.idx=e.Sym.idx,r},i.prototype.connect=function(e,t){var r=!1,n=this.makeEdge_(e),s=n.Sym;if(t.Lface!==e.Lface&&(r=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(n,e.Lnext),this.splice_(s,t),n.Org=e.Dst,s.Org=t.Org,n.Lface=s.Lface=e.Lface,e.Lface.anEdge=s,!r){var o=new Hu;this.makeFace_(o,n,e.Lface)}return n},i.prototype.zapFace=function(e){var t=e.anEdge,r,n,s,o,a;n=t.Lnext;do r=n,n=r.Lnext,r.Lface=null,r.Rface===null&&(r.Onext===r?this.killVertex_(r.Org,null):(r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),s=r.Sym,s.Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(r));while(r!=t);o=e.prev,a=e.next,a.prev=o,o.next=a},i.prototype.countFaceVerts_=function(e){var t=e.anEdge,r=0;do r++,t=t.Lnext;while(t!==e.anEdge);return r},i.prototype.mergeConvexFaces=function(e){var t,r,n,s,o,a,l;for(t=this.fHead.next;t!==this.fHead;t=t.next)if(!!t.inside)for(r=t.anEdge,o=r.Org;n=r.Lnext,s=r.Sym,s&&s.Lface&&s.Lface.inside&&(a=this.countFaceVerts_(t),l=this.countFaceVerts_(s.Lface),a+l-2<=e&&ze.vertCCW(r.Lprev.Org,r.Org,s.Lnext.Lnext.Org)&&ze.vertCCW(s.Lprev.Org,s.Org,r.Lnext.Lnext.Org)&&(n=s.Lnext,this.delete(s),r=null,s=null)),!(r&&r.Lnext.Org===o);)r=n;return!0},i.prototype.check=function(){var e=this.fHead,t=this.vHead,r=this.eHead,n,s,o,a,l,c;for(s=e,s=e;(n=s.next)!==e;s=n){qe(n.prev===s),l=n.anEdge;do qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l),qe(l.Lface===n),l=l.Lnext;while(l!==n.anEdge)}for(qe(n.prev===s&&n.anEdge===null),a=t,a=t;(o=a.next)!==t;a=o){qe(o.prev===a),l=o.anEdge;do qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l),qe(l.Org===o),l=l.Onext;while(l!==o.anEdge)}for(qe(o.prev===a&&o.anEdge===null),c=r,c=r;(l=c.next)!==r;c=l)qe(l.Sym.next===c.Sym),qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Org!==null),qe(l.Dst!==null),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l);qe(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)},i}(),XM=function(){function i(){this.handle=null}return i}(),YM=function(){function i(){this.key=null,this.node=0}return i}(),_O=function(){function i(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 r=0;r<e+1;r++)this.nodes[r]=new XM,this.handles[r]=new YM;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return i.prototype.floatDown_=function(e){var t=this.nodes,r=this.handles,n,s,o;for(n=t[e].handle;;){if(o=e<<1,o<this.size&&this.leq(r[t[o+1].handle].key,r[t[o].handle].key)&&++o,qe(o<=this.max),s=t[o].handle,o>this.size||this.leq(r[n].key,r[s].key)){t[e].handle=n,r[n].node=e;break}t[e].handle=s,r[s].node=e,e=o}},i.prototype.floatUp_=function(e){var t=this.nodes,r=this.handles,n,s,o;for(n=t[e].handle;;){if(o=e>>1,s=t[o].handle,o===0||this.leq(r[s].key,r[n].key)){t[e].handle=n,r[n].node=e;break}t[e].handle=s,r[s].node=e,e=o}},i.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},i.prototype.min=function(){return this.handles[this.nodes[1].handle].key},i.prototype.insert=function(e){var t,r;if(t=++this.size,t*2>this.max){this.max*=2;var n,s;for(s=this.nodes.length,this.nodes.length=this.max+1,n=s;n<this.nodes.length;n++)this.nodes[n]=new XM;for(s=this.handles.length,this.handles.length=this.max+1,n=s;n<this.handles.length;n++)this.handles[n]=new YM}return this.freeList===0?r=t:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[t].handle=r,this.handles[r].node=t,this.handles[r].key=e,this.initialized&&this.floatUp_(t),r},i.prototype.extractMin=function(){var e=this.nodes,t=this.handles,r=e[1].handle,n=t[r].key;return this.size>0&&(e[1].handle=e[this.size].handle,t[e[1].handle].node=1,t[r].key=null,t[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),n},i.prototype.delete=function(e){var t=this.nodes,r=this.handles,n;qe(e>=1&&e<=this.max&&r[e].key!==null),n=r[e].node,t[n].handle=t[this.size].handle,r[t[n].handle].node=n,--this.size,n<=this.size&&(n<=1||this.leq(r[t[n>>1].handle].key,r[t[n].handle].key)?this.floatDown_(n):this.floatUp_(n)),r[e].key=null,r[e].node=this.freeList,this.freeList=e},i}(),sv=function(){function i(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}return i}(),JM=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),CO=function(){function i(e,t){this.frame=e,this.leq=t,this.head=new JM,this.head.next=this.head,this.head.prev=this.head}return i.prototype.min=function(){return this.head.next},i.prototype.max=function(){return this.head.prev},i.prototype.insert=function(e){return this.insertBefore(this.head,e)},i.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},i.prototype.insertBefore=function(e,t){do e=e.prev;while(e.key!==null&&!this.leq(this.frame,e.key,t));var r=new JM;return r.key=t,r.next=e.next,e.next.prev=r,r.prev=e,e.next=r,r},i.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},i}(),LO=function(){function i(){}return i.regionBelow=function(e){return e.nodeUp.prev.key},i.regionAbove=function(e){return e.nodeUp.next.key},i.debugEvent=function(e){},i.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},i.edgeLeq=function(e,t,r){var n=e.event,s=t.eUp,o=r.eUp;if(s.Dst===n)return o.Dst===n?ze.vertLeq(s.Org,o.Org)?ze.edgeSign(o.Dst,s.Org,o.Org)<=0:ze.edgeSign(s.Dst,o.Org,s.Org)>=0:ze.edgeSign(o.Dst,n,o.Org)<=0;if(o.Dst===n)return ze.edgeSign(s.Dst,n,s.Org)>=0;var a=ze.edgeEval(s.Dst,n,s.Org),l=ze.edgeEval(o.Dst,n,o.Org);return a>=l},i.deleteRegion=function(e,t){t.fixUpperEdge&&qe(t.eUp.winding===0),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},i.fixUpperEdge=function(e,t,r){qe(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,t.eUp=r,r.activeRegion=t},i.topLeftRegion=function(e,t){var r=t.eUp.Org,n;do t=i.regionAbove(t);while(t.eUp.Org===r);if(t.fixUpperEdge){if(n=e.mesh.connect(i.regionBelow(t).eUp.Sym,t.eUp.Lnext),n===null)return null;i.fixUpperEdge(e,t,n),t=i.regionAbove(t)}return t},i.topRightRegion=function(e){var t=e.eUp.Dst;do e=i.regionAbove(e);while(e.eUp.Dst===t);return e},i.addRegionBelow=function(e,t,r){var n=new sv;return n.eUp=r,n.nodeUp=e.dict.insertBefore(t.nodeUp,n),n.fixUpperEdge=!1,n.sentinel=!1,n.dirty=!1,r.activeRegion=n,n},i.isWindingInside=function(e,t){switch(e.windingRule){case Kt.ODD:return(t&1)!==0;case Kt.NONZERO:return t!==0;case Kt.POSITIVE:return t>0;case Kt.NEGATIVE:return t<0;case Kt.ABS_GEQ_TWO:return t>=2||t<=-2}throw new Error("Invalid winding rulle")},i.computeWinding=function(e,t){t.windingNumber=i.regionAbove(t).windingNumber+t.eUp.winding,t.inside=i.isWindingInside(e,t.windingNumber)},i.finishRegion=function(e,t){var r=t.eUp,n=r.Lface;n.inside=t.inside,n.anEdge=r,i.deleteRegion(e,t)},i.finishLeftRegions=function(e,t,r){for(var n,s=null,o=t,a=t.eUp;o!==r;){if(o.fixUpperEdge=!1,s=i.regionBelow(o),n=s.eUp,n.Org!=a.Org){if(!s.fixUpperEdge){i.finishRegion(e,o);break}n=e.mesh.connect(a.Lprev,n.Sym),i.fixUpperEdge(e,s,n)}a.Onext!==n&&(e.mesh.splice(n.Oprev,n),e.mesh.splice(a,n)),i.finishRegion(e,o),a=s.eUp,o=s}return a},i.addRightEdges=function(e,t,r,n,s,o){var a,l,c,u,h=!0;c=r;do qe(ze.vertLeq(c.Org,c.Dst)),i.addRegionBelow(e,t,c.Sym),c=c.Onext;while(c!==n);for(s===null&&(s=i.regionBelow(t).eUp.Rprev),l=t,u=s;a=i.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=i.isWindingInside(e,a.windingNumber),l.dirty=!0,!h&&i.checkForRightSplice(e,l)&&(i.addWinding(c,u),i.deleteRegion(e,l),e.mesh.delete(u)),h=!1,l=a,u=c;l.dirty=!0,qe(l.windingNumber-c.winding===a.windingNumber),o&&i.walkDirtyRegions(e,l)},i.spliceMergeVertices=function(e,t,r){e.mesh.splice(t,r)},i.vertexWeights=function(e,t,r){var n=ze.vertL1dist(t,e),s=ze.vertL1dist(r,e),o=.5*s/(n+s),a=.5*n/(n+s);e.coords[0]+=o*t.coords[0]+a*r.coords[0],e.coords[1]+=o*t.coords[1]+a*r.coords[1],e.coords[2]+=o*t.coords[2]+a*r.coords[2]},i.getIntersectData=function(e,t,r,n,s,o){t.coords[0]=t.coords[1]=t.coords[2]=0,t.idx=-1,i.vertexWeights(t,r,n),i.vertexWeights(t,s,o)},i.checkForRightSplice=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp;if(ze.vertLeq(n.Org,s.Org)){if(ze.edgeSign(s.Dst,n.Org,s.Org)>0)return!1;ze.vertEq(n.Org,s.Org)?n.Org!==s.Org&&(e.pq.delete(n.Org.pqHandle),i.spliceMergeVertices(e,s.Oprev,n)):(e.mesh.splitEdge(s.Sym),e.mesh.splice(n,s.Oprev),t.dirty=r.dirty=!0)}else{if(ze.edgeSign(n.Dst,s.Org,n.Org)<0)return!1;i.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(n.Sym),e.mesh.splice(s.Oprev,n)}return!0},i.checkForLeftSplice=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp,o;if(qe(!ze.vertEq(n.Dst,s.Dst)),ze.vertLeq(n.Dst,s.Dst)){if(ze.edgeSign(n.Dst,s.Dst,n.Org)<0)return!1;i.regionAbove(t).dirty=t.dirty=!0,o=e.mesh.splitEdge(n),e.mesh.splice(s.Sym,o),o.Lface.inside=t.inside}else{if(ze.edgeSign(s.Dst,n.Dst,s.Org)>0)return!1;t.dirty=r.dirty=!0,o=e.mesh.splitEdge(s),e.mesh.splice(n.Lnext,s.Sym),o.Rface.inside=t.inside}return!0},i.checkForIntersect=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp,o=n.Org,a=s.Org,l=n.Dst,c=s.Dst,u,h,f=new Ll,d,m;if(qe(!ze.vertEq(c,l)),qe(ze.edgeSign(l,e.event,o)<=0),qe(ze.edgeSign(c,e.event,a)>=0),qe(o!==e.event&&a!==e.event),qe(!t.fixUpperEdge&&!r.fixUpperEdge),o===a||(u=Math.min(o.t,l.t),h=Math.max(a.t,c.t),u>h))return!1;if(ze.vertLeq(o,a)){if(ze.edgeSign(c,o,a)>0)return!1}else if(ze.edgeSign(l,a,o)<0)return!1;return i.debugEvent(e),ze.intersect(l,o,c,a,f),qe(Math.min(o.t,l.t)<=f.t),qe(f.t<=Math.max(a.t,c.t)),qe(Math.min(c.s,l.s)<=f.s),qe(f.s<=Math.max(a.s,o.s)),ze.vertLeq(f,e.event)&&(f.s=e.event.s,f.t=e.event.t),d=ze.vertLeq(o,a)?o:a,ze.vertLeq(d,f)&&(f.s=d.s,f.t=d.t),ze.vertEq(f,o)||ze.vertEq(f,a)?(i.checkForRightSplice(e,t),!1):!ze.vertEq(l,e.event)&&ze.edgeSign(l,e.event,f)>=0||!ze.vertEq(c,e.event)&&ze.edgeSign(c,e.event,f)<=0?c===e.event?(e.mesh.splitEdge(n.Sym),e.mesh.splice(s.Sym,n),t=i.topLeftRegion(e,t),n=i.regionBelow(t).eUp,i.finishLeftRegions(e,i.regionBelow(t),r),i.addRightEdges(e,t,n.Oprev,n,n,!0),!0):l===e.event?(e.mesh.splitEdge(s.Sym),e.mesh.splice(n.Lnext,s.Oprev),r=t,t=i.topRightRegion(t),m=i.regionBelow(t).eUp.Rprev,r.eUp=s.Oprev,s=i.finishLeftRegions(e,r,null),i.addRightEdges(e,t,s.Onext,n.Rprev,m,!0),!0):(ze.edgeSign(l,e.event,f)>=0&&(i.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(n.Sym),n.Org.s=e.event.s,n.Org.t=e.event.t),ze.edgeSign(c,e.event,f)<=0&&(t.dirty=r.dirty=!0,e.mesh.splitEdge(s.Sym),s.Org.s=e.event.s,s.Org.t=e.event.t),!1):(e.mesh.splitEdge(n.Sym),e.mesh.splitEdge(s.Sym),e.mesh.splice(s.Oprev,n),n.Org.s=f.s,n.Org.t=f.t,n.Org.pqHandle=e.pq.insert(n.Org),i.getIntersectData(e,n.Org,o,l,a,c),i.regionAbove(t).dirty=t.dirty=r.dirty=!0,!1)},i.walkDirtyRegions=function(e,t){for(var r=i.regionBelow(t),n,s;;){for(;r.dirty;)t=r,r=i.regionBelow(r);if(!t.dirty&&(r=t,t=i.regionAbove(t),t===null||!t.dirty))return;if(t.dirty=!1,n=t.eUp,s=r.eUp,n.Dst!==s.Dst&&i.checkForLeftSplice(e,t)&&(r.fixUpperEdge?(i.deleteRegion(e,r),e.mesh.delete(s),r=i.regionBelow(t),s=r.eUp):t.fixUpperEdge&&(i.deleteRegion(e,t),e.mesh.delete(n),t=i.regionAbove(r),n=t.eUp)),n.Org!==s.Org)if(n.Dst!==s.Dst&&!t.fixUpperEdge&&!r.fixUpperEdge&&(n.Dst===e.event||s.Dst===e.event)){if(i.checkForIntersect(e,t))return}else i.checkForRightSplice(e,t);n.Org===s.Org&&n.Dst===s.Dst&&(i.addWinding(s,n),i.deleteRegion(e,t),e.mesh.delete(n),t=i.regionAbove(r))}},i.connectRightVertex=function(e,t,r){var n,s=r.Onext,o=i.regionBelow(t),a=t.eUp,l=o.eUp,c=!1;if(a.Dst!==l.Dst&&i.checkForIntersect(e,t),ze.vertEq(a.Org,e.event)&&(e.mesh.splice(s.Oprev,a),t=i.topLeftRegion(e,t),s=i.regionBelow(t).eUp,i.finishLeftRegions(e,i.regionBelow(t),o),c=!0),ze.vertEq(l.Org,e.event)&&(e.mesh.splice(r,l.Oprev),r=i.finishLeftRegions(e,o,null),c=!0),c){i.addRightEdges(e,t,r.Onext,s,s,!0);return}ze.vertLeq(l.Org,a.Org)?n=l.Oprev:n=a,n=e.mesh.connect(r.Lprev,n),i.addRightEdges(e,t,n,n.Onext,n.Onext,!1),n.Sym.activeRegion.fixUpperEdge=!0,i.walkDirtyRegions(e,t)},i.connectLeftDegenerate=function(e,t,r){var n,s,o,a,l;if(n=t.eUp,ze.vertEq(n.Org,r)){qe(!1),i.spliceMergeVertices(e,n,r.anEdge);return}if(!ze.vertEq(n.Dst,r)){e.mesh.splitEdge(n.Sym),t.fixUpperEdge&&(e.mesh.delete(n.Onext),t.fixUpperEdge=!1),e.mesh.splice(r.anEdge,n),i.sweepEvent(e,r);return}qe(!1),t=i.topRightRegion(t),l=i.regionBelow(t),o=l.eUp.Sym,s=a=o.Onext,l.fixUpperEdge&&(qe(s!==o),i.deleteRegion(e,l),e.mesh.delete(o),o=s.Oprev),e.mesh.splice(r.anEdge,o),ze.edgeGoesLeft(s)||(s=null),i.addRightEdges(e,t,o.Onext,a,s,!0)},i.connectLeftVertex=function(e,t){var r,n,s,o,a,l,c=new sv;if(c.eUp=t.anEdge.Sym,r=e.dict.search(c).key,n=i.regionBelow(r),!!n){if(o=r.eUp,a=n.eUp,ze.edgeSign(o.Dst,t,o.Org)===0){i.connectLeftDegenerate(e,r,t);return}if(s=ze.vertLeq(a.Dst,o.Dst)?r:n,r.inside||s.fixUpperEdge){if(s===r)l=e.mesh.connect(t.anEdge.Sym,o.Lnext);else{var u=e.mesh.connect(a.Dnext,t.anEdge);l=u.Sym}s.fixUpperEdge?i.fixUpperEdge(e,s,l):i.computeWinding(e,i.addRegionBelow(e,r,l)),i.sweepEvent(e,t)}else i.addRightEdges(e,r,t.anEdge,t.anEdge,null,!0)}},i.sweepEvent=function(e,t){e.event=t,i.debugEvent(e);for(var r=t.anEdge;r.activeRegion===null;)if(r=r.Onext,r===t.anEdge){i.connectLeftVertex(e,t);return}var n=i.topLeftRegion(e,r.activeRegion);qe(n!==null);var s=i.regionBelow(n),o=s.eUp,a=i.finishLeftRegions(e,s,null);a.Onext===o?i.connectRightVertex(e,n,a):i.addRightEdges(e,n,a.Onext,o,o,!0)},i.addSentinel=function(e,t,r,n){var s=new sv,o=e.mesh.makeEdge();o.Org.s=r,o.Org.t=n,o.Dst.s=t,o.Dst.t=n,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)},i.initEdgeDict=function(e){e.dict=new CO(e,i.edgeLeq);var t=e.bmax[0]-e.bmin[0],r=e.bmax[1]-e.bmin[1],n=e.bmin[0]-t,s=e.bmax[0]+t,o=e.bmin[1]-r,a=e.bmax[1]+r;i.addSentinel(e,n,s,o),i.addSentinel(e,n,s,a)},i.doneEdgeDict=function(e){for(var t,r=0;(t=e.dict.min().key)!==null;)t.sentinel||(qe(t.fixUpperEdge),qe(++r===1)),qe(t.windingNumber===0),i.deleteRegion(e,t)},i.removeDegenerateEdges=function(e){var t,r,n,s=e.mesh.eHead;for(t=s.next;t!==s;t=r)r=t.next,n=t.Lnext,ze.vertEq(t.Org,t.Dst)&&t.Lnext.Lnext!==t&&(i.spliceMergeVertices(e,n,t),e.mesh.delete(t),t=n,n=t.Lnext),n.Lnext===t&&(n!==t&&((n===r||n===r.Sym)&&(r=r.next),e.mesh.delete(n)),(t===r||t===r.Sym)&&(r=r.next),e.mesh.delete(t))},i.initPriorityQ=function(e){var t,r,n,s=0;for(n=e.mesh.vHead,r=n.next;r!==n;r=r.next)s++;for(s+=8,t=e.pq=new _O(s,ze.vertLeq),n=e.mesh.vHead,r=n.next;r!==n;r=r.next)r.pqHandle=t.insert(r);return r!==n?!1:(t.init(),!0)},i.donePriorityQ=function(e){e.pq=null},i.removeDegenerateFaces=function(e,t){var r,n,s;for(r=t.fHead.next;r!==t.fHead;r=n)n=r.next,s=r.anEdge,qe(s.Lnext!==s),s.Lnext.Lnext===s&&(i.addWinding(s.Onext,s),e.mesh.delete(s));return!0},i.computeInterior=function(e,t){t===void 0&&(t=!0);var r,n;if(i.removeDegenerateEdges(e),!i.initPriorityQ(e))return!1;for(i.initEdgeDict(e);(r=e.pq.extractMin())!==null;){for(;n=e.pq.min(),!(n===null||!ze.vertEq(n,r));)n=e.pq.extractMin(),i.spliceMergeVertices(e,r.anEdge,n.anEdge);i.sweepEvent(e,r)}return e.event=e.dict.min().key.eUp.Org,i.debugEvent(e),i.doneEdgeDict(e),i.donePriorityQ(e),i.removeDegenerateFaces(e,e.mesh)?(t&&e.mesh.check(),!0):!1},i}(),DO=function(){function i(){this.mesh=new qM,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=Kt.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 i.prototype.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},i.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},i.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},i.prototype.computeNormal_=function(e){var t,r,n,s,o,a,l=[0,0,0],c=[0,0,0],u=[0,0,0],h=[0,0,0],f=[0,0,0],d=[null,null,null],m=[null,null,null],p=this.mesh.vHead;t=p.next;for(var g=0;g<3;++g)s=t.coords[g],c[g]=s,m[g]=t,l[g]=s,d[g]=t;for(t=p.next;t!==p;t=t.next)for(var y=0;y<3;++y)s=t.coords[y],s<c[y]&&(c[y]=s,m[y]=t),s>l[y]&&(l[y]=s,d[y]=t);var v=0;if(l[1]-c[1]>l[0]-c[0]&&(v=1),l[2]-c[2]>l[v]-c[v]&&(v=2),c[v]>=l[v]){e[0]=0,e[1]=0,e[2]=1;return}for(a=0,r=m[v],n=d[v],u[0]=r.coords[0]-n.coords[0],u[1]=r.coords[1]-n.coords[1],u[2]=r.coords[2]-n.coords[2],t=p.next;t!==p;t=t.next)h[0]=t.coords[0]-n.coords[0],h[1]=t.coords[1]-n.coords[1],h[2]=t.coords[2]-n.coords[2],f[0]=u[1]*h[2]-u[2]*h[1],f[1]=u[2]*h[0]-u[0]*h[2],f[2]=u[0]*h[1]-u[1]*h[0],o=f[0]*f[0]+f[1]*f[1]+f[2]*f[2],o>a&&(a=o,e[0]=f[0],e[1]=f[1],e[2]=f[2]);a<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(u)]=1)},i.prototype.checkOrientation_=function(){for(var e=this.mesh.fHead,t,r=this.mesh.vHead,n,s=0,o=e.next;o!==e;o=o.next)if(n=o.anEdge,!(n.winding<=0))do s+=(n.Org.s-n.Dst.s)*(n.Org.t+n.Dst.t),n=n.Lnext;while(n!==o.anEdge);if(s<0){for(t=r.next;t!==r;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]}},i.prototype.projectPolygon_=function(){var e=this.mesh.vHead,t=[0,0,0],r,n,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),r=this.sUnit,n=this.tUnit;var o=this.longAxis_(t);r[o]=0,r[(o+1)%3]=1,r[(o+2)%3]=0,n[o]=0,n[(o+1)%3]=0,n[(o+2)%3]=t[o]>0?1:-1;for(var a=e.next;a!==e;a=a.next)a.s=this.dot_(a.coords,r),a.t=this.dot_(a.coords,n);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))},i.prototype.addWinding_=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},i.prototype.tessellateMonoRegion_=function(e,t){var r,n;if(r=t.anEdge,!(r.Lnext!==r&&r.Lnext.Lnext!==r))throw"Mono region invalid";for(;ze.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;ze.vertLeq(r.Org,r.Dst);r=r.Lnext);n=r.Lprev;for(var s=void 0;r.Lnext!==n;)if(ze.vertLeq(r.Dst,n.Org)){for(;n.Lnext!==r&&(ze.edgeGoesLeft(n.Lnext)||ze.edgeSign(n.Org,n.Dst,n.Lnext.Dst)<=0);)s=e.connect(n.Lnext,n),n=s.Sym;n=n.Lprev}else{for(;n.Lnext!==r&&(ze.edgeGoesRight(r.Lprev)||ze.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)s=e.connect(r,r.Lprev),r=s.Sym;r=r.Lnext}if(n.Lnext===r)throw"Mono region invalid";for(;n.Lnext.Lnext!==r;)s=e.connect(n.Lnext,n),n=s.Sym;return!0},i.prototype.tessellateInterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)if(t=r.next,r.inside&&!this.tessellateMonoRegion_(e,r))return!1;return!0},i.prototype.discardExterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)t=r.next,r.inside||e.zapFace(r)},i.prototype.setWindingNumber_=function(e,t,r){for(var n,s=e.eHead.next;s!==e.eHead;s=n)n=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?t:-t:r?e.delete(s):s.winding=0},i.prototype.getNeighbourFace_=function(e){return!e.Rface||!e.Rface.inside?-1:e.Rface.n},i.prototype.outputPolymesh_=function(e,t,r,n){var s,o=0,a=0,l;r>3&&e.mergeConvexFaces(r);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>r)throw"Face vertex greater that support polygon";u.n=o,++o}this.elementCount=o,t===Mr.CONNECTED_POLYGONS&&(o*=2),this.elements=[],this.elements.length=o*r,this.vertexCount=a,this.vertices=[],this.vertices.length=a*n,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*n;this.vertices[h+0]=c.coords[0],this.vertices[h+1]=c.coords[1],n>2&&(this.vertices[h+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var f=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[f++]=c.n,l++,s=s.Lnext}while(s!==u.anEdge);for(var d=l;d<r;++d)this.elements[f++]=-1;if(t===Mr.CONNECTED_POLYGONS){s=u.anEdge;do this.elements[f++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==u.anEdge);for(var m=l;m<r;++m)this.elements[f++]=-1}}},i.prototype.outputContours_=function(e,t){var r,n,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){n=r=a.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==n);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,n=r=a.anEdge;do this.vertices[l++]=r.Org.coords[0],this.vertices[l++]=r.Org.coords[1],t>2&&(this.vertices[l++]=r.Org.coords[2]),this.vertexIndices[c++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,o++,r=r.Lnext;while(r!==n);this.elements[u++]=s,this.elements[u++]=o,s+=o}},i.prototype.addContour=function(e,t){this.mesh===null&&(this.mesh=new qM),e<2&&(e=2),e>3&&(e=3);for(var r=null,n=0;n<t.length;n+=e)r===null?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=t[n+0],r.Org.coords[1]=t[n+1],e>2?r.Org.coords[2]=t[n+2]:r.Org.coords[2]=0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},i.prototype.tesselate=function(e,t,r,n,s,o){if(e===void 0&&(e=Kt.ODD),t===void 0&&(t=Mr.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,n<2&&(n=2),n>3&&(n=3),!this.mesh)return!1;this.projectPolygon_(),LO.computeInterior(this,o);var a=this.mesh;return t===Mr.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),o&&a.check(),t===Mr.BOUNDARY_CONTOURS?this.outputContours_(a,n):this.outputPolymesh_(a,t,r,n),!0},i}();function jo(i){var e=i.windingRule,t=e===void 0?Kt.ODD:e,r=i.elementType,n=r===void 0?Mr.POLYGONS:r,s=i.polySize,o=s===void 0?3:s,a=i.vertexSize,l=a===void 0?2:a,c=i.normal,u=c===void 0?[0,0,1]:c,h=i.contours,f=h===void 0?[]:h,d=i.strict,m=d===void 0?!0:d,p=i.debug,g=p===void 0?!1:p;if(!f&&m)throw new Error("Contours can't be empty");if(!!f){var y=new DO;i.edgeCreateCallback&&(y.edgeCreateCallback=i.edgeCreateCallback),i.vertexIdCallback&&(y.vertexIdCallback=i.vertexIdCallback);for(var v=0;v<f.length;v++)y.addContour(l||2,f[v]);return y.tesselate(t,n,o,l,u,m),{vertices:y.vertices,vertexIndices:y.vertexIndices,vertexCount:y.vertexCount,elements:y.elements,elementCount:y.elementCount,mesh:g?y.mesh:void 0}}}var Zq=Kt.ODD,$q=Kt.NONZERO,e7=Kt.POSITIVE,t7=Kt.NEGATIVE,r7=Kt.ABS_GEQ_TWO,n7=Mr.POLYGONS,i7=Mr.CONNECTED_POLYGONS,s7=Mr.BOUNDARY_CONTOURS;var so=class extends Ie{constructor(t,r=12,n=100,s={}){super();this.type="ShapeGeometry";this.windingRule=Kt.ODD;this.elementType=Mr.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._drawCount=0,this._shape=t,this._curveSegments=r,this._maxCount=n,this._maxDrawCount=n*3,this._triangulationOptions=Object.assign({windingRule:Kt.ODD,elementType:Mr.POLYGONS,polySize:3,vertexSize:2,strict:!0},s),this._positionAttribute=new Ue(new Float32Array(n*3),3),this._normalAttribute=new Ue(new Float32Array(n*3),3),this._uvAttribute=new Ue(new Float32Array(n*2),2),this._indexAttribute=new Ue(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(t){return this._drawCount=t.drawCount,this._maxDrawCount=t._maxDrawCount,this._maxCount=t.maxCount,super.copy(t)}get curveSegments(){return this._curveSegments}set curveSegments(t){this._curveSegments=t,this.updateFromShape()}get drawCount(){return this._drawCount}get maxDrawCount(){return this._maxDrawCount}get maxCount(){return this._maxCount}updateFromShape(){let t=this._shape.extractShapePointsToFlatArray([],this._curveSegments),r=this._shape.shapeHoles.map(c=>c.extractShapePointsToFlatArray([],this._curveSegments)),n,s=!0,o=!0,a,l;for(let c=0,u=t.length/2;c<u;c++){let h=c*2,f=t[h+0],d=t[h+1];if(a!==void 0&&f!==a&&(s=!1),l!==void 0&&d!==l&&(o=!1),a=f,l=d,!s&&!o)break}if(!s&&!o&&(n=jo({contours:[t,...r],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 c=1/0,u=-1/0,h=1/0,f=-1/0;for(let p=0,g=n.vertexCount;p<g;p++){let y=p*2,v=n.vertices[y+0],b=n.vertices[y+1];v<c&&(c=v),v>u&&(u=v),b<h&&(h=b),b>f&&(f=b)}let d=u-c,m=f-h;for(let p=0,g=n.vertexCount;p<g;p++){let y=p*2,v=n.vertices[y+0],b=n.vertices[y+1],w=(v-c)/d,x=(b-h)/m;this._positionAttribute.setXYZ(p,v,b,0),this._normalAttribute.setXYZ(p,0,0,1),this._uvAttribute.setXY(p,w,x)}for(let p=0,g=n.elementCount;p<g;p++){let y=p*3,v=n.elements[y+0],b=n.elements[y+1],w=n.elements[y+2];this._indexAttribute.setX(y+0,v),this._indexAttribute.setX(y+1,b),this._indexAttribute.setX(y+2,w),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}clone(){let t=new so(this._shape,this._curveSegments,this._maxCount);return t.userData=Su(this.userData),t}};var up=class{constructor(e=256,t=!1){this.capacity=e,this.size=0,this.debug=t,this.debug&&console.log(`allocating with cap ${e}`);let r=e*up.eSize;this.buffer=new ArrayBuffer(r);let n=Float32Array.BYTES_PER_ELEMENT,s=0;this.positions=new Float32Array(this.buffer,s*n,3*e),s+=3*e,this.normals=new Float32Array(this.buffer,s*n,3*e),s+=3*e,this.uvs=new Float32Array(this.buffer,s*n,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 r=e*up.eSize,n=new ArrayBuffer(r),s=Float32Array.BYTES_PER_ELEMENT,o=0,a=new Float32Array(n,o*s,3*e);o+=3*e;let l=new Float32Array(n,o*s,3*e);o+=3*e;let c=new Float32Array(n,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=n,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 n=this.capacity;for(;t>n;)n*=2;this.realloc(n)}let r=this.size;return this.size=t,r}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)}},Wu=up;Wu.eSize=(3+3+2)*Float32Array.BYTES_PER_ELEMENT;var ov=(i,e)=>([t,r])=>(r<t&&(r+=e),(i>=t?i:i+e)<=r),Dl=class extends Ie{constructor(t,r,n=0,s=12,o=3){super();this.type="ShapeGeometry";this.vertexCache={};this._shape=t,this._depth=r,this._bevel=n,this._curveSegments=s,this._bevelSegmentsInput=o,n<=0?(this._bevelSize=0,this._bevelSegments=0):(this._bevelSize=Math.min(n,r/2-1e-12),this._bevelSegments=Math.floor(o));let a=this._shape.extractShapePointsToFlatArray([],s),l=this._shape.shapeHoles.map(T=>{let S=T.extractShapePointsToFlatArray([],s),I=[];for(let C=S.length-1;C>=1;C-=2){let M=S[C-1],_=S[C-0];I.push(M,_)}return I}),c=jo({windingRule:Kt.ODD,elementType:Mr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[a]}),u=jo({windingRule:Kt.ODD,elementType:Mr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...l]});if(!c)throw new Error("error generating geometry");let h=c.elementCount;if(u){c.elementCount+=u.elementCount;for(let T=0;T<u.elements.length;T++){let S=u.elements[T],I=T%2===0?c.vertexCount:0;c.elements.push(S+I)}for(let T=0;T<u.vertexIndices.length;T++){let S=u.vertexIndices[T],I=c.vertexCount;c.vertexIndices.push(S+I)}for(let T=0;T<u.vertices.length;T++){let S=u.vertices[T];c.vertices.push(S)}}let f=1/0,d=-1/0,m=1/0,p=-1/0;for(let T=0,S=c.vertexCount;T<S;T++){let I=T*2,C=c.vertices[I+0],M=c.vertices[I+1];C<f&&(f=C),C>d&&(d=C),M<m&&(m=M),M>p&&(p=M)}this._minX=f,this._minY=m,this._width=d-f,this._height=p-m;let g=c.vertexCount*2*(2+this._bevelSegments);this._buffer=new Wu(g);let y=[],v=[];for(let T=c.elementCount-1;T>=0;T--){let S=T>=h,I=T*2,C=c.elements[I+0],M=c.elements[I+1],_=C+M,R={start:C,count:M,normals:[],continuous:[],concave:[]},B=C,O=_-1,z=C+1,q=this._shape.roundedCurves.length;do{let V=B-C,U=c.vertices[O*2+0],J=c.vertices[O*2+1],K=c.vertices[B*2+0],$=c.vertices[B*2+1],j=c.vertices[z*2+0],ge=c.vertices[z*2+1],ae=K-U,le=$-J,W=Math.sqrt(ae*ae+le*le);ae/=W,le/=W;let ue=K-j,Y=$-ge,H=Math.sqrt(ue*ue+Y*Y);ue/=H,Y/=H,R.normals[V*2+0]=-Y,R.normals[V*2+1]=ue,R.concave[V]=ae*Y-le*ue>0;let Q=c.vertexIndices[B];if(Array.isArray(Q))R.continuous[V]=!1;else{let[ce,ie]=this._shape.getCurveIndexFromVertexId(Q-1,!0);if(ie>0&&ie<1)R.continuous[V]=!0;else{let pe=ie===1?ce+1:ce-1;pe=(pe+q)%q;let ve=ie===1?0:1,me=this._shape.roundedCurves[ce].getTangent(ie),De=this._shape.roundedCurves[pe].getTangent(ve);R.continuous[V]=me.dot(De)>.95}}S&&(R.normals[V*2+0]*=-1,R.normals[V*2+1]*=-1),[O,B,z]=[B,z,z+1],z>=_&&(z-=M)}while(z!==C+1);let F=[];F.push({bevelI:0,angle:0,size:0,boundary:{vertices:c.vertices.slice(C*2,_*2),vertexCount:M,vertexIndices:new Array(M).fill(!0).map((V,U)=>[U,U]),elements:[0,M],elementCount:1,mesh:null},reverseMap:[],insetPoints:c.vertices.slice(C*2,_*2)});for(let V=1;V<=this._bevelSegments;V++){let U=V/this._bevelSegments*Math.PI/2,J=(1-Math.cos(U))*this._bevelSize,K=[],$=[],j=[],ge=[],ae=0;for(let W=0;W<M;W++){let ue=W*2,Y=(W-1+M)%M*2,H=c.vertices[R.start*2+ue+0],Q=c.vertices[R.start*2+ue+1],ce=-R.normals[Y+0]*J,ie=-R.normals[Y+1]*J,pe=-R.normals[ue+0]*J,ve=-R.normals[ue+1]*J;if(R.concave[W]||!R.concave[W]&&S){let me=Math.atan2(ie,ce),De=Math.atan2(ve,pe);De>me&&(De-=Math.PI*2);let ke=De-me;if(R.continuous[W]||S){let P=me+ke/2,L=Math.cos(P)*J,te=Math.sin(P)*J;K[2*ae+0]=H+L*(S?-1:1),K[2*ae+1]=Q+te*(S?-1:1),ge[ae]=W,ae++}else{let P=Math.max(1,Math.floor(s/4*Math.abs(ke)/Math.PI));for(let L=0;L<=P;L++){let te=me+ke*(L/P),ye=Math.cos(te)*J,Se=Math.sin(te)*J;K[2*ae+0]=H+ye,K[2*ae+1]=Q+Se,ge[ae]=W,ae++}}}else K[2*ae+0]=H+ce,K[2*ae+1]=Q+ie,ge[ae]=W,$[W]=ae,ae++,K[2*ae+0]=H,K[2*ae+1]=Q,ge[ae]=W,ae++,K[2*ae+0]=H+pe,K[2*ae+1]=Q+ve,ge[ae]=W,j[W]=ae,ae++}let le=jo({windingRule:Kt.POSITIVE,elementType:Mr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[K],edgeCreateCallback:W=>{let Y=W.Org.idx,H=ge[Y],Q=ge[(Y+1)%ge.length];W.idx=[H,Q],W.Sym.idx=[Q,H]},vertexIdCallback:W=>{let ue=W.Lprev.idx;return[ue?ue[1]:0,W.idx[0]]}});if(!le)throw console.log("Error"),new Error(`error generating bevel geometry for ${V}'th loop`);if(!le.vertexCount)break;for(let W=0;W<le.vertexIndices.length;W++){let[ue,Y]=le.vertexIndices[W];if(ue===Y)continue;let H=Y;Y<ue&&(H+=M);for(let Q=ue;Q<H;Q++){let ce=Q%M,ie=(Q+1)%M;if(!R.continuous[ce]||!R.continuous[ie]){le.vertexIndices[W]=[ue,ce],le.vertexIndices.splice(W+1,0,[ie,Y]),le.vertices.splice((W+1)*2,0,le.vertices[W*2],le.vertices[W*2+1]);break}}}F.push({bevelI:V,angle:U,size:J,boundary:le,reverseMap:ge,insetPoints:K})}let ee=(V,U,J)=>{let K=0,$=V.boundary.vertexIndices.length;for(;K<$&&J(V.boundary.vertexIndices[U]);)U=(U+1)%$,K++;return K},k=y.length;for(let V=1;V<F.length;V++){let U=F[V-1],J=F[V],K=U.boundary.vertexIndices.length,$=J.boundary.vertexIndices.length;if(!K||!$)break;let j=R.concave.length,ge=0,ae=ov(ge,M);for(;!U.boundary.vertexIndices.filter(ae).length||!J.boundary.vertexIndices.filter(ae).length;)ge++,ae=ov(ge,M);let le=U.boundary.vertexIndices.findIndex(ae),W=J.boundary.vertexIndices.findIndex(ae);do le=(le+1)%K;while(ae(U.boundary.vertexIndices[le]));do W=(W+1)%$;while(ae(J.boundary.vertexIndices[W]));ge=(ge+1)%M;let ue=ge,Y=this.buildBevelVert(R,U,(le-1+K)%K),H=this.buildBevelVert(R,J,(W-1+$)%$),Q=Y,ce=H,ie,pe,ve=!1;do{ae=ov(ge,M);let me=ee(U,le,ae),De=ee(J,W,ae),ke=ve;if(ve=!1,me&&!De){for(let P=0;P<me;P++)ie=this.buildBevelVert(R,U,(le+P)%K,P/(me-1)),y.push(Q.topN,ie.topP,ce.topN),y.push(ie.bottomP,Q.bottomN,ce.bottomN),Q=ie;ve=!0}else if(!me&&De)for(let P=0;P<De;P++)pe=this.buildBevelVert(R,J,(W+P)%$,P/(De-1)),y.push(ce.topN,Q.topP,pe.topP),y.push(Q.bottomP,ce.bottomN,pe.bottomP),ce=pe;else if(me&&De)if(ie=this.buildBevelVert(R,U,le,0),pe=this.buildBevelVert(R,J,W,0),ke?(y.push(Q.topN,pe.topP,ce.topN),y.push(Q.topN,ie.topP,pe.topP),y.push(pe.bottomP,Q.bottomN,ce.bottomN),y.push(ie.bottomP,Q.bottomN,pe.bottomP)):(y.push(Q.topN,ie.topP,ce.topN),y.push(ce.topN,ie.topP,pe.topP),y.push(ie.bottomP,Q.bottomN,ce.bottomN),y.push(ie.bottomP,ce.bottomN,pe.bottomP)),Q=ie,ce=pe,me===De)for(let P=1;P<me;P++)ie=this.buildBevelVert(R,U,(le+P)%K,P/(me-1)),pe=this.buildBevelVert(R,J,(W+P)%$,P/(De-1)),y.push(Q.topN,ie.topP,ce.topN),y.push(ce.topN,ie.topP,pe.topP),y.push(ie.bottomP,Q.bottomN,ce.bottomN),y.push(ie.bottomP,ce.bottomN,pe.bottomP),Q=ie,ce=pe;else if(me>De){let P=me/De,L=0;for(let te=1;te<me;te++)ie=this.buildBevelVert(R,U,(le+te)%K,te/(me-1)),y.push(Q.topN,ie.topP,ce.topN),y.push(ie.bottomP,Q.bottomN,ce.bottomN),Q=ie,te>(L+1)*P&&(L++,pe=this.buildBevelVert(R,J,(W+L)%$,L/(De-1)),y.push(ce.topN,ie.topP,pe.topP),y.push(ie.bottomP,ce.bottomN,pe.bottomP),ce=pe)}else{let P=De/me,L=0;for(let te=1;te<De;te++)pe=this.buildBevelVert(R,J,(W+te)%$,te/(De-1)),y.push(ce.topN,ie.topP,pe.topP),y.push(ie.bottomP,ce.bottomN,pe.bottomP),ce=pe,te>(L+1)*P&&(L++,ie=this.buildBevelVert(R,U,(le+L)%K,L/(me-1)),y.push(Q.topN,ie.topP,ce.topN),y.push(ie.bottomP,Q.bottomN,ce.bottomN),Q=ie)}le=(le+me)%K,W=(W+De)%$,ge=(ge+1)%j}while(ge!==ue)}{let V=F[0];for(let U=0,J=V.boundary.vertexCount;U<J;U++){let K=this.buildBevelVert(R,V,U),$=this.buildBevelVert(R,V,(U+1)%J);y.push($.topP,K.topN,K.bottomN),y.push($.topP,K.bottomN,$.bottomP)}}if(S){let V=[];for(let U=y.length-1;U>=k+2;U-=3){let J=y[U-2],K=y[U-1],$=y[U-0];V.push($,K,J)}y.splice(k,y.length-k,...V)}if(S){let V=[];for(let U=F[F.length-1].boundary.vertices.length-1;U>=1;U-=2){let J=F[F.length-1].boundary.vertices[U-1],K=F[F.length-1].boundary.vertices[U-0];V.push(J,K)}v.push(V)}if(!S){let V=F[F.length-1],U=jo({windingRule:F.length>1?Kt.POSITIVE:Kt.ODD,elementType:Mr.POLYGONS,vertexSize:2,strict:!0,contours:[V.insetPoints,...v]});if(!U)throw new Error("Error generating geometry for surface");for(let J=0;J<U.elementCount*3;J+=3){let K=this.buildSurfaceVert(U,U.elements[J+0]),$=this.buildSurfaceVert(U,U.elements[J+1]),j=this.buildSurfaceVert(U,U.elements[J+2]);y.push(K.top,$.top,j.top),y.push(j.bottom,$.bottom,K.bottom)}}this.vertexCache={}}this._buffer.shrink();let b=new Ue(Uint32Array.from(y),1),w=new Ue(this._buffer.positions,3),x=new Ue(this._buffer.normals,3),E=new Ue(this._buffer.uvs,2);w.needsUpdate=!0,x.needsUpdate=!0,E.needsUpdate=!0,b.needsUpdate=!0,this.setAttribute("position",w),this.setAttribute("normal",x),this.setAttribute("uv",E),this.setIndex(b)}buildSurfaceVert(t,r){let n=r.toString();if(n in this.vertexCache)return this.vertexCache[n];let s=t.vertices[r*2+0],o=t.vertices[r*2+1],a=(s-this._minX)/this._width,l=(o-this._minY)/this._height,c=this._buffer.get(2),u=c*3,h=c*2,f={top:c+0,bottom:c+1};return this._buffer.positions[u+0]=s,this._buffer.positions[u+1]=o,this._buffer.positions[u+2]=this._depth,this._buffer.normals[u+0]=0,this._buffer.normals[u+1]=0,this._buffer.normals[u+2]=1,this._buffer.uvs[h+0]=a,this._buffer.uvs[h+1]=l,this._buffer.positions[u+3]=s,this._buffer.positions[u+4]=o,this._buffer.positions[u+5]=0,this._buffer.normals[u+3]=0,this._buffer.normals[u+4]=0,this._buffer.normals[u+5]=-1,this._buffer.uvs[h+2]=a,this._buffer.uvs[h+3]=l,this.vertexCache[n]=f,f}buildBevelVert(t,r,n,s=1){let o=`${r.bevelI}:${n}`;if(o in this.vertexCache)return this.vertexCache[o];let[a,l]=r.boundary.vertexIndices[n],c,u,h,f;a!==l?(u=a,c=l,f=!1,h=t.continuous[u]&&t.continuous[c]):(c=a,u=(c-1+t.count)%t.count,f=t.concave[c]&&r.bevelI>0,h=t.continuous[c]||f);let d=Math.cos(r.angle),m=Math.sin(r.angle),p=n*2,g=c*2,y=u*2,v=r.boundary.vertices[p+0],b=r.boundary.vertices[p+1],w=(1-m)*this._bevelSize,x=(v-this._minX)/this._width,E=(b-this._minY)/this._height,T=t.normals[g+0],S=t.normals[g+1],I=t.normals[y+0],C=t.normals[y+1];if(f){let O=I-T,z=C-S;T=T+O*(1-s),S=S+z*(1-s);let q=Math.sqrt(T*T+S*S);T/=q,S/=q}let M=this._buffer.get(h?2:4),_=M*3,R=M*2,B={i:n,fi:c,topP:M+0,topN:M+0,bottomP:M+1,bottomN:M+1};return this._buffer.positions[_+0]=v,this._buffer.positions[_+1]=b,this._buffer.positions[_+2]=this._depth-w,this._buffer.normals[_+0]=T*d,this._buffer.normals[_+1]=S*d,this._buffer.normals[_+2]=m,this._buffer.uvs[R+0]=x,this._buffer.uvs[R+1]=E,this._buffer.positions[_+3]=v,this._buffer.positions[_+4]=b,this._buffer.positions[_+5]=w,this._buffer.normals[_+3]=T*d,this._buffer.normals[_+4]=S*d,this._buffer.normals[_+5]=-m,this._buffer.uvs[R+2]=E,this._buffer.uvs[R+3]=x,h||(M+=2,_+=6,R+=4,B.topP=M+0,B.bottomP=M+1,this._buffer.positions[_+0]=v,this._buffer.positions[_+1]=b,this._buffer.positions[_+2]=this._depth-w,this._buffer.normals[_+0]=I*d,this._buffer.normals[_+1]=C*d,this._buffer.normals[_+2]=m,this._buffer.uvs[R+0]=x,this._buffer.uvs[R+1]=E,this._buffer.positions[_+3]=v,this._buffer.positions[_+4]=b,this._buffer.positions[_+5]=w,this._buffer.normals[_+3]=I*d,this._buffer.normals[_+4]=C*d,this._buffer.normals[_+5]=-m,this._buffer.uvs[R+2]=E,this._buffer.uvs[R+3]=x),this.vertexCache[o]=B,B}clone(){let t=new Dl(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return t.userData=Su(this.userData),t}};var Gr=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var c,u,h,f,d,m,p;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},i.parameters),r=Math.abs(t.width),n=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=(f=i.shape)!=null?f:e==null?void 0:e.shape,a=(d=o==null?void 0:o.roundness)!=null?d:t.roundness;o!==void 0&&(o instanceof At?(o.width!==r||o.height!==n)&&o.applySize(r,n):o=new At(r,n).fromJSON(o),((m=i.parameters)==null?void 0:m.roundness)!==void 0&&((p=i.parameters)==null?void 0:p.roundness)>0&&o.update(!1));let l=o!=null?o:new At(r,n);return{parameters:Object.assign(t,{width:r,height:n,depth:s,extrudeDepth:s,roundness:a}),shape:l}}static build(i){let{extrudeDepth:e,extrudeBevelSize:t,extrudeBevelSegments:r,subdivisions:n,roundness:s,surfaceMaxCount:o}=i.parameters;i.shape.roundness=s;let a;return e<=0?a=new so(i.shape,n,o):a=new Dl(i.shape,e,t,n,r),Object.assign(a,{userData:be(se({},i),{type:"VectorGeometry"})})}};var KM=Math.PI*2,ZM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1e3},i.parameters);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,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(i){let{width:e,height:t,spikes:r,angle:n,innerRadius:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,surfaceMaxCount:c}=i.parameters,u=i.shape,h=e*.5,f=t*.5,d=PO(u,h,f,n*Math.PI/180,r,s);u.isClosed=!0,u.update();let m=Gr.create({shape:u,parameters:{subdivisions:d,surfaceMaxCount:c,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(m,{userData:be(se({},i),{type:"EllipseGeometry"})})}};function PO(i,e,t,r,n,s){if(r>=KM)return n>30||n%4===0?(RO(i,e,t,s),Math.round(n/4)):QM(i,r,n,e,t,s);let o={x:0,y:t},a=r+Math.PI*.5,l={x:Math.cos(a)*e,y:Math.sin(a)*t},c=jM({px:o.x,py:o.y,cx:l.x,cy:l.y,rx:e,ry:t,largeArcFlag:r>Math.PI,sweepFlag:!0});return n>30||n%c.length===0?IO(i,o.x,o.y,c,n,e,t,s):QM(i,r,n,e,t,s)}function IO(i,e,t,r,n,s,o,a){let l=Math.round(n/r.length);i.addPoint(Pl(e,t));for(let c=0,u=r.length;c<u;c++){let h=r[c],f=i.points[c],d=Pl(h.x,h.y);f.controls[1].position.set(h.x1,h.y1),d.controls[0].position.set(h.x2,h.y2),i.addPoint(d)}return a>0?$M(i,s,o,a):i.addPoint(Pl(0,0)),l}function QM(i,e,t,r,n,s){let o=-e/t;for(let a=0;a<=t;a++){let l=o*a,c=Math.sin(l)*r,u=Math.cos(l)*n;i.addPoint(Pl(c,u))}return e<KM?s>0?$M(i,r,n,s):i.addPoint(Pl(0,0)):(i.removePoint(i.points[i.points.length-1]),s>0&&e1(i,r,n,s)),1}function RO(i,e,t,r=0,n=0,s=0){let o=.5522847498,a=e*o,l=t*o;i.addPoint(hp(n-e,s,n-e,s-l,n-e,s+l)),i.addPoint(hp(n,s+t,n-a,s+t,n+a,s+t)),i.addPoint(hp(n+e,s,n+e,s+l,n+e,s-l)),i.addPoint(hp(n,s-t,n+a,s-t,n-a,s-t)),r>0&&e1(i,e,t,r)}function Pl(i,e){return new ui(et.generateUUID(),new N(i,e))}function hp(i,e,t,r,n,s){let o=Pl(i,e);return o.controls[0].position.set(t,r),o.controls[1].position.set(n,s),o}function $M(i,e,t,r){t1(i,e,t,r).forEach(s=>i.addPoint(s))}function e1(i,e,t,r){let n=t1(i,e,t,r),s=new At;n.forEach(o=>s.addPoint(o)),s.isClosed=!0,i.shapeHoles.push(s)}function t1(i,e,t,r){let n=r*e/100,s=n*(Math.abs(t)/Math.abs(e)),o=new N(n/e,s/t),a=i.points.map(l=>{let c=l.clone();return c.uuid=et.generateUUID(),c}).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 r1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,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},i.parameters),r=Math.abs(t.width),n=Math.abs((l=t.height)!=null?l:r),s=Math.abs((c=t.depth)!=null?c:r),o=Math.abs(Math.min(r,s))/2;return{parameters:Object.assign(t,{width:r,height:n,depth:s,radius:o,segments:Math.round(t.segments),pathSegments:Math.round(t.pathSegments),cornerSegments:Math.round(t.cornerSegments)})}}static build(i){let{width:e,height:t,depth:r,radius:n,revolutions:s,segments:o,pathRadius:a,pathType:l,pathSegments:c,cornerRadius:u,cornerSegments:h}=i.parameters,f=new ju(!1,e,t,r,n,s,o,a,l,c,u,h);return Object.assign(f,{userData:be(se({},i),{type:"HelixGeometry"})})}},ju=class extends Ie{constructor(e=!0,t=1,r=1,n=1,s=1,o=1,a=1,l=1,c=1,u=1,h=1,f=1){super();let d=e&&o===1;d&&(f=0),h>100&&(h=100);let m=()=>new A,p=new A,g=m(),y=m(),v=m(),b,w,x,E,T,S,I,C,M=m(),_=m(),R=m(),B=m(),O=m(),z=m(),q=m(),F=m(),ee=r-2*l+.001,k=ee/o,V=Math.ceil(a*o),U=V+1,J=ee/V,K=-ee/2,$=u+1,j=2*Math.PI/u,ge=Math.PI/2/f,ae=.01,le=Math.min((1-h/100)*l,l-ae),W=l-le,ue=0,Y=2,H=f*Y+Y,Q=$*H/Y,ce=Q+$*U,ie=$*(U+H),[pe,ve,me]=[3,3,2].map(Ae=>Array(ie*Ae).fill(0)),De=[],ke=s-l;function P(Ae,G){let Me=Math.PI/2;S=G*J,C=2*Math.PI*(S%k)/k+Me,S+=K,I=Math.sin(C)*ke,T=Math.cos(C)*ke,e?Ae.set(T,I,S):Ae.set(T,S,I)}P(p,-1e-10),P(g,0),M.copy(p),P(p,1);let L=p.distanceTo(g),te=W+le,ye=L*V+2*te,Se=le,Pe=ye-te;for(let Ae=0;Ae<=V;Ae++){P(y,Ae),F.subVectors(y,M).normalize(),M.copy(y),z.copy(y).setComponent(+e+1,0).normalize(),q.crossVectors(F,z).normalize();let G=Ae===0,Me=Ae===V,Ce=G?3*Math.PI/2:ge,Ke=G?Se:Pe,Oe=G?$:ce,Ze=G?0:ie-$,_e=F.clone().multiplyScalar(G?-W:W).add(y),nt=F.clone().multiplyScalar(G?-1:1).normalize();for(let pt=0;pt<$;pt++){let ht=pt*j;if(_.addVectors(p.copy(z).multiplyScalar(l*Math.cos(ht)),g.copy(q).multiplyScalar(l*Math.sin(ht))),R.copy(_).normalize(),G||Me){d||(ue=Ze+pt,[0,1,2].forEach(Ot=>{pe[ue*3+Ot]=_e.getComponent(Ot),ve[ue*3+Ot]=nt.getComponent(Ot)}),me[ue*2]=+Me,me[ue*2+1]=pt/u),g.copy(R).multiplyScalar(le),v.addVectors(y,g);for(let Ot=0;Ot<f;Ot++){let Nr=Ot*ge+Ce;B.addVectors(p.copy(F).multiplyScalar(W*Math.sin(Nr)),g.copy(R).multiplyScalar(W*Math.cos(Nr))),O.copy(B).normalize(),g.addVectors(v,B),B.normalize(),ue=Oe+Ot*$+pt,[0,1,2].forEach(We=>{pe[ue*3+We]=g.getComponent(We),ve[ue*3+We]=O.getComponent(We)});let ta=+G+Math.sin(Nr);me[ue*2]=(Ke+W*ta)/ye,me[ue*2+1]=pt/u}}g.addVectors(y,_),ue=Q+Ae*$+pt,[0,1,2].forEach(Ot=>{pe[ue*3+Ot]=g.getComponent(Ot),ve[ue*3+Ot]=R.getComponent(Ot)}),me[ue*2]=(te+Ae*L)/ye,me[ue*2+1]=pt/u}}let Fe=U+2*f+Y,he=1,[rt,st]=d?[he,he+U-1]:[0,Fe-1];for(let Ae=rt;Ae<=st-1;Ae++){let G=d&&Ae===st-1;for(let Me=0;Me<$-1;Me++)b=Ae*$+Me,w=b+1,x=(G?Me:b)+$,E=(G?Me+1:w)+$,Ae===0?De.push(w,E,x):Ae===Fe-2?De.push(b,w,x):De.push(b,w,x,w,E,x)}this.setIndex(De),this.setAttribute("position",new Le(pe,3)),this.setAttribute("normal",new Le(ve,3)),this.setAttribute("uv",new Le(me,2))}};var n1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:n,corner:s,cornerSides:o}=i.parameters,a=n===0&&s!==0?new qu(e*.5,s,o):new Ga(e*.5,n);return a.scale(1,t/e,r/e),Object.assign(a,{userData:be(se({},i),{type:"IcosahedronGeometry"})})}},qu=class extends no{constructor(e=1,t=.2,r=4){let n=(1+Math.sqrt(5))/2,s=[-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],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,r),this.type=a}static fromJSON(e){return new qu(e.radius,e.corner,e.cornerSides)}};var i1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s,o,a;((n=(r=i.parameters)==null?void 0:r.points)!=null?n:[]).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}]},i.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(i){let{points:e,segments:t,verticalSegments:r}=i.parameters,n=new tn;n.moveTo(e[0].x,e[0].y),n.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let s=new Oa(n.extractPoints(r).shape,t);return s.rotateZ(Math.PI),Object.assign(s,{userData:be(se({},i),{type:"LatheGeometry"})})}};var Bi=new Ee,av=new ot,fp=new A,oo=class extends jt{constructor(){super(),this.uuid=et.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 Nt().getNormalMatrix(e);for(let r=0,n=this.vertices.length;r<n;r++)this.vertices[r].applyMatrix4(e);for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r];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 Bi.makeRotationX(e),this.applyMatrix4(Bi),this}rotateY(e){return Bi.makeRotationY(e),this.applyMatrix4(Bi),this}rotateZ(e){return Bi.makeRotationZ(e),this.applyMatrix4(Bi),this}translate(e,t,r){return Bi.makeTranslation(e,t,r),this.applyMatrix4(Bi),this}scale(e,t,r){return Bi.makeScale(e,t,r),this.applyMatrix4(Bi),this}lookAt(e){return av.lookAt(e),av.updateMatrix(),this.applyMatrix4(av.matrix),this}fromBufferGeometry(e){let t=this,r=e.index!==null?e.index:void 0,n=e.attributes;if(n.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;let s=n.position,o=n.normal,a=n.color,l=n.uv,c=n.uv2;c!==void 0&&(this.faceVertexUvs[1]=[]);for(let f=0;f<s.count;f++)t.vertices.push(new A().fromBufferAttribute(s,f)),a!==void 0&&t.colors.push(new xe().fromBufferAttribute(a,f));function u(f,d,m,p){let g=a===void 0?[]:[t.colors[f].clone(),t.colors[d].clone(),t.colors[m].clone()],y=o===void 0?[]:[new A().fromBufferAttribute(o,f),new A().fromBufferAttribute(o,d),new A().fromBufferAttribute(o,m)],v=new Il(f,d,m,y,g,p);t.faces.push(v),l!==void 0&&t.faceVertexUvs[0].push([new N().fromBufferAttribute(l,f),new N().fromBufferAttribute(l,d),new N().fromBufferAttribute(l,m)]),c!==void 0&&t.faceVertexUvs[1].push([new N().fromBufferAttribute(c,f),new N().fromBufferAttribute(c,d),new N().fromBufferAttribute(c,m)])}let h=e.groups;if(h.length>0)for(let f=0;f<h.length;f++){let d=h[f],m=d.start,p=d.count;for(let g=m,y=m+p;g<y;g+=3)r!==void 0?u(r.getX(g),r.getX(g+1),r.getX(g+2),d.materialIndex):u(g,g+1,g+2,d.materialIndex)}else if(r!==void 0)for(let f=0;f<r.count;f+=3)u(r.getX(f),r.getX(f+1),r.getX(f+2));else for(let f=0;f<s.count;f+=3)u(f,f+1,f+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(fp).negate(),this.translate(fp.x,fp.y,fp.z),this}normalize(){this.computeBoundingSphere();let e=this.boundingSphere.center,t=this.boundingSphere.radius,r=t===0?1:1/t,n=new Ee;return n.set(r,0,0,-r*e.x,0,r,0,-r*e.y,0,0,r,-r*e.z,0,0,0,1),this.applyMatrix4(n),this}computeFaceNormals(){let e=new A,t=new A;for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r],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 r=0,n=this.vertices.length;r<n;r++)t[r]=new A;if(e){let r=new A,n=new A;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];r.subVectors(u,c),n.subVectors(l,c),r.cross(n),t[a.a].add(r),t[a.b].add(r),t[a.c].add(r)}}else{this.computeFaceNormals();for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r];t[s.a].add(s.normal),t[s.b].add(s.normal),t[s.c].add(s.normal)}}for(let r=0,n=this.vertices.length;r<n;r++)t[r].normalize();for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r],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 r=this.faces[e],n=r.vertexNormals;n.length===3?(n[0].copy(r.normal),n[1].copy(r.normal),n[2].copy(r.normal)):(n[0]=r.normal.clone(),n[1]=r.normal.clone(),n[2]=r.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let t=0,r=this.faces.length;t<r;t++){let n=this.faces[t];n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]);for(let s=0,o=n.vertexNormals.length;s<o;s++)n.__originalVertexNormals[s]?n.__originalVertexNormals[s].copy(n.vertexNormals[s]):n.__originalVertexNormals[s]=n.vertexNormals[s].clone()}let e=new oo;e.faces=this.faces;for(let t=0,r=this.morphTargets.length;t<r;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 A,u={a:new A,b:new A,c:new A};s.push(c),o.push(u)}}let n=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=n.faceNormals[s],c=n.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,r=this.faces.length;t<r;t++){let n=this.faces[t];n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals}}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qt),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Yr),this.boundingSphere.setFromPoints(this.vertices)}merge(e,t,r=0){if(!(e&&e.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);return}let n,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&&(n=new Nt().getNormalMatrix(t));for(let f=0,d=a.length;f<d;f++){let p=a[f].clone();t!==void 0&&p.applyMatrix4(t),o.push(p)}for(let f=0,d=h.length;f<d;f++)u.push(h[f].clone());for(let f=0,d=c.length;f<d;f++){let m=c[f],p,g,y=m.vertexNormals,v=m.vertexColors,b=new Il(m.a+s,m.b+s,m.c+s);b.normal.copy(m.normal),n!==void 0&&b.normal.applyMatrix3(n).normalize();for(let w=0,x=y.length;w<x;w++)p=y[w].clone(),n!==void 0&&p.applyMatrix3(n).normalize(),b.vertexNormals.push(p);b.color.copy(m.color);for(let w=0,x=v.length;w<x;w++)g=v[w],b.vertexColors.push(g.clone());b.materialIndex=m.materialIndex+r,l.push(b)}for(let f=0,d=e.faceVertexUvs.length;f<d;f++){let m=e.faceVertexUvs[f];this.faceVertexUvs[f]===void 0&&(this.faceVertexUvs[f]=[]);for(let p=0,g=m.length;p<g;p++){let y=m[p],v=[];for(let b=0,w=y.length;b<w;b++)v.push(y[b].clone());this.faceVertexUvs[f].push(v)}}}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={},r=[],n=[],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,r.push(this.vertices[l]),n[l]=r.length-1):n[l]=n[t[h]]}let o=[];for(let l=0,c=this.faces.length;l<c;l++){let u=this.faces[l];u.a=n[u.a],u.b=n[u.b],u.c=n[u.c];let h=[u.a,u.b,u.c];for(let f=0;f<3;f++)if(h[f]===h[(f+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-r.length;return this.vertices=r,a}setFromPoints(e){this.vertices=[];for(let t=0,r=e.length;t<r;t++){let n=e[t];this.vertices.push(new A(n.x,n.y,n.z||0))}return this}sortFacesByMaterialIndex(){let e=this.faces,t=e.length;for(let l=0;l<t;l++)e[l]._id=l;function r(l,c){return l.materialIndex-c.materialIndex}e.sort(r);let n=this.faceVertexUvs[0],s=this.faceVertexUvs[1],o,a;n&&n.length===t&&(o=[]),s&&s.length===t&&(a=[]);for(let l=0;l<t;l++){let c=e[l]._id;o&&o.push(n[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 m=this.parameters;for(let p in m)m[p]!==void 0&&(e[p]=m[p]);return e}let t=[];for(let m=0;m<this.vertices.length;m++){let p=this.vertices[m];t.push(p.x,p.y,p.z)}let r=[],n=[],s={},o=[],a={},l=[],c={};for(let m=0;m<this.faces.length;m++){let p=this.faces[m],g=!0,y=!1,v=this.faceVertexUvs[0][m]!==void 0,b=p.normal.length()>0,w=p.vertexNormals.length>0,x=p.color.r!==1||p.color.g!==1||p.color.b!==1,E=p.vertexColors.length>0,T=0;if(T=u(T,0,0),T=u(T,1,g),T=u(T,2,y),T=u(T,3,v),T=u(T,4,b),T=u(T,5,w),T=u(T,6,x),T=u(T,7,E),r.push(T),r.push(p.a,p.b,p.c),r.push(p.materialIndex),v){let S=this.faceVertexUvs[0][m];r.push(d(S[0]),d(S[1]),d(S[2]))}if(b&&r.push(h(p.normal)),w){let S=p.vertexNormals;r.push(h(S[0]),h(S[1]),h(S[2]))}if(x&&r.push(f(p.color)),E){let S=p.vertexColors;r.push(f(S[0]),f(S[1]),f(S[2]))}}function u(m,p,g){return g?m|1<<p:m&~(1<<p)}function h(m){let p=m.x.toString()+m.y.toString()+m.z.toString();return s[p]!==void 0||(s[p]=n.length/3,n.push(m.x,m.y,m.z)),s[p]}function f(m){let p=m.r.toString()+m.g.toString()+m.b.toString();return a[p]!==void 0||(a[p]=o.length,o.push(m.getHex())),a[p]}function d(m){let p=m.x.toString()+m.y.toString();return c[p]!==void 0||(c[p]=l.length/2,l.push(m.x,m.y)),c[p]}return e.data={},e.data.vertices=t,e.data.normals=n,o.length>0&&(e.data.colors=o),l.length>0&&(e.data.uvs=[l]),e.data.faces=r,e}clone(){return new oo().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 f=0,d=t.length;f<d;f++)this.vertices.push(t[f].clone());let r=e.colors;for(let f=0,d=r.length;f<d;f++)this.colors.push(r[f].clone());let n=e.faces;for(let f=0,d=n.length;f<d;f++)this.faces.push(n[f].clone());for(let f=0,d=e.faceVertexUvs.length;f<d;f++){let m=e.faceVertexUvs[f];this.faceVertexUvs[f]===void 0&&(this.faceVertexUvs[f]=[]);for(let p=0,g=m.length;p<g;p++){let y=m[p],v=[];for(let b=0,w=y.length;b<w;b++){let x=y[b];v.push(x.clone())}this.faceVertexUvs[f].push(v)}}let s=e.morphTargets;for(let f=0,d=s.length;f<d;f++){let m={};if(m.name=s[f].name,s[f].vertices!==void 0){m.vertices=[];for(let p=0,g=s[f].vertices.length;p<g;p++)m.vertices.push(s[f].vertices[p].clone())}if(s[f].normals!==void 0){m.normals=[];for(let p=0,g=s[f].normals.length;p<g;p++)m.normals.push(s[f].normals[p].clone())}this.morphTargets.push(m)}let o=e.morphNormals;for(let f=0,d=o.length;f<d;f++){let m={};if(o[f].vertexNormals!==void 0){m.vertexNormals=[];for(let p=0,g=o[f].vertexNormals.length;p<g;p++){let y=o[f].vertexNormals[p],v={};v.a=y.a.clone(),v.b=y.b.clone(),v.c=y.c.clone(),m.vertexNormals.push(v)}}if(o[f].faceNormals!==void 0){m.faceNormals=[];for(let p=0,g=o[f].faceNormals.length;p<g;p++)m.faceNormals.push(o[f].faceNormals[p].clone())}this.morphNormals.push(m)}let a=e.skinWeights;for(let f=0,d=a.length;f<d;f++)this.skinWeights.push(a[f].clone());let l=e.skinIndices;for(let f=0,d=l.length;f<d;f++)this.skinIndices.push(l[f].clone());let c=e.lineDistances;for(let f=0,d=c.length;f<d;f++)this.lineDistances.push(c[f]);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 lv().fromGeometry(this),t=new Ie,r=new Float32Array(e.vertices.length*3);if(t.setAttribute("position",new Ue(r,3).copyVector3sArray(e.vertices)),e.normals.length>0){let n=new Float32Array(e.normals.length*3);t.setAttribute("normal",new Ue(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){let n=new Float32Array(e.colors.length*3);t.setAttribute("color",new Ue(n,3).copyColorsArray(e.colors))}if(e.uvs.length>0){let n=new Float32Array(e.uvs.length*2);t.setAttribute("uv",new Ue(n,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){let n=new Float32Array(e.uvs2.length*2);t.setAttribute("uv2",new Ue(n,2).copyVector2sArray(e.uvs2))}t.groups=e.groups;for(let n in e.morphTargets){let s=[],o=e.morphTargets[n];for(let a=0,l=o.length;a<l;a++){let c=o[a],u=new Le(c.data.length*3,3);u.name=c.name,s.push(u.copyVector3sArray(c.data))}t.morphAttributes[n]=s}if(e.skinIndices.length>0){let n=new Le(e.skinIndices.length*4,4);t.setAttribute("skinIndex",n.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){let n=new Le(e.skinWeights.length*4,4);t.setAttribute("skinWeight",n.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 Ie,r=e.geometry;if(e.isPoints||e.isLine){let n=new Le(r.vertices.length*3,3),s=new Le(r.colors.length*3,3);if(t.setAttribute("position",n.copyVector3sArray(r.vertices)),t.setAttribute("color",s.copyColorsArray(r.colors)),r.lineDistances&&r.lineDistances.length===r.vertices.length){let o=new Le(r.lineDistances.length,1);t.setAttribute("lineDistance",o.copyArray(r.lineDistances))}r.boundingSphere!==null&&(t.boundingSphere=r.boundingSphere.clone()),r.boundingBox!==null&&(t.boundingBox=r.boundingBox.clone())}else e.isMesh&&(t=r.toBufferGeometry());return t}};oo.prototype.isGeometry=!0;var lv=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=[],r,n,s,o=e.faces;for(n=0;n<o.length;n++){let a=o[n];a.materialIndex!==s&&(s=a.materialIndex,r!==void 0&&(r.count=n*3-r.start,t.push(r)),r={start:n*3,materialIndex:s})}r!==void 0&&(r.count=n*3-r.start,t.push(r)),this.groups=t}fromGeometry(e){let t=e.faces,r=e.vertices,n=e.faceVertexUvs,s=n[0]&&n[0].length>0,o=n[1]&&n[1].length>0,a=e.morphTargets,l=a.length,c;if(l>0){c=[];for(let y=0;y<l;y++)c[y]={name:a[y].name,data:[]};this.morphTargets.position=c}let u=e.morphNormals,h=u.length,f;if(h>0){f=[];for(let y=0;y<h;y++)f[y]={name:u[y].name,data:[]};this.morphTargets.normal=f}let d=e.skinIndices,m=e.skinWeights,p=d.length===r.length,g=m.length===r.length;r.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let y=0;y<t.length;y++){let v=t[y];this.vertices.push(r[v.a],r[v.b],r[v.c]);let b=v.vertexNormals;if(b.length===3)this.normals.push(b[0],b[1],b[2]);else{let x=v.normal;this.normals.push(x,x,x)}let w=v.vertexColors;if(w.length===3)this.colors.push(w[0],w[1],w[2]);else{let x=v.color;this.colors.push(x,x,x)}if(s===!0){let x=n[0][y];x!==void 0?this.uvs.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",y),this.uvs.push(new N,new N,new N))}if(o===!0){let x=n[1][y];x!==void 0?this.uvs2.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",y),this.uvs2.push(new N,new N,new N))}for(let x=0;x<l;x++){let E=a[x].vertices;c[x].data.push(E[v.a],E[v.b],E[v.c])}for(let x=0;x<h;x++){let E=u[x].vertexNormals[y];f[x].data.push(E.a,E.b,E.c)}p&&this.skinIndices.push(d[v.a],d[v.b],d[v.c]),g&&this.skinWeights.push(m[v.a],m[v.b],m[v.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}},Il=class{constructor(e,t,r,n,s,o=0){this.a=e,this.b=t,this.c=r,this.normal=n&&n.isVector3?n:new A,this.vertexNormals=Array.isArray(n)?n:[],this.color=s&&s.isColor?s:new xe,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,r=e.vertexNormals.length;t<r;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,r=e.vertexColors.length;t<r;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}};var BO=["a","b","c"];function NO(i,e){switch(e){case"c":return i.c;case"b":return i.b;case"a":default:return i.a}}function cv(i,e,t){let r=Math.min(i,e),n=Math.max(i,e),s=r+"_"+n;return t.get(s)}function uv(i,e,t,r,n,s){let o=Math.min(i,e),a=Math.max(i,e),l=o+"_"+a,c;if(r.has(l))c=r.get(l);else{let u=t[o],h=t[a];c={a:u,b:h,newEdge:null,faces:[]},r.set(l,c)}c.faces.push(n),s[i].edges.push(c),s[e].edges.push(c)}function OO(i,e,t,r){let n,s,o;for(n=0,s=i.length;n<s;n++)t[n]={edges:[]};for(n=0,s=e.length;n<s;n++)o=e[n],uv(o.a,o.b,i,r,o,t),uv(o.b,o.c,i,r,o,t),uv(o.c,o.a,i,r,o,t)}function dp(i,e,t,r,n){i.push(new Il(e,t,r,void 0,void 0,n))}function Rl(i,e){return Math.abs(e-i)/2+Math.min(i,e)}function pp(i,e,t,r){i.push([e.clone(),t.clone(),r.clone()])}var mp=class{constructor(e=1){this.subdivisions=e}modify(e){e instanceof Ie?e=new oo().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 A,r,n,s,o,a,l=e.vertices,c=e.faces,u=e.faceVertexUvs[0],h=u!==void 0&&u.length>0,f=[],d=new Map;OO(l,c,f,d);let m=[],p,g,y,v,b,w,x;for(let ae of Array.from(d.keys())){for(g=d.get(ae),y=new A,b=3/8,w=1/8,x=g.faces.length,x!=2&&(b=.5,w=0,x!=1),y.addVectors(g.a,g.b).multiplyScalar(b),t.set(0,0,0),o=0;o<x;o++){for(v=g.faces[o],a=0;a<3&&(p=l[NO(v,BO[a])],!(p!==g.a&&p!==g.b));a++);p&&t.add(p)}t.multiplyScalar(w),y.add(t),g.newEdge=m.length,m.push(y)}let E,T,S,I,C,M,_,R=[];for(n=0,s=l.length;n<s;n++){for(M=l[n],C=f[n].edges,r=C.length,r==3?E=3/16:r>3&&(E=3/(8*r)),T=1-r*Number(E),S=E,r<=2&&(r==2?(T=3/4,S=1/8):r==1||r==0),_=M.clone().multiplyScalar(T),t.set(0,0,0),o=0;o<r;o++)I=C[o],p=I.a!==M?I.a:I.b,t.add(p);t.multiplyScalar(Number(S)),_.add(t),R.push(_)}let B=R.concat(m),O=R.length,z,q,F,ee=[],k=[],V,U,J,K,$=new N,j=new N,ge=new N;for(n=0,s=c.length;n<s;n++)v=c[n],z=Number(cv(v.a,v.b,d).newEdge)+O,q=Number(cv(v.b,v.c,d).newEdge)+O,F=Number(cv(v.c,v.a,d).newEdge)+O,dp(ee,z,q,F,v.materialIndex),dp(ee,v.a,z,F,v.materialIndex),dp(ee,v.b,q,z,v.materialIndex),dp(ee,v.c,F,q,v.materialIndex),h&&(V=u[n],U=V[0],J=V[1],K=V[2],$.set(Rl(U.x,J.x),Rl(U.y,J.y)),j.set(Rl(J.x,K.x),Rl(J.y,K.y)),ge.set(Rl(U.x,K.x),Rl(U.y,K.y)),pp(k,$,j,ge),pp(k,U,$,ge),pp(k,J,j,$),pp(k,K,ge,j));e.vertices=B,e.faces=ee,h&&(e.faceVertexUvs[0]=k)}};var Ar=new A,s1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var s,o;let t=(o=(s=i.geometry)!=null?s:e==null?void 0:e.geometry)!=null?o:new Ie().copy(new mn(100,100,100)),r;e===void 0?(t.computeBoundingBox(),t.boundingBox.getSize(Ar),r={width:Ar.x,height:Ar.y,depth:Ar.z,subdivisions:0}):r=e.parameters;let n=se(se({},r),i.parameters);return{parameters:{width:Math.abs(n.width),height:Math.abs(n.height),depth:Math.abs(n.depth),subdivisions:Math.abs(n.subdivisions)},geometry:t}}static build(i){var l;let{width:e,height:t,depth:r,subdivisions:n}=i.parameters,s=(l=i.geometry)!=null?l:new Ie().copy(new mn(100,100,100)),o=s.userData.parameters;o===void 0?(s.computeBoundingBox(),s.boundingBox.getSize(Ar)):Ar.set(o.width,o.height,o.depth),(e!==Ar.x||t!==Ar.y||r!==Ar.z)&&s.scale(Ar.x===0?1:e/Ar.x,Ar.y===0?1:t/Ar.y,Ar.z===0?1:r/Ar.z);let a=s.originalGeometry;return n>0?(a===void 0||(o==null?void 0:o.subdivisions)!==n)&&(a===void 0&&(a=s),s=new mp(n).modify(a).toBufferGeometry()):(a!==void 0&&(s=a),a=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()),a!==void 0&&Object.assign(s,{originalGeometry:a}),delete i.geometry,Object.assign(s,{userData:be(se({},i),{type:"NonParametricGeometry"})})}static loadFromUrl(i,e,t){new Gs(t).load(i,n=>{let s=this.normalizeInputs({geometry:n});n.boundingBox.getSize(Ar);let o=100/Ar.x;Object.assign(s.parameters,{width:100,height:Ar.y*o,depth:Ar.z*o}),e(this.build(s))})}};var o1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o,a;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,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(i){let{width:e,height:t,spikes:r,cornerRadius:n,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a,surfaceMaxCount:l}=i.parameters,c=i.shape,u=e*.5,h=t*.5,f=0,d=0,m=2*Math.PI/r;for(let g=0;g<r;g++){let y=m*g,v=f+Math.sin(y)*u,b=d+Math.cos(y)*h;c.addPoint(c.createPoint(v,b))}c.isClosed=!0;for(let g=0,y=c.points.length;g<y;g++)c.points[g].roundness=n;c.roundness=n,c.update();let p=Gr.create({shape:c,parameters:{surfaceMaxCount:l,roundness:n,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}});return Object.assign(p,{userData:be(se({},i),{type:"PolygonGeometry"})})}};var a1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,radialSegments:n,heightSegments:s,openEnded:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=new fv(e*.5,t,n,s,o,a,l);return c.scale(1,1,r/e),Object.assign(c,{userData:be(se({},i),{type:"PyramidGeometry"})})}};function Xu(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function hv(i,e,t,r,n,s){let o=e.clone().sub(i),a=t.clone().sub(i),l=o.angleTo(a);if(o.normalize(),a.normalize(),r===n){let c=o.add(a).normalize();s.copy(i).addScaledVector(c,r/Math.sin(l/2))}else{let c=o.angleTo(a);s.copy(i),s.addScaledVector(o,n/Math.sin(c)),s.addScaledVector(a,r/Math.sin(c))}}function FO(i,e,t){let r=i.clone().sub(e),n=t.clone().sub(e);return r.projectOnVector(n),r.add(e)}var fv=class extends Ie{constructor(e=.5,t=1,r=4,n=1,s=!1,o=0,a=4){super(),r=Math.floor(Math.max(3,r)),n=Math.floor(n),a=Math.floor(a);let l=[],c=[],u=[],h=[],f=0,d=t/2,m=Math.PI/r,p=e*Math.cos(Math.PI/r),g=2*Math.PI/r,y=(r-2)*Math.PI/r,v=Math.PI-y,b=new A(0,-d,0),w=new A(0,d,0),x=new N(e,-d),E=new N(p,-d),T=new N(0,w.y).sub(E),S=new N(0,w.y).sub(x),I=new N(T.y,-T.x).normalize(),C=new N(S.y,-S.x).normalize(),_=e*Math.cos(Math.PI/r)*Math.tan((Math.PI-T.angle())/2)-1e-8;o=Math.min(o,_);let R;{let k=new A(I.x,I.y,0),V=new A(Math.cos(g)*k.x,k.y,Math.sin(g)*k.x);R=k.angleTo(V)}let B=o/Math.tan((Math.PI-T.angle())/2),O=o/Math.tan((Math.PI-R)/2),z=new A;if(!s){c.push(b.x,b.y,b.z),u.push(0,-1,0),h.push(0,0);let k=f++,V=[],U=x.clone(),J=B/Math.cos(Math.PI/r);U.x-=J;for(let K=0;K<r;K++){let $=K/r*Math.PI*2+m,j=new N(Math.sin($),Math.cos($));Xu(U,j,z),c.push(z.x,z.y,z.z),u.push(0,-1,0),h.push(0,0),V.push(f++)}for(let K=0;K<V.length;K++)l.push(V[K],k,V[(K+1)%V.length])}let q=[];{let k=new A,V=new A,U=new A,J=new A,K=new A,$=new A;for(let j=0;j<r;j++){let ge=j/r*Math.PI*2+m,ae=(j+.5)/r*Math.PI*2+m,le=(j+1)/r*Math.PI*2+m,W=new N(Math.sin(ge),Math.cos(ge)),ue=new N(Math.sin(ae),Math.cos(ae)),Y=new N(Math.sin(le),Math.cos(le));Xu(x,W,V),Xu(x,Y,U),Xu(I,ue,k),hv(w,V,U,O,O,J),c.push(J.x,J.y,J.z),hv(V,w,U,O,B,K),c.push(K.x,K.y,K.z),hv(U,V,w,B,O,$),c.push($.x,$.y,$.z),u.push(k.x,k.y,k.z),u.push(k.x,k.y,k.z),u.push(k.x,k.y,k.z),h.push(0,0),h.push(0,0),h.push(0,0);let H=f++,Q=f++,ce=f++;if(l.push(H,Q,ce),o>0){{let ve=V.clone().add(U).multiplyScalar(.5),me=w.clone().sub(ve).normalize(),ke=b.clone().sub(ve).normalize().add(me).normalize().multiplyScalar(-1),P=$.clone().sub(K);F(ve,P,ke,T.angle())}let ie,pe;{let ve=new A;Xu(C,Y,ve);let me=$.clone().add(J).multiplyScalar(.5);me=FO(me,U,w);let De=$.clone().sub(J);[ie,pe]=F(me,De,ve,R,J.y)}{let ve=ie,me=ve.clone().setY(0).normalize(),De=new A(0,-1,0),ke=me.clone().cross(De);ee(ve,me,De,ke)}q.concat(pe);{let ve=T.angle(),me=Math.PI-ve,De=w.clone();De.y-=o/Math.sin(ve-Math.PI/2);let ke=new A,P=[];for(let te=0;te<a;te++){let ye=[],Se=Math.PI/2-me*te/a,Pe=Math.cos(Se),Fe=Math.sin(Se),he=ae;for(let rt=0;rt<=te;rt++){let st=Math.cos(he),Ae=Math.sin(he);k.x=Pe*Ae,k.y=Fe,k.z=Pe*st,ke.copy(De).addScaledVector(k,o),c.push(ke.x,ke.y,ke.z),u.push(k.x,k.y,k.z),h.push(0,0),ye.push(f++),he+=Math.PI*2/te/r}P.push(ye)}pe.reverse(),P.push(pe);let L=P.length-1;for(let te=0;te<L;te++){let ye=P[te],Se=P[te+1],Pe=ye.length-1;l.push(Se[1],ye[0],Se[0]);for(let Fe=1;Fe<=Pe;Fe++)l.push(ye[Fe],ye[Fe-1],Se[Fe]),l.push(Se[Fe+1],ye[Fe],Se[Fe])}}}}}this.setIndex(l),this.setAttribute("position",new Le(c,3)),this.setAttribute("normal",new Le(u,3)),this.setAttribute("uv",new Le(h,2));function F(k,V,U,J,K){let $=-J/2,j=(Math.PI-J)/2,ge=V.clone().normalize().cross(U);k.addScaledVector(U,-o/Math.sin(j));let ae=new A,le=new A,W=1,ue=f,Y=[];for(let H=0;H<=a;H++){let Q=$+H/a*J;le.set(0,0,0),le.addScaledVector(ge,Math.sin(Q)),le.addScaledVector(U,Math.cos(Q));for(let ce=0;ce<=W;ce++){let ie=ce/W-.5;if(ae.copy(k),ae.addScaledVector(V,ie),ae.addScaledVector(le,o),K!=null){let pe=Math.max(0,ae.y-K);ae.addScaledVector(V,-pe/V.y)}c.push(ae.x,ae.y,ae.z),u.push(le.x,le.y,le.z),h.push(0,0),ce===0&&Y.push(f),f++}}for(let H=0;H<a;H++)for(let Q=0;Q<W;Q++){let ce=ue+Q+(W+1)*H,ie=ce+(W+1),pe=ie+1,ve=ce+1;l.push(ce,ie,ve),l.push(ie,pe,ve)}return[k.clone().addScaledVector(V,.5),Y]}function ee(k,V,U,J){let K=Math.PI/2,$=S.angle()-K,j=[],ge=new A,ae=new A;for(let W=0;W<=a;W++){let ue=[],Y=W/a;for(let H=0;H<=W;H++){let ce=((W?H/W:0)-.5)*v,ie=Math.cos(ce),pe=Math.sin(ce),ve=Math.atan(Math.tan($)*ie),me=(K+ve)*Y,De=Math.cos(me),ke=Math.sin(me);ge.set(0,0,0),ge.addScaledVector(V,ke*ie),ge.addScaledVector(U,De),ge.addScaledVector(J,ke*pe),ae.copy(k).addScaledVector(ge,o),c.push(ae.x,ae.y,ae.z),u.push(ge.x,ge.y,ge.z),h.push(0,0),ue.push(f++)}j.push(ue)}let le=j.length-1;for(let W=0;W<le;W++){let ue=j[W],Y=j[W+1],H=ue.length-1;l.push(ue[0],Y[1],Y[0]);for(let Q=1;Q<=H;Q++)l.push(ue[Q-1],ue[Q],Y[Q]),l.push(ue[Q],Y[Q+1],Y[Q])}}}};var gp=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,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},i.parameters),r=Object.assign((a=e==null?void 0:e.ui)!=null?a:{enabledIndieCorners:!1},i.ui),n=t.cornerRadius.reduce((h,f)=>h+f,0);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,parameters:Object.assign(t,{surfaceMaxCount:((l=t.surfaceMaxCount)!=null?l:n>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:r}}static build(i){let e=i.shape,{width:t,height:r,cornerRadius:n,cornerType:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,surfaceMaxCount:c}=i.parameters,u={x:t*.5,y:r*.5},h={x:-u.x,y:-u.y},f={x:u.x,y:u.y};function d(x,E,T){return E>t&&T>r?Math.min(x*t/E,x*r/T):E>t?x*t/E:T>r?x*r/T:x}let m=[];m[0]=n[0]===0?0:d(n[0],n[0]+n[3],n[0]+n[1]),m[1]=n[1]===0?0:d(n[1],n[1]+n[2],n[1]+n[0]),m[2]=n[2]===0?0:d(n[2],n[2]+n[1],n[2]+n[3]),m[3]=n[3]===0?0:d(n[3],n[3]+n[0],n[3]+n[2]);let p=h.x,g=f.x,y=f.y,v=h.y;e.addPoint(e.createPoint(p,y)),e.addPoint(e.createPoint(g,y)),e.addPoint(e.createPoint(g,v)),e.addPoint(e.createPoint(p,v)),e.isClosed=!0;let b=!0;for(let x=0,E=e.points.length;x<E;x++)e.points[x].roundness=m[x],x>0&&m[x]!==m[x-1]&&(b=!1);b&&(e.roundness=m[0]),e.useCubicForRoundedCorners=s!==1,e.update();let w=Gr.create({shape:e,parameters:{surfaceMaxCount:c,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(w,{userData:be(se({},i),{type:"RectangleGeometry"})})}};var l1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:Math.PI},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e=100,height:t=e,depth:r=e,widthSegments:n=64,heightSegments:s=64,phiStart:o,phiLength:a,thetaStart:l,thetaLength:c}=i.parameters,u=new Po(.5*e,n,s,o,a,l,c);return u.scale(1,t/e,r/e),Object.assign(u,{userData:be(se({},i),{type:"SphereGeometry"})})}};var c1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0,widthSegments:8,heightSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:0})}}static build(i){let{width:e=100,height:t=e,widthSegments:r=8,heightSegments:n=8}=i.parameters,s=new ts(e,t,r,n);return s.scale(1,1,1),Object.assign(s,{userData:be(se({},i),{type:"PlaneGeometry"})})}};var u1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o,a;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,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(i){let{width:e,height:t,innerRadiusPercent:r,spikes:n,cornerRadius:s,angle:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c,surfaceMaxCount:u}=i.parameters,h=i.shape,f=e*.5,d=t*.5,m=0,p=0,g=o*Math.PI/360/n,y=Math.PI/2*3*-1,v=f*r/100,b=d*r/100;if(n==3&&r==50){g=2*Math.PI/n;for(let x=0;x<n;x++){let E=g*x,T=m+Math.sin(E)*f,S=p+Math.cos(E)*d;h.addPoint(h.createPoint(T,S))}}else for(let x=0;x<n;x++){let E=m+Math.cos(y)*f,T=p+Math.sin(y)*d;h.addPoint(h.createPoint(E,T)),y+=g,E=m+Math.cos(y)*v,T=p+Math.sin(y)*b,x<=n,h.addPoint(h.createPoint(E,T)),y+=g}h.isClosed=!0;for(let x=0,E=h.points.length;x<E;x++)h.points[x].roundness=s;h.roundness=s,h.update();let w=Gr.create({shape:h,parameters:{surfaceMaxCount:u,roundness:s,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c}});return Object.assign(w,{userData:be(se({},i),{type:"StarGeometry"})})}};var yp=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:0)})}}static build(i){let{width:e,height:t}=i.parameters,r=new ts(e,t);return Object.assign(r,{userData:be(se({},i),{type:"TextFrameGeometry"})})}};var h1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,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},i.parameters),r=Math.abs(t.width),n=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:r,height:n,depth:s})}}static build(i){let{width:e,height:t,depth:r,radialSegments:n,tubularSegments:s,arc:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=UO(e,t,r,e*.5,o,s,0,0,n,a,l);return c.scale(1,t/e,1),Object.assign(c,{userData:be(se({},i),{type:"TorusGeometry"})})}};function UO(i,e,t,r,n,s,o,a,l,c,u){return[e,t]=[t,e],o=e/2,n/=2*Math.PI,n==1&&(c=0),new ju(!0,i,e,t,r,n,s,o,a,l,c,u)}var f1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s,o;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width),tube:(o=t.tube)!=null?o:t.width*.125})}}static build(i){let{width:e,tube:t,tubularSegments:r,radialSegments:n,p:s,q:o}=i.parameters,a=e*.5;a!==t&&(a-=t);let l=new ka(a,t,r,n,s,o);return Object.assign(l,{userData:be(se({},i),{type:"TorusKnotGeometry"})})}};var d1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o,a;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},i.parameters);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,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(i){let{width:e=100,height:t,cornerRadius:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:o,isRect:a,surfaceMaxCount:l}=i.parameters,c=i.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 d=0,m=c.points.length;d<m;d++)c.points[d].roundness=r;c.roundness=r,c.update();let f=Gr.create({shape:c,parameters:{surfaceMaxCount:l,roundness:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:o}});return Object.assign(f,{userData:be(se({},i),{type:"TriangleGeometry"})})}};var Yu={};dT(Yu,{addBarycentricAttribute:()=>kO,fixUvs:()=>HO,loadFromUrl:()=>VO,resizeGeometry:()=>GO,roundShapePolygon:()=>zO});var p1=function(i,e){let t=e.x-i.x,r=e.y-i.y,n=Math.sqrt(t*t+r*r),s=t/n,o=r/n,a=Math.atan2(o,s);return{x:t,y:r,len:n,nx:s,ny:o,ang:a}},zO=(i,e,t)=>{let r,n,s,o,a,l,c,u,h,f,d,m,p,g,y=e.length;for(o=e[y-2],i.curves=[],r=1;r<y-1;r++){a=e[r%y],l=e[(r+1)%y];let v=p1(a,o),b=p1(a,l);c=v.nx*b.ny-v.ny*b.nx,u=v.nx*b.nx-v.ny*-b.ny,d=Math.asin(c),h=1,f=!1,u<0?d<0?d=Math.PI+d:(d=Math.PI-d,h=-1,f=!0):d>0&&(h=-1,f=!0),m=d/2,g=Math.abs(Math.cos(m)*t/Math.sin(m)),g>Math.min(v.len/2,b.len/2)?(g=Math.min(v.len/2,b.len/2),p=Math.abs(g*Math.sin(m)/Math.cos(m))):p=t,n=a.x+b.nx*g,s=a.y+b.ny*g,n+=-b.ny*p*h,s+=b.nx*p*h,i.absarc(n,s,p,v.ang+Math.PI/2*h,b.ang-Math.PI/2*h,f),o=a,a=l}i.closePath()},GO=(i,{width:e,height:t,depth:r})=>{e=Math.abs(e),t=Math.abs(t),r=Math.abs(r);let n=i.userData.parameters,s,o,a;e===0?(e=n.width,s=1):s=e/n.width,t===0?(t=n.height,o=1):o=t/n.height,r===0?(r=n.depth,a=1):a=r/n.depth,i.scale(s,o,a),n.width=e,n.height=t,n.depth=r},kO=(i,e)=>{let t=[new A(1,0,0),new A(0,1,0),new A(0,0,1)],r=i.attributes.position,n=new Float32Array(r.count*3);for(let s=0,o=r.count;s<o;s++)t[s%3].toArray(n,s*3);i.setAttribute(e,new Le(n,3))},VO=i=>new Promise(e=>{new Gs().load(i,r=>e(r))}),HO=(i,e,t)=>{let r=i.getAttribute("uv");if(r)for(let n=0;n<r.count;n++){let s=r.getX(n),o=r.getY(n);r.setXY(n,(s+e/2)/e,1-(o-t/2)/t*-1)}};var WO,vp=new Promise(i=>{WO=i});var Xe;vp.then(i=>{Xe=i});var m1=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),g1=new Uint32Array([0,1,2,3]),y1=new Uint8Array([4]),Pn=class{static build(i,e,t,r,n){let s,o,a;if(i===void 0)s=Pn.allocate(n,t),Xe.set_destination_refinement_level(s,0),o=Pn.buildLevel(s,!0,r);else if(i.positionWASM!==void 0){e&&e!==0&&(Xe.free_bvh(e),Xe.free_subdivision_surface(e));try{s=Pn.allocate(n,void 0,i)}catch(l){console.error(l,i),s=Pn.allocate(n,void 0,{positionWASM:m1,indexWASM:g1,verticesPerFaceWASM:y1})}Xe.set_destination_refinement_level(s,0),o=Pn.buildLevel(s,!0,r)}else s=e;if(i!==void 0&&i.subdivisions!==void 0){let l=jO(i.subdivisions,i.positionWASM.length);Xe.set_destination_refinement_level(s,l),l>0?a=Pn.buildLevel(s,!1,r):a=null}return{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}}static allocate(i,e,t){var x;let r,n,s,o=[],a=[];if(t)t.positionWASM&&t.positionWASM.length>0?(r=t.positionWASM,n=t.indexWASM,s=t.verticesPerFaceWASM):(r=m1,n=g1,s=y1);else{e.deleteAttribute("normal"),e.deleteAttribute("uv");let E=SM(e);r=E.attributes.position.array;let T=E.getIndex().array,S=T.length;switch(e.userData.type==="TorusGeometry"&&(e==null?void 0:e.userData.parameters.arc)===Math.PI*2&&(e.userData.type="ClosedTorusGeometry"),e.userData.type){case"ClosedTorusGeometry":case"PlaneGeometry":case"TorusKnotGeometry":case"CubeGeometry":n=new Uint32Array(S/3*2),s=new Uint8Array(S/6).fill(4);for(let O=0,z=0;O<S;O+=6)n[z++]=T[O],n[z++]=T[O+1],n[z++]=T[O+4],n[z++]=T[O+5];break;case"TorusGeometry":case"SphereGeometry":case"HelixGeometry":case"CylinderGeometry":case"ConeGeometry":let I,C,M;if(e.userData.type==="SphereGeometry")C=e.parameters.heightSegments,I=e.parameters.widthSegments,e.parameters.thetaLength!==Math.PI&&(M=!0);else if(e.userData.type==="CylinderGeometry")C=e.parameters.heightSegments+2,I=e.parameters.radialSegments;else if(e.userData.type==="ConeGeometry")C=e.parameters.heightSegments+1,I=e.parameters.radialSegments;else if(e.userData.type==="TorusGeometry"){let O=e.userData.parameters;C=Math.ceil(O.tubularSegments*O.arc/(2*Math.PI))+2,I=O.radialSegments}else{let{pathSegments:O,segments:z,revolutions:q}=e.userData.parameters;C=Math.ceil(z*q)+2,I=O}M?(n=new Uint32Array(1*I*3+(C-1)*I*4),s=new Uint8Array(1*I+(C-1)*I)):(n=new Uint32Array(2*I*3+(C-2)*I*4),s=new Uint8Array(2*I+(C-2)*I));let _=0,R=0,B=0;if(e.userData.type==="SphereGeometry"||e.userData.type==="HelixGeometry"||e.userData.type==="TorusGeometry"){for(;R<3*I;)n[R++]=T[_++],n[R++]=T[_++],n[R++]=T[_++],s[B++]=3;let O=M?n.length:3*I+4*(C-2)*I;for(;R<O;_+=6)n[R++]=T[_],n[R++]=T[_+1],n[R++]=T[_+4],n[R++]=T[_+5],s[B++]=4}else for(;R<4*(C-2)*I;_+=6)n[R++]=T[_],n[R++]=T[_+1],n[R++]=T[_+4],n[R++]=T[_+5],s[B++]=4;for(;R<n.length;)n[R++]=T[_++],n[R++]=T[_++],n[R++]=T[_++],s[B++]=3;break;default:n=T,s=new Uint8Array(S/3).fill(3);break}}let l=r.length,c=n.length,u=s.length,h=r.length+o.length+a.length,f=n.length+s.length,d=h*Float32Array.BYTES_PER_ELEMENT+f*Uint32Array.BYTES_PER_ELEMENT,m=h*Float32Array.BYTES_PER_ELEMENT,p=f*Uint32Array.BYTES_PER_ELEMENT,g=Xe._malloc(d),y=new Float32Array(Xe.HEAPF32.buffer,g,h),v=new Uint32Array(Xe.HEAPU32.buffer,g+m,f);y.set(r,0),y.set(o,r.length),y.set(a,r.length+o.length),v.set(n,0),v.set(s,n.length);let b;(x=t==null?void 0:t.scaleBaked)!=null&&x.some(E=>E!==1)&&(b=new Ee().makeScale(...t.scaleBaked)),i&&(b?b.premultiply(i):b=i);let w=b?Xe.alloc_subdivision_surface2(g,l,g+m,c,g+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u,b.elements):Xe.alloc_subdivision_surface(g,l,g+m,c,g+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u);return Xe._free(g),w}static buildLevel(i,e,t,r,n){let s=n?Xe.get_mesh_data2(i,e?Xe.Level.CONTROL:Xe.Level.REFINED,t!=null?t:!e,n.elements):Xe.get_mesh_data(i,e?Xe.Level.CONTROL:Xe.Level.REFINED,t!=null?t:!e),o=8,a=Xe.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(4,4+4),c=0,u=Xe.HEAPU32[a[c]>>2],h=Xe.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let f=Xe.HEAPU32[a[c]>>2],d=Xe.HEAPF32.subarray(f>>2,(f>>2)+l[c]);c++;let m=Xe.HEAPU32[a[c]>>2],p=Xe.HEAPU32.subarray(m>>2,(m>>2)+l[c]);c++;let g=Xe.HEAPU32[a[c]>>2],y=Xe.HEAPU32.subarray(g>>2,(g>>2)+l[c]);if(c++,r===void 0){let v=new Ie;if(v.setIndex(new Is(y,1)),v.setAttribute("position",new Le(h,3)),v.setAttribute("normal",new Le(d,3)),e){v.setAttribute("faceMap",new Is(p,1));let b=new Float32Array(d.length/3*4).fill(0);v.setAttribute("color",new Ue(b,4))}return Xe.free_mesh_data(s),v.userData.type="SubdivGeometry",v}r.getAttribute("position").copyArray(h),r.getAttribute("normal").copyArray(d),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,Xe.free_mesh_data(s)}static buildControlCageWireframe(i,e,t){let r=Xe.get_wireframe_data_for_base_level(i),n=4,s=Xe.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(2,2+2),a=0,l=Xe.HEAPU32[s[a]>>2],c=Xe.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;let u=Xe.HEAPU32[s[a]>>2],h=Xe.HEAPU32.subarray(u>>2,(u>>2)+o[a]);if(e===void 0){let f=new Ie;f.setAttribute("position",new Le(c,3));let d=new Float32Array(c.length);for(let m=0,p=c.length;m<p;)d[m++]=t.r,d[m++]=t.g,d[m++]=t.b;return f.setAttribute("color",new Ue(d,3)),f.setIndex(new Is(h,1)),Xe.free_wireframe_data_for_base_level(r),f}e.getAttribute("position").copyArray(c),e.attributes.position.needsUpdate=!0,Xe.free_wireframe_data_for_base_level(r)}static updateCollabMesh(i,e,t){e||Xe.set_destination_refinement_level(i,1);let r=t?Xe.get_topological_data2(i,e?Xe.Level.CONTROL:Xe.Level.REFINED,t.elements):Xe.get_topological_data(i,e?Xe.Level.CONTROL:Xe.Level.REFINED),n=6,s=Xe.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(3,3+3),a=0,l=Xe.HEAPU32[s[a]>>2],c=new Float32Array(Xe.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let u=Xe.HEAPU32[s[a]>>2],h=new Uint32Array(Xe.HEAPU32.subarray(u>>2,(u>>2)+o[a]));a++;let f=Xe.HEAPU32[s[a]>>2],d=new Uint8Array(Xe.HEAPU32.subarray(f>>2,(f>>2)+o[a]));return Xe.free_topological_data(r),{positions:c,indices:h,verticesPerFace:d}}};function jO(i,e){let t=i;return t=Math.min(t,3-Math.ceil(Math.log(e/172e3)/Math.log(4))),Math.max(t,0)}var dv={ConeGeometry:PM,CubeGeometry:IM,CylinderGeometry:DM,DodecahedronGeometry:RM,EllipseGeometry:ZM,HelixGeometry:r1,IcosahedronGeometry:n1,LatheGeometry:i1,NonParametricGeometry:s1,PolygonGeometry:o1,PyramidGeometry:a1,RectangleGeometry:gp,SphereGeometry:l1,PlaneGeometry:c1,StarGeometry:u1,TextFrameGeometry:yp,TorusGeometry:h1,TorusKnotGeometry:f1,TriangleGeometry:d1,VectorGeometry:Gr},Ju=i=>dv[i.type].create(i);var kr=class extends xe{constructor(t,r,n,s){super(t,r,n);this.isColorA=!0;this.a=s}setRGBA(t,r,n,s){super.setRGB(t,r,n),this.a=s}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}};function fr(i,e){let t;if(typeof i=="string"){let r=e==null?void 0:e.getColor(i);r?t=r:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new kr(0,0,0,0))}else return"a"in i?new kr(i.r,i.g,i.b,i.a):new kr(i.r,i.g,i.b,1);return t}var qo=i=>"isEntity"in i,us=i=>"isAbstractMesh"in i,v1=i=>i.objectType==="CombinedCamera",x1=i=>qo(i)&&(i.objectType==="LightDirectional"||i.objectType==="LightSpot"||i.objectType==="LightPoint");var hs=i=>"objectHelper"in i;function pv(i,e){var r;let t=!1;e.position&&(i.position.fromArray(e.position),t=!0),e.rotation&&(i.rotation.fromArray(e.rotation),t=!0),e.scale&&(t=!0,i.scale.fromArray(e.scale)),e.hiddenMatrix!==void 0&&"hiddenMatrix"in i&&(t=!0,i.hiddenMatrix.fromArray((r=e.hiddenMatrix)!=null?r:_i.identity)),t&&i.updateMatrix(),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&i.updateWorldMatrix(!1,!0),i.objectType==="CombinedCamera"&&(e.isUpVectorFlipped!==void 0&&(i.isUpVectorFlipped=e.isUpVectorFlipped),i.updateUp())}function qO(i,e){pv(i,e),e.name!==void 0&&(i.name=e.name),e.visible!==void 0&&(i.isEntity?i.visibility=e.visible:i.visible=e.visible)}function b1(i,e,t){qO(i,e),e.color!==void 0&&(i.color=fr(e.color,t)),e.intensity!==void 0&&(i.intensity=e.intensity),e.shadows!==void 0&&!(i instanceof zs)&&(i.castShadow=e.shadows),i.shadow&&!(i instanceof zs)&&e.depth!==void 0&&(i.shadow.camera.far=e.depth,i.shadow.needsUpdate=!0),e.helper!==void 0&&hs(i)&&(i.enableHelper=e.helper,i.gizmos.shadowmap.visible=e.helper)}function w1(i,e){i.shadow.camera.right=e/2,i.shadow.camera.left=-e/2,i.shadow.camera.top=e/2,i.shadow.camera.bottom=-e/2,i.shadow.needsUpdate=!0}var Bl=new Qt,Vr=new A,Ge=new A,xr=new Ee;function XO(i,e,t=0,r=e.count){let n=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,c=-1/0;for(let u=t;u<r;u++){let h=e.getX(u),f=e.getY(u),d=e.getZ(u);h<n&&(n=h),f<s&&(s=f),d<o&&(o=d),h>a&&(a=h),f>l&&(l=f),d>c&&(c=d)}return i.min.set(n,s,o),i.max.set(a,l,c),i}var S1=(i,e,t,r)=>{var n;if(us(i)){let s=i.geometry.userData.parameters,o=i.geometry.getAttribute("position");i.geometry.userData.type==="SubdivGeometry"?Vr.copy(i.originalGeometry.boundingSphere.center):(XO(Bl,o,i.geometry.drawRange.start,i.geometry.drawRange.count<1/0?i.geometry.drawRange.count:o.count),Bl.getCenter(Vr)),i.forceComputeSize?Bl.getSize(Ge).multiplyScalar(.5):Ge.set(s.width,s.height,(n=s.depth)!=null?n:0).multiplyScalar(.5)}else if(hs(i)&&r===!0){let s=i.geometryHelper.getAttribute("position");Bl.setFromArray(s.array),Bl.getCenter(Vr),Bl.getSize(Ge).multiplyScalar(.5)}else Vr.setScalar(0),Ge.setScalar(0);xr.copy(e).multiply(i.matrixWorld),Ge.x===0&&Ge.y===0&&Ge.z===0?t.push(new A(Vr.x,Vr.y,Vr.z).applyMatrix4(xr)):t.push(new A(-Ge.x,Ge.y,Ge.z).add(Vr).applyMatrix4(xr),new A(-Ge.x,-Ge.y,Ge.z).add(Vr).applyMatrix4(xr),new A(Ge.x,-Ge.y,Ge.z).add(Vr).applyMatrix4(xr),new A(Ge.x,Ge.y,Ge.z).add(Vr).applyMatrix4(xr),new A(-Ge.x,Ge.y,-Ge.z).add(Vr).applyMatrix4(xr),new A(-Ge.x,-Ge.y,-Ge.z).add(Vr).applyMatrix4(xr),new A(Ge.x,-Ge.y,-Ge.z).add(Vr).applyMatrix4(xr),new A(Ge.x,Ge.y,-Ge.z).add(Vr).applyMatrix4(xr))},Qu=class extends Qt{constructor(){super(...arguments);this.matrix=new Ee;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(r=>r.clone()),this.faces=t.faces.map(r=>r.clone()),this.edges=t.edges.map(r=>r.clone()),this.centerEdges=t.centerEdges.map(r=>r.clone()),this}setFromObjectSize(t,r=!1){t.updateWorldMatrix(!1,r),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let n=new Ee().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,n,r)}expandByObjectSize(t,r,n=!1){let s=[];return n===!0?t.traverseEntity(o=>{o.visible&&S1(o,r,s,t.enableHelper===!0)}):S1(t,r,s,t.enableHelper===!0),this.setFromPoints(s)}getCenter(t){return t=super.getCenter(t),t.applyMatrix4(this.matrix),t}getPositionToCenter(t){return t=super.getCenter(t),t.applyMatrix4(xr.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Ge).multiplyScalar(.5),this.getCenter(Vr),xr.copy(this.matrix).setPosition(Vr),this.vertices=[new A(-Ge.x,Ge.y,Ge.z).applyMatrix4(xr),new A(-Ge.x,-Ge.y,Ge.z).applyMatrix4(xr),new A(Ge.x,-Ge.y,Ge.z).applyMatrix4(xr),new A(Ge.x,Ge.y,Ge.z).applyMatrix4(xr),new A(-Ge.x,Ge.y,-Ge.z).applyMatrix4(xr),new A(-Ge.x,-Ge.y,-Ge.z).applyMatrix4(xr),new A(Ge.x,-Ge.y,-Ge.z).applyMatrix4(xr),new A(Ge.x,Ge.y,-Ge.z).applyMatrix4(xr)]}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=[new Qr(this.vertices[0],this.vertices[3]),new Qr(this.vertices[1],this.vertices[2]),new Qr(this.vertices[5],this.vertices[6]),new Qr(this.vertices[4],this.vertices[7]),new Qr(this.vertices[0],this.vertices[1]),new Qr(this.vertices[3],this.vertices[2]),new Qr(this.vertices[7],this.vertices[6]),new Qr(this.vertices[4],this.vertices[5]),new Qr(this.vertices[0],this.vertices[4]),new Qr(this.vertices[1],this.vertices[5]),new Qr(this.vertices[2],this.vertices[6]),new Qr(this.vertices[3],this.vertices[7])],this.centerEdges=this.edges.map(t=>t.getCenter(new A))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=[new A().copy(this.vertices[0]).sub(this.vertices[2]).multiplyScalar(.5).add(this.vertices[2]),new A().copy(this.vertices[7]).sub(this.vertices[5]).multiplyScalar(.5).add(this.vertices[5]),new A().copy(this.vertices[4]).sub(this.vertices[1]).multiplyScalar(.5).add(this.vertices[1]),new A().copy(this.vertices[3]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6]),new A().copy(this.vertices[4]).sub(this.vertices[3]).multiplyScalar(.5).add(this.vertices[3]),new A().copy(this.vertices[1]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6])]}};function Ku(i){let e=[];for(let t in i){let r=i[t];delete r.metadata,e.push(r)}return e}function YO(i){let e=[];for(let t in i)e.push(i[t]);return e}var xp=i=>class extends i{hasEntityChild(){return this.children.some(t=>qo(t))}isDescendantOf(t){t instanceof ot&&(t=t.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===t)return!0;r=r.parent}return!1}attach(t,r){this.updateWorldMatrix(!0,!1);let n=new Ee().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),n.multiply(t.parent.matrixWorld)),qo(t)?t.hiddenMatrix.premultiply(n):t.applyMatrix4(n),t.updateWorldMatrix(!1,!1),this.add(t),r!==void 0&&(this.children.pop(),this.children.splice(r,0,t)),this}copy(t,r=!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)),r===!0)for(let n=0;n<t.children.length;n++){let s=t.children[n];this.add(s.clone())}return this}toJSON(t){let r=t===void 0,n={object:{uuid:"",objectType:""}};t===void 0&&(t={geometries:{},materials:{},textures:{},images:{},interactionStates:{},nodes:{}},n.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)(qo(o)||o instanceof yn)&&s.children.push(o.toJSON(t).object)}if(r){let o=Ku(t.geometries),a=Ku(t.materials),l=Ku(t.textures),c=Ku(t.images),u=Ku(t.interactionStates),h=YO(t.nodes);o.length>0&&(n.geometries=o),a.length>0&&(n.materials=a),l.length>0&&(n.textures=l),c.length>0&&(n.images=c),u.length>0&&(n.interactionStates=u),h.length>0&&(n.nodes=h)}return n.object=s,n}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 Xn=i=>"isEntity"in i;var Yn=i=>class extends xp(i){constructor(){super(...arguments);this.objectType="";this.isEntity=!0;this.raycastLock=!1;this.scaleLock=!1;this.hiddenMatrix=new Ee;this._singleBBox=new Qu;this._recursiveBBox=new Qu;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this.forceComputeSize=!1}set visibility(r){this.visible=r;for(let n of this.children)Xn(n)&&n.traverseEntity(s=>{hs(s)&&s.visible&&(s.objectHelper.visible=r)})}get visibility(){return this.visible}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}resetBBoxNeedsUpdate(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.traverseAncestors(r=>{Xn(r)&&(r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0)}),this.traverseEntity(r=>{r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0})}traverseEntity(r){r(this);for(let n of this.children)Xn(n)&&n.traverseEntity(r)}updateMatrixWorld(r){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||r)&&(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,r=!0);for(let n of this.children)n.updateMatrixWorld(r)}updateWorldMatrix(r,n){let s=this.parent;if(r&&s!==null&&s.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 o of this.children)o.updateWorldMatrix(!1,!0)}shallowClone(r){return new this.constructor().shallowCopy(this,r)}shallowCopy(r,n=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),n===!0)for(let s of r.children)Xn(s)&&this.add(s.shallowClone());return this}clone(r){return new this.constructor().copy(this,r)}copy(r,n=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),n===!0)for(let s of r.children)Xn(s)&&this.add(s.clone());return this}keepChildrenMatrixWorld(){let r=new Ee,n=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),r.copy(this.matrixWorld).invert(),r.multiply(n);for(let s of this.children)Xn(s)&&s.hiddenMatrix.premultiply(r)}toJSON(r){let n=super.toJSON(r),s=n.object;return this.raycastLock===!0&&(s.raycastLock=!0),this.scaleLock===!0&&(s.scaleLock=!0),s.hiddenMatrix=this.hiddenMatrix.toArray(),n}fromJSON(r){return super.fromJSON(r),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.scaleLock!==void 0&&(this.scaleLock=r.scaleLock),this.hiddenMatrix.fromArray(r.hiddenMatrix),this}fromObject3D(r){let n=r.children;return r.children=[],Object.assign(r,{raycastLock:!1,scaleLock:!1,hiddenMatrix:new Ee}),this.copy(r),r.children=n,this}toObjectTransformState(r=[]){this.updateWorldMatrix(!0,!1);let n={position:this.position.toArray(),rotation:[this.rotation.x,this.rotation.y,this.rotation.z],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return xl(n,r)}fromObjectTransformState(r){return r.position&&this.position.fromArray(r.position),r.rotation&&this.rotation.fromArray(r.rotation),r.scale&&this.scale.fromArray(r.scale),r.hiddenMatrix&&this.hiddenMatrix.fromArray(r.hiddenMatrix),this.updateMatrix(),this}toState(r=[]){let n=se({name:this.name,visible:this.visible,raycastLock:this.raycastLock},this.toObjectTransformState(r));return xl(n,r)}fromState(r,n){return r.name&&(this.name=r.name),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.type!=="OrthographicCamera"&&r.type!=="PerspectiveCamera"&&(this.matrixAutoUpdate=!1),r.visible!==void 0&&(this.visibility=r.visible),this.fromObjectTransformState(r),this}};var Zu=class extends ot{constructor(t,r={}){super();this.object=t;let n=t.recursiveBBox.getSize(new A),s=.1;this.parameters=Od.defaultData(n.toArray(),s),Go(this.parameters,r),this.update(),this.setHideBase(this.parameters.hideBase)}refreshMaterial(){if("material"in this.object)for(let t of this.children)t.material=this.object.material}setHideBase(t){if("material"in this.object){if(Array.isArray(this.object.material)){if(this.children.length>0){for(let r of this.object.material)r.visible=!0;if(t){let r=this.object.material.map(n=>n.clone());for(let n of this.children)n.material=r}else for(let r of this.children)r.material=this.object.material}for(let r of this.object.material)r.visible=!t}else{if(this.children.length>0)if(this.object.material.visible=!0,t){let r=this.object.material.clone();for(let n of this.children)n.material=r}else for(let r of this.children)r.material=this.object.material;this.object.material.visible=!t}this.parameters.hideBase=t}}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)}this.children.forEach(t=>t.updateMatrix())}_updateCount(){let t=this.parameters.type==="grid"?this.parameters.grid.count[0]*this.parameters.grid.count[1]*this.parameters.grid.count[2]:this.parameters.count;if(this.children.length!==t)if(this.children.length<t)for(let r=0,n=t-this.children.length;r<n;++r){let s=this.object.shallowClone(!1);s.visible=!0,this.add(s),this.parameters.hideBase&&this.setHideBase(!0)}else for(let r=0,n=this.children.length-t;r<n;++r)this.remove(this.children[0])}_updateRadial(t){let r=t.radial,n=r.start*et.DEG2RAD,s=r.end*et.DEG2RAD,o=n-s,a=new pn(r.rotation[0]*et.DEG2RAD,r.rotation[1]*et.DEG2RAD,r.rotation[2]*et.DEG2RAD),l;switch(r.axis){case"z":l=new A(0,0,1);break;case"y":l=new A(0,1,0);break;default:case"x":l=new A(1,0,0);break}for(let[c,u]of this.children.entries()){u.hiddenMatrix.identity(),u.scale.x=r.scale[0],u.scale.y=r.scale[1],u.scale.z=r.scale[2],u.position.setScalar(0);let h=o/t.count*c-n;switch(r.axis){case"x":u.rotation.set(0,h,0);break;case"y":u.rotation.set(0,0,h);break;case"z":u.rotation.set(h,0,0);break}u.translateOnAxis(l,r.radius),u.position.x+=r.position[0],u.position.y+=r.position[1],u.position.z+=r.position[2],r.alignment===!0?(u.rotation.x+=a.x,u.rotation.y+=a.y,u.rotation.z+=a.z):u.rotation.copy(a)}}_updateLinear(t){if(t.type!=="linear")throw new Error;let r=t.linear,n=new pn(r.rotation[0]*et.DEG2RAD,r.rotation[1]*et.DEG2RAD,r.rotation[2]*et.DEG2RAD);for(let[s,o]of this.children.entries())o.hiddenMatrix.identity(),o.scale.x=1+(r.scale[0]-1)*s,o.scale.y=1+(r.scale[1]-1)*s,o.scale.z=1+(r.scale[2]-1)*s,o.rotation.x=n.x*s,o.rotation.y=n.y*s,o.rotation.z=n.z*s,o.position.x=r.position[0]*s,o.position.y=r.position[1]*s,o.position.z=r.position[2]*s}_updateGrid(t){let r=0,n=t.grid;if(n.useCenter===!0){let s={x:n.count[0]%2===0?2:1,y:n.count[1]%2===0?2:1,z:n.count[2]%2===0?2:1},o=new A(n.size[0]*(n.count[0]-s.x)*.5,n.size[1]*(n.count[1]-s.y)*.5,n.size[2]*(n.count[2]-s.z)*.5);for(let a=0;a<n.count[0];a++)for(let l=0;l<n.count[1];l++)for(let c=0;c<n.count[2];c++){let u=this.children[r++];u.hiddenMatrix.identity(),u.scale.setScalar(1),u.rotation.set(0,0,0),u.position.x=n.size[0]*a-o.x,u.position.y=n.size[1]*l-o.y,u.position.z=n.size[2]*c-o.z}}else for(let s=0;s<n.count[0];s++)for(let o=0;o<n.count[1];o++)for(let a=0;a<n.count[2];a++){let l=this.children[r++];l.hiddenMatrix.identity(),l.scale.setScalar(1),l.rotation.set(0,0,0),l.position.x=n.size[0]*s,l.position.y=-n.size[1]*o,l.position.z=-n.size[2]*a}}fromJSON(t){return this}toJSON(){return{}}fromClonerState(t){return t.hideBase!==void 0&&this.setHideBase(t.hideBase),Go(this.parameters,t),this.update(),this}};var Xt=class extends Yn(Gt){constructor(t,r){super(t,r);this.isAbstractMesh=!0;Array.isArray(r)&&(this.selectedMaterial=0,t.groups.length===0&&t.addGroup(0,t.getAttribute("position").count,0))}get cloner(){return this._cloner}set cloner(t){this._cloner&&this.remove(this._cloner),t&&this.add(t),this._cloner=t}getSelectedMaterial(t){return Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=t!=null?t:0),this.material[t!=null?t:this.selectedMaterial]):this.material}setSelectedMaterial(t,r){Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=r!=null?r:0),r=r!=null?r:this.selectedMaterial,this.material[r].dispose(),this.material[r]=t):(this.material.dispose(),this.material=t)}updateGeometry(t){let r=this.geometry,n=dv[r.userData.type],s=this.objectType==="NonParametric"?Object.assign({},r.userData,{geometry:r}):r.userData,o=n.build(n.normalizeInputs(t,s)),a=r.uuid;if(this.geometry.dispose(),this.geometry=o,this.geometry.uuid=a,this.geometry.computeBoundingSphere(),this.cloner)for(let l of this.cloner.children)l.geometry=this.geometry}resizeGeometry(t,r,n){Yu.resizeGeometry(this.geometry,{width:t,height:r,depth:n})}shallowClone(t){return new this.constructor(this.geometry,this.material).shallowCopy(this,t)}clone(t){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,n=Ju(r),s=Array.isArray(this.material)?this.material.map(o=>o.clone()):this.material.clone();return new this.constructor(n,s).copy(this,t)}copy(t,r=!0){return super.copy(t,r),t.cloner&&(this.cloner=new Zu(t,t.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(t){t===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new Zu(this)),this.cloner.fromClonerState(t))}fromState(t,r){var n,s;return super.fromState(t),t.type==="Mesh"&&(this.setFromClonerState(t.cloner),this.castShadow=(n=t.castShadow)!=null?n:!0,this.receiveShadow=(s=t.receiveShadow)!=null?s:!0),this}};var $u=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 He=class{constructor(e){this.hashProperties=void 0;this.isNode=!0;this.shortcuts={};this.uuid=et.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,r){return r=r!=null?r:{},this.analyze(e,r),this.flow(e,t,r)}flow(e,t,r){r=r!=null?r:{},e.addFlow(r.slot,r.cache,r.context);let n={result:this.build(e,t),code:e.clearNodeCode(),extra:e.context.extra};return e.removeFlow(),n}build(e,t,r){t=t!=null?t:this.getType(e,t);let n=e.getNodeData(r!=null?r:this);return e.analyzing&&this.appendDepsNode(e,n,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,r)}updateFrame(e){}generateReadonly(e,t,r,n,s,o){return""}generate(e,t,r,n,s){return""}parse(e,t,r,n){}appendDepsNode(e,t,r){t.deps=(t.deps||0)+1;let n=e.getTypeLength(r);(n>(t.outputMax||0)||this.getType(e,r))&&(t.outputMax=n,t.output=r)}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,r;for(t in this)r=this[t],r instanceof He&&(e+='"'+t+'":'+r.getHash()+",");if(this.hashProperties)for(let n=0;n<this.hashProperties.length;n++)t=this.hashProperties[n],r=this[t],e+='"'+t+'":"'+String(r)+'",';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 r={};return r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),!t&&e&&(e.nodes[this.uuid]=r),r}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 mv=class{constructor(){this.nodes={};this.keywords={}}add(e){this.nodes[e.name]=e}addKeyword(e,t,r){r=r!==void 0?r:!0,this.keywords[e]={callback:t,cache:r}}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}},Tr=new mv;var Ye=class extends He{constructor(t,r){super(t);this.scope="";r=r!=null?r:{},this.shared=r.shared!==void 0?r.shared:!0,this.unique=r.unique!==void 0?r.unique:!1}build(t,r,n,s){if(r=r!=null?r:this.getType(t),this.getShared(t,r)){let o=this.getUnique(t,r);o&&this.uuid===void 0&&(this.uuid=et.generateUUID()),n=t.getUUID(n!=null?n:this.getUUID(),!o);let a=t.getNodeData(n),l=a.output||this.getType(t);if(t.analyzing)return(a.deps||0)>0||this.getLabel()?(this.appendDepsNode(t,a,r),this.generate(t,r,n)):super.build(t,r,n);if(o)return a.name=a.name||super.build(t,r,n),a.name;if(!this.getLabel()&&(!this.getShared(t,l)||t.context.ignoreCache||a.deps===1))return super.build(t,r,n);n=this.getUUID(!1);let c=this.getTemp(t,n);if(c)return t.format(c,l,r);{c=super.generate(t,r,n,a.output,s);let u=this.generate(t,l,n);return t.addNodeCode(c+" = "+u+";"),t.format(c,l,r)}}return super.build(t,r,n)}getShared(t,r){return r!=="sampler2D"&&r!=="samplerCube"&&this.shared}getUnique(t,r){return this.unique}setLabel(t){return this.label=t,this}getLabel(){return this.label}getUUID(t){let r=this.uuid;return typeof this.scope=="string"&&(r=this.scope+"-"+r),r}getTemp(t,r){r=r||this.uuid;let n=t.getVars()[r];return n?n.name:void 0}generate(t,r,n,s,o){return this.getShared(t,r)||console.error("TempNode is not shared"),n=n!=null?n:this.uuid,t.getTempVar(n,s!=null?s:this.getType(t),o,this.getLabel()).name}};var Ht=class extends Ye{constructor(t,r){r=r!=null?r:{},r.shared=r.shared!==void 0?r.shared:!1;super(t,r);this.readonly=!1}setReadonly(t){return this.readonly=t,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}createJSONNode(t){let r=super.createJSONNode(t);return this.readonly===!0&&(r.readonly=this.readonly),r}fromJSON(t,r){return super.fromJSON(t,r),t.readonly!==void 0&&this.setReadonly(t.readonly),this}generate(t,r,n,s,o,a){n=t.getUUID(n!=null?n:this.getUUID()),s=s!=null?s:this.getType(t);let l=t.getNodeData(n);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(t,r,n,s,o,a):t.isShader("vertex")?(l.vertex||(l.vertex=t.createVertexUniform(s,this,o,a,this.getLabel())),t.format(l.vertex.name,s,r)):(l.fragment||(l.fragment=t.createFragmentUniform(s,this,o,a,this.getLabel())),t.format(l.fragment.name,s,r))}copy(t){return super.copy(t),this.readonly=t.readonly,this}};var Ir=class extends Ht{constructor(t=0,r){super("v2");this.nodeType="Vector2";this.value=t instanceof N?t:new N(t,r)}get x(){return this.value.x}set x(t){this.value.x=t}get y(){return this.value.y}set y(t){this.value.y=t}generateReadonly(t,r,n,s,o,a){return t.format("vec2("+this.value.x+", "+this.value.y+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var Rr=class extends Ht{constructor(t=0,r,n){super("v3");this.nodeType="Vector3";this.value=t instanceof A?t:new A(t,r,n)}get x(){return this.value.x}set x(t){this.value.x=t}get y(){return this.value.y}set y(t){this.value.y=t}get z(){return this.value.z}set z(t){this.value.z=t}generateReadonly(t,r,n,s,o,a){return t.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var hi=class extends Ht{constructor(t){super("v4");this.nodeType="Vector4";this.value=t instanceof kr?t:new kr(t.r,t.g,t.b,t.a)}generateReadonly(t,r,n,s,o,a){return t.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var JO=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,M1=/[a-z_0-9]+/gi,Ne=class extends Ye{constructor(t,r,n,s,o){super(o);this.src="";this.nodeType="Function";this.useKeywords=!0;this.includes=[];this.extensions={};this.keywords={};this.isMethod=o===void 0,this.isInterface=!1,this.parse(t,r,n,s)}getShared(t,r){return!this.isMethod}getType(t){return t.getTypeByFormat(this.type)}getInputByName(t){if(this.inputs){let r=this.inputs.length;for(;r--;)if(this.inputs[r].name===t)return this.inputs[r]}}getIncludeByName(t){if(this.includes){let r=this.includes.length;for(;r--;)if(this.includes[r].name===t)return this.includes[r]}}generate(t,r,n,s,o){let a,l=0,c=this.src;if(this.includes)for(let h=0;h<this.includes.length;h++)t.include(this.includes[h],this);for(let h in this.extensions)t.extensions[h]=!0;let u=[];for(;a=M1.exec(this.src);)u.push(a);for(let h=0;h<u.length;h++){let f=u[h],d=f[0],m=this.isMethod?!this.getInputByName(d):!0,p=d;if(this.keywords[d]||this.useKeywords&&m&&Tr.containsKeyword(d)){let g=this.keywords[d];if(!g){let y=Tr.getKeywordData(d);y.cache&&(g=t.keywords[d]),g=g||Tr.getKeyword(d,t),y.cache&&(t.keywords[d]=g)}p=g.build(t)}d!==p&&(c=c.substring(0,f.index+l)+p+c.substring(f.index+d.length+l),l+=p.length-d.length),this.getIncludeByName(p)===void 0&&Tr.contains(p)&&t.include(Tr.get(p))}return r==="source"?c:this.isMethod?(this.isInterface||t.include(this,void 0,c),this.name):t.format("( "+c+" )",this.getType(t),r)}parse(t,r,n,s){if(this.src=t||"",this.includes=r!=null?r:[],this.extensions=n!=null?n:{},this.keywords=s!=null?s:{},this.isMethod){let o=JO.exec(this.src);if(this.inputs=[],o&&o.length==4){this.type=o[1],this.name=o[2];let a=o[3].match(M1);if(a){let l=0;for(;l<a.length;){let c=a[l++],u;c==="in"||c==="out"||c==="inout"?u=a[l++]:(u=c,c="");let h=a[l++];this.inputs.push({name:h,type:u,qualifier:c})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}copy(t){return super.copy(t),this.isMethod=t.isMethod,this.useKeywords=t.useKeywords,t.type!==void 0&&(this.type=t.type),this.parse(t.src,t.includes,t.extensions,t.keywords),this}toJSON(t){var n;let r=this.getJSONNode(t);if(!r){r=this.createJSONNode(t),r.src=this.src,r.isMethod=this.isMethod,r.useKeywords=this.useKeywords,this.isMethod||(r.type=this.type),r.extensions=JSON.parse(JSON.stringify(this.extensions));let s={};for(let o in this.keywords)s[o]=this.keywords[o].toJSON(t).uuid;if(r.keywords=s,(n=this.includes)!=null&&n.length){let o=[];for(let a=0;a<this.includes.length;a++)o.push(this.includes[a].toJSON(t).uuid);r.includes=o}r.isMethod=this.isMethod,r.inputs=this.inputs}return r.nodeType=this.nodeType,r}fromJSON(t,r){if(super.fromJSON(t,r),t.inputs!==void 0&&(this.inputs=t.inputs),t.isMethod!==void 0&&(this.isMethod=t.isMethod),t.src&&(this.src=t.src),t.isMethod&&(this.isMethod=t.isMethod),t.useKeywords&&(this.useKeywords=t.useKeywords),t.type&&(this.type=t.type),t.extensions&&(this.extensions=t.extensions),t.keywords&&r){this.keywords={};for(let n in t.keywords)this.keywords[n]=r.getNode(t.keywords[n])}return t.includes&&r&&(this.includes=t.includes.map(n=>r.getNode(n))),this}};var QO=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,gv=class extends Ye{constructor(t="",r){super();this.src="";this.useDefine=!1;this.nodeType="Const";this.parse(t||gv.PI,void 0,void 0,void 0,r)}getType(t){return t.getTypeByFormat(this.type)}parse(t,r,n,s,o){this.src=t||"";let a,l,c="",u=QO.exec(t);this.useDefine=o!=null?o:this.src.charAt(0)==="#",u&&u.length>1?(l=u[1],a=u[2],c=u[3]):(a=this.src,l="f"),this.name=a,this.type=l,this.value=c}build(t,r){if(r==="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 t.include(this),t.format(this.name,this.getType(t),r)}generate(t,r,n,s,o){return t.format(this.name,this.getType(t),r)}copy(t){return super.copy(t),this.parse(t.src,void 0,void 0,void 0,t.useDefine),this}},bt=gv;bt.PI="PI",bt.PI2="PI2",bt.RECIPROCAL_PI="RECIPROCAL_PI",bt.RECIPROCAL_PI2="RECIPROCAL_PI2",bt.LOG2="LOG2",bt.EPSILON="EPSILON";var KO=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
|
|
2995
2995
|
)*?)}`,"gim"),ZO=new RegExp("s*(w*?)s*(w*?)(=|;)","gim"),Nl=class extends Ye{constructor(t=""){super();this.inputs=[];this.src="";this.nodeType="Struct";this.parse(t)}getType(t){return t.getTypeByFormat(this.name)}getInputByName(t){let r=this.inputs.length;for(;r--;)if(this.inputs[r].name===t)return this.inputs[r]}generate(t,r,n,s,o){return r==="source"?this.src+";":t.format("( "+this.src+" )",this.getType(t),r)}parse(t=""){this.src=t,this.inputs=[];let r=KO.exec(t);if(r){let n=r[2],s;for(;s=ZO.exec(n);)this.inputs.push({type:s[1],name:s[2]});this.name=r[1]}else this.name="";this.type=this.name}};var Ol=class extends Ye{constructor(t){super("v2",{shared:!1});this.nodeType="UV";this.index=t!=null?t:0}generate(t,r){t.requires.uv[this.index]=!0;let n=this.index>0?this.index+1:"",s=t.isShader("vertex")?"uv"+n:"vUv"+n;return t.format(s,this.getType(t),r)}copy(t){return super.copy(t),this.index=t.index,this}toJSON(t){let r=this.getJSONNode(t);return r||(r=this.createJSONNode(t),r.index=this.index),r.nodeType=this.nodeType,r}fromJSON(t,r){return super.fromJSON(t,r),t.index&&(this.index=t.index),this}};Tr.addKeyword("uv",function(){return new Ol});Tr.addKeyword("uv2",function(){return new Ol(1)});var Xo=class extends Ye{constructor(t=new He,r){super("v4");this.nodeType="ColorSpace";this.factor=new He;this.input=t,this.method=r!=null?r:Xo.LINEAR_TO_LINEAR,this.hashProperties=["method"]}static getEncodingComponents(t){switch(t){case rn:return["Linear"];case je:return["sRGB"];default:return[]}}generate(t,r){var l;let n=this.input.build(t,"v4"),s=this.getType(t),o=Xo.Nodes[this.method],a=t.include(o);if(a===Xo.LINEAR_TO_LINEAR)return t.format(n,s,r);if(((l=o.inputs)==null?void 0:l.length)===2){let c=this.factor.build(t,"f");return t.format(a+"( "+n+", "+c+" )",s,r)}else return t.format(a+"( "+n+" )",s,r)}fromEncoding(t){let r=Xo.getEncodingComponents(t);this.method="LinearTo"+r[0],this.factor=r[1]}fromDecoding(t){let r=Xo.getEncodingComponents(t);this.method=r[0]+"ToLinear",this.factor=r[1]}copy(t){return super.copy(t),this.input.copy(t.input),this.method=t.method,this.factor.copy(t.factor),this}},fn=Xo;fn.Nodes={LinearToLinear:new Ne(["vec4 LinearToLinear( in vec4 value ) {"," return value;","}"].join(`
|
|
2996
2996
|
`)),sRGBToLinear:new Ne(["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(`
|
|
2997
2997
|
`)),LinearTosRGB:new Ne(["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(`
|
|
2998
|
-
`))},fn.LINEAR_TO_LINEAR="LinearToLinear",fn.SRGB_TO_LINEAR="sRGBToLinear",fn.LINEAR_TO_SRGB="LinearTosRGB";var zt=class extends Ne{constructor(t="",r,n,s,o){super(t,o,s,n,r);this.nodeType="Expression"}};var Ni=class extends _t{toJSON(e){let t=super.toJSON(e),r=e===void 0||typeof e=="string";if(this.image!==void 0&&!r){let n=this.image;if(Array.isArray(n)){e.images[n.uuid].url=[];for(let s=0;s<n.length;s++)e.images[n.uuid].url[s]=A1(n[s])}else e.images[n.uuid].url=A1(n)}return t}};function A1(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?$O(i):(console.warn("THREE.Texture: Unable to serialize Texture."),"")}var Fl;function $O(i){if(/^data:/i.test(i.src))return i.src;let e;if(i instanceof HTMLCanvasElement)e=i;else{Fl===void 0&&(Fl=document.createElement("canvas")),Fl.width=i.width,Fl.height=i.height;let r=Fl.getContext("2d");i instanceof ImageData?r.putImageData(i,0,0):r.drawImage(i,0,0,i.width,i.height),e=Fl}let t=i.src.startsWith("blob:")?i.fileName:i.src;return/\.jpe?g$/i.test(t)?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}var Hr=class extends Ht{constructor(t=new Ni,r,n,s){super("v4",{shared:!0});this.nodeType="Texture";this.value=t,this.uv=r!=null?r:new Ol,this.bias=n,this.project=s!==void 0?s:!1}getTexture(t,r){return super.generate(t,r,this.value.uuid,"t")}generate(t,r){var h;if(r==="sampler2D")return this.getTexture(t,r);let n=this.getTexture(t,r),s=this.uv.build(t,this.project?"v4":"v2"),o=this.bias?this.bias.build(t,"f"):void 0;o===void 0&&t.context.bias&&(o=t.context.bias.setTexture(this).build(t,"f"));let a,l;this.project?a="texture2DProj":a=o?"tex2DBias":"tex2D",o?l=a+"( "+n+", "+s+", "+o+" )":l=a+"( "+n+", "+s+" )";let c={include:t.isShader("vertex"),ignoreCache:!0},u=this.getType(t);return t.addContext(c),this.colorSpace=(h=this.colorSpace)!=null?h:new fn(new zt("",u)),this.colorSpace.fromDecoding(t.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(l),l=this.colorSpace.build(t,u),t.removeContext(),t.format(l,u,r)}copy(t){return super.copy(t),t.value.isRenderTargetTexture?this.value=t.value:this.value.copy(t.value),this.uv.copy(t.uv),t.bias?this.bias?this.bias.copy(t.bias):this.bias=t.bias.clone():this.bias=void 0,t.colorSpace?this.colorSpace?this.colorSpace.copy(t.colorSpace):this.colorSpace=t.colorSpace.clone():this.colorSpace=void 0,this.project=t.project,t.value.isRenderTargetTexture||(this.value.updateMatrix(),this.value.needsUpdate=!0),this}};var Be=class extends Ht{constructor(t){super("f");this.nodeType="Float";this.value=t!=null?t:0}generateReadonly(t,r,n,s,o,a){return t.format(this.value+(this.value%1?"":".0"),s,r)}copy(t){return super.copy(t),this.value=t.value,this}};var $u=class extends Ye{constructor(t,r){super();this.inputs=[];this.nodeType="FunctionCall";this.value=t,this.inputs=r!=null?r:[]}getFunction(){return this.value}getType(t){return this.value.getType(t)}generate(t,r,n,s,o){s=this.getType(t);let a=this.value,l=a.build(t,r)+"( ",c=[];if(a.inputs){for(let u=0;u<a.inputs.length;u++){let h=a.inputs[u],f=this.inputs[u]||this.inputs[h.name];c.push(f.build(t,t.getTypeByFormat(h.type)))}l+=c.join(", ")+" )"}return t.format(l,s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this.inputs=t.inputs.map(r=>r.clone()),this}toJSON(t){var n;let r=this.getJSONNode(t);if(!r){let s=this.value;if(r=this.createJSONNode(t),r.value=this.value.toJSON(t).uuid,(n=s.inputs)!=null&&n.length){r.inputs={};for(let o=0;o<s.inputs.length;o++){let a=s.inputs[o],l=this.inputs[o];r.inputs[a.name]=l.toJSON(t).uuid}}}return r}};var yv=class extends Ye{constructor(t=new He,r=new He,n=yv.ADD){super();this.nodeType="Operator";this.type=t.type,this.a=t,this.b=r,this.op=n}getType(t){let r=this.a.getType(t),n=this.b.getType(t);return t.isTypeMatrix(r)?"v4":t.getTypeLength(n)>t.getTypeLength(r)?n:r}generate(t,r){let n=this.getType(t);this.type=n;let s=this.a.build(t,n),o=this.b.build(t,n);return t.format("( "+s+" "+this.op+" "+o+" )",n,r)}copy(t){return super.copy(t),this.a.copy(t.a),this.b.copy(t.b),this.op=t.op,this}},bn=yv;bn.ADD="+",bn.SUB="-",bn.MUL="*",bn.DIV="/";var It=class extends Ye{constructor(t=new He,r=It.ABS,n,s){super();this.nodeType="Math";this.a=t,typeof r!="string"?this.b=r:s=r,typeof n!="string"?this.c=n:s=n,this.method=s,this.hashProperties=["method"]}getNumInputs(t){switch(this.method){case It.MIX:case It.CLAMP:case It.REFRACT:case It.SMOOTHSTEP:case It.FACEFORWARD:return 3;case It.MIN:case It.MAX:case It.MOD:case It.STEP:case It.REFLECT:case It.DISTANCE:case It.DOT:case It.CROSS:case It.POW:return 2;default:return 1}}getInputType(t){let r=t.getTypeLength(this.a.getType(t)),n=this.b?t.getTypeLength(this.b.getType(t)):0,s=this.c?t.getTypeLength(this.c.getType(t)):0;return r>n&&r>s?this.a.getType(t):n>s?this.b.getType(t):this.c.getType(t)}getType(t){switch(this.method){case It.LENGTH:case It.DISTANCE:case It.DOT:return"f";case It.CROSS:return"v3"}return this.getInputType(t)}generate(t,r){let n,s,o,a=this.a?t.getTypeLength(this.a.getType(t)):0,l=this.b?t.getTypeLength(this.b.getType(t)):0,c=this.c?t.getTypeLength(this.c.getType(t)):0,u=this.getInputType(t),h=this.getType(t);switch(this.type=h,this.method){case It.NEGATE:return t.format("( -"+this.a.build(t,u)+" )",u,r);case It.INVERT:return t.format("( 1.0 - "+this.a.build(t,u)+" )",u,r);case It.CROSS:n=this.a.build(t,"v3"),s=this.b.build(t,"v3");break;case It.STEP:n=this.a.build(t,a===1?"f":u),s=this.b.build(t,u);break;case It.MIN:case It.MAX:case It.MOD:n=this.a.build(t,u),s=this.b.build(t,l===1?"f":u);break;case It.REFRACT:n=this.a.build(t,u),s=this.b.build(t,u),o=this.c.build(t,"f");break;case It.MIX:n=this.a.build(t,u),s=this.b.build(t,u),o=this.c.build(t,c===1?"f":u);break;default:n=this.a.build(t,u),this.b&&(s=this.b.build(t,u)),this.c&&(o=this.c.build(t,u));break}let f=[];f.push(n),s&&f.push(s),o&&f.push(o);let d=this.getNumInputs(t);if(f.length!==d)throw Error(`Arguments not match used in "${this.method}". Require ${d}, currently ${f.length}.`);return t.format(this.method+"( "+f.join(", ")+" )",h,r)}copy(t){return super.copy(t),this.a.copy(t.a),this.b=t.b instanceof He?t.b.clone():t.b,this.c=t.c instanceof He?t.c.clone():t.c,this.method=t.method,this}},tt=It;tt.RAD="radians",tt.DEG="degrees",tt.EXP="exp",tt.EXP2="exp2",tt.LOG="log",tt.LOG2="log2",tt.SQRT="sqrt",tt.INV_SQRT="inversesqrt",tt.FLOOR="floor",tt.CEIL="ceil",tt.NORMALIZE="normalize",tt.FRACT="fract",tt.SATURATE="saturate",tt.SIN="sin",tt.COS="cos",tt.TAN="tan",tt.ASIN="asin",tt.ACOS="acos",tt.ARCTAN="atan",tt.ABS="abs",tt.SIGN="sign",tt.LENGTH="length",tt.NEGATE="negate",tt.INVERT="invert",tt.MIN="min",tt.MAX="max",tt.MOD="mod",tt.STEP="step",tt.REFLECT="reflect",tt.DISTANCE="distance",tt.DOT="dot",tt.CROSS="cross",tt.POW="pow",tt.MIX="mix",tt.CLAMP="clamp",tt.REFRACT="refract",tt.SMOOTHSTEP="smoothstep",tt.FACEFORWARD="faceforward";var Ul=class extends Ye{constructor(t=new He,r=new He,n=new He){super("v4");this.nodeType="TextureCubeUV";this.value=t,this.uv=r,this.bias=n}bilinearCubeUV(t,r,n,s){var c,u,h,f;let o=new $u(Ul.Nodes.bilinearCubeUV,[r,n,s]);this.colorSpaceTL=(c=this.colorSpaceTL)!=null?c:new fn(new zt("","v4")),this.colorSpaceTL.fromDecoding(t.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTL.input.parse(o.build(t)+".tl"),this.colorSpaceTR=(u=this.colorSpaceTR)!=null?u:new fn(new zt("","v4")),this.colorSpaceTR.fromDecoding(t.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTR.input.parse(o.build(t)+".tr"),this.colorSpaceBL=(h=this.colorSpaceBL)!=null?h:new fn(new zt("","v4")),this.colorSpaceBL.fromDecoding(t.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBL.input.parse(o.build(t)+".bl"),this.colorSpaceBR=(f=this.colorSpaceBR)!=null?f:new fn(new zt("","v4")),this.colorSpaceBR.fromDecoding(t.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBR.input.parse(o.build(t)+".br");let a={include:t.isShader("vertex"),ignoreCache:!0};t.addContext(a),this.colorSpaceTLExp=new zt(this.colorSpaceTL.build(t,"v4"),"v4"),this.colorSpaceTRExp=new zt(this.colorSpaceTR.build(t,"v4"),"v4"),this.colorSpaceBLExp=new zt(this.colorSpaceBL.build(t,"v4"),"v4"),this.colorSpaceBRExp=new zt(this.colorSpaceBR.build(t,"v4"),"v4"),t.removeContext();let l=new zt("mix( mix( cubeUV_TL, cubeUV_TR, cubeUV.f.x ), mix( cubeUV_BL, cubeUV_BR, cubeUV.f.x ), cubeUV.f.y )","v4");return l.keywords.cubeUV_TL=this.colorSpaceTLExp,l.keywords.cubeUV_TR=this.colorSpaceTRExp,l.keywords.cubeUV_BL=this.colorSpaceBLExp,l.keywords.cubeUV_BR=this.colorSpaceBRExp,l.keywords.cubeUV=o,l}generate(t,r){if(t.isShader("fragment")){let n=this.uv,s=this.bias||t.context.roughness,o=new $u(Ul.Nodes.roughnessToMip,[s]),a=new tt(o,Ul.Nodes.m0,Ul.Nodes.cubeUV_maxMipLevel,tt.CLAMP),l=new tt(a,tt.FLOOR),c=new tt(a,tt.FRACT),u=this.bilinearCubeUV(t,this.value,n,l),h=this.bilinearCubeUV(t,this.value,n,new bn(l,new Be(1).setReadonly(!0),bn.ADD)),f=new tt(u,h,c,tt.MIX);return t.format(f.build(t),"v4",r)}else return console.warn("TextureCubeUVNode is not compatible with "+t.shader+" shader."),t.format("vec4( 0.0 )",this.getType(t),r)}copy(t){return super.copy(t),this.uv.copy(t.uv),this.bias.copy(t.bias),this.value.copy(t.value),t.colorSpaceTL?this.colorSpaceTL?this.colorSpaceTL.copy(t.colorSpaceTL):this.colorSpaceTL=t.colorSpaceTL.clone():this.colorSpaceTL=void 0,t.colorSpaceTR?this.colorSpaceTR?this.colorSpaceTR.copy(t.colorSpaceTR):this.colorSpaceTR=t.colorSpaceTR.clone():this.colorSpaceTR=void 0,t.colorSpaceBL?this.colorSpaceBL?this.colorSpaceBL.copy(t.colorSpaceBL):this.colorSpaceBL=t.colorSpaceBL.clone():this.colorSpaceBL=void 0,t.colorSpaceBR?this.colorSpaceBR?this.colorSpaceBR.copy(t.colorSpaceBR):this.colorSpaceBR=t.colorSpaceBR.clone():this.colorSpaceBR=void 0,t.colorSpaceTLExp?this.colorSpaceTLExp?this.colorSpaceTLExp.copy(t.colorSpaceTLExp):this.colorSpaceTLExp=t.colorSpaceTLExp.clone():this.colorSpaceTLExp=void 0,t.colorSpaceTRExp?this.colorSpaceTRExp?this.colorSpaceTRExp.copy(t.colorSpaceTRExp):this.colorSpaceTRExp=t.colorSpaceTRExp.clone():this.colorSpaceTRExp=void 0,t.colorSpaceBLExp?this.colorSpaceBLExp?this.colorSpaceBLExp.copy(t.colorSpaceBLExp):this.colorSpaceBLExp=t.colorSpaceBLExp.clone():this.colorSpaceBLExp=void 0,t.colorSpaceBRExp?this.colorSpaceBRExp?this.colorSpaceBRExp.copy(t.colorSpaceBRExp):this.colorSpaceBRExp=t.colorSpaceBRExp.clone():this.colorSpaceBRExp=void 0,this}},zl=Ul;zl.Nodes=function(){let t=new Nl(`struct TextureCubeUVData {
|
|
2998
|
+
`))},fn.LINEAR_TO_LINEAR="LinearToLinear",fn.SRGB_TO_LINEAR="sRGBToLinear",fn.LINEAR_TO_SRGB="LinearTosRGB";var zt=class extends Ne{constructor(t="",r,n,s,o){super(t,o,s,n,r);this.nodeType="Expression"}};var Ni=class extends _t{toJSON(e){let t=super.toJSON(e),r=e===void 0||typeof e=="string";if(this.image!==void 0&&!r){let n=this.image;if(Array.isArray(n)){e.images[n.uuid].url=[];for(let s=0;s<n.length;s++)e.images[n.uuid].url[s]=A1(n[s])}else e.images[n.uuid].url=A1(n)}return t}};function A1(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?$O(i):(console.warn("THREE.Texture: Unable to serialize Texture."),"")}var Fl;function $O(i){if(/^data:/i.test(i.src))return i.src;let e;if(i instanceof HTMLCanvasElement)e=i;else{Fl===void 0&&(Fl=document.createElement("canvas")),Fl.width=i.width,Fl.height=i.height;let r=Fl.getContext("2d");i instanceof ImageData?r.putImageData(i,0,0):r.drawImage(i,0,0,i.width,i.height),e=Fl}let t=i.src.startsWith("blob:")?i.fileName:i.src;return/\.jpe?g$/i.test(t)?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}var Hr=class extends Ht{constructor(t=new Ni,r,n,s){super("v4",{shared:!0});this.nodeType="Texture";this.value=t,this.uv=r!=null?r:new Ol,this.bias=n,this.project=s!==void 0?s:!1}getTexture(t,r){return super.generate(t,r,this.value.uuid,"t")}generate(t,r){var h;if(r==="sampler2D")return this.getTexture(t,r);let n=this.getTexture(t,r),s=this.uv.build(t,this.project?"v4":"v2"),o=this.bias?this.bias.build(t,"f"):void 0;o===void 0&&t.context.bias&&(o=t.context.bias.setTexture(this).build(t,"f"));let a,l;this.project?a="texture2DProj":a=o?"tex2DBias":"tex2D",o?l=a+"( "+n+", "+s+", "+o+" )":l=a+"( "+n+", "+s+" )";let c={include:t.isShader("vertex"),ignoreCache:!0},u=this.getType(t);return t.addContext(c),this.colorSpace=(h=this.colorSpace)!=null?h:new fn(new zt("",u)),this.colorSpace.fromDecoding(t.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(l),l=this.colorSpace.build(t,u),t.removeContext(),t.format(l,u,r)}copy(t){return super.copy(t),t.value.isRenderTargetTexture?this.value=t.value:this.value.copy(t.value),this.uv.copy(t.uv),t.bias?this.bias?this.bias.copy(t.bias):this.bias=t.bias.clone():this.bias=void 0,t.colorSpace?this.colorSpace?this.colorSpace.copy(t.colorSpace):this.colorSpace=t.colorSpace.clone():this.colorSpace=void 0,this.project=t.project,t.value.isRenderTargetTexture||(this.value.updateMatrix(),this.value.needsUpdate=!0),this}};var Be=class extends Ht{constructor(t){super("f");this.nodeType="Float";this.value=t!=null?t:0}generateReadonly(t,r,n,s,o,a){return t.format(this.value+(this.value%1?"":".0"),s,r)}copy(t){return super.copy(t),this.value=t.value,this}};var eh=class extends Ye{constructor(t,r){super();this.inputs=[];this.nodeType="FunctionCall";this.value=t,this.inputs=r!=null?r:[]}getFunction(){return this.value}getType(t){return this.value.getType(t)}generate(t,r,n,s,o){s=this.getType(t);let a=this.value,l=a.build(t,r)+"( ",c=[];if(a.inputs){for(let u=0;u<a.inputs.length;u++){let h=a.inputs[u],f=this.inputs[u]||this.inputs[h.name];c.push(f.build(t,t.getTypeByFormat(h.type)))}l+=c.join(", ")+" )"}return t.format(l,s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this.inputs=t.inputs.map(r=>r.clone()),this}toJSON(t){var n;let r=this.getJSONNode(t);if(!r){let s=this.value;if(r=this.createJSONNode(t),r.value=this.value.toJSON(t).uuid,(n=s.inputs)!=null&&n.length){r.inputs={};for(let o=0;o<s.inputs.length;o++){let a=s.inputs[o],l=this.inputs[o];r.inputs[a.name]=l.toJSON(t).uuid}}}return r}};var yv=class extends Ye{constructor(t=new He,r=new He,n=yv.ADD){super();this.nodeType="Operator";this.type=t.type,this.a=t,this.b=r,this.op=n}getType(t){let r=this.a.getType(t),n=this.b.getType(t);return t.isTypeMatrix(r)?"v4":t.getTypeLength(n)>t.getTypeLength(r)?n:r}generate(t,r){let n=this.getType(t);this.type=n;let s=this.a.build(t,n),o=this.b.build(t,n);return t.format("( "+s+" "+this.op+" "+o+" )",n,r)}copy(t){return super.copy(t),this.a.copy(t.a),this.b.copy(t.b),this.op=t.op,this}},bn=yv;bn.ADD="+",bn.SUB="-",bn.MUL="*",bn.DIV="/";var It=class extends Ye{constructor(t=new He,r=It.ABS,n,s){super();this.nodeType="Math";this.a=t,typeof r!="string"?this.b=r:s=r,typeof n!="string"?this.c=n:s=n,this.method=s,this.hashProperties=["method"]}getNumInputs(t){switch(this.method){case It.MIX:case It.CLAMP:case It.REFRACT:case It.SMOOTHSTEP:case It.FACEFORWARD:return 3;case It.MIN:case It.MAX:case It.MOD:case It.STEP:case It.REFLECT:case It.DISTANCE:case It.DOT:case It.CROSS:case It.POW:return 2;default:return 1}}getInputType(t){let r=t.getTypeLength(this.a.getType(t)),n=this.b?t.getTypeLength(this.b.getType(t)):0,s=this.c?t.getTypeLength(this.c.getType(t)):0;return r>n&&r>s?this.a.getType(t):n>s?this.b.getType(t):this.c.getType(t)}getType(t){switch(this.method){case It.LENGTH:case It.DISTANCE:case It.DOT:return"f";case It.CROSS:return"v3"}return this.getInputType(t)}generate(t,r){let n,s,o,a=this.a?t.getTypeLength(this.a.getType(t)):0,l=this.b?t.getTypeLength(this.b.getType(t)):0,c=this.c?t.getTypeLength(this.c.getType(t)):0,u=this.getInputType(t),h=this.getType(t);switch(this.type=h,this.method){case It.NEGATE:return t.format("( -"+this.a.build(t,u)+" )",u,r);case It.INVERT:return t.format("( 1.0 - "+this.a.build(t,u)+" )",u,r);case It.CROSS:n=this.a.build(t,"v3"),s=this.b.build(t,"v3");break;case It.STEP:n=this.a.build(t,a===1?"f":u),s=this.b.build(t,u);break;case It.MIN:case It.MAX:case It.MOD:n=this.a.build(t,u),s=this.b.build(t,l===1?"f":u);break;case It.REFRACT:n=this.a.build(t,u),s=this.b.build(t,u),o=this.c.build(t,"f");break;case It.MIX:n=this.a.build(t,u),s=this.b.build(t,u),o=this.c.build(t,c===1?"f":u);break;default:n=this.a.build(t,u),this.b&&(s=this.b.build(t,u)),this.c&&(o=this.c.build(t,u));break}let f=[];f.push(n),s&&f.push(s),o&&f.push(o);let d=this.getNumInputs(t);if(f.length!==d)throw Error(`Arguments not match used in "${this.method}". Require ${d}, currently ${f.length}.`);return t.format(this.method+"( "+f.join(", ")+" )",h,r)}copy(t){return super.copy(t),this.a.copy(t.a),this.b=t.b instanceof He?t.b.clone():t.b,this.c=t.c instanceof He?t.c.clone():t.c,this.method=t.method,this}},tt=It;tt.RAD="radians",tt.DEG="degrees",tt.EXP="exp",tt.EXP2="exp2",tt.LOG="log",tt.LOG2="log2",tt.SQRT="sqrt",tt.INV_SQRT="inversesqrt",tt.FLOOR="floor",tt.CEIL="ceil",tt.NORMALIZE="normalize",tt.FRACT="fract",tt.SATURATE="saturate",tt.SIN="sin",tt.COS="cos",tt.TAN="tan",tt.ASIN="asin",tt.ACOS="acos",tt.ARCTAN="atan",tt.ABS="abs",tt.SIGN="sign",tt.LENGTH="length",tt.NEGATE="negate",tt.INVERT="invert",tt.MIN="min",tt.MAX="max",tt.MOD="mod",tt.STEP="step",tt.REFLECT="reflect",tt.DISTANCE="distance",tt.DOT="dot",tt.CROSS="cross",tt.POW="pow",tt.MIX="mix",tt.CLAMP="clamp",tt.REFRACT="refract",tt.SMOOTHSTEP="smoothstep",tt.FACEFORWARD="faceforward";var Ul=class extends Ye{constructor(t=new He,r=new He,n=new He){super("v4");this.nodeType="TextureCubeUV";this.value=t,this.uv=r,this.bias=n}bilinearCubeUV(t,r,n,s){var c,u,h,f;let o=new eh(Ul.Nodes.bilinearCubeUV,[r,n,s]);this.colorSpaceTL=(c=this.colorSpaceTL)!=null?c:new fn(new zt("","v4")),this.colorSpaceTL.fromDecoding(t.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTL.input.parse(o.build(t)+".tl"),this.colorSpaceTR=(u=this.colorSpaceTR)!=null?u:new fn(new zt("","v4")),this.colorSpaceTR.fromDecoding(t.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTR.input.parse(o.build(t)+".tr"),this.colorSpaceBL=(h=this.colorSpaceBL)!=null?h:new fn(new zt("","v4")),this.colorSpaceBL.fromDecoding(t.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBL.input.parse(o.build(t)+".bl"),this.colorSpaceBR=(f=this.colorSpaceBR)!=null?f:new fn(new zt("","v4")),this.colorSpaceBR.fromDecoding(t.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBR.input.parse(o.build(t)+".br");let a={include:t.isShader("vertex"),ignoreCache:!0};t.addContext(a),this.colorSpaceTLExp=new zt(this.colorSpaceTL.build(t,"v4"),"v4"),this.colorSpaceTRExp=new zt(this.colorSpaceTR.build(t,"v4"),"v4"),this.colorSpaceBLExp=new zt(this.colorSpaceBL.build(t,"v4"),"v4"),this.colorSpaceBRExp=new zt(this.colorSpaceBR.build(t,"v4"),"v4"),t.removeContext();let l=new zt("mix( mix( cubeUV_TL, cubeUV_TR, cubeUV.f.x ), mix( cubeUV_BL, cubeUV_BR, cubeUV.f.x ), cubeUV.f.y )","v4");return l.keywords.cubeUV_TL=this.colorSpaceTLExp,l.keywords.cubeUV_TR=this.colorSpaceTRExp,l.keywords.cubeUV_BL=this.colorSpaceBLExp,l.keywords.cubeUV_BR=this.colorSpaceBRExp,l.keywords.cubeUV=o,l}generate(t,r){if(t.isShader("fragment")){let n=this.uv,s=this.bias||t.context.roughness,o=new eh(Ul.Nodes.roughnessToMip,[s]),a=new tt(o,Ul.Nodes.m0,Ul.Nodes.cubeUV_maxMipLevel,tt.CLAMP),l=new tt(a,tt.FLOOR),c=new tt(a,tt.FRACT),u=this.bilinearCubeUV(t,this.value,n,l),h=this.bilinearCubeUV(t,this.value,n,new bn(l,new Be(1).setReadonly(!0),bn.ADD)),f=new tt(u,h,c,tt.MIX);return t.format(f.build(t),"v4",r)}else return console.warn("TextureCubeUVNode is not compatible with "+t.shader+" shader."),t.format("vec4( 0.0 )",this.getType(t),r)}copy(t){return super.copy(t),this.uv.copy(t.uv),this.bias.copy(t.bias),this.value.copy(t.value),t.colorSpaceTL?this.colorSpaceTL?this.colorSpaceTL.copy(t.colorSpaceTL):this.colorSpaceTL=t.colorSpaceTL.clone():this.colorSpaceTL=void 0,t.colorSpaceTR?this.colorSpaceTR?this.colorSpaceTR.copy(t.colorSpaceTR):this.colorSpaceTR=t.colorSpaceTR.clone():this.colorSpaceTR=void 0,t.colorSpaceBL?this.colorSpaceBL?this.colorSpaceBL.copy(t.colorSpaceBL):this.colorSpaceBL=t.colorSpaceBL.clone():this.colorSpaceBL=void 0,t.colorSpaceBR?this.colorSpaceBR?this.colorSpaceBR.copy(t.colorSpaceBR):this.colorSpaceBR=t.colorSpaceBR.clone():this.colorSpaceBR=void 0,t.colorSpaceTLExp?this.colorSpaceTLExp?this.colorSpaceTLExp.copy(t.colorSpaceTLExp):this.colorSpaceTLExp=t.colorSpaceTLExp.clone():this.colorSpaceTLExp=void 0,t.colorSpaceTRExp?this.colorSpaceTRExp?this.colorSpaceTRExp.copy(t.colorSpaceTRExp):this.colorSpaceTRExp=t.colorSpaceTRExp.clone():this.colorSpaceTRExp=void 0,t.colorSpaceBLExp?this.colorSpaceBLExp?this.colorSpaceBLExp.copy(t.colorSpaceBLExp):this.colorSpaceBLExp=t.colorSpaceBLExp.clone():this.colorSpaceBLExp=void 0,t.colorSpaceBRExp?this.colorSpaceBRExp?this.colorSpaceBRExp.copy(t.colorSpaceBRExp):this.colorSpaceBRExp=t.colorSpaceBRExp.clone():this.colorSpaceBRExp=void 0,this}},zl=Ul;zl.Nodes=function(){let t=new Nl(`struct TextureCubeUVData {
|
|
2999
2999
|
vec4 tl;
|
|
3000
3000
|
vec4 tr;
|
|
3001
3001
|
vec4 br;
|
|
@@ -3119,8 +3119,8 @@ void main() {
|
|
|
3119
3119
|
`}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,r,n="varying",s="V",o=""){let a=this.getVars(n),l=a[e];if(!l){let c=a.length;l={name:r||"node"+s+c+(o?"_"+o:""),type:t},a.push(l),a[e]=l}return l}getTempVar(e,t,r,n){return this.getVar(e,t,r,this.shader,"T",n)}getAttribute(e,t){if(!this.attributes[e]){let r=this.getVar(e,t);this.addVertexParsCode("attribute "+t+" "+e+";"),this.addVertexFinalCode(r.name+" = "+e+";"),this.attributes[e]={varying:r,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(`
|
|
3120
3120
|
`)}getVarListCode(e,t){t=t!=null?t:"";let r="";for(let n=0,s=e.length;n<s;++n){let o=e[n],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("[]")?r+=t+" "+u.substring(0,u.length-2)+" "+l+`[${c}];
|
|
3121
3121
|
`:r+=t+" "+u+" "+l+`;
|
|
3122
|
-
`}return r}getVars(e){return this.inputs.vars[e!=null?e:this.shader]}getNodeData(e){let t=e instanceof He?e.uuid:e;return this.nodeData[t]=this.nodeData[t]||{}}createUniform(e,t,r,n,s,o){if(t.includes("[]")){let a=this.inputs.arrayUniforms,l=a.list.length,c=new
|
|
3123
|
-
`;return t.isShader("vertex")?n+="gl_Position = "+r.result+";":n+="gl_FragColor = "+r.result+";",n}copy(t){return super.copy(t),this.value.copy(t.value),this}};var Rt=class extends Ht{constructor(t=0,r,n,s){super("c");this.nodeType="Color";this.value=t instanceof kr?t:new kr(t||0,r,n,s)}setRGBA(t){this.value.setRGBA(t.r,t.g,t.b,t.a)}generate(t,r,n,s,o,a){n=t.getUUID(n!=null?n:this.getUUID()),s=s!=null?s:this.getType(t);let l=t.getNodeData(n),c=this.getReadonly()&&this.generateReadonly!==void 0;if(this.alpha){let u=this.alpha.build(t,"f");t.addFragmentNodeCode(`accumAlpha += ( 1.0 - accumAlpha ) * ${u};`)}return c?this.generateReadonly(t,r,n,s,o,a):t.isShader("vertex")?(l.vertex||(l.vertex=t.createVertexUniform(s,this,o,a,this.getLabel())),t.format(l.vertex.name,s,r)):(l.fragment||(l.fragment=t.createFragmentUniform(s,this,o,a,this.getLabel())),t.format(l.fragment.name,s,r))}generateReadonly(t,r,n,s,o,a){return t.format("vec3("+this.value.r+", "+this.value.g+", "+this.value.b+")",s,r)}};var ft=class extends Ht{constructor(t){super("i");this.nodeType="Int";this.value=Math.floor(t!=null?t:0)}generateReadonly(t,r,n,s,o,a){return t.format(this.value.toString(),s,r)}copy(t){return super.copy(t),this.value=t.value,this}};var Zt=class{constructor(e,t,r,n){this.next=void 0;this.uniforms={};this.textures={};this.defines={};if(this.id=e,this.uuid=t,r){this.type=r.type;for(let s in r)s!=="type"&&s!=="calpha"&&(this.uniforms[`f${this.id}_${s}`]=r[s]);for(let s in n)this.defines[s]=n[s]}}copy(e){this.id=e.id,this.type=e.type,this.defines=se({},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 Zt(this.id).copy(this)}fromJSON(e,t){this.id=e.id,this.defines=se({},e.defines);for(let r in e.uniforms)this.uniforms[r]=t.getNode(e.uniforms[r]);if(e.type==="texture"){if(!(`f${this.id}_textureSize`in this.uniforms)){let r=this.uniforms[`f${this.id}_texture`].value.image;this.uniforms[`f${e.id}_textureSize`]=new Rr(r.width,r.height)}`f${this.id}_size`in this.uniforms||(this.uniforms[`f${e.id}_size`]=new Ir(200,200)),`f${e.id}_axis`in this.uniforms||(this.uniforms[`f${e.id}_axis`]=new ft(0)),`f${e.id}_projection`in this.uniforms||(this.uniforms[`f${e.id}_projection`]=new ft(0))}else e.type==="noise"?(`f${e.id}_noiseType`in this.uniforms||(this.uniforms[`f${e.id}_noiseType`]=new ft(0)),`f${e.id}_size`in this.uniforms||(this.uniforms[`f${e.id}_size`]=new Rr(-1,-1,-1))):e.type==="depth"&&(`f${e.id}_isWorldSpace`in this.uniforms||(this.uniforms[`f${e.id}_isWorldSpace`]=new Be(1)));return this}toJSON(e){let t={};for(let n in this.uniforms)t[n]=this.uniforms[n].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 r=this.getName(t);r!==void 0&&e.uniforms[`f${e.id}_${r}`]&&r!=="transmissionDepthMap"&&r!=="transmissionSamplerMap"&&this.uniforms[t].copy(e.uniforms[`f${e.id}_${r}`])}return this}hasValueByKey(e){return this.uniforms[e]!==void 0}hasValue(e){return this.hasValueByKey(`f${this.id}_${e}`)}setValue(e,t){let r=`f${this.id}_${e}`;this.hasValueByKey(r)&&t!==void 0&&(this.uniforms[r].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 r=this.getName(t);if(r===void 0)continue;let s=this.uniforms[`f${this.id}_${r}`].value;s!==void 0&&(Array.isArray(s)?e[r]=s.map(o=>o.clone?o.clone():o):e[r]=s.clone?s.clone():s)}return e}getName(e){let r=/f\d+_(.*)/.exec(e);if(r&&r.length>1)return r[1];console.log(`Layer.getName: error ${e}`)}getNames(){let e=[];for(let t in this.uniforms){let r=this.getName(t);r&&e.push(r)}return e}isEqual(e){for(let t in e.uniforms){let r=e.getName(t);if(!r)return!1;let n=this.getValue(r),s=e.uniforms[t].value;if(s.value instanceof _t){if(n.image!==s.image)return!1}else if(Array.isArray(s)){let o=n;for(let a=0,l=o.length;a<l;++a)if(o[a]!==s[a])return!1}else{let o=n;if(o.equals){if(!o.equals(s))return!1}else if(n!==s)return!1}}return!0}dispose(){}};function E1(i){let e=i instanceof Zt?i.type:i;return e==="texture"||e==="displace_map"||e==="matcap"}var
|
|
3122
|
+
`}return r}getVars(e){return this.inputs.vars[e!=null?e:this.shader]}getNodeData(e){let t=e instanceof He?e.uuid:e;return this.nodeData[t]=this.nodeData[t]||{}}createUniform(e,t,r,n,s,o){if(t.includes("[]")){let a=this.inputs.arrayUniforms,l=a.list.length,c=new $u({type:t,size:r.size,name:n||"nodeUA"+l+(o?"_"+o:""),node:r,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 $u({type:t,name:n||"nodeU"+l+(o?"_"+o:""),node:r,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,r,n,s){return this.createUniform("vertex",e,t,r,n,s)}createFragmentUniform(e,t,r,n,s){return this.createUniform("fragment",e,t,r,n,s)}include(e,t,r){var o;let n;if(e=typeof e=="string"?Tr.get(e):e,this.context.include===!1)return e.name;e instanceof Ne?n=this.includes.functions:e instanceof bt?n=this.includes.consts:e instanceof Nl&&(n=this.includes.structs);let s=n[this.shader]=n[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 Ne&&t&&s[t.name]&&s[t.name].deps.indexOf(e)===-1&&(s[t.name].deps.push(e),(o=e.includes)!=null&&o.length)){let l=0;do this.include(e.includes[l++],t);while(l<e.includes.length)}return r&&(a.src=r),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 eF[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 r=e[t];if(r!=null&&r.isNode)return r}}resolve(...e){for(let t=0;t<arguments.length;t++){let r=e[t];if(r!==void 0){if(r.isNode)return r;if(r.isTexture)switch(r.mapping){case Ls:case Ds:return new wp(r);case ja:return new bp(new Hr(r));default:return new Hr(r)}else{if(r.isVector2)return new Ir(r);if(r.isVector3)return new Rr(r);if(r.isVector4)return new hi(r)}}}}format(e,t,r){switch(this.colorToVector(r+" <- "+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 tF[e]||e}getFormatByType(e){return rF[e]||e}getUUID(e,t){return t=t!==void 0?t:!0,t&&this.cache&&(e=this.cache+"-"+e),e}getElementByIndex(e){return T1[e]}getIndexByElement(e){return T1.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=rn,t===rn&&this.context.gamma&&(t=je),t}};var th=class extends He{constructor(t=new He){super("v4");this.nodeType="Raw";this.value=t}generate(t){let r=this.value.analyzeAndFlow(t,this.type),n=r.code+`
|
|
3123
|
+
`;return t.isShader("vertex")?n+="gl_Position = "+r.result+";":n+="gl_FragColor = "+r.result+";",n}copy(t){return super.copy(t),this.value.copy(t.value),this}};var Rt=class extends Ht{constructor(t=0,r,n,s){super("c");this.nodeType="Color";this.value=t instanceof kr?t:new kr(t||0,r,n,s)}setRGBA(t){this.value.setRGBA(t.r,t.g,t.b,t.a)}generate(t,r,n,s,o,a){n=t.getUUID(n!=null?n:this.getUUID()),s=s!=null?s:this.getType(t);let l=t.getNodeData(n),c=this.getReadonly()&&this.generateReadonly!==void 0;if(this.alpha){let u=this.alpha.build(t,"f");t.addFragmentNodeCode(`accumAlpha += ( 1.0 - accumAlpha ) * ${u};`)}return c?this.generateReadonly(t,r,n,s,o,a):t.isShader("vertex")?(l.vertex||(l.vertex=t.createVertexUniform(s,this,o,a,this.getLabel())),t.format(l.vertex.name,s,r)):(l.fragment||(l.fragment=t.createFragmentUniform(s,this,o,a,this.getLabel())),t.format(l.fragment.name,s,r))}generateReadonly(t,r,n,s,o,a){return t.format("vec3("+this.value.r+", "+this.value.g+", "+this.value.b+")",s,r)}};var ft=class extends Ht{constructor(t){super("i");this.nodeType="Int";this.value=Math.floor(t!=null?t:0)}generateReadonly(t,r,n,s,o,a){return t.format(this.value.toString(),s,r)}copy(t){return super.copy(t),this.value=t.value,this}};var Zt=class{constructor(e,t,r,n){this.next=void 0;this.uniforms={};this.textures={};this.defines={};if(this.id=e,this.uuid=t,r){this.type=r.type;for(let s in r)s!=="type"&&s!=="calpha"&&(this.uniforms[`f${this.id}_${s}`]=r[s]);for(let s in n)this.defines[s]=n[s]}}copy(e){this.id=e.id,this.type=e.type,this.defines=se({},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 Zt(this.id).copy(this)}fromJSON(e,t){this.id=e.id,this.defines=se({},e.defines);for(let r in e.uniforms)this.uniforms[r]=t.getNode(e.uniforms[r]);if(e.type==="texture"){if(!(`f${this.id}_textureSize`in this.uniforms)){let r=this.uniforms[`f${this.id}_texture`].value.image;this.uniforms[`f${e.id}_textureSize`]=new Rr(r.width,r.height)}`f${this.id}_size`in this.uniforms||(this.uniforms[`f${e.id}_size`]=new Ir(200,200)),`f${e.id}_axis`in this.uniforms||(this.uniforms[`f${e.id}_axis`]=new ft(0)),`f${e.id}_projection`in this.uniforms||(this.uniforms[`f${e.id}_projection`]=new ft(0))}else e.type==="noise"?(`f${e.id}_noiseType`in this.uniforms||(this.uniforms[`f${e.id}_noiseType`]=new ft(0)),`f${e.id}_size`in this.uniforms||(this.uniforms[`f${e.id}_size`]=new Rr(-1,-1,-1))):e.type==="depth"&&(`f${e.id}_isWorldSpace`in this.uniforms||(this.uniforms[`f${e.id}_isWorldSpace`]=new Be(1)));return this}toJSON(e){let t={};for(let n in this.uniforms)t[n]=this.uniforms[n].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 r=this.getName(t);r!==void 0&&e.uniforms[`f${e.id}_${r}`]&&r!=="transmissionDepthMap"&&r!=="transmissionSamplerMap"&&this.uniforms[t].copy(e.uniforms[`f${e.id}_${r}`])}return this}hasValueByKey(e){return this.uniforms[e]!==void 0}hasValue(e){return this.hasValueByKey(`f${this.id}_${e}`)}setValue(e,t){let r=`f${this.id}_${e}`;this.hasValueByKey(r)&&t!==void 0&&(this.uniforms[r].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 r=this.getName(t);if(r===void 0)continue;let s=this.uniforms[`f${this.id}_${r}`].value;s!==void 0&&(Array.isArray(s)?e[r]=s.map(o=>o.clone?o.clone():o):e[r]=s.clone?s.clone():s)}return e}getName(e){let r=/f\d+_(.*)/.exec(e);if(r&&r.length>1)return r[1];console.log(`Layer.getName: error ${e}`)}getNames(){let e=[];for(let t in this.uniforms){let r=this.getName(t);r&&e.push(r)}return e}isEqual(e){for(let t in e.uniforms){let r=e.getName(t);if(!r)return!1;let n=this.getValue(r),s=e.uniforms[t].value;if(s.value instanceof _t){if(n.image!==s.image)return!1}else if(Array.isArray(s)){let o=n;for(let a=0,l=o.length;a<l;++a)if(o[a]!==s[a])return!1}else{let o=n;if(o.equals){if(!o.equals(s))return!1}else if(n!==s)return!1}}return!0}dispose(){}};function E1(i){let e=i instanceof Zt?i.type:i;return e==="texture"||e==="displace_map"||e==="matcap"}var rh=class extends Ht{constructor(t){super("b");this.nodeType="Bool";this.value=t!=null?t:!1}generateReadonly(t,r,n,s){return t.format(this.value?"true":"false",s,r)}copy(t){return super.copy(t),this.value=t.value,this}};var fs=class extends Ht{constructor(t=1,r){super("v4[]");this.nodeType="Vector4Array";this.size=t,this.value=Array.isArray(r)?r:r instanceof Qe?new Array(t).fill(r):new Array(t).fill(new Qe(0))}copy(t){return super.copy(t),this.value=t.value.map(r=>r.clone()),this}};var Jo=class extends Ht{constructor(t=1,r){super("f[]");this.nodeType="FloatArray";this.size=t,this.value=Array.isArray(r)?r:typeof r=="number"?new Array(t).fill(r):new Array(t).fill(0)}copy(t){return super.copy(t),this.size=t.size,this.value=[...t.value],this}};var Gl=class extends Ht{constructor(t){super("m3");this.nodeType="Matrix3";this.value=t!=null?t:new Nt}generateReadonly(t,r,n,s,o,a){return t.format("mat3("+this.value.elements.join(", ")+")",s,r)}copy(t){return super.copy(t),this.elements=t.elements,this}get elements(){return this.value.elements}set elements(t){this.value.fromArray(t)}};var ih=class extends Ye{constructor(t=new Hr,r,n,s,o,a,l,c){super("v3");this.nodeType="CustomTexture";this.firstTime=!0,this.texture=t,this.textureSize=r,this.crop=n,this.projection=s,this.axis=o,this.size=a,this.mat=new Gl(this.texture.value.matrix),this.alpha=l,this.mode=c,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,r){t.require("position"),t.require("uv"),t.requires.uv=[!0],t.extensions.shaderTextureLOD=!0,t.extensions.derivatives=!0;let n;switch(this.projection.value){case 3:n=t.include(ih.Nodes.cylindrical);break;case 2:n=t.include(ih.Nodes.spherical);break;case 1:let o=new Ne(`
|
|
3124
3124
|
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) {
|
|
3125
3125
|
|
|
3126
3126
|
vec2 uvs = ( mat * vec3( (g${this.uuid.toString().replace(/-/g,"")}_vCustomUv * 2. - 1.) / (size * .5), 1. ) / 2. + 0.5 ).xy;
|
|
@@ -3137,7 +3137,7 @@ void main() {
|
|
|
3137
3137
|
calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
|
|
3138
3138
|
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
|
|
3139
3139
|
return col;
|
|
3140
|
-
}`);n=t.include(o);break;default:n=t.include(
|
|
3140
|
+
}`);n=t.include(o);break;default:n=t.include(ih.Nodes.uv);break}if(this.projection.value===1&&this.firstTime){let o=`g${this.uuid.toString().replace(/-/g,"")}`;t.addVertexParsCode(`varying vec2 ${o}_vCustomUv;`),t.addFragmentParsCode(`varying vec2 ${o}_vCustomUv;`),t.addVertexFinalCode(`
|
|
3141
3141
|
vec3 ${o}_posN = transformed;
|
|
3142
3142
|
${this.axis.value===0?`
|
|
3143
3143
|
float ${o}_u = (1. + (${o}_posN.z)) / 2.;
|
|
@@ -3155,7 +3155,7 @@ ${this.axis.value===2?`
|
|
|
3155
3155
|
`:""}
|
|
3156
3156
|
|
|
3157
3157
|
${o}_vCustomUv = vec2(${o}_u, ${o}_v);
|
|
3158
|
-
`)}t.addFragmentVariable(this.calpha,"float");let s=[];return s.push(this.texture.getTexture(t,"t")),s.push(this.textureSize.build(t,"v2")),s.push(this.crop.build(t,"f")),s.push(this.mat.build(t,"mat3")),s.push(this.size.build(t,"v2")),s.push(this.alpha.build(t,"f")),s.push(this.mode.build(t,"i")),s.push(this.calpha),this.firstTime=!this.firstTime,t.format(n+"("+s.join(",")+")",this.getType(t),r)}copy(t){return super.copy(t),this.texture.copy(t.texture),this.textureSize=t.textureSize.clone(),this.crop=t.crop.clone(),this.projection=t.projection.clone(),this.axis=t.axis.clone(),this.size=t.size.clone(),this.alpha=t.alpha.clone(),this.mode=t.mode.clone(),this}},
|
|
3158
|
+
`)}t.addFragmentVariable(this.calpha,"float");let s=[];return s.push(this.texture.getTexture(t,"t")),s.push(this.textureSize.build(t,"v2")),s.push(this.crop.build(t,"f")),s.push(this.mat.build(t,"mat3")),s.push(this.size.build(t,"v2")),s.push(this.alpha.build(t,"f")),s.push(this.mode.build(t,"i")),s.push(this.calpha),this.firstTime=!this.firstTime,t.format(n+"("+s.join(",")+")",this.getType(t),r)}copy(t){return super.copy(t),this.texture.copy(t.texture),this.textureSize=t.textureSize.clone(),this.crop=t.crop.clone(),this.projection=t.projection.clone(),this.axis=t.axis.clone(),this.size=t.size.clone(),this.alpha=t.alpha.clone(),this.mode=t.mode.clone(),this}},nh=ih;nh.Nodes=function(){let t=new Ne(`
|
|
3159
3159
|
vec3 cylindricalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float alpha, int mode, out float calpha) {
|
|
3160
3160
|
vec3 posN = normalize(position);
|
|
3161
3161
|
float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);
|
|
@@ -3229,14 +3229,14 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
3229
3229
|
calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
|
|
3230
3230
|
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
|
|
3231
3231
|
return col;
|
|
3232
|
-
}`);return{cylindrical:t,spherical:r,uv:n}}();var vv=class extends Ye{constructor(t,r,n,s,o,a,l){super("v3");this.nodeType="Fresnel";this.color=t,this.bias=r,this.scale=n,this.intensity=s,this.factor=o,this.alpha=a,this.mode=l,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,r){if(t.require("vWorldViewDir"),t.require("worldNormal"),t.isShader("fragment")){t.addFragmentVariable(this.calpha,"float");let n=t.include(vv.Nodes.fresnel),s=[];return s.push(this.color.build(t,"c")),s.push(this.bias.build(t,"f")),s.push(this.scale.build(t,"f")),s.push(this.intensity.build(t,"f")),s.push(this.factor.build(t,"f")),s.push(this.alpha.build(t,"f")),s.push(this.mode.build(t,"i")),s.push(this.calpha),t.format(n+"("+s.join(",")+")",this.getType(t),r)}else return console.warn("FresnelNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),r)}copy(t){return super.copy(t),this.color=t.color.clone(),this.bias=t.bias.clone(),this.scale=t.scale.clone(),this.intensity=t.intensity.clone(),this.factor=t.factor.clone(),this.alpha=t.alpha.clone(),this.mode=t.mode.clone(),this.calpha=t.calpha,this}},
|
|
3232
|
+
}`);return{cylindrical:t,spherical:r,uv:n}}();var vv=class extends Ye{constructor(t,r,n,s,o,a,l){super("v3");this.nodeType="Fresnel";this.color=t,this.bias=r,this.scale=n,this.intensity=s,this.factor=o,this.alpha=a,this.mode=l,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,r){if(t.require("vWorldViewDir"),t.require("worldNormal"),t.isShader("fragment")){t.addFragmentVariable(this.calpha,"float");let n=t.include(vv.Nodes.fresnel),s=[];return s.push(this.color.build(t,"c")),s.push(this.bias.build(t,"f")),s.push(this.scale.build(t,"f")),s.push(this.intensity.build(t,"f")),s.push(this.factor.build(t,"f")),s.push(this.alpha.build(t,"f")),s.push(this.mode.build(t,"i")),s.push(this.calpha),t.format(n+"("+s.join(",")+")",this.getType(t),r)}else return console.warn("FresnelNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),r)}copy(t){return super.copy(t),this.color=t.color.clone(),this.bias=t.bias.clone(),this.scale=t.scale.clone(),this.intensity=t.intensity.clone(),this.factor=t.factor.clone(),this.alpha=t.alpha.clone(),this.mode=t.mode.clone(),this.calpha=t.calpha,this}},sh=vv;sh.Nodes=function(){return{fresnel:new Ne(`vec3 fresnel(vec3 color, float bias, float scale, float intensity, float factor, float alpha, int mode, out float calpha) {
|
|
3233
3233
|
float fresnel = bias + scale * pow( abs( factor + dot( normalize( vWorldViewDir ), normalize( vWNormal ) ) ), intensity );
|
|
3234
3234
|
|
|
3235
3235
|
float lalpha = clamp( fresnel, 0.0, 1.0 ) * alpha;
|
|
3236
3236
|
calpha = lalpha / clamp(lalpha + accumAlpha, 0.001, 1.0);
|
|
3237
3237
|
accumAlpha += (1.0 - accumAlpha) * lalpha;
|
|
3238
3238
|
return color;
|
|
3239
|
-
}`)}}();var
|
|
3239
|
+
}`)}}();var oh=(s=>(s.SIMPLEX="simplex3d",s.SIMPLEX_FRACTAL="simplex3dFractal",s.ASHIMA="simplexAshima",s.FBM="fbm",s.PERLIN="perlin",s))(oh||{}),wn=function(){let e=new Ne(`vec3 random3(vec3 c) {
|
|
3240
3240
|
float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0)));
|
|
3241
3241
|
vec3 r;
|
|
3242
3242
|
r.z = fract(512.0*j);
|
|
@@ -3413,7 +3413,7 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
3413
3413
|
vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
|
|
3414
3414
|
float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
|
|
3415
3415
|
return 2.2 * n_xyz;
|
|
3416
|
-
}`,[n,s,h]);return{simplex:t,simplexFractal:r,simplexAshima:o,fbm:u,perlin:f}}();var xv=class extends Ye{constructor(t,r,n,s,o,a,l){super("v3");this.nodeType="Rainbow";this.filmThickness=t,this.movement=r,this.wavelengths=n,this.noiseStrength=s,this.noiseScale=o,this.offset=a,this.alpha=l,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,r){if(t.require("vWorldViewDir"),t.require("worldNormal"),t.isShader("fragment")){t.require("uv"),t.requires.uv=[!0],t.addFragmentVariable(this.calpha,"float");let n=t.include(xv.Nodes.rainbow),s=[];return s.push(this.filmThickness.build(t,"f")),s.push(this.movement.build(t,"f")),s.push(this.wavelengths.build(t,"v3")),s.push(this.noiseStrength.build(t,"f")),s.push(this.noiseScale.build(t,"f")),s.push(this.offset.build(t,"v3")),s.push(this.alpha.build(t,"f")),s.push(this.calpha),t.format(n+"("+s.join(",")+")",this.getType(t),r)}else return console.warn("RainbowNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),r)}copy(t){return super.copy(t),this.filmThickness=t.filmThickness.clone(),this.movement=t.movement.clone(),this.wavelengths=t.wavelengths.clone(),this.noiseStrength=t.noiseStrength.clone(),this.noiseScale=t.noiseScale.clone(),this.offset=t.offset.clone(),this.alpha=t.alpha.clone(),this.calpha=t.calpha,this}},
|
|
3416
|
+
}`,[n,s,h]);return{simplex:t,simplexFractal:r,simplexAshima:o,fbm:u,perlin:f}}();var xv=class extends Ye{constructor(t,r,n,s,o,a,l){super("v3");this.nodeType="Rainbow";this.filmThickness=t,this.movement=r,this.wavelengths=n,this.noiseStrength=s,this.noiseScale=o,this.offset=a,this.alpha=l,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,r){if(t.require("vWorldViewDir"),t.require("worldNormal"),t.isShader("fragment")){t.require("uv"),t.requires.uv=[!0],t.addFragmentVariable(this.calpha,"float");let n=t.include(xv.Nodes.rainbow),s=[];return s.push(this.filmThickness.build(t,"f")),s.push(this.movement.build(t,"f")),s.push(this.wavelengths.build(t,"v3")),s.push(this.noiseStrength.build(t,"f")),s.push(this.noiseScale.build(t,"f")),s.push(this.offset.build(t,"v3")),s.push(this.alpha.build(t,"f")),s.push(this.calpha),t.format(n+"("+s.join(",")+")",this.getType(t),r)}else return console.warn("RainbowNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),r)}copy(t){return super.copy(t),this.filmThickness=t.filmThickness.clone(),this.movement=t.movement.clone(),this.wavelengths=t.wavelengths.clone(),this.noiseStrength=t.noiseStrength.clone(),this.noiseScale=t.noiseScale.clone(),this.offset=t.offset.clone(),this.alpha=t.alpha.clone(),this.calpha=t.calpha,this}},ah=xv;ah.Nodes=function(){let t=new Ne(`vec3 attenuation(vec3 wavelengths, float filmThickness, float movement, float noiseStrength, float noiseScale, vec3 offset) {
|
|
3417
3417
|
vec3 st = position / noiseScale;
|
|
3418
3418
|
vec3 q = vec3(simplex3d(st),
|
|
3419
3419
|
simplex3d(st + vec3(1.0)),
|
|
@@ -3435,7 +3435,7 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
3435
3435
|
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
|
|
3436
3436
|
|
|
3437
3437
|
return res;
|
|
3438
|
-
}`,[t])}}();var bv=class extends Ye{constructor(t,r,n,s,o,a,l,c){super("v3");this.nodeType="Transmission";this.thickness=t,this.ior=r,this.roughness=n,this.transmissionSamplerSize=s,this.transmissionSamplerMap=o,this.transmissionDepthMap=a,this.aspectRatio=l,this.alpha=c,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,r){if(t.extensions.shaderTextureLOD=!0,t.extensions.derivatives=!0,t.isShader("fragment")){t.define("NUM_SAMPLES",30),t.require("worldPosition"),t.requires.worldNormal=!0,t.requires.modelMatrix=!0,t.requires.projectionMatrix=!0,t.addFragmentVariable(this.calpha,"float");let n=t.include(bv.Nodes.transmission),s=[];return s.push(this.thickness.build(t,"f")),s.push(this.ior.build(t,"f")),s.push(this.roughness.build(t,"f")),s.push(this.transmissionSamplerSize.build(t,"v2")),s.push(this.transmissionSamplerMap.getTexture(t,"t")),s.push(this.transmissionDepthMap.getTexture(t,"t")),s.push(this.aspectRatio.build(t,"v2")),s.push("normal"),s.push(this.alpha.build(t,"f")),s.push(this.calpha),t.format(n+"("+s.join(",")+")",this.getType(t),r)}else return console.warn("TransmissionNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),r)}copy(t){return super.copy(this),this.thickness=t.thickness.clone(),this.ior=t.ior.clone(),this.roughness=t.roughness.clone(),this.transmissionSamplerSize=t.transmissionSamplerSize.clone(),this.transmissionSamplerMap=t.transmissionSamplerMap,this.transmissionDepthMap=t.transmissionDepthMap,this.alpha=t.alpha.clone(),this.calpha=t.calpha,this}},
|
|
3438
|
+
}`,[t])}}();var bv=class extends Ye{constructor(t,r,n,s,o,a,l,c){super("v3");this.nodeType="Transmission";this.thickness=t,this.ior=r,this.roughness=n,this.transmissionSamplerSize=s,this.transmissionSamplerMap=o,this.transmissionDepthMap=a,this.aspectRatio=l,this.alpha=c,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,r){if(t.extensions.shaderTextureLOD=!0,t.extensions.derivatives=!0,t.isShader("fragment")){t.define("NUM_SAMPLES",30),t.require("worldPosition"),t.requires.worldNormal=!0,t.requires.modelMatrix=!0,t.requires.projectionMatrix=!0,t.addFragmentVariable(this.calpha,"float");let n=t.include(bv.Nodes.transmission),s=[];return s.push(this.thickness.build(t,"f")),s.push(this.ior.build(t,"f")),s.push(this.roughness.build(t,"f")),s.push(this.transmissionSamplerSize.build(t,"v2")),s.push(this.transmissionSamplerMap.getTexture(t,"t")),s.push(this.transmissionDepthMap.getTexture(t,"t")),s.push(this.aspectRatio.build(t,"v2")),s.push("normal"),s.push(this.alpha.build(t,"f")),s.push(this.calpha),t.format(n+"("+s.join(",")+")",this.getType(t),r)}else return console.warn("TransmissionNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),r)}copy(t){return super.copy(this),this.thickness=t.thickness.clone(),this.ior=t.ior.clone(),this.roughness=t.roughness.clone(),this.transmissionSamplerSize=t.transmissionSamplerSize.clone(),this.transmissionSamplerMap=t.transmissionSamplerMap,this.transmissionDepthMap=t.transmissionDepthMap,this.alpha=t.alpha.clone(),this.calpha=t.calpha,this}},lh=bv;lh.Nodes=function(){let t=new Ne(`
|
|
3439
3439
|
float gaussian(vec2 i) {
|
|
3440
3440
|
const float sigma = float(NUM_SAMPLES) * .25;
|
|
3441
3441
|
return exp( -.5* dot(i/=sigma,i) ) / ( 6.28 * sigma*sigma );
|
|
@@ -3522,14 +3522,14 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
3522
3522
|
calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
|
|
3523
3523
|
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
|
|
3524
3524
|
return transmission.rgb;
|
|
3525
|
-
}`,[a])}}();var wv=class extends Ye{constructor(t,r){super("v3");this.nodeType="CustomNormal";this.cnormal=t,this.alpha=r}generate(t,r){if(t.isShader("fragment")){let n=t.include(wv.Nodes.customNormal),s=[];return s.push(this.cnormal.build(t,"v3")),s.push("normal"),s.push(this.alpha.build(t,"f")),t.format(n+"("+s.join(",")+")",this.getType(t),r)}else return console.warn("CustomNormalNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),r)}copy(t){return super.copy(t),this.cnormal.copy(t.cnormal),this.alpha.copy(t.alpha),this}},
|
|
3525
|
+
}`,[a])}}();var wv=class extends Ye{constructor(t,r){super("v3");this.nodeType="CustomNormal";this.cnormal=t,this.alpha=r}generate(t,r){if(t.isShader("fragment")){let n=t.include(wv.Nodes.customNormal),s=[];return s.push(this.cnormal.build(t,"v3")),s.push("normal"),s.push(this.alpha.build(t,"f")),t.format(n+"("+s.join(",")+")",this.getType(t),r)}else return console.warn("CustomNormalNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),r)}copy(t){return super.copy(t),this.cnormal.copy(t.cnormal),this.alpha.copy(t.alpha),this}},ch=wv;ch.Nodes=function(){return{customNormal:new Ne(`vec3 customNormal(vec3 cnormal, vec3 norm, float alpha) {
|
|
3526
3526
|
vec3 normal = packNormalToRGB( norm ).rgb;
|
|
3527
3527
|
normal *= step( vec3(0.5), cnormal );
|
|
3528
3528
|
|
|
3529
3529
|
accumAlpha += ( 1.0 - accumAlpha ) * alpha;
|
|
3530
3530
|
|
|
3531
3531
|
return normal;
|
|
3532
|
-
}`)}}();var Sv=class extends Ye{constructor(t,r,n,s,o,a,l,c){super("v3");this.nodeType="Gradient";this.gradientType=t,this.smooth=r,this.colors=n,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(t,r){if(t.isShader("fragment")){t.define("GRAD_MAX",10),t.require("uv"),t.requires.uv=[!0],t.addFragmentVariable(this.calpha,"float");let n=t.include(Sv.Nodes.gradient),s=[];return s.push(this.gradientType.build(t,"i")),s.push(this.smooth.build(t,"b")),s.push(this.colors.build(t,"v4[]")),s.push(this.steps.build(t,"f[]")),s.push(this.offset.build(t,"v2")),s.push(this.morph.build(t,"v2")),s.push(this.angle.build(t,"f")),s.push(this.alpha.build(t,"f")),s.push(this.calpha),t.format(n+"("+s.join(",")+")",this.getType(t),r)}else return console.warn("GradientNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),r)}copy(t){return super.copy(t),this.gradientType=t.gradientType.clone(),this.smooth=t.smooth.clone(),this.colors=t.colors.clone(),this.steps=t.steps.clone(),this.offset=t.offset.clone(),this.morph=t.morph.clone(),this.angle=t.angle.clone(),this.alpha=t.alpha.clone(),this.calpha=t.calpha,this}},
|
|
3532
|
+
}`)}}();var Sv=class extends Ye{constructor(t,r,n,s,o,a,l,c){super("v3");this.nodeType="Gradient";this.gradientType=t,this.smooth=r,this.colors=n,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(t,r){if(t.isShader("fragment")){t.define("GRAD_MAX",10),t.require("uv"),t.requires.uv=[!0],t.addFragmentVariable(this.calpha,"float");let n=t.include(Sv.Nodes.gradient),s=[];return s.push(this.gradientType.build(t,"i")),s.push(this.smooth.build(t,"b")),s.push(this.colors.build(t,"v4[]")),s.push(this.steps.build(t,"f[]")),s.push(this.offset.build(t,"v2")),s.push(this.morph.build(t,"v2")),s.push(this.angle.build(t,"f")),s.push(this.alpha.build(t,"f")),s.push(this.calpha),t.format(n+"("+s.join(",")+")",this.getType(t),r)}else return console.warn("GradientNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),r)}copy(t){return super.copy(t),this.gradientType=t.gradientType.clone(),this.smooth=t.smooth.clone(),this.colors=t.colors.clone(),this.steps=t.steps.clone(),this.offset=t.offset.clone(),this.morph=t.morph.clone(),this.angle=t.angle.clone(),this.alpha=t.alpha.clone(),this.calpha=t.calpha,this}},uh=Sv;uh.Nodes=function(){return{gradient:new Ne(`vec3 gradient(int gradientType, bool smoothed, vec4 colors[GRAD_MAX], float steps[GRAD_MAX], vec2 offset, vec2 morph, float angle, float alpha, out float calpha) {
|
|
3533
3533
|
vec4 color = colors[0];
|
|
3534
3534
|
vec2 m = morph / vUv.xy;
|
|
3535
3535
|
vec2 rot = vec2( 0.5 + m.x, m.y );
|
|
@@ -3571,7 +3571,7 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
3571
3571
|
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
|
|
3572
3572
|
|
|
3573
3573
|
return color.xyz;
|
|
3574
|
-
}`)}}();var Mv=(t=>(t.NOISE="noise",t.MAP="map",t))(Mv||{}),Av=class extends Ye{constructor(t=new ft(0),r,n,s,o,a){super("v3");this.nodeType="VertexDisplacement";this.displacementTypeIndex=t,this.intensity=r,this.movementOrTexture=n,Object.values(Mv)[this.displacementTypeIndex.value]==="map"&&(this.mat=new Gl(this.movementOrTexture.value.matrix)),this.cropOrOffset=s,this.scale=o,this.noiseFunctionIndex=a}generate(t,r){if(t.isShader("vertex")){t.define("USE_LAYER_DISPLACE");let n,s=[];switch(s.push("displaced_position"),s.push("displaced_normal"),Object.values(Mv)[this.displacementTypeIndex.value]){case"map":{n=t.include(Av.Nodes.map),s.push(this.movementOrTexture.getTexture(t,"t")),s.push("uv"),s.push(this.cropOrOffset.build(t,"f")),this.mat&&s.push(this.mat.build(t,"mat3"));break}case"noise":{let a=Object.values(
|
|
3574
|
+
}`)}}();var Mv=(t=>(t.NOISE="noise",t.MAP="map",t))(Mv||{}),Av=class extends Ye{constructor(t=new ft(0),r,n,s,o,a){super("v3");this.nodeType="VertexDisplacement";this.displacementTypeIndex=t,this.intensity=r,this.movementOrTexture=n,Object.values(Mv)[this.displacementTypeIndex.value]==="map"&&(this.mat=new Gl(this.movementOrTexture.value.matrix)),this.cropOrOffset=s,this.scale=o,this.noiseFunctionIndex=a}generate(t,r){if(t.isShader("vertex")){t.define("USE_LAYER_DISPLACE");let n,s=[];switch(s.push("displaced_position"),s.push("displaced_normal"),Object.values(Mv)[this.displacementTypeIndex.value]){case"map":{n=t.include(Av.Nodes.map),s.push(this.movementOrTexture.getTexture(t,"t")),s.push("uv"),s.push(this.cropOrOffset.build(t,"f")),this.mat&&s.push(this.mat.build(t,"mat3"));break}case"noise":{let a=Object.values(oh)[this.noiseFunctionIndex.value],l=new Ne(`vec3 orthogonal(vec3 v) {
|
|
3575
3575
|
return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));
|
|
3576
3576
|
}`),c=new Ne(`vec3 distorted(vec3 p, vec3 n, float scale, float intensity, vec3 offset, float neighbour_offset, float movement) {
|
|
3577
3577
|
return p + n * ${a}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1)) * intensity;
|
|
@@ -3613,7 +3613,7 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
3613
3613
|
vec3 distorted2 = nearby2 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;
|
|
3614
3614
|
displaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));
|
|
3615
3615
|
return displaced_position;
|
|
3616
|
-
}`,[t,r])}}();var
|
|
3616
|
+
}`,[t,r])}}();var hh=class extends Ye{constructor(t=new He,r=new He,n=new He,s=new He,o=new He,a=new He,l=new He,c=new He,u=new He,h=new He,f=new He,d=new He){super("v3");this.nodeType="Noise";this.scale=t,this.size=r,this.move=n,this.fA=s,this.fB=o,this.distortion=a,this.colorA=l,this.colorB=c,this.colorC=u,this.colorD=h,this.alpha=f,this.noiseType=d,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,r,n,s,o){t.require("uv"),t.requires.uv=[!0],t.addFragmentVariable(this.calpha,"float");let a=Object.values(oh)[this.noiseType.value],l=new Ne(`vec3 ${a}customNoise(float scale, vec3 size, float move, vec2 fA, vec2 fB, vec2 distortion, vec4 colorA, vec4 colorB, vec4 colorC, vec4 colorD, float alpha, out float calpha) {
|
|
3617
3617
|
vec3 st = position / size;
|
|
3618
3618
|
st /= scale;
|
|
3619
3619
|
vec3 q = vec3(${a}(st),
|
|
@@ -3633,7 +3633,7 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
3633
3633
|
|
|
3634
3634
|
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
|
|
3635
3635
|
return clamp(color, 0.0, 1.0).rgb;
|
|
3636
|
-
}`,[wn.simplex,wn.simplexFractal,wn.simplexAshima,wn.fbm,wn.perlin]),c=t.include(l),u=[];return u.push(this.scale.build(t,"f")),u.push(this.size.build(t,"v3")),u.push(this.move.build(t,"f")),u.push(this.fA.build(t,"v2")),u.push(this.fB.build(t,"v2")),u.push(this.distortion.build(t,"v2")),u.push(this.colorA.build(t,"v4")),u.push(this.colorB.build(t,"v4")),u.push(this.colorC.build(t,"v4")),u.push(this.colorD.build(t,"v4")),u.push(this.alpha.build(t,"f")),u.push(this.calpha),t.format(c+"("+u.join(",")+")",this.getType(t),r)}copy(t){return super.copy(t),this.scale.copy(t.scale),this.size.copy(t.size),this.move.copy(t.move),this.fA.copy(t.fA),this.fB.copy(t.fB),this.distortion.copy(t.distortion),this.colorA.copy(t.colorA),this.colorB.copy(t.colorB),this.colorC.copy(t.colorC),this.colorD.copy(t.colorD),this.alpha.copy(t.alpha),this.calpha=t.calpha,this.noiseType.copy(t.noiseType),this}};
|
|
3636
|
+
}`,[wn.simplex,wn.simplexFractal,wn.simplexAshima,wn.fbm,wn.perlin]),c=t.include(l),u=[];return u.push(this.scale.build(t,"f")),u.push(this.size.build(t,"v3")),u.push(this.move.build(t,"f")),u.push(this.fA.build(t,"v2")),u.push(this.fB.build(t,"v2")),u.push(this.distortion.build(t,"v2")),u.push(this.colorA.build(t,"v4")),u.push(this.colorB.build(t,"v4")),u.push(this.colorC.build(t,"v4")),u.push(this.colorD.build(t,"v4")),u.push(this.alpha.build(t,"f")),u.push(this.calpha),t.format(c+"("+u.join(",")+")",this.getType(t),r)}copy(t){return super.copy(t),this.scale.copy(t.scale),this.size.copy(t.size),this.move.copy(t.move),this.fA.copy(t.fA),this.fB.copy(t.fB),this.distortion.copy(t.distortion),this.colorA.copy(t.colorA),this.colorB.copy(t.colorB),this.colorC.copy(t.colorC),this.colorD.copy(t.colorD),this.alpha.copy(t.alpha),this.calpha=t.calpha,this.noiseType.copy(t.noiseType),this}};hh.numOctaves=5;var fh=class extends Ye{constructor(t=new He,r=new He,n=new He,s=new He){super("v3");this.nodeType="Blend";this.a=t,this.b=r,this.alpha=n,this.mode=s}generate(t,r){if(t.isShader("fragment")){let n=[];return n.push(this.a.build(t,"c")),n.push(this.b.build(t,"c")),n.push(this.alpha.build(t,"f")),n.push(this.mode.build(t,"i")),t.format("spe_blend("+n.join(",")+")",this.getType(t),r)}else return console.warn("BlendNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),r)}copy(t){return super.copy(t),this.a.copy(t.a),this.b.copy(t.b),this.alpha.copy(t.alpha),this.mode.copy(t.mode),this}};var Vl=class extends Ye{constructor(t,r,n,s,o,a,l,c,u,h,f,d){super("v3");this.nodeType="Depth";this.gradientType=t,this.smooth=r,this.near=n,this.far=s,this.isVector=o,this.isWorldSpace=a,this.origin=l,this.direction=c,this.colors=u,this.steps=h,this.num=f,this.alpha=d,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,r){let n=`g${this.uuid.toString().replace(/-/g,"")}`,s=new Ne(`vec3 ${n}_sdepth(float near, float far, vec3 origin, vec3 direction, vec4 colors[${n}_MAX_COLORS], float steps[10], float alpha, out float calpha) {
|
|
3637
3637
|
vec4 color = colors[0];
|
|
3638
3638
|
#ifdef ${n}_IS_VECTOR
|
|
3639
3639
|
#ifdef ${n}_LINEAR
|
|
@@ -3673,7 +3673,7 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
3673
3673
|
|
|
3674
3674
|
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
|
|
3675
3675
|
return color.rgb;
|
|
3676
|
-
}`,[Vl.Nodes.vectorLinearWorldSpaceDepth,Vl.Nodes.vectorLinearObjectSpaceDepth,Vl.Nodes.vectorSphericalObjectSpaceDepth,Vl.Nodes.vectorSphericalWorldSpaceDepth]);if(t.isShader("fragment")){t.define(`${n}_MAX_COLORS`,this.num.value+1),this.smooth.value&&t.define(`${n}_SMOOTH`),this.isVector.value>.5&&t.define(`${n}_IS_VECTOR`),this.gradientType.value===0&&t.define(`${n}_LINEAR`),this.isWorldSpace.value>.5&&t.define(`${n}_WORLDSPACE`),t.require("worldPosition"),t.addFragmentVariable(this.calpha,"float");let o=t.include(s),a=[];return a.push(this.near.build(t,"f")),a.push(this.far.build(t,"f")),a.push(this.origin.build(t,"v3")),a.push(this.direction.build(t,"v3")),a.push(this.colors.build(t,"v4[]")),a.push(this.steps.build(t,"f[]")),a.push(this.alpha.build(t,"f")),a.push(this.calpha),t.format(o+"("+a.join(",")+")",this.getType(t),r)}else return console.warn("DepthNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),r)}copy(t){return super.copy(t),this.gradientType=t.gradientType.clone(),this.smooth=t.smooth.clone(),this.near=t.near.clone(),this.far=t.far.clone(),this.isVector=t.isVector.clone(),this.isWorldSpace=t.isWorldSpace.clone(),this.origin=t.origin.clone(),this.direction=t.direction.clone(),this.colors=t.colors.clone(),this.steps=t.steps.clone(),this.alpha=t.alpha.clone(),this.calpha=t.calpha,this}},
|
|
3676
|
+
}`,[Vl.Nodes.vectorLinearWorldSpaceDepth,Vl.Nodes.vectorLinearObjectSpaceDepth,Vl.Nodes.vectorSphericalObjectSpaceDepth,Vl.Nodes.vectorSphericalWorldSpaceDepth]);if(t.isShader("fragment")){t.define(`${n}_MAX_COLORS`,this.num.value+1),this.smooth.value&&t.define(`${n}_SMOOTH`),this.isVector.value>.5&&t.define(`${n}_IS_VECTOR`),this.gradientType.value===0&&t.define(`${n}_LINEAR`),this.isWorldSpace.value>.5&&t.define(`${n}_WORLDSPACE`),t.require("worldPosition"),t.addFragmentVariable(this.calpha,"float");let o=t.include(s),a=[];return a.push(this.near.build(t,"f")),a.push(this.far.build(t,"f")),a.push(this.origin.build(t,"v3")),a.push(this.direction.build(t,"v3")),a.push(this.colors.build(t,"v4[]")),a.push(this.steps.build(t,"f[]")),a.push(this.alpha.build(t,"f")),a.push(this.calpha),t.format(o+"("+a.join(",")+")",this.getType(t),r)}else return console.warn("DepthNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),r)}copy(t){return super.copy(t),this.gradientType=t.gradientType.clone(),this.smooth=t.smooth.clone(),this.near=t.near.clone(),this.far=t.far.clone(),this.isVector=t.isVector.clone(),this.isWorldSpace=t.isWorldSpace.clone(),this.origin=t.origin.clone(),this.direction=t.direction.clone(),this.colors=t.colors.clone(),this.steps=t.steps.clone(),this.alpha=t.alpha.clone(),this.calpha=t.calpha,this}},dh=Vl;dh.Nodes=function(){let t=new Ne(`float vectorLinearWorldSpaceDepth(vec3 direction, vec3 origin, float near, float far) {
|
|
3677
3677
|
vec3 n = normalize(direction);
|
|
3678
3678
|
float dist = (n.x*(vWPosition.x - origin.x) + n.y*(vWPosition.y - origin.y) + n.z*(vWPosition.z - origin.z));
|
|
3679
3679
|
return ( dist - near ) / ( far - near );
|
|
@@ -3687,7 +3687,7 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
3687
3687
|
}`),s=new Ne(`float vectorSphericalObjectSpaceDepth(vec3 origin, float near, float far) {
|
|
3688
3688
|
float dist = length(position - origin);
|
|
3689
3689
|
return ( dist - near ) / ( far - near );
|
|
3690
|
-
}`);return{vectorLinearWorldSpaceDepth:t,vectorLinearObjectSpaceDepth:r,vectorSphericalWorldSpaceDepth:n,vectorSphericalObjectSpaceDepth:s}}();var Tv=class extends Ye{constructor(t,r,n){super("v3");this.nodeType="Matcap";this.texture=t,this.alpha=r,this.mode=n,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,r){if(t.isShader("fragment")){t.addFragmentVariable(this.calpha,"float");let n=t.include(Tv.Nodes.matcap);t.require("normal"),t.requires.normal=!0;let s=[];return s.push(this.texture.getTexture(t,"t")),s.push("normal"),s.push(this.alpha.build(t,"f")),s.push(this.mode.build(t,"i")),s.push(this.calpha),t.format(n+"("+s.join(",")+")",this.getType(t),r)}else return console.warn("MatcapNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),r)}copy(t){return super.copy(t),this.texture=t.texture.clone(),this.alpha=t.alpha.clone(),this.mode=t.mode.clone(),this.calpha=t.calpha,this}},
|
|
3690
|
+
}`);return{vectorLinearWorldSpaceDepth:t,vectorLinearObjectSpaceDepth:r,vectorSphericalWorldSpaceDepth:n,vectorSphericalObjectSpaceDepth:s}}();var Tv=class extends Ye{constructor(t,r,n){super("v3");this.nodeType="Matcap";this.texture=t,this.alpha=r,this.mode=n,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,r){if(t.isShader("fragment")){t.addFragmentVariable(this.calpha,"float");let n=t.include(Tv.Nodes.matcap);t.require("normal"),t.requires.normal=!0;let s=[];return s.push(this.texture.getTexture(t,"t")),s.push("normal"),s.push(this.alpha.build(t,"f")),s.push(this.mode.build(t,"i")),s.push(this.calpha),t.format(n+"("+s.join(",")+")",this.getType(t),r)}else return console.warn("MatcapNode is not compatible with "+t.shader+" shader."),t.format("vec3( 0.0 )",this.getType(t),r)}copy(t){return super.copy(t),this.texture=t.texture.clone(),this.alpha=t.alpha.clone(),this.mode=t.mode.clone(),this.calpha=t.calpha,this}},ph=Tv;ph.Nodes=function(){return{matcap:new Ne(`vec3 matcap(sampler2D matcapTex, vec3 normal, float alpha, int mode, out float calpha) {
|
|
3691
3691
|
vec3 viewDir = normalize( vViewPosition );
|
|
3692
3692
|
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
|
3693
3693
|
vec3 y = cross( viewDir, x );
|
|
@@ -3699,7 +3699,7 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
3699
3699
|
|
|
3700
3700
|
return matcapColor.rgb;
|
|
3701
3701
|
}
|
|
3702
|
-
`)}}();var Zr=class{constructor(e){this.id=2,this.layerCount=2,this.uuid=et.generateUUID(),this.needsUpdate=!1,this._material=e,this._layerNodes=[];let t=this._createLayer({id:0,type:"color"});this._material.color=t.color,this._material.alpha===void 0&&(this._material.alpha=new Be(1));let r=new Be(1),n=new ft(0);"shadingAlpha"in this._material&&"shadingBlend"in this._material&&(this._material.shadingAlpha=r,this._material.shadingBlend=n),this._layerNodes.push({id:0,type:"color",color:t.color,alpha:t.alpha,mode:t.mode}),this._layerNodes.push({id:1,type:"light",alpha:r,mode:n}),this.head=t.layer,this.head.next=new Zt(1,void 0,{type:"light",alpha:r,mode:n}),this.attachLightNodes(this.getLightLayer())}get material(){return this._material}set material(e){var s;this._material=e;let t,r,n=this.head;for(;n!==void 0;){if(n.type==="light"){t=n.uniforms[`f${n.id}_alpha`],r=n.uniforms[`f${n.id}_mode`];break}n=n.next}"shadingAlpha"in this._material&&"shadingBlend"in this._material&&(this._material.shadingAlpha=t,this._material.shadingBlend=r),this.attachLightNodes((s=e.userData.layers)==null?void 0:s.getLightLayer()),this.blendColors(),this.blendAfterColors(),this.blendPositions()}getLayersOfType(e){let t=[],r=this.head;for(;r;)r.type===e&&t.push(r),r=r.next;return t}addLayer(e){var n;if(e.id=(n=e.id)!=null?n:++this.id,this.layerCount++,e.type==="light"){let s=this.createLightLayer(e);return this.uuid=et.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),s}let t=this._createLayer(e),r=t.layer;if(this.head===void 0)this.head=r;else{let s=this.head;for(;s.next!=null;)s=s.next;s.next=r}return t.color&&this._layerNodes.push({id:r.id,type:"color",color:t.color,alpha:t.alpha,mode:t.mode}),t.position&&this._layerNodes.push({id:r.id,type:"position",position:t.position}),this.uuid=et.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),r}addLayerBeforeAt(e,t){var a;let r=this.head;e.id=(a=e.id)!=null?a:++this.id,this.layerCount++;let n=this._createLayer(e),s=n.layer;s.next=t;let o=0;if(r===t)this.head=s,n.color&&this._layerNodes.splice(0,0,{id:s.id,type:"color",color:n.color,alpha:n.alpha,mode:n.mode}),n.position&&this._layerNodes.splice(0,0,{id:s.id,type:"position",position:n.position});else{for(o=1;(r==null?void 0:r.next)!==t;)r=r==null?void 0:r.next,o++;r.next=s,n.color&&this._layerNodes.splice(o,0,{id:s.id,type:"color",color:n.color,alpha:n.alpha,mode:n.mode}),n.position&&this._layerNodes.splice(o,0,{id:s.id,type:"position",position:n.position})}return this.uuid=et.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 r=this._createLayer(t),n=r.layer;if(r.color&&this._layerNodes.splice(e,0,{id:n.id,type:"color",color:r.color,alpha:r.alpha,mode:r.mode}),r.position&&this._layerNodes.splice(e,0,{id:n.id,type:"position",position:r.position}),e==0)n.next=this.head,this.head=n;else{let o=this.head,a=this.head.next;for(let l=0;l<e-1;l++)o=a,a=a.next;n.next=a,o.next=n}return this.uuid=et.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),n}removeLayer(e){let t=this.head,r,n=0;if((t==null?void 0:t.id)==e)this.head=t.next;else for(n=1,r=t,t=t==null?void 0:t.next;t!=null;){if(t.id==e){r.next=t.next;break}n++,r=t,t=t.next}return this.cleanupChangedLayer(t),this.blendColors(),this.blendAfterColors(),this.blendPositions(),this.uuid=et.generateUUID(),this.layerCount--,n}changeLayer(e,t){let r,n=this.head,s;if((n==null?void 0:n.id)==e){let o=this._createLayer(se({id:e,uuid:n.uuid},t));s=o.layer,s.next=n.next,this.head=s,o.color&&(this._layerNodes[0]={id:s.id,type:"color",color:o.color,alpha:o.alpha,mode:o.mode}),o.position&&(this._layerNodes[0]={id:s.id,type:"position",position:o.position}),s.uniforms[`f${e}_mode`].value=n.uniforms[`f${e}_mode`].value,s.uniforms[`f${e}_alpha`].value=n.uniforms[`f${e}_alpha`].value}else{r=n,n=n.next;let o=1;for(;n!=null;){if(n.id==e){let a=this._createLayer(se({id:e,uuid:n.uuid},t));s=a.layer,r.next=s,s.next=n.next,a.color&&(this._layerNodes[o]={id:e,type:"color",color:a.color,alpha:a.alpha,mode:a.mode}),a.position&&(this._layerNodes[o]={id:e,type:"position",position:a.position}),s.uniforms[`f${e}_mode`].value=n.uniforms[`f${e}_mode`].value,s.uniforms[`f${e}_alpha`].value=n.uniforms[`f${e}_alpha`].value;break}r=n,n=n.next,o++}}return this.uuid=et.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}getLayerByUuid(e){let t=this.head;for(;t!==void 0;){if(t.uuid===e)return t;t=t.next}}getLayers(){let e=[],t=this.head;for(;t!=null;)e.push(t),t=t.next;return e}getLayerPosition(e){let t=this.head,r=0;for(;t!==void 0&&t.id!=e;)r++,t=t.next;return r}getDefines(){}getBeforeProgram(){}getLightingProgram(){}getAfterProgram(){}getVarPrograms(){}getUniforms(){}moveLayer(e,t){let r,n=this.head,s;if(e==0)r=this.head,this.head=r.next;else{for(let a=0;a<e;a++)s=n,n=n.next;s.next=n.next,r=n}if(n=this.head,s=void 0,t==0)r.next=this.head,this.head=r;else{for(let a=0;a<t-1;a++)n=n.next;r.next=n==null?void 0:n.next,n.next=r}let o=this._layerNodes.splice(e,1)[0];this._layerNodes.splice(t,0,o),this.uuid=et.generateUUID(),this.blendColors(),this.blendAfterColors()}updateLayerUniform(){this.uuid=et.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,r=this.head;for(;t.next!=null;)this.rebuildLayerNodes(r,t.next),r=r.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 Be(e.alpha),r=new ft(e.mode);this._material.shadingAlpha=t,this._material.shadingBlend=r,this._layerNodes.push({id:e.id,type:"light",alpha:t,mode:r});let n=new Zt(e.id,void 0,{type:"light",alpha:t,mode:r});if(this.head===void 0)this.head=n;else{let s=this.head;for(;s.next!=null;)s=s.next;s.next=n}return this.attachLightNodes(this.getLightLayer()),n}rebuildLayerNodes(e,t,r=!1){if(t.type==="light"){let n=r?t.uniforms[`f${t.id}_alpha`]:new Be(t.uniforms[`f${t.id}_alpha`].value),s=r?t.uniforms[`f${t.id}_mode`]:new ft(t.uniforms[`f${t.id}_mode`].value);this._material.shadingAlpha=n,this._material.shadingBlend=s,this._layerNodes.push({id:t.id,type:"light",alpha:n,mode:s}),this.head===void 0?this.head=new Zt(t.id,t.uuid,{type:"light",alpha:n,mode:s}):e&&(e.next=new Zt(t.id,t.uuid,{type:"light",alpha:n,mode:s})),this.attachLightNodes(t)}else{let n={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))n[o]=t.uniforms[a].value.map(l=>l.clone&&!r?l.clone():l);else{let l=t.uniforms[a].value;if(o==="transmissionDepthMap"){n[o]=l;continue}l!=null&&(n[o]=l.clone&&!r&&!l.isRenderTargetTexture?l.clone():l)}}this.addLayer(n)}}attachLightNodes(e){var n,s,o,a,l,c,u,h,f,d,m;let t={},r=this.getLightLayer();switch(this._material.userData.category){case"Lambert":t.emissive=new Rt((s=(n=e==null?void 0:e.getValue("emissive"))==null?void 0:n.clone())!=null?s:0);break;case"Phong":t.shininess=new Be((o=e==null?void 0:e.getValue("shininess"))!=null?o:30),t.specular=new Rt((l=(a=e==null?void 0:e.getValue("specular"))==null?void 0:a.clone())!=null?l:1118481);break;case"Toon":t.shininess=new Be((c=e==null?void 0:e.getValue("shininess"))!=null?c:30),t.specular=new Rt((h=(u=e==null?void 0:e.getValue("specular"))==null?void 0:u.clone())!=null?h:1118481);break;case"Physical":t.roughness=new Be((f=e==null?void 0:e.getValue("roughness"))!=null?f:.3),t.metalness=new Be((d=e==null?void 0:e.getValue("metalness"))!=null?d:0),t.reflectivity=new Be((m=e==null?void 0:e.getValue("reflectivity"))!=null?m:.5);break;default:break}Object.keys(t).forEach(p=>{this._material[p]=t[p],r.uniforms[`f${r.id}_${p}`]=t[p]})}clone(e){return new Zr(e).copy(this)}toJSON(e){return{id:this.id,uuid:this.uuid,head:this.head.toJSON(e)}}fromJSON(e,t,r){let n=new Zt(e.head.id,void 0,{type:e.head.type}).fromJSON(e.head,t),s=e.head.next,o=n;for(;s!=null;)o.next=new Zt(s.id,void 0,{type:s.type}).fromJSON(s,t),s=s.next,o=o.next;this._layerNodes=[],this.head=void 0,this.rebuildLayerNodes(this.head,n,!0);let a=n;for(o=this.head;a.next!=null;)this.rebuildLayerNodes(o,a.next,!0),o=o.next,a=a.next;return this._material=r,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 r,n,s,o,a,l,c,u,h,f,d,m,p,g,y,v,b,w,x,E,T,S,I,C,M,_,R,B,O,z,q,F,ee,k,V,U,J,K,$,j,ge,ae,le,W,ue,Y,H,Q,ce,ie,pe,ve,me,De,ke,P,L,te,ye,Se,Pe,Fe,he,rt,st,Ae,G,Me,Ce,Ke,Oe,Ze,_e,nt,pt,ht,Ot,Nr,ta;let t=e.type;switch(t){case"color":{let We=new Rt((r=e.color)!=null?r:5855577),dt=new Be((n=e.alpha)!=null?n:1),at=new zt("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");at.keywords.alpha=dt;let ut=new ft((s=e.mode)!=null?s:0);return We.alpha=dt,{layer:new Zt(e.id,e.uuid,{type:t,color:We,alpha:dt,calpha:at,mode:ut}),color:We,alpha:at,mode:ut}}case"texture":{let We=(o=e.texture)!=null?o:new Ni,dt=We.matrix;e.mat&&dt.copy(e.mat),We.needsUpdate=!0;let at=new Be((a=e.crop)!=null?a:0),ut=new ft((l=e.projection)!=null?l:0),vt=new ft((c=e.axis)!=null?c:0),Lt=new Ir(e.size?new N(e.size[0],e.size[1]):new N(100,100)),Ft=new Be((u=e.alpha)!=null?u:1),D=new ft((h=e.mode)!=null?h:0),X=new Hr(We),ne=new Rr((f=e.textureSize)!=null?f:new A(We.image?We.image.width:0,We.image?We.image.height:0)),re=new rh(X,ne,at,ut,vt,Lt,Ft,D),fe=new zt(re.calpha,"f");return{layer:new Zt(e.id,e.uuid,{type:t,texture:X,textureSize:ne,crop:at,projection:ut,axis:vt,size:Lt,mat:re.mat,alpha:Ft,calpha:fe,mode:D}),color:re,alpha:fe,mode:D}}case"matcap":{let We=(d=e.texture)!=null?d:new Ni;We.needsUpdate=!0;let dt=new Be((m=e.alpha)!=null?m:1),at=new Hr(We),ut=new ft((p=e.mode)!=null?p:0),vt=new dh(at,dt,ut),Lt=new zt(vt.calpha,"f");return{layer:new Zt(e.id,e.uuid,{type:t,texture:at,alpha:dt,calpha:Lt,mode:ut}),color:vt,alpha:Lt,mode:ut}}case"fresnel":{let We=new Rt((g=e.color)!=null?g:16777215),dt=new Be((y=e.bias)!=null?y:.1),at=new Be((v=e.scale)!=null?v:1),ut=new Be((b=e.intensity)!=null?b:2),vt=new Be((w=e.factor)!=null?w:1),Lt=new Be((x=e.alpha)!=null?x:1),Ft=new ft((E=e.mode)!=null?E:0),D=new ih(We,dt,at,ut,vt,Lt,Ft),X=new zt(D.calpha,"f");return{layer:new Zt(e.id,e.uuid,{type:t,color:We,bias:dt,scale:at,intensity:ut,factor:vt,alpha:Lt,calpha:X,mode:Ft}),color:D,alpha:X,mode:Ft}}case"rainbow":{let We=new Be((T=e.filmThickness)!=null?T:30),dt=new Be((S=e.movement)!=null?S:0),at=new Rr((I=e.wavelengths)!=null?I:new A(0,0,0)),ut=new Be((C=e.noiseStrength)!=null?C:0),vt=new Be((M=e.noiseScale)!=null?M:1),Lt=new Rr((_=e.offset)!=null?_:new A(0,0,0)),Ft=new Be((R=e.alpha)!=null?R:1),D=new oh(We,dt,at,ut,vt,Lt,Ft),X=new zt(D.calpha,"f"),ne=new ft((B=e.mode)!=null?B:0);return{layer:new Zt(e.id,e.uuid,{type:t,filmThickness:We,movement:dt,wavelengths:at,noiseStrength:ut,noiseScale:vt,offset:Lt,alpha:Ft,calpha:X,mode:ne}),color:D,alpha:X,mode:ne}}case"transmission":{let We=new Be((O=e.thickness)!=null?O:10),dt=new Be((z=e.ior)!=null?z:1.5),at=new Be((q=e.roughness)!=null?q:.5),ut=new Ir((F=e.transmissionSamplerSize)!=null?F:new N(2048,2048)),vt=(ee=e.transmissionSamplerMap)!=null?ee:new Ni,Lt=(k=e.transmissionDepthMap)!=null?k:new Ni,Ft=new Hr(vt),D=new Hr(Lt),X=window.innerWidth,ne=window.innerHeight,re=X>=ne?new Ir(ne/X,1):new Ir(1,X/ne),fe=new Be((V=e.alpha)!=null?V:1),Ve=new ah(We,dt,at,ut,Ft,D,re,fe),$e=new zt(Ve.calpha,"f"),it=new ft((U=e.mode)!=null?U:0);return{layer:new Zt(e.id,e.uuid,{type:t,thickness:We,ior:dt,roughness:at,transmissionSamplerSize:ut,transmissionSamplerMap:Ft,transmissionDepthMap:D,aspectRatio:re,alpha:fe,calpha:$e,mode:it}),color:Ve,alpha:$e,mode:it}}case"depth":{let We=new ft((J=e.gradientType)!=null?J:0),dt=new th((K=e.smooth)!=null?K:!1),at=new Be(($=e.near)!=null?$:50),ut=new Be((j=e.far)!=null?j:200),vt=new Be((ge=e.isVector)!=null?ge:1),Lt=new Be((ae=e.isWorldSpace)!=null?ae:0),Ft=new Rr((le=e.origin)!=null?le:new A),D=new Rr((W=e.direction)!=null?W:new A),X=new ft((ue=e.num)!=null?ue:0),ne;e.colors?ne=new fs(X.value+1,e.colors):(ne=new fs(X.value+1,new Qe(0,0,0,1)),ne.value[1]=new Qe(1,1,1,1));let re;e.steps?re=new Jo(e.steps.length,e.steps):(re=new Jo(10,1),re.value[0]=0);let fe=new Be((Y=e.alpha)!=null?Y:1),Ve=new ft((H=e.mode)!=null?H:0),$e=new fh(We,dt,at,ut,vt,Lt,Ft,D,ne,re,X,fe),it=new zt($e.calpha,"f");return{layer:new Zt(e.id,e.uuid,{type:t,gradientType:We,smooth:dt,near:at,far:ut,isVector:vt,isWorldSpace:Lt,origin:Ft,direction:D,colors:ne,steps:re,num:X,alpha:fe,calpha:it,mode:Ve}),color:$e,alpha:it,mode:Ve}}case"noise":{let We=new Be((Q=e.scale)!=null?Q:1),dt=new Rr((ce=e.size)!=null?ce:new A(100,100,100)),at=new Be((ie=e.move)!=null?ie:1),ut=new Ir((pe=e.fA)!=null?pe:new N(1.7,9.2)),vt=new Ir((ve=e.fB)!=null?ve:new N(8.3,2.8)),Lt=new Ir((me=e.distortion)!=null?me:new N(1,1)),Ft=new hi(e.colorA),D=new hi(e.colorB),X=new hi(e.colorC),ne=new hi(e.colorD),re=new Be((De=e.alpha)!=null?De:1),fe=new ft((ke=e.mode)!=null?ke:0),Ve=new ft((P=e.noiseType)!=null?P:0),$e=new uh(We,dt,at,ut,vt,Lt,Ft,D,X,ne,re,Ve),it=new zt($e.calpha,"f");return{layer:new Zt(e.id,e.uuid,{type:t,scale:We,size:dt,move:at,fA:ut,fB:vt,distortion:Lt,colorA:Ft,colorB:D,colorC:X,colorD:ne,alpha:re,calpha:it,mode:fe,noiseType:Ve}),color:$e,alpha:it,mode:fe}}case"normal":{let We=new Rr((L=e.cnormal)!=null?L:new A(1,1,1)),dt=new Be((te=e.alpha)!=null?te:1),at=new ft((ye=e.mode)!=null?ye:0),ut=new lh(We,dt),vt=new zt("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");return vt.keywords.alpha=dt,{layer:new Zt(e.id,e.uuid,{type:t,cnormal:We,alpha:dt,calpha:vt,mode:at}),color:ut,alpha:vt,mode:at}}case"gradient":{let We=new ft((Se=e.gradientType)!=null?Se:0),dt=new th((Pe=e.smooth)!=null?Pe:!1),at;e.colors?at=new fs(e.colors.length,e.colors):(at=new fs(10,new Qe(0,0,0,1)),at.value[1]=new Qe(1,1,1,1));let ut;e.steps?ut=new Jo(e.steps.length,e.steps):(ut=new Jo(10,1),ut.value[0]=0);let vt=new Ir((Fe=e.offset)!=null?Fe:new N(0,0)),Lt=new Ir((he=e.morph)!=null?he:new N(0,0)),Ft=new Be((rt=e.angle)!=null?rt:0),D=new Be((st=e.alpha)!=null?st:1),X=new ft((Ae=e.mode)!=null?Ae:0),ne=new ch(We,dt,at,ut,vt,Lt,Ft,D),re=new zt(ne.calpha,"f");return{layer:new Zt(e.id,e.uuid,{type:t,gradientType:We,smooth:dt,colors:at,steps:ut,offset:vt,morph:Lt,angle:Ft,alpha:D,calpha:re,mode:X}),color:ne,alpha:re,mode:X}}case"displace":{let We=new ft((G=e.displacementType)!=null?G:0);if(We.value===0){let dt=new Rr((Me=e.offset)!=null?Me:new A(0,0,0)),at=new Be((Ce=e.scale)!=null?Ce:10),ut=new Be((Ke=e.intensity)!=null?Ke:8),vt=new Be((Oe=e.movement)!=null?Oe:1),Lt=new Be((Ze=e.alpha)!=null?Ze:1),Ft=new ft((_e=e.mode)!=null?_e:0),D=new ft((nt=e.noiseType)!=null?nt:0),X=new kl(We,ut,vt,dt,at,D);return{layer:new Zt(e.id,e.uuid,{displacementType:We,type:t,offset:dt,scale:at,intensity:ut,movement:vt,alpha:Lt,mode:Ft,noiseType:D}),position:X}}else if(We.value===1){let dt=(pt=e.texture)!=null?pt:new Ni,at=dt.matrix;e.mat&&at.copy(e.mat),dt.needsUpdate=!0;let ut=new Be((ht=e.intensity)!=null?ht:8),vt=new Hr(dt),Lt=new Be((Ot=e.crop)!=null?Ot:0),Ft=new Be((Nr=e.alpha)!=null?Nr:1),D=new ft((ta=e.mode)!=null?ta:0),X=new kl(We,ut,vt,Lt);return{layer:new Zt(e.id,e.uuid,{displacementType:We,type:t,intensity:ut,texture:vt,crop:Lt,mat:X.mat,alpha:Ft,mode:D}),position:X}}return{}}}return{}}blendColors(){let e=this._layerNodes.findIndex(r=>r.type==="color"),t=this._layerNodes.findIndex(r=>r.type==="light");if(e!==-1&&e<t){let r=this._layerNodes[e].color;for(let n=e+1;n<t;++n){let s=this._layerNodes[n];s.type==="color"&&(r=new hh(r,s.color,s.alpha,s.mode))}this._material.color=r}else this._material.color=void 0}blendAfterColors(){let e=new zt("outgoingLight","f"),t=this._layerNodes.findIndex(r=>r.type==="light");if(this._layerNodes.length>t+1){for(let r=t+1;r<this._layerNodes.length;++r){let n=this._layerNodes[r];n.type==="color"&&(e=new hh(e,n.color,n.alpha,n.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==="position");if(e.length>0){let t=e[0].position;for(let r=1;r<e.length;++r)e[r]&&(t=new bn(t,e[r].position,bn.ADD),t=new bn(t,new Be(.5).setReadonly(!0),bn.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"displace":{this.blendPositions();break}default:{this.blendColors(),this.blendAfterColors();break}}}};var In=class extends St{constructor(t,r,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=t!=null?t:new eh(new Wr(Wr.PROJECTION)),this.fragment=r!=null?r:new eh(new Rt(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(t,r){this.build({renderer:r}),t.defines=this.defines,t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.extensionDerivatives=this.extensions.derivatives===!0,t.extensionFragDepth=this.extensions.fragDepth===!0,t.extensionDrawBuffers=this.extensions.drawBuffers===!0,t.extensionShaderTextureLOD=this.extensions.shaderTextureLOD===!0}_getLayerStack(t){let r=new Zr(this);return t&&(async()=>{for(;t.image===void 0;)await new Promise(n=>requestAnimationFrame(n));r.addLayerAt(1,{type:"texture",texture:t}),this.dispose()})(),r}clampUniformsForPreview(t,r){let n=(s,o,a)=>Math.min(Math.max(s,o),a);if(this.userData.layers){for(let s of this.userData.layers.getLayers())if(s.type=="displace"){this.uniformsBackup[`f${s.id}_intensity`]=s.uniforms[`f${s.id}_intensity`].value;let o=n(s.uniforms[`f${s.id}_intensity`].value,t,r);s.uniforms[`f${s.id}_intensity`].value=o}}}restoreClampedUniforms(){if(this.userData.layers)for(let t of this.userData.layers.getLayers())t.type=="displace"&&(t.uniforms[`f${t.id}_intensity`].value=this.uniformsBackup[`f${t.id}_intensity`])}customProgramCacheKey(){return this.getHash()}updateFrame(t){for(let r=0;r<this.updaters.length;++r)t.updateNode(this.updaters[r])}build(t){var n;t=t!=null?t:{};let r=(n=t.builder)!=null?n:new Sp;return r.setMaterial(this,t.renderer),r.build(this.vertex,this.fragment),this.vertexShader=r.getCode("vertex"),this.fragmentShader=r.getCode("fragment"),this.defines=r.defines,this.uniforms=r.uniforms,this.extensions=r.extensions,this.updaters=r.updaters,this.fog=r.requires.fog,this.lights=r.requires.lights,this.transparent=r.requires.transparent||this.blending>Es,this}getHash(){let t="{";return t+='"vertex":'+this.vertex.getHash()+",",t+='"fragment":'+this.fragment.getHash(),t+="}",t}copy(t){let r=this.uuid;for(let n in t)this[n]=t[n];return this.uuid=r,t.userData!==void 0&&(this.userData=JSON.parse(JSON.stringify(t.userData))),this}toJSON(t){let r=this.userData.layers;this.userData.layers=void 0;let n=super.toJSON(t);return n.type="ShaderMaterial",n.userData={type:this.userData.type,category:this.userData.category,nodeType:this.type,layers:r.toJSON(t)},n.vertex=this.vertex.toJSON(t).uuid,n.fragment=this.fragment.toJSON(t).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,t&&!t.materials[this.uuid]&&(t.materials[this.uuid]=n),this.userData.layers=r,n}fromJSON(t,r){var n;this.defines=(n=t.defines)!=null?n:{},this.depthFunc=t.depthFunc,this.depthWrite=t.depthWrite,this.side=t.side!==void 0?t.side:ii,this.transparent=t.transparent,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.wireframe=t.wireframe,this.userData.layers.fromJSON(t.userData.layers,r,this)}};Object.defineProperties(In.prototype,{properties:{get:function(){return this.fragment.properties}},needsUpdate:{set:function(i){i===!0&&this.version++,this.needsCompile=i},get:function(){return this.needsCompile}}});var Mp=class extends He{constructor(){super("basic");this.nodeType="Basic";this.color=new Rt(5855577)}generate(t){let r;if(t.isShader("vertex")){let n=this.position?this.position.analyzeAndFlow(t,"v3",{cache:"position"}):void 0;t.mergeUniform(li.merge([we.fog])),t.addParsCode(["varying vec3 vViewPosition;","#include <fog_pars_vertex>","#include <normal_pars_vertex>"].join(`
|
|
3702
|
+
`)}}();var Zr=class{constructor(e){this.id=2,this.layerCount=2,this.uuid=et.generateUUID(),this.needsUpdate=!1,this._material=e,this._layerNodes=[];let t=this._createLayer({id:0,type:"color"});this._material.color=t.color,this._material.alpha===void 0&&(this._material.alpha=new Be(1));let r=new Be(1),n=new ft(0);"shadingAlpha"in this._material&&"shadingBlend"in this._material&&(this._material.shadingAlpha=r,this._material.shadingBlend=n),this._layerNodes.push({id:0,type:"color",color:t.color,alpha:t.alpha,mode:t.mode}),this._layerNodes.push({id:1,type:"light",alpha:r,mode:n}),this.head=t.layer,this.head.next=new Zt(1,void 0,{type:"light",alpha:r,mode:n}),this.attachLightNodes(this.getLightLayer())}get material(){return this._material}set material(e){var s;this._material=e;let t,r,n=this.head;for(;n!==void 0;){if(n.type==="light"){t=n.uniforms[`f${n.id}_alpha`],r=n.uniforms[`f${n.id}_mode`];break}n=n.next}"shadingAlpha"in this._material&&"shadingBlend"in this._material&&(this._material.shadingAlpha=t,this._material.shadingBlend=r),this.attachLightNodes((s=e.userData.layers)==null?void 0:s.getLightLayer()),this.blendColors(),this.blendAfterColors(),this.blendPositions()}getLayersOfType(e){let t=[],r=this.head;for(;r;)r.type===e&&t.push(r),r=r.next;return t}addLayer(e){var n;if(e.id=(n=e.id)!=null?n:++this.id,this.layerCount++,e.type==="light"){let s=this.createLightLayer(e);return this.uuid=et.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),s}let t=this._createLayer(e),r=t.layer;if(this.head===void 0)this.head=r;else{let s=this.head;for(;s.next!=null;)s=s.next;s.next=r}return t.color&&this._layerNodes.push({id:r.id,type:"color",color:t.color,alpha:t.alpha,mode:t.mode}),t.position&&this._layerNodes.push({id:r.id,type:"position",position:t.position}),this.uuid=et.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),r}addLayerBeforeAt(e,t){var a;let r=this.head;e.id=(a=e.id)!=null?a:++this.id,this.layerCount++;let n=this._createLayer(e),s=n.layer;s.next=t;let o=0;if(r===t)this.head=s,n.color&&this._layerNodes.splice(0,0,{id:s.id,type:"color",color:n.color,alpha:n.alpha,mode:n.mode}),n.position&&this._layerNodes.splice(0,0,{id:s.id,type:"position",position:n.position});else{for(o=1;(r==null?void 0:r.next)!==t;)r=r==null?void 0:r.next,o++;r.next=s,n.color&&this._layerNodes.splice(o,0,{id:s.id,type:"color",color:n.color,alpha:n.alpha,mode:n.mode}),n.position&&this._layerNodes.splice(o,0,{id:s.id,type:"position",position:n.position})}return this.uuid=et.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 r=this._createLayer(t),n=r.layer;if(r.color&&this._layerNodes.splice(e,0,{id:n.id,type:"color",color:r.color,alpha:r.alpha,mode:r.mode}),r.position&&this._layerNodes.splice(e,0,{id:n.id,type:"position",position:r.position}),e==0)n.next=this.head,this.head=n;else{let o=this.head,a=this.head.next;for(let l=0;l<e-1;l++)o=a,a=a.next;n.next=a,o.next=n}return this.uuid=et.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),n}removeLayer(e){let t=this.head,r,n=0;if((t==null?void 0:t.id)==e)this.head=t.next;else for(n=1,r=t,t=t==null?void 0:t.next;t!=null;){if(t.id==e){r.next=t.next;break}n++,r=t,t=t.next}return this.cleanupChangedLayer(t),this.blendColors(),this.blendAfterColors(),this.blendPositions(),this.uuid=et.generateUUID(),this.layerCount--,n}changeLayer(e,t){let r,n=this.head,s;if((n==null?void 0:n.id)==e){let o=this._createLayer(se({id:e,uuid:n.uuid},t));s=o.layer,s.next=n.next,this.head=s,o.color&&(this._layerNodes[0]={id:s.id,type:"color",color:o.color,alpha:o.alpha,mode:o.mode}),o.position&&(this._layerNodes[0]={id:s.id,type:"position",position:o.position}),s.uniforms[`f${e}_mode`].value=n.uniforms[`f${e}_mode`].value,s.uniforms[`f${e}_alpha`].value=n.uniforms[`f${e}_alpha`].value}else{r=n,n=n.next;let o=1;for(;n!=null;){if(n.id==e){let a=this._createLayer(se({id:e,uuid:n.uuid},t));s=a.layer,r.next=s,s.next=n.next,a.color&&(this._layerNodes[o]={id:e,type:"color",color:a.color,alpha:a.alpha,mode:a.mode}),a.position&&(this._layerNodes[o]={id:e,type:"position",position:a.position}),s.uniforms[`f${e}_mode`].value=n.uniforms[`f${e}_mode`].value,s.uniforms[`f${e}_alpha`].value=n.uniforms[`f${e}_alpha`].value;break}r=n,n=n.next,o++}}return this.uuid=et.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}getLayerByUuid(e){let t=this.head;for(;t!==void 0;){if(t.uuid===e)return t;t=t.next}}getLayers(){let e=[],t=this.head;for(;t!=null;)e.push(t),t=t.next;return e}getLayerPosition(e){let t=this.head,r=0;for(;t!==void 0&&t.id!=e;)r++,t=t.next;return r}getDefines(){}getBeforeProgram(){}getLightingProgram(){}getAfterProgram(){}getVarPrograms(){}getUniforms(){}moveLayer(e,t){let r,n=this.head,s;if(e==0)r=this.head,this.head=r.next;else{for(let a=0;a<e;a++)s=n,n=n.next;s.next=n.next,r=n}if(n=this.head,s=void 0,t==0)r.next=this.head,this.head=r;else{for(let a=0;a<t-1;a++)n=n.next;r.next=n==null?void 0:n.next,n.next=r}let o=this._layerNodes.splice(e,1)[0];this._layerNodes.splice(t,0,o),this.uuid=et.generateUUID(),this.blendColors(),this.blendAfterColors()}updateLayerUniform(){this.uuid=et.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,r=this.head;for(;t.next!=null;)this.rebuildLayerNodes(r,t.next),r=r.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 Be(e.alpha),r=new ft(e.mode);this._material.shadingAlpha=t,this._material.shadingBlend=r,this._layerNodes.push({id:e.id,type:"light",alpha:t,mode:r});let n=new Zt(e.id,void 0,{type:"light",alpha:t,mode:r});if(this.head===void 0)this.head=n;else{let s=this.head;for(;s.next!=null;)s=s.next;s.next=n}return this.attachLightNodes(this.getLightLayer()),n}rebuildLayerNodes(e,t,r=!1){if(t.type==="light"){let n=r?t.uniforms[`f${t.id}_alpha`]:new Be(t.uniforms[`f${t.id}_alpha`].value),s=r?t.uniforms[`f${t.id}_mode`]:new ft(t.uniforms[`f${t.id}_mode`].value);this._material.shadingAlpha=n,this._material.shadingBlend=s,this._layerNodes.push({id:t.id,type:"light",alpha:n,mode:s}),this.head===void 0?this.head=new Zt(t.id,t.uuid,{type:"light",alpha:n,mode:s}):e&&(e.next=new Zt(t.id,t.uuid,{type:"light",alpha:n,mode:s})),this.attachLightNodes(t)}else{let n={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))n[o]=t.uniforms[a].value.map(l=>l.clone&&!r?l.clone():l);else{let l=t.uniforms[a].value;if(o==="transmissionDepthMap"){n[o]=l;continue}l!=null&&(n[o]=l.clone&&!r&&!l.isRenderTargetTexture?l.clone():l)}}this.addLayer(n)}}attachLightNodes(e){var n,s,o,a,l,c,u,h,f,d,m;let t={},r=this.getLightLayer();switch(this._material.userData.category){case"Lambert":t.emissive=new Rt((s=(n=e==null?void 0:e.getValue("emissive"))==null?void 0:n.clone())!=null?s:0);break;case"Phong":t.shininess=new Be((o=e==null?void 0:e.getValue("shininess"))!=null?o:30),t.specular=new Rt((l=(a=e==null?void 0:e.getValue("specular"))==null?void 0:a.clone())!=null?l:1118481);break;case"Toon":t.shininess=new Be((c=e==null?void 0:e.getValue("shininess"))!=null?c:30),t.specular=new Rt((h=(u=e==null?void 0:e.getValue("specular"))==null?void 0:u.clone())!=null?h:1118481);break;case"Physical":t.roughness=new Be((f=e==null?void 0:e.getValue("roughness"))!=null?f:.3),t.metalness=new Be((d=e==null?void 0:e.getValue("metalness"))!=null?d:0),t.reflectivity=new Be((m=e==null?void 0:e.getValue("reflectivity"))!=null?m:.5);break;default:break}Object.keys(t).forEach(p=>{this._material[p]=t[p],r.uniforms[`f${r.id}_${p}`]=t[p]})}clone(e){return new Zr(e).copy(this)}toJSON(e){return{id:this.id,uuid:this.uuid,head:this.head.toJSON(e)}}fromJSON(e,t,r){let n=new Zt(e.head.id,void 0,{type:e.head.type}).fromJSON(e.head,t),s=e.head.next,o=n;for(;s!=null;)o.next=new Zt(s.id,void 0,{type:s.type}).fromJSON(s,t),s=s.next,o=o.next;this._layerNodes=[],this.head=void 0,this.rebuildLayerNodes(this.head,n,!0);let a=n;for(o=this.head;a.next!=null;)this.rebuildLayerNodes(o,a.next,!0),o=o.next,a=a.next;return this._material=r,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 r,n,s,o,a,l,c,u,h,f,d,m,p,g,y,v,b,w,x,E,T,S,I,C,M,_,R,B,O,z,q,F,ee,k,V,U,J,K,$,j,ge,ae,le,W,ue,Y,H,Q,ce,ie,pe,ve,me,De,ke,P,L,te,ye,Se,Pe,Fe,he,rt,st,Ae,G,Me,Ce,Ke,Oe,Ze,_e,nt,pt,ht,Ot,Nr,ta;let t=e.type;switch(t){case"color":{let We=new Rt((r=e.color)!=null?r:5855577),dt=new Be((n=e.alpha)!=null?n:1),at=new zt("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");at.keywords.alpha=dt;let ut=new ft((s=e.mode)!=null?s:0);return We.alpha=dt,{layer:new Zt(e.id,e.uuid,{type:t,color:We,alpha:dt,calpha:at,mode:ut}),color:We,alpha:at,mode:ut}}case"texture":{let We=(o=e.texture)!=null?o:new Ni,dt=We.matrix;e.mat&&dt.copy(e.mat),We.needsUpdate=!0;let at=new Be((a=e.crop)!=null?a:0),ut=new ft((l=e.projection)!=null?l:0),vt=new ft((c=e.axis)!=null?c:0),Lt=new Ir(e.size?new N(e.size[0],e.size[1]):new N(100,100)),Ft=new Be((u=e.alpha)!=null?u:1),D=new ft((h=e.mode)!=null?h:0),X=new Hr(We),ne=new Rr((f=e.textureSize)!=null?f:new A(We.image?We.image.width:0,We.image?We.image.height:0)),re=new nh(X,ne,at,ut,vt,Lt,Ft,D),fe=new zt(re.calpha,"f");return{layer:new Zt(e.id,e.uuid,{type:t,texture:X,textureSize:ne,crop:at,projection:ut,axis:vt,size:Lt,mat:re.mat,alpha:Ft,calpha:fe,mode:D}),color:re,alpha:fe,mode:D}}case"matcap":{let We=(d=e.texture)!=null?d:new Ni;We.needsUpdate=!0;let dt=new Be((m=e.alpha)!=null?m:1),at=new Hr(We),ut=new ft((p=e.mode)!=null?p:0),vt=new ph(at,dt,ut),Lt=new zt(vt.calpha,"f");return{layer:new Zt(e.id,e.uuid,{type:t,texture:at,alpha:dt,calpha:Lt,mode:ut}),color:vt,alpha:Lt,mode:ut}}case"fresnel":{let We=new Rt((g=e.color)!=null?g:16777215),dt=new Be((y=e.bias)!=null?y:.1),at=new Be((v=e.scale)!=null?v:1),ut=new Be((b=e.intensity)!=null?b:2),vt=new Be((w=e.factor)!=null?w:1),Lt=new Be((x=e.alpha)!=null?x:1),Ft=new ft((E=e.mode)!=null?E:0),D=new sh(We,dt,at,ut,vt,Lt,Ft),X=new zt(D.calpha,"f");return{layer:new Zt(e.id,e.uuid,{type:t,color:We,bias:dt,scale:at,intensity:ut,factor:vt,alpha:Lt,calpha:X,mode:Ft}),color:D,alpha:X,mode:Ft}}case"rainbow":{let We=new Be((T=e.filmThickness)!=null?T:30),dt=new Be((S=e.movement)!=null?S:0),at=new Rr((I=e.wavelengths)!=null?I:new A(0,0,0)),ut=new Be((C=e.noiseStrength)!=null?C:0),vt=new Be((M=e.noiseScale)!=null?M:1),Lt=new Rr((_=e.offset)!=null?_:new A(0,0,0)),Ft=new Be((R=e.alpha)!=null?R:1),D=new ah(We,dt,at,ut,vt,Lt,Ft),X=new zt(D.calpha,"f"),ne=new ft((B=e.mode)!=null?B:0);return{layer:new Zt(e.id,e.uuid,{type:t,filmThickness:We,movement:dt,wavelengths:at,noiseStrength:ut,noiseScale:vt,offset:Lt,alpha:Ft,calpha:X,mode:ne}),color:D,alpha:X,mode:ne}}case"transmission":{let We=new Be((O=e.thickness)!=null?O:10),dt=new Be((z=e.ior)!=null?z:1.5),at=new Be((q=e.roughness)!=null?q:.5),ut=new Ir((F=e.transmissionSamplerSize)!=null?F:new N(2048,2048)),vt=(ee=e.transmissionSamplerMap)!=null?ee:new Ni,Lt=(k=e.transmissionDepthMap)!=null?k:new Ni,Ft=new Hr(vt),D=new Hr(Lt),X=window.innerWidth,ne=window.innerHeight,re=X>=ne?new Ir(ne/X,1):new Ir(1,X/ne),fe=new Be((V=e.alpha)!=null?V:1),Ve=new lh(We,dt,at,ut,Ft,D,re,fe),$e=new zt(Ve.calpha,"f"),it=new ft((U=e.mode)!=null?U:0);return{layer:new Zt(e.id,e.uuid,{type:t,thickness:We,ior:dt,roughness:at,transmissionSamplerSize:ut,transmissionSamplerMap:Ft,transmissionDepthMap:D,aspectRatio:re,alpha:fe,calpha:$e,mode:it}),color:Ve,alpha:$e,mode:it}}case"depth":{let We=new ft((J=e.gradientType)!=null?J:0),dt=new rh((K=e.smooth)!=null?K:!1),at=new Be(($=e.near)!=null?$:50),ut=new Be((j=e.far)!=null?j:200),vt=new Be((ge=e.isVector)!=null?ge:1),Lt=new Be((ae=e.isWorldSpace)!=null?ae:0),Ft=new Rr((le=e.origin)!=null?le:new A),D=new Rr((W=e.direction)!=null?W:new A),X=new ft((ue=e.num)!=null?ue:0),ne;e.colors?ne=new fs(X.value+1,e.colors):(ne=new fs(X.value+1,new Qe(0,0,0,1)),ne.value[1]=new Qe(1,1,1,1));let re;e.steps?re=new Jo(e.steps.length,e.steps):(re=new Jo(10,1),re.value[0]=0);let fe=new Be((Y=e.alpha)!=null?Y:1),Ve=new ft((H=e.mode)!=null?H:0),$e=new dh(We,dt,at,ut,vt,Lt,Ft,D,ne,re,X,fe),it=new zt($e.calpha,"f");return{layer:new Zt(e.id,e.uuid,{type:t,gradientType:We,smooth:dt,near:at,far:ut,isVector:vt,isWorldSpace:Lt,origin:Ft,direction:D,colors:ne,steps:re,num:X,alpha:fe,calpha:it,mode:Ve}),color:$e,alpha:it,mode:Ve}}case"noise":{let We=new Be((Q=e.scale)!=null?Q:1),dt=new Rr((ce=e.size)!=null?ce:new A(100,100,100)),at=new Be((ie=e.move)!=null?ie:1),ut=new Ir((pe=e.fA)!=null?pe:new N(1.7,9.2)),vt=new Ir((ve=e.fB)!=null?ve:new N(8.3,2.8)),Lt=new Ir((me=e.distortion)!=null?me:new N(1,1)),Ft=new hi(e.colorA),D=new hi(e.colorB),X=new hi(e.colorC),ne=new hi(e.colorD),re=new Be((De=e.alpha)!=null?De:1),fe=new ft((ke=e.mode)!=null?ke:0),Ve=new ft((P=e.noiseType)!=null?P:0),$e=new hh(We,dt,at,ut,vt,Lt,Ft,D,X,ne,re,Ve),it=new zt($e.calpha,"f");return{layer:new Zt(e.id,e.uuid,{type:t,scale:We,size:dt,move:at,fA:ut,fB:vt,distortion:Lt,colorA:Ft,colorB:D,colorC:X,colorD:ne,alpha:re,calpha:it,mode:fe,noiseType:Ve}),color:$e,alpha:it,mode:fe}}case"normal":{let We=new Rr((L=e.cnormal)!=null?L:new A(1,1,1)),dt=new Be((te=e.alpha)!=null?te:1),at=new ft((ye=e.mode)!=null?ye:0),ut=new ch(We,dt),vt=new zt("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");return vt.keywords.alpha=dt,{layer:new Zt(e.id,e.uuid,{type:t,cnormal:We,alpha:dt,calpha:vt,mode:at}),color:ut,alpha:vt,mode:at}}case"gradient":{let We=new ft((Se=e.gradientType)!=null?Se:0),dt=new rh((Pe=e.smooth)!=null?Pe:!1),at;e.colors?at=new fs(e.colors.length,e.colors):(at=new fs(10,new Qe(0,0,0,1)),at.value[1]=new Qe(1,1,1,1));let ut;e.steps?ut=new Jo(e.steps.length,e.steps):(ut=new Jo(10,1),ut.value[0]=0);let vt=new Ir((Fe=e.offset)!=null?Fe:new N(0,0)),Lt=new Ir((he=e.morph)!=null?he:new N(0,0)),Ft=new Be((rt=e.angle)!=null?rt:0),D=new Be((st=e.alpha)!=null?st:1),X=new ft((Ae=e.mode)!=null?Ae:0),ne=new uh(We,dt,at,ut,vt,Lt,Ft,D),re=new zt(ne.calpha,"f");return{layer:new Zt(e.id,e.uuid,{type:t,gradientType:We,smooth:dt,colors:at,steps:ut,offset:vt,morph:Lt,angle:Ft,alpha:D,calpha:re,mode:X}),color:ne,alpha:re,mode:X}}case"displace":{let We=new ft((G=e.displacementType)!=null?G:0);if(We.value===0){let dt=new Rr((Me=e.offset)!=null?Me:new A(0,0,0)),at=new Be((Ce=e.scale)!=null?Ce:10),ut=new Be((Ke=e.intensity)!=null?Ke:8),vt=new Be((Oe=e.movement)!=null?Oe:1),Lt=new Be((Ze=e.alpha)!=null?Ze:1),Ft=new ft((_e=e.mode)!=null?_e:0),D=new ft((nt=e.noiseType)!=null?nt:0),X=new kl(We,ut,vt,dt,at,D);return{layer:new Zt(e.id,e.uuid,{displacementType:We,type:t,offset:dt,scale:at,intensity:ut,movement:vt,alpha:Lt,mode:Ft,noiseType:D}),position:X}}else if(We.value===1){let dt=(pt=e.texture)!=null?pt:new Ni,at=dt.matrix;e.mat&&at.copy(e.mat),dt.needsUpdate=!0;let ut=new Be((ht=e.intensity)!=null?ht:8),vt=new Hr(dt),Lt=new Be((Ot=e.crop)!=null?Ot:0),Ft=new Be((Nr=e.alpha)!=null?Nr:1),D=new ft((ta=e.mode)!=null?ta:0),X=new kl(We,ut,vt,Lt);return{layer:new Zt(e.id,e.uuid,{displacementType:We,type:t,intensity:ut,texture:vt,crop:Lt,mat:X.mat,alpha:Ft,mode:D}),position:X}}return{}}}return{}}blendColors(){let e=this._layerNodes.findIndex(r=>r.type==="color"),t=this._layerNodes.findIndex(r=>r.type==="light");if(e!==-1&&e<t){let r=this._layerNodes[e].color;for(let n=e+1;n<t;++n){let s=this._layerNodes[n];s.type==="color"&&(r=new fh(r,s.color,s.alpha,s.mode))}this._material.color=r}else this._material.color=void 0}blendAfterColors(){let e=new zt("outgoingLight","f"),t=this._layerNodes.findIndex(r=>r.type==="light");if(this._layerNodes.length>t+1){for(let r=t+1;r<this._layerNodes.length;++r){let n=this._layerNodes[r];n.type==="color"&&(e=new fh(e,n.color,n.alpha,n.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==="position");if(e.length>0){let t=e[0].position;for(let r=1;r<e.length;++r)e[r]&&(t=new bn(t,e[r].position,bn.ADD),t=new bn(t,new Be(.5).setReadonly(!0),bn.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"displace":{this.blendPositions();break}default:{this.blendColors(),this.blendAfterColors();break}}}};var In=class extends St{constructor(t,r,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=t!=null?t:new th(new Wr(Wr.PROJECTION)),this.fragment=r!=null?r:new th(new Rt(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(t,r){this.build({renderer:r}),t.defines=this.defines,t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.extensionDerivatives=this.extensions.derivatives===!0,t.extensionFragDepth=this.extensions.fragDepth===!0,t.extensionDrawBuffers=this.extensions.drawBuffers===!0,t.extensionShaderTextureLOD=this.extensions.shaderTextureLOD===!0}_getLayerStack(t){let r=new Zr(this);return t&&(async()=>{for(;t.image===void 0;)await new Promise(n=>requestAnimationFrame(n));r.addLayerAt(1,{type:"texture",texture:t}),this.dispose()})(),r}clampUniformsForPreview(t,r){let n=(s,o,a)=>Math.min(Math.max(s,o),a);if(this.userData.layers){for(let s of this.userData.layers.getLayers())if(s.type=="displace"){this.uniformsBackup[`f${s.id}_intensity`]=s.uniforms[`f${s.id}_intensity`].value;let o=n(s.uniforms[`f${s.id}_intensity`].value,t,r);s.uniforms[`f${s.id}_intensity`].value=o}}}restoreClampedUniforms(){if(this.userData.layers)for(let t of this.userData.layers.getLayers())t.type=="displace"&&(t.uniforms[`f${t.id}_intensity`].value=this.uniformsBackup[`f${t.id}_intensity`])}customProgramCacheKey(){return this.getHash()}updateFrame(t){for(let r=0;r<this.updaters.length;++r)t.updateNode(this.updaters[r])}build(t){var n;t=t!=null?t:{};let r=(n=t.builder)!=null?n:new Sp;return r.setMaterial(this,t.renderer),r.build(this.vertex,this.fragment),this.vertexShader=r.getCode("vertex"),this.fragmentShader=r.getCode("fragment"),this.defines=r.defines,this.uniforms=r.uniforms,this.extensions=r.extensions,this.updaters=r.updaters,this.fog=r.requires.fog,this.lights=r.requires.lights,this.transparent=r.requires.transparent||this.blending>Es,this}getHash(){let t="{";return t+='"vertex":'+this.vertex.getHash()+",",t+='"fragment":'+this.fragment.getHash(),t+="}",t}copy(t){let r=this.uuid;for(let n in t)this[n]=t[n];return this.uuid=r,t.userData!==void 0&&(this.userData=JSON.parse(JSON.stringify(t.userData))),this}toJSON(t){let r=this.userData.layers;this.userData.layers=void 0;let n=super.toJSON(t);return n.type="ShaderMaterial",n.userData={type:this.userData.type,category:this.userData.category,nodeType:this.type,layers:r.toJSON(t)},n.vertex=this.vertex.toJSON(t).uuid,n.fragment=this.fragment.toJSON(t).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,t&&!t.materials[this.uuid]&&(t.materials[this.uuid]=n),this.userData.layers=r,n}fromJSON(t,r){var n;this.defines=(n=t.defines)!=null?n:{},this.depthFunc=t.depthFunc,this.depthWrite=t.depthWrite,this.side=t.side!==void 0?t.side:ii,this.transparent=t.transparent,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.wireframe=t.wireframe,this.userData.layers.fromJSON(t.userData.layers,r,this)}};Object.defineProperties(In.prototype,{properties:{get:function(){return this.fragment.properties}},needsUpdate:{set:function(i){i===!0&&this.version++,this.needsCompile=i},get:function(){return this.needsCompile}}});var Mp=class extends He{constructor(){super("basic");this.nodeType="Basic";this.color=new Rt(5855577)}generate(t){let r;if(t.isShader("vertex")){let n=this.position?this.position.analyzeAndFlow(t,"v3",{cache:"position"}):void 0;t.mergeUniform(li.merge([we.fog])),t.addParsCode(["varying vec3 vViewPosition;","#include <fog_pars_vertex>","#include <normal_pars_vertex>"].join(`
|
|
3703
3703
|
`));let s=["#include <beginnormal_vertex>",`
|
|
3704
3704
|
#if !defined( USE_LAYER_DISPLACE )
|
|
3705
3705
|
#include <defaultnormal_vertex>
|
|
@@ -3947,9 +3947,9 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
3947
3947
|
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${l.result}, ${c.result} );
|
|
3948
3948
|
}
|
|
3949
3949
|
`),u&&d.push(u.code,`outgoingLight = spe_blend(outgoingLight, ${u.result}, 1.0, SPE_BLENDING_NORMAL);`),h?d.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${h.result} );`):d.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),d.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),r=d.join(`
|
|
3950
|
-
`)}return r}copy(t){return super.copy(t),t.color&&(this.color=t.color.clone()),this.roughness=t.roughness.clone(),this.metalness=t.metalness.clone(),t.position&&(this.position=t.position.clone()),t.afterColor&&(this.afterColor=t.afterColor.clone()),t.alpha&&(this.alpha=t.alpha.clone()),t.reflectivity&&(this.reflectivity=t.reflectivity.clone()),t.shadingAlpha&&(this.shadingAlpha=t.shadingAlpha.clone()),t.shadingBlend&&(this.shadingBlend=t.shadingBlend.clone()),this}};var Ip=class extends In{constructor(t=new Pp,r){super(t,t,r);this.type="StandardNodeMaterial",this.fragment=t}get color(){return this.fragment.color}set color(t){this.fragment.color=t}get afterColor(){return this.fragment.afterColor}set afterColor(t){this.fragment.afterColor=t}get alpha(){return this.fragment.alpha}set alpha(t){this.fragment.alpha=t}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(t){this.fragment.shadingAlpha=t}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(t){this.fragment.shadingBlend=t}get position(){return this.fragment.position}set position(t){this.fragment.position=t}get roughness(){return this.fragment.roughness}set roughness(t){this.fragment.roughness=t}get metalness(){return this.fragment.metalness}set metalness(t){this.fragment.metalness=t}get reflectivity(){return this.fragment.reflectivity}set reflectivity(t){this.fragment.reflectivity=t}};var jl=class extends Ip{constructor(e,t,r){super(t,e),this.userData.type="PhysicalMaterial",this.userData.category="Physical",this.userData.layers=r!=null?r: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 Zr){let t=e.userData.layers,r=e.fragment;super.copy(e);let n=r.clone();this.fragment=n,this.vertex=n;let s=t.clone(this);this.userData.layers=s,n.shadingAlpha.value=r.shadingAlpha.value,n.shadingBlend.value=r.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,r){let n=r.getNode(t.vertex),s=new jl(void 0,n);return s.fromJSON(t,r),s}dispose(){super.dispose()}};function Rp(i,e){switch(i.data.type){case"light":return pi(i);case"fresnel":return iF(i,e);case"gradient":return sF(i);case"depth":return oF(i);case"normal":return aF(i);case"noise":return lF(i,e);case"texture":return cF(i,e);case"rainbow":return uF(i);case"transmission":return hF(i,e);case"matcap":return fF(i,e);case"displace":return dF(i);case"color":default:return nF(i,e)}}function C1(i){return{type:i.data.type}}function pi(i){let{alpha:e,mode:t}=i.data;return be(se({},C1(i)),{alpha:e,mode:t})}function nF(i,e){return be(se({},pi(i)),{color:fr(i.data.color,e)})}function iF(i,e){let{bias:t,scale:r,intensity:n,factor:s,color:o}=i.data;return be(se({},pi(i)),{color:fr(o,e),bias:t,scale:r,intensity:n,factor:s})}function sF(i){let{gradientType:e,smooth:t,colors:r,steps:n,angle:s,offset:o,morph:a}=i.data;return be(se({},pi(i)),{gradientType:e,smooth:t,colors:r.map(l=>new Qe(l[0],l[1],l[2],l[3])),num:r.length,steps:n,offset:new N(...o),morph:new N(...a),angle:s})}function oF(i){let{gradientType:e,near:t,far:r,isVector:n,isWorldSpace:s,origin:o,direction:a,colors:l,steps:c,smooth:u,num:h}=i.data;return be(se({},pi(i)),{gradientType:e,near:t,far:r,isVector:n,isWorldSpace:s,origin:new A(...o),direction:a?new A(...a):new A(1,0,0),num:h,colors:l.map(f=>new Qe(f[0],f[1],f[2],f[3])),steps:c,smooth:u})}function aF(i){let{cnormal:e}=i.data;return be(se({},pi(i)),{cnormal:new A(e[0],e[1],e[2])})}function lF(i,e){let{data:t}=i;return be(se({},pi(i)),{scale:t.scale,move:t.move,fA:new N(...t.fA),fB:new N(...t.fB),size:new A(...t.size),distortion:new N(...t.distortion),colorA:fr(t.colorA,e),colorB:fr(t.colorB,e),colorC:fr(t.colorC,e),colorD:fr(t.colorD,e),noiseType:t.noiseType})}function cF(i,e){let{projection:t,axis:r,crop:n,size:s}=i.data,{image:o,wrapping:a,repeat:l,offset:c}=i.data.texture,u=new _t,h;if(typeof o=="string")h=e==null?void 0:e.getImage(o);else{let f=new Image;f.src=o.data,f.onload=()=>{e!=null&&e.onImageLoad&&(e==null||e.onImageLoad(o.data))},h=f}return u.image=h,u.repeat.set(l[0],l[1]),u.offset.set(c[0],c[1]),u.wrapS=u.wrapT=a,be(se({},pi(i)),{texture:u,mat:new Nt().setUvTransform(c[0],c[1],l[0],l[1],0,0,0),crop:n,projection:t,axis:["x","y","z"].indexOf(r),size:s})}function uF(i){let{data:e}=i;return be(se({},pi(i)),{filmThickness:e.filmThickness,movement:e.movement,wavelengths:new A(...e.wavelengths),noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,offset:new A(...e.offset)})}function hF(i,e){let{data:t}=i;return be(se({},pi(i)),{thickness:t.thickness,ior:t.ior,roughness:t.roughness,transmissionSamplerMap:e.transmissionSamplerMap,transmissionDepthMap:e.transmissionDepthMap})}function fF(i,e){let t=new _t,{image:r}=i.data.texture,n;if(typeof r=="string")n=e==null?void 0:e.getImage(r);else{let o=new Image;o.src=r.data,o.onload=()=>{e!=null&&e.onImageLoad&&(e==null||e.onImageLoad(r.data))},n=o}t.image=n;let s=16777215;return be(se({},pi(i)),{color:s,texture:t})}function dF(i){let{data:e}=i,t=be(se({},C1(i)),{intensity:e.intensity});if(e.displacementType==="noise")return be(se({},t),{offset:new A(...e.offset),scale:e.scale,movement:e.movement,noiseType:e.noiseType});{let r=new _t,n=new Nt().setUvTransform(0,0,1,1,0,0,0);return be(se({},t),{texture:r,mat:n,crop:e.crop})}}function Bp(i,e,t){if(t.type==="displace"&&(i==="intensity"||i==="visible")){let r=e.uniforms[`f${e.id}_intensity`];return r?(r.value=t.intensity*(t.visible?1:0),r):void 0}if(t.type!=="displace"&&(i==="alpha"||i==="visible")){let r=e.uniforms[`f${e.id}_alpha`];return r?(r.value=t.alpha*(t.visible?1:0),r):void 0}}var ql;(e=>{function i(t){return new xe(t.x,t.y,t.z).getHex()}e.getHex=i})(ql||(ql={}));var L1;(e=>{function i(t){return new Qe(t.r,t.g,t.b,t.a)}e.getThreeVector4=i})(L1||(L1={}));var D1;(t=>{function i(r,n){r.setRGB(n.r,n.g,n.b)}t.setThreeColor=i;function e(r){return new xe(r.r,r.g,r.b).getHex()}t.getHex=e})(D1||(D1={}));function ph(i,e){return typeof i=="string"?e.getMaterialOrDeletedPlaceholder(i):Ev(i,e)}function P1(i,e){return i.map(t=>ph(t,e))}function Ev(i,e){var o,a;let t=(o=i.layers)!=null?o:Ri.defaultTwoLayerData("phong").layers,r=pF(t),n;switch(r.category){case"basic":n=new jr;break;case"lambert":{n=new Hl;break}case"toon":{n=new Wl;break}case"physical":n=new jl;break;case"phong":default:{n=new Rn;break}}n.name=(a=i.name)!=null?a:"Untitled Material";let s=n.userData.layers;mF(s);for(let l=t.length-1;l>=0;l--)gF(s,t[l],e);switch(r.category){case"basic":break;case"lambert":{let u=n,f=fr(r.emissive,e);f instanceof xe?u.emissive.value=f:u.emissive.value.setHex(ql.getHex(f));break}case"toon":{let u=n,h=r;u.shininess.value=h.shininess;let f=fr(h.specular,e);f instanceof xe?u.specular.value=f:u.specular.value.setHex(ql.getHex(f));break}case"physical":let l=n,c=r;l.metalness.value=c.metalness,l.roughness.value=c.roughness,l.reflectivity.value=c.reflectivity;break;case"phong":default:{let u=n,h=r;u.shininess.value=h.shininess;let f=fr(h.specular,e);f instanceof xe?u.specular.value=f:u.specular.value.setHex(ql.getHex(f));break}}return s.blendColors(),s.blendAfterColors(),s.blendPositions(),n}function pF(i){for(let e of i)if(e.data.type==="light")return e.data;return{type:"light",category:"basic",visible:!0,alpha:1,mode:0}}function mF(i){for(let e of i.getLayers())i.removeLayer(e.id)}function gF(i,e,t){let r=Rp(e,t);r.type==="transmission"&&(r.transmissionSamplerMap=t==null?void 0:t.transmissionSamplerMap,r.transmissionDepthMap=t==null?void 0:t.transmissionDepthMap);let n=i.addLayer(r);n.uuid=e.id;for(let s in e.data)Bp(s,n,e.data)}var I1=i=>i.tagName==="VIDEO",Qo=class{static resize(e,t,r){let n=e/t,s;if(!r.image)return;let o=r.image;I1(o)?s=o.videoWidth/o.videoHeight:s=o.width/o.height,n>s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*s/n):r.repeat.set(1,1*s/n)),n<s&&(r.imageType=="WEBCAM"?r.repeat.set(1*n/s*-1,1):r.repeat.set(1*n/s,1)),n==s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(e,t,r){let n=e/t,s=r.image!==void 0?r.image.width/r.image.height:1,o;n>s?o={x:1,y:s/n}:n<s?o={x:n/s,y:1}:o={x:1,y:1},r.repeat.set(o.x,o.y),r.updateMatrix()}static resizeTextureLayers(e,t,r){let n=r.userData.layers,s=n.getLayers();for(let o=0;o<s.length;o++){let a=s[o];E1(a)&&(Qo.resizeTextureLayer(e,t,a.uniforms[`f${a.id}_texture`].value),n.updateLayerUniform())}}static resizeComplex(e,t,r,n){let s=e/t,o,a=r.image;I1(a)?o=a.videoWidth/a.videoHeight:o=a.width/a.height,n.geometry.type.includes("Shape")?(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t*o/s):r.repeat.set(1/e,1/t*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*s/o*-1,1/t):r.repeat.set(1/e*s/o,1/t)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t):r.repeat.set(1/e,1/t))):(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*o/s):r.repeat.set(1,1*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1*s/o*-1,1):r.repeat.set(1*s/o,1)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1)))}};var Xl=class extends Xt{constructor(t,r=new jr){super(t,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(t){super.updateGeometry(t),this.material.userData.layers&&Qo.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}resizeGeometry(t,r){super.resizeGeometry(t,r,0),this.material.userData.layers&&Qo.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}toJSON(t){let r=super.toJSON(t);return r.object.objectType="Mesh2D",r}clone(){let t=super.clone();return t.updateGeometry({}),t}static fromTexture(t){let r,n;if(t instanceof eu){let a=t.image;r=a.videoWidth*.5,n=a.videoHeight*.5}else{let a=t.image;r=a.width*.5,n=a.height*.5}let s=gp.create({parameters:{width:r,height:n}}),o=new jr;return o.layersList.changeLayer(0,{type:"texture",texture:t}),o.layersList.moveLayer(0,1),o.dispose(),new Xl(s,o)}};var yF=new A(0,0,1),R1=new A,B1=new A,N1=new Nt,ao=class extends Xt{constructor(t=Gr.create({}),r=new jr({side:ir})){var n;super(t,r);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new jt;this._onShapeUpdate=()=>{if(this.geometry instanceof so){if(this.geometry.updateFromShape()){let t=this.geometry.drawCount,r=this.geometry.userData;this.updateGeometry(Object.assign(this.geometry.userData,{parameters:Object.assign(r.parameters,{surfaceMaxCount:t+1e3})}))}}else this.updateGeometry({});this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=t.userData.shape,(n=this.shape.eventDispatcher)==null||n.addEventListener("update",this._onShapeUpdate)}toJSON(t){let r=super.toJSON(t);return r.object.objectType="VectorObject",r}fromState(t){return super.fromState(t),this.shape.update(),this}setHelperVisibility(){}updateGeometry(t){if(super.updateGeometry(t),"userData"in this.geometry){let r=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:r})}}setShape(t){var r,n;this.shape&&((r=this.shape.eventDispatcher)==null||r.removeEventListener("update",this._onShapeUpdate)),this.shape=t,(n=this.shape.eventDispatcher)==null||n.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),N1.getNormalMatrix(this.matrixWorld),R1.copy(yF).applyMatrix3(N1).normalize(),B1.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(R1,B1)}clone(t){let r=this.shape.clone(),n=this.material.clone(),s=this.geometry.userData,o=Gr.create(Object.assign({},s,{shape:r})),a=new ao(o,n).copy(this,t);return a.shape=r,r.update(),a}raycast(t,r){Xt.prototype.raycast.call(this,t,r)}};var Ui=i=>{var e;return e=class extends i{constructor(){super(...arguments);this.isObjectHelper=!0}},e.geometryHelper=new mn(30,30,30),e};var Np=new si,_v=new Yr,O1=new Ee,zi=(i,e,t,r,n=!1)=>{let s=e,o=i.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),_v.copy(s.boundingSphere),_v.applyMatrix4(o),t.ray.intersectsSphere(_v)===!1||(O1.copy(o).invert(),Np.copy(t.ray).applyMatrix4(O1),s.boundingBox!==null&&Np.intersectsBox(s.boundingBox)===!1))return;let a,l,c,u,h=s.index,f=s.attributes.position,d=s.drawRange,m,p;if(n===!1){let y=Math.max(0,d.start),v=Math.min(h.count,d.start+d.count);for(m=y,p=v;m<p;m+=3)if(l=h.getX(m),c=h.getX(m+1),u=h.getX(m+2),a=g(i,t,Np,f,l,c,u),a){a.faceIndex=Math.floor(m/3),r.push(a);return}}else{let v=s.attributes.position,b=new A,w=new A,x=new A,E=new A,T=2,I=1/((i.scale.x+i.scale.y+i.scale.z)/3),C=I*I,M=Math.max(0,d.start),_=Math.min(v.count,d.start+d.count);for(let R=M,B=_-1;R<B;R+=T){if(b.fromBufferAttribute(v,R),w.fromBufferAttribute(v,R+1),Np.distanceSqToSegment(b,w,E,x)>C)continue;E.applyMatrix4(i.matrixWorld);let z=t.ray.origin.distanceTo(E);z<t.near||z>t.far||r.push({distance:z,point:x.clone().applyMatrix4(i.matrixWorld),object:i})}}function g(y,v,b,w,x,E,T){let S=new A,I=new A,C=new A,M=new A,_=new A;if(S.fromBufferAttribute(w,x),I.fromBufferAttribute(w,E),C.fromBufferAttribute(w,T),b.intersectTriangle(S,I,C,!1,M)===null)return null;_.copy(M),_.applyMatrix4(y.matrixWorld);let B=v.ray.origin.distanceTo(_);return B<v.near||B>v.far?null:{faceIndex:1,distance:B,point:_.clone(),object:y}}};var Op=new A,Jn=new zn,Cv=class extends ai{constructor(t){let r=new Ie,n=new Ur({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],o=[],a={},l=new xe(15711266),c=new xe(15711266),u=new xe(2857471);h("n1","n2",l),h("n2","n4",l),h("n4","n3",l),h("n3","n1",l),h("f1","f2",l),h("f2","f4",l),h("f4","f3",l),h("f3","f1",l),h("n1","f1",l),h("n2","f2",l),h("n3","f3",l),h("n4","f4",l),h("p","n1",c),h("p","n2",c),h("p","n3",c),h("p","n4",c),h("u1","u2",u),h("u2","u3",u),h("u3","u1",u);function h(d,m,p){f(d,p),f(m,p)}function f(d,m){s.push(0,0,0),o.push(m.r,m.g,m.b),a[d]===void 0&&(a[d]=[]),a[d].push(s.length/3-1)}r.setAttribute("position",new Le(s,3)),r.setAttribute("color",new Le(o,3));super(r,n);this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let t=this.geometry,r=this.pointMap,n=!0;Jn.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,o=1,a=n?.8:1e-4;mi("n1",r,t,Jn,-s,-o,a),mi("n2",r,t,Jn,s,-o,a),mi("n3",r,t,Jn,-s,o,a),mi("n4",r,t,Jn,s,o,a);let l=a;mi("f1",r,t,Jn,-s,-o,l),mi("f2",r,t,Jn,s,-o,l),mi("f3",r,t,Jn,-s,o,l),mi("f4",r,t,Jn,s,o,l);let c=l,u=.5;mi("u1",r,t,Jn,s*.7*u,o*1.1,c),mi("u2",r,t,Jn,-s*.7*u,o*1.1,c),mi("u3",r,t,Jn,0,o*(1.1+.9*u),c),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function mi(i,e,t,r,n,s,o){Op.set(n,s,o).unproject(r);let a=e[i];if(a!==void 0){let l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],Op.x,Op.y,Op.z)}}var Fp=class extends Ui(Cv){constructor(t){super(t);this.object=t;this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,r){zi(this.object,this.geometry,t,r,!0)}};var Yl=class extends Ui(qf){constructor(t,r=15,n=10066329){super(t,r,n);this.object=t;this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,r){zi(this.object,Yl.geometryHelper,t,r)}};var Jl=class extends Ui(Xf){constructor(t,r=15){super(r);this.object=t;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}raycast(t,r){zi(this.object,Jl.geometryHelper,t,r)}update(){}};var Ql=class extends Ui(jf){constructor(t,r=15,n=6710886){super(t,r,n);this.object=t;this.name=`PointLightHelper: ${t.uuid}`}raycast(t,r){zi(this.object,Ql.geometryHelper,t,r)}};var Up=class extends Ui(Wf){constructor(t,r=6710886){super(t,r);this.object=t;this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,r){zi(this.object,Up.geometryHelper,t,r)}update(){if(this.object!==void 0){let t=Up._vector,r=this.object.distance?this.object.distance:1e3,n=r*Math.tan(this.object.angle);this.cone.scale.set(n,n,r),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let o=0,a=this.cone.material.length;o<a;o++)this.cone.material[o].color.set(s);else this.cone.material.color.set(s)}}},mh=Up;mh._vector=new A;var Gi=(i,e)=>class extends i{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 s of this.children)Xn(s)&&s.traverseEntity(o=>{hs(o)&&o.visible&&(o.objectHelper.visible=n)})}raycast(n,s){this.objectHelper.raycast(n,s)}copy(n,s=!0){return super.copy(n,s),n.enableHelper!==void 0&&(this.enableHelper=n.enableHelper),n.objectHelper!==void 0&&(this.objectHelper.visible=n.objectHelper.visible),this}toJSON(n){let s=super.toJSON(n),o=s.object;return o.enableHelper=this.enableHelper,s}fromJSON(n){return super.fromJSON(n),n.enableHelper!==void 0&&(this.enableHelper=!0),this}fromLightState(n,s){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let o=this;n.color!==void 0&&(o.color=fr(n.color,s)),n.intensity!==void 0&&(o.intensity=n.intensity),n.depth!==void 0&&(o.shadow.camera.far=n.depth,o.shadow.needsUpdate=!0),n.shadows!==void 0&&(this.castShadow=n.shadows),n.helper!==void 0&&(this.enableHelper=n.helper,o.gizmos.shadowmap.visible=n.helper)}return this}};var Kl=new A,Lv=new A,Bn=class extends Gi(Yn(zn),Fp){constructor(t=window.innerWidth,r=window.innerHeight,n=45,s,o=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=ko.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=t,this.height=r,this.orthoCamera=new Eo(t*-.5,t*.5,r*.5,r*-.5,s!=null?s:-5e4,o),this.perspCamera=new nr(n,t/r,s!=null?s:50,o),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)}static createFromState(t,r){let n=new Bn().fromState(r);return n.enableHelper=!0,n.objectHelper.update(),n.uuid=t,n}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(t,r){t==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(t,r){r>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t){super.lookAt(t),this.getWorldPosition(Kl),this.targetOffset=Kl.distanceTo(t)}getTarget(t=new A){return this.getWorldDirection(Lv),this.getWorldPosition(Kl),Lv.multiplyScalar(this.targetOffset),t.copy(Kl).add(Lv),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(Kl),Kl.distanceTo(t)}updateUp(){let t=this.getWorldQuaternion(new Ut),r=new A(0,0,1).applyQuaternion(t),n=new A().copy(ot.DefaultUp);this.isUpVectorFlipped&&n.negate(),n.applyQuaternion(t);let s=new A().copy(ot.DefaultUp).projectOnPlane(r),o=new A().crossVectors(s,n).dot(r)>=0?1:-1;this.angleOffsetFromUp=s.angleTo(n)*o}getViewFrontToObject(t){let r=t.getWorldPosition(new A),s=t.getWorldDirection(new A).multiplyScalar(this.targetOffset);return{position:r.clone().add(s),target:r}}getViewToObject(t){let r=t.getWorldPosition(new A),s=this.getWorldDirection(new A).multiplyScalar(this.targetOffset);return{position:r.clone().sub(s),target:r}}setViewplaneSize(t,r){this.left=-t*.5,this.right=t*.5,this.top=r*.5,this.bottom=-r*.5,this.aspect=t/r,this.updateProjectionMatrix()}toOrthographic(t){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||t===!0)&&this.objectHelper.update()}toPerspective(t){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||t===!0)&&this.objectHelper.update()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,r,n,s,o,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,r,n,s,o,a):this.orthoCamera.setViewOffset(t,r,n,s,o,a)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(t){this._cameraType==="PerspectiveCamera"?this.toPerspective(t):this._cameraType==="OrthographicCamera"&&this.toOrthographic(t)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,r){return super.copy(t,r),this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=t.targetOffset,this.updateProjectionMatrix(),this}fromCameraRender(t){let r={near:this.orthoCamera.near,far:this.orthoCamera.far},n={near:this.perspCamera.near,far:this.perspCamera.far};return this.copy(t),this.name="",this.enableHelper=!0,this.objectHelper.visible=!0,this.orthoCamera.near=r.near,this.orthoCamera.far=r.far,this.perspCamera.near=n.near,this.perspCamera.far=n.far,this.updateProjectionMatrix(),this}toJSON(t){let r=super.toJSON(t),n=r.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,r}fromJSON(t){var r;if(super.fromJSON(t),this.cameraType=t.cameraType,t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.orbitControlsTarget!==void 0){let n=this.getWorldPosition(new A),s=new A().fromArray(t.orbitControlsTarget);this.targetOffset=s.distanceTo(n)}else t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset);return this.isUpVectorFlipped=!1,this.angleOffsetFromUp=(r=t.angleOffsetFromUp)!=null?r:0,t.left!==void 0&&(this.left=t.left),t.right!==void 0&&(this.right=t.right),t.top!==void 0&&(this.top=t.top),t.bottom!==void 0&&(this.bottom=t.bottom),t.view!==void 0&&(this.view=Object.assign({},t.view)),t.zoomOrtho!==void 0&&(this.orthoCamera.zoom=t.zoomOrtho),t.nearOrtho!==void 0&&(this.orthoCamera.near=t.nearOrtho),t.far!==void 0&&(this.far=t.far),t.aspect!==void 0&&(this.aspect=t.aspect),t.fov!==void 0&&(this.fov=t.fov),t.focus!==void 0&&(this.focus=t.focus),t.filmGauge!==void 0&&(this.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(this.filmOffset=t.filmOffset),t.zoomPersp!==void 0&&(this.perspCamera.zoom=t.zoomPersp),t.nearPersp!==void 0&&(this.perspCamera.near=t.nearPersp),this.updateProjectionMatrix(),this}toCameraState(t=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return xl(r,t)}fromCameraState(t){let{orthographic:r,perspective:n}=t;return t.type!==void 0&&(this.cameraType=t.type),t.far!==void 0&&(this.far=t.far),r!==void 0&&(r.near!==void 0&&(this.orthoCamera.near=r.near),r.zoom!==void 0&&(this.orthoCamera.zoom=r.zoom)),n!==void 0&&(n.near!==void 0&&(this.perspCamera.near=n.near),n.fov!==void 0&&(this.perspCamera.fov=n.fov),n.zoom!==void 0&&(this.perspCamera.zoom=n.zoom)),t.up!==void 0&&this.up.fromArray(t.up),t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(t){return be(se(se({},super.toState(t)),this.toCameraState(t)),{type:this.cameraType})}fromState(t){return super.fromState(t),this.fromCameraState(t),this}};var ds=class extends Gi(Yn(Zi),Jl){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(t,r){let n=new ds().fromState(r);return n.uuid=t,n.enableHelper=!0,n.objectHelper.update(),n}toJSON(t){let r=super.toJSON(t);return r.object.objectType="EmptyObject",r}};var Zl=class extends Gi(Yn(cu),Yl){constructor(...t){super(...t);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 s=new Vn(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,n){let s=new Zl().fromState(r,n);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Vn&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Vn&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Vn&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),n=r.object;return n.objectType="LightDirectional",n.color=this.color.getHex(),n.intensity=this.intensity,n.shadow=this.shadow.toJSON(),r}fromJSON(t){var s;super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.shadow.normalBias=(s=t.shadow.normalBias)!=null?s:0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray(t.shadow.mapSize);let r=this.shadow.camera,n=t.shadow.camera;return r.near=n.near,r.far=n.far,r.zoom=n.zoom,r.left=n.left,r.right=n.right,r.top=n.top,r.bottom=n.bottom,n.view!==void 0&&(r.view=Object.assign({},n.view)),this}fromDirectionalLightState(t,r){let n=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;return super.fromLightState(t,r),t.size!==void 0&&w1(this,t.size),n&&this.update(),this}fromState(t,r){return super.fromState(t),this.fromDirectionalLightState(t,r),this}};var $l=class extends Gi(Yn(lu),Ql){constructor(...t){super(...t);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 s=new A(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),o=new A(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z),a=new Qt(s,o),l=new No(a,new xe(16755200));l.visible=!1,this._gizmos.shadowmap=l,this.update()}static createFromState(t,r,n){let s=new $l().fromState(r,n);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof No&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof No&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let t in this._gizmos){let r=this._gizmos[t];if(r instanceof No){let n=this.shadow.camera,s=new A(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),o=new A(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z);r.box.set(s,o),r.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),n=r.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(),r}fromJSON(t){var s,o;super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.distance=t.distance,this.decay=t.decay,this.shadow.normalBias=(s=t.shadow.normalBias)!=null?s:0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray((o=t.shadow.mapSize)!=null?o:[512,512]),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null);let r=this.shadow.camera,n=t.shadow.camera;return r.near=n.near,r.far=n.far,r.zoom=n.zoom,r.fov=n.fov,r.focus=n.focus,r.aspect=n.aspect,r.filmGauge=n.filmGauge,r.filmOffset=n.filmOffset,n.view!==void 0&&(r.view=Object.assign({},n.view)),this}fromPointLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,r){return super.fromState(t),this.fromPointLightState(t,r),this}};var F1=new A,U1=new A,z1=new Ut,ec=class extends Gi(Yn(au),mh){constructor(...t){super(...t);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=et.RAD2DEG*2*this.angle,n.aspect=1,n.near=100,n.far=2500;let s=new Vn(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,n){let s=new ec().fromState(r,n);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Vn&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Vn&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Vn&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),U1.setFromMatrixPosition(this.matrixWorld),z1.setFromRotationMatrix(this.matrixWorld),F1.copy(this.up).applyQuaternion(z1).negate().multiplyScalar(this.distance),this.target.position.copy(U1).add(F1),this.target.updateMatrixWorld(),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),n=r.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(),r}fromJSON(t){var s;super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.distance=t.distance,this.angle=t.angle,this.decay=t.decay,this.penumbra=t.penumbra,this.shadow.normalBias=(s=t.shadow.normalBias)!=null?s:0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray(t.shadow.mapSize);let r=this.shadow.camera,n=t.shadow.camera;return r.near=n.near,r.far=n.far,r.zoom=n.zoom,r.fov=n.fov,r.focus=n.focus,r.aspect=n.aspect,r.filmGauge=n.filmGauge,r.filmOffset=n.filmOffset,n.view!==void 0&&(r.view=Object.assign({},n.view)),this}fromSpotLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),this}fromState(t,r){return super.fromState(t),this.fromSpotLightState(t,r),this}};var tc=class extends Xt{constructor(t,r=new Rn){super(t,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}toJSON(t){let r=super.toJSON(t);return r.object.objectType="Mesh3D",r}};var rc=class extends tc{constructor(t,r=new Rn){super(t,r);this.objectType="NonParametric"}toJSON(t){let r=super.toJSON(t);return r.object.objectType="NonParametric",r}};var zp=class extends ln{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new is(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{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)},r,n)}parse(e){return new Gp(e)}},Gp=class{constructor(e){this.type="Font",this.data=e}generateShapes(e,t=100){let r=[],n=xF(e,t,this.data);for(let s=0,o=n.length;s<o;s++)Array.prototype.push.apply(r,n[s].toShapes());return r}};function xF(i,e,t){let r=Array.from(i),n=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*n,o=[],a=0,l=0;for(let c=0;c<r.length;c++){let u=r[c];if(u===`
|
|
3951
|
-
`)a=0,l-=s;else{let h=bF(u,n,a,l,t);a+=h.offsetX,o.push(h.path)}}return o}function bF(i,e,t,r,n){let s=n.glyphs[i]||n.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+n.familyName+".");return}let o=new
|
|
3952
|
-
`),l=0;this.userData.textFrame.textLines=a.map((c,u)=>{let h=new lo(l,r.lineHeight,r.fontSize);return h.message=c.split("").map(f=>{let d={char:f,fontFamily:n,letterSpacing:r.letterSpacing,fontSize:r.fontSize,LOD:16},m=o.clone();m.color=r.hexColor,m.opacity=r.opacity;let p=new dn(d,m);return h.addChar3D(p,s),this.charContainer.add(p),p}),l+=h.maxCharSize*h.lineHeight,h}),this.textFullUpdate(),this.checkOverFlow()}clearText(){let t=this.userData.textFrame.textLines;for(;this.charContainer.children.length;){let r=this.charContainer.children[0];this.charContainer.remove(r)}for(;t.length;)t.pop()}raycast(t,r){let n=[];if(super.raycast(t,n),n.length>0){r.push(n[0]);return}let s=[];for(let o=0,a=this.charContainer.children.length;o<a;++o)if(this.charContainer.children[o]instanceof dn&&(t.intersectObject(this.charContainer.children[o],!1,s),s.length>0)){s[0].object=this,r.push(s[0]);return}}updateGeometry(t){var u,h,f,d;let r=this.userData,n=this.geometry.userData,s=n.parameters.width,o=n.parameters.height,a=(h=(u=t.parameters)==null?void 0:u.width)!=null?h:s,l=(d=(f=t.parameters)==null?void 0:f.height)!=null?d:o,c=r.textFrame;super.updateGeometry(t),c.maxLineSize=a,c.textOrigin.set(-.5*a,.5*l,0),l!==o?(this.checkOverFlow(),this.checkCapacity()):a!==s&&(s<a?this.checkCapacity():s>a&&this.checkOverFlow())}checkOverFlow(t=0){let r=this.userData,n=r.textFrame.textOrigin,s=r.textFrame.textLines;for(let o=t;o<s.length;o++){s[o].updateYLinePos(this.getNewLinePosition(o)),s[o].fullUpdate(n);let a=[];for(;s[o].checkOverFlow(r.textFrame.maxLineSize);)s[o].containSpaceOverFlow()?a.unshift(s[o].getWord(s[o].message.length-1,-1)):a.unshift(s[o].popChar());if(a.length>0){s[o+1]===void 0?(s[o].isEndLine(!1),this.createTextLine()):s[o].endLine&&(this.createTextLine(o+1),s[o].isEndLine(!1),s[o+1].isEndLine(!0));let l=0;for(let c=0;c<a.length;c+=1)for(let u=0;u<a[c].length;u+=1)s[o+1].addChar3D(a[c][u],n,l),l+=1;s[o+1].fullUpdate(n)}s[o].fullUpdate(n)}this.textFullUpdate(t)}checkCapacity(t=0){let r=this.userData,n=r.textFrame.textOrigin,s=r.textFrame.maxLineSize,o=r.textFrame.textLines;for(let a=t;a<o.length;a+=1)if(o[a].updateYLinePos(this.getNewLinePosition(a)),o[a].fullUpdate(n),!!o[a-1])for(;!o[a-1].endLine;){let l,c=o[a-1].spaceLeft(s);if(o[a].wordSize(0,1)<=c){o[a].containSpace()?l=o[a].getWord(0,1):l=o[a].popChar(0);for(let u=0;u<l.length;u+=1)l[u]&&o[a-1].addChar3D(l[u],n)}else{o[a].isEmpty()?(o[a].endLine&&o[a-1].isEndLine(!0),o.splice(a,1),a-=1):(o[a].updateYLinePos(this.getNewLinePosition(a)),o[a].fullUpdate(n));break}}this.textFullUpdate(t)}createTextLine(t=this.userData.textFrame.textLines.length){let n=this.userData.textFrame;n.textLines.splice(t,0,new lo(this.getNewLinePosition(t),n.lineHeight,n.fontSize))}textFullUpdate(t=0){let n=this.userData.textFrame,s=n.textLines,o=this.getVerticalAlignmentOffSet();for(let a=t;a<s.length;a++)s[a].updateYLinePos(this.getNewLinePosition(a)),s[a].fullUpdate(n.textOrigin),s[a].alignText(n.textOrigin,n.maxLineSize,n.horizontalAlignment,n.verticalAlignment,o)}getVerticalAlignmentOffSet(){switch(this.userData.textFrame.verticalAlignment){case 1:return 0;case 2:return this.getRemainingVerticalSpace()/2;case 3:return this.getRemainingVerticalSpace();default:return 0}}getRemainingVerticalSpace(){let r=this.userData.textFrame.textLines;return this.geometry.userData.parameters.height-this.getNewLinePosition(r.length)}getNewLinePosition(t){let n=this.userData.textFrame.textLines,s=0;for(let o=0;o<t;o+=1)s+=n[o].maxCharSize*n[o].lineHeight;return s}updateColor(t){var s;let r=this.userData;r.textFrame.hexColor=t;let n=r.textFrame.textLines;for(let o=0;o<n.length;o++){let a=n[o].message;for(let l=0;l<a.length;l++){let c=a[l].material;(s=c.color)!=null&&s.isColor&&(c.color=t)}}}updateOpacity(t){let r=this.userData;r.textFrame.opacity=t;let n=r.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;l.opacity=t}}}updateVisible(t){let r=this.userData;r.textFrame.visible=t;let n=r.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;l.visible=t}}}async updateFontFamily(t){await dn.loadFont(t);let n=this.userData.textFrame,s=n.textLines;n.fontFamily=t;for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)a[l].updateFontFamily(t)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateFontSize(t){let n=this.userData.textFrame,s=n.textLines,o=n.fontSize;n.fontSize=t;for(let a=0;a<s.length;a++)s[a].updateFontSize(t);this.textFullUpdate(),t>o?this.checkOverFlow():t<o&&this.checkCapacity()}async updateTextTransform(t){let n=this.userData.textFrame;await dn.loadFont(n.fontFamily);let s=n.textLines;switch(n.textTransform=t,t){case 2:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].char.toUpperCase())}break;case 3:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].char.toLowerCase())}break;default:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].originalChar)}}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLetterSpacing(t){let r=this.userData,n=r.textFrame.textLines;r.textFrame.letterSpacing=t;for(let s=0;s<n.length;s++){let o=n[s].message;for(let a=0;a<o.length;a++)o[a].updateLetterSpacing(t)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLOD(t){let r=this.userData;r.textFrame.LOD=t;let n=r.textFrame.textLines;for(let s=0;s<n.length;s++);this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLineHeight(t){let r=this.userData,n=r.textFrame.textLines;r.textFrame.lineHeight=t;for(let s=0;s<n.length;s++)n[s].updatelineHeight(t);this.textFullUpdate()}updateVerticalAlignment(t){let r=this.userData;r.textFrame.verticalAlignment=t,this.textFullUpdate()}updateHorizontalAlignment(t){let r=this.userData;r.textFrame.horizontalAlignment=t,this.textFullUpdate()}toJSON(t){let r=super.toJSON(t),n=r.object;n.objectType="TextFrame";let o=this.userData.textFrame.textLines.map(a=>{let l=a.message.map(c=>({char:c.char,originalChar:c.originalChar,fontFamily:c.fontFamily,letterSpacing:c.letterSpacing,fontSize:c.fontSize,LOD:c.LOD}));return{align:a.align,endLine:a.endLine,lineHeight:a.lineHeight,maxCharSize:a.maxCharSize,yLinePos:a.yLinePos,message:l}});return n.userData.textFrame.textLinesData=o,r}async fromJSONasync(t){if(super.fromJSON(t),t.userData!==void 0){let r=t.userData.textFrame;await dn.loadFont(r.fontFamily),r.textOrigin=new A(r.textOrigin.x,r.textOrigin.y,r.textOrigin.z);let n=new Un({color:r.hexColor,opacity:r.opacity,visible:r.visible,transparent:!0,side:ir});r.textLinesData&&(r.textLines=r.textLinesData.map((s,o)=>{let a=new lo(Number(s.yLinePos),Number(s.lineHeight),Number(s.maxCharSize)),l=s.message.map((c,u)=>{if(c.char===void 0){let d=r.textLines[o].message[u];if("geometries"in d){let m=d.geometries[0].userData.parameters;Object.assign(c,{LOD:m.lod,char:m.char,fontFamily:m.fontFamily,fontSize:m.fontSize,letterSpacing:m.letterSpacing,originalChar:m.char})}}let h={char:c.char,fontFamily:c.fontFamily,letterSpacing:Number(c.letterSpacing),fontSize:Number(c.fontSize),LOD:c.LOD},f=new dn(h,n.clone());return a.addChar3D(f,r.textOrigin),this.charContainer.add(f),f});return a.message=l,a}),this.userData.textFrame=r),this.textFullUpdate()}return this}fromTextFrameData(t,r){if(t.color!==void 0){let n=fr(t.color,r);this.updateColor(n),this.updateOpacity(n.a)}t.alpha!==void 0&&this.updateOpacity(t.alpha),t.font!==void 0&&this.updateFontFamily(t.font),t.horizontalAlign!==void 0&&this.updateHorizontalAlignment(t.horizontalAlign),t.verticalAlign!==void 0&&this.updateVerticalAlignment(t.verticalAlign),t.textTransform!==void 0&&this.updateTextTransform(t.textTransform),t.fontSize!==void 0&&this.updateFontSize(t.fontSize),t.lineHeight!==void 0&&this.updateLineHeight(t.lineHeight),t.letterSpacing!==void 0&&this.updateLetterSpacing(t.letterSpacing),t.text!==void 0&&t.text!==""&&this.updateText(t.text),(t.width!==void 0||t.height!==void 0)&&this.updateGeometry({parameters:{width:t.width,height:t.height}})}fromState(t,r){return super.fromState(t),this.fromTextFrameData(t,r),this}convertToVector(){let{fontFamily:t,hexColor:r}=this.userData.textFrame,n=new ds;n.name="Text Shape";let s=dn.fontCache[t];for(let o of this.charContainer.children)o instanceof dn&&s.generateShapes(o.char,1).forEach(a=>{let l=new At().fromShape(a);l.applyScale(o.scale.x,o.scale.y);let c=Gr.create({shape:l}),u=new jr({side:ir});u.color=r;let h=new ao(c,u);h.name=o.char,h.position.copy(o.position),h.rotation.copy(o.rotation),n.attach(h)});return n}},Ko=Dv;Ko.VerticalAlign=zy,Ko.HorizontalAlign=Uy,Ko.TextTransform=Gy;function G1(i,e){return wF(i)}function wF(i){let e={parameters:i,type:i.type};if(i.type==="VectorGeometry"){let r=At.createFromState(i.shape,i.width,i.height);e.shape=r}else i.type==="NonParametricGeometry"&&(i.data.groups&&i.data.groups.forEach(r=>{var n;return r.materialIndex=Math.max((n=r.materialIndex)!=null?n:0,0)}),e.geometry=new Gs().parse(i));let t;try{t=Yu(e)}catch(r){console.error(r)}if(!t){let r=At.createFromState(Tl.defaultData(),100,100);e.shape=r,t=Yu(e)}return t}var W1=mT(V1());var Pv;vp.then(i=>{Pv=i});var j1=new Ee,SF=new Ee,MF=new Ee,gi=new Qt,co=new A,AF=new Ee,TF=new Ee,uo=class extends Xt{constructor(t,r,n,s=new Rn){super(n!=null?n:r,s);this.subdivPointer=t;this.originalGeometry=r;this.subdividedGeometry=n;this.objectType="SubdivObject";this.hiddenMatrixOld=new Ee;this.smoothShading=!0;this.matrixWorldRigid=new Ee;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(t,r,n){let{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}=Pn.build(r.geometry,void 0,void 0,!r.flatShading),l=ph(r.material,n),c=new uo(s,o,a||void 0,l);return c.calcBoundingBox(),c.freeSubdivPointer(),c.uuid=t,c.fromState(r),c}shallowClone(t){return new rc(this.geometry,this.material).shallowCopy(this,t)}toJSON(t){let r=super.toJSON(t);return r.object.objectType="SubdivObject",r}buildFromStore(t){var o,a,l;let{originalGeometry:r,subdividedGeometry:n,subdivPointer:s}=Pn.build(t,this.subdivPointer,void 0,this.smoothShading,this.shearScale);if(this.subdivPointer=s,r!==void 0&&((o=this.originalGeometry)==null||o.dispose(),this.originalGeometry=r),n!==void 0&&((a=this.subdividedGeometry)==null||a.dispose(),this.subdividedGeometry=n!=null?n:void 0),this.geometry=(l=this.subdividedGeometry)!=null?l:this.originalGeometry,this.cloner)for(let c of this.cloner.children)c.geometry=this.geometry;t.width&&(this.geometry.userData.parameters={width:t.width,height:t.height,depth:t.depth})}updateMesh(t=!1){Pn.buildLevel(this.subdivPointer,!0,this.smoothShading,this.originalGeometry,t?this.shearScaleInv:void 0),this.subdividedGeometry&&Pn.buildLevel(this.subdivPointer,!1,this.smoothShading,this.subdividedGeometry,t?this.shearScaleInv:void 0)}updateTopology(){var t;this.originalGeometry.dispose(),this.originalGeometry=Pn.buildLevel(this.subdivPointer,!0,this.smoothShading),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Pn.buildLevel(this.subdivPointer,!1,this.smoothShading)),this.geometry=(t=this.subdividedGeometry)!=null?t:this.originalGeometry}raycast(t,r){var n;this.geometry=this.originalGeometry,Xt.prototype.raycast.call(this,t,r),this.geometry=(n=this.subdividedGeometry)!=null?n:this.originalGeometry}updateMatrixWorldSVD(){let t=this.matrixWorld.elements,r=[[t[0],t[4],t[8]],[t[1],t[5],t[9]],[t[2],t[6],t[10]]],{u:n,v:s,q:o}=(0,W1.SVD)(r),a=j1.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),l=SF.set(s[0][0],s[0][1],s[0][2],0,s[1][0],s[1][1],s[1][2],0,s[2][0],s[2][1],s[2][2],0,0,0,0,1),c=MF.copy(l).transpose();this.shearScale=AF.makeScale(o[0],o[1],o[2]).multiply(c).premultiply(l),this.shearScaleInv=TF.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(a,c),o.every(u=>Math.abs(o[0]-u)<.01)&&(this.shearScale=void 0,this.shearScaleInv=void 0)}activateSVDCompensation(){this.shearScale!==void 0&&(this.matrixAutoUpdate=!1,this.matrix.copy(this.matrixWorldRigid).copyPosition(this.matrixWorld),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateSVDCompensation(){this.shearScale!==void 0&&(this.shearScale=void 0,this.shearScaleInv=void 0,this.matrixAutoUpdate=!0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new Yr);let r=t.attributes.position,n=t.boundingSphere.center;gi.setFromBufferAttribute(r),gi.getCenter(n),t.boundingSphere.radius=n.distanceTo(gi.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),gi.getSize(co);let s={width:co.x,height:co.y,depth:co.z};return this.geometry.userData.parameters=s,s}updateBoundingBox(t){let r=this.originalGeometry;gi.min.set(t[0],t[2],t[4]),gi.max.set(t[1],t[3],t[5]),this.shearScaleInv&&(gi.min.applyMatrix4(this.shearScaleInv),gi.max.applyMatrix4(this.shearScaleInv)),r.boundingSphere===null&&(r.boundingSphere=new Yr);let n=r.boundingSphere.center;gi.getCenter(n),r.boundingSphere.radius=n.distanceTo(gi.max),isNaN(r.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),gi.getSize(co);let s={width:co.x,height:co.y,depth:co.z};return this.geometry.userData.parameters=s,s}freeSubdivPointer(){this.subdivPointer&&(Pv.free_bvh(this.subdivPointer),Pv.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(t){this.geometry.userData.scale||(this.geometry.userData.scale=Array(3)),this.geometry.userData.scale[0]=this.geometry.userData.parameters.width===0?1:t.parameters.width/this.geometry.userData.parameters.width,this.geometry.userData.scale[1]=this.geometry.userData.parameters.height===0?1:t.parameters.height/this.geometry.userData.parameters.height,this.geometry.userData.scale[2]=this.geometry.userData.parameters.depth===0?1:t.parameters.depth/this.geometry.userData.parameters.depth,H1(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(H1(this.subdividedGeometry.attributes,...this.subdividedGeometry.userData.scale),this.subdividedGeometry.attributes.position.needsUpdate=!0,this.subdividedGeometry.attributes.normal.needsUpdate=!0),this.geometry.userData.parameters=se({},t.parameters)}};function H1(i,e,t,r){let n=i.position.array,s=i.normal.array,o=j1.makeScale(e,t,r).invert().elements,a,l,c;for(var u=0,h=n.length;u<h;u+=3)n[u]*=e,n[u+1]*=t,n[u+2]*=r,a=s[u],l=s[u+1],c=s[u+2],s[u]=o[0]*a+o[4]*l+o[8]*c,s[u+1]=o[1]*a+o[5]*l+o[9]*c,s[u+2]=o[2]*a+o[6]*l+o[10]*c}function q1(i,e){e.flatShading!==void 0&&(i.flatShading=e.flatShading,i.needsUpdate=!0),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.side!==void 0&&(e.side===0?i.side=ii:e.side===1?i.side=Cr:i.side=ir)}function EF(i,e){if(Array.isArray(i.material))for(let t of i.material)q1(t,e);else{let t=i.material;q1(t,e)}i.objectType==="SubdivObject"&&e.flatShading!==void 0&&(i.material.flatShading=!1,i.smoothShading=!e.flatShading,i.updateMesh())}function X1(i,e,t){let r;if(e.geometry.type==="SubdivGeometry")r=uo.createFromState(i,e,t);else{let n=G1(e.geometry,t),s="materials"in e?P1(e.materials,t):ph(e.material,t);ip.is2DParametricMesh(n.userData.type)?r=new Xl(n,s):(n==null?void 0:n.userData.type)==="VectorGeometry"?r=new ao(n,s):e.geometry.type==="NonParametricGeometry"?r=new rc(n,s):r=new tc(n,s),r.uuid=i,r.fromState(e)}return EF(r,e),r}function Y1(i,e,t){return e.type==="Mesh"?X1(i,e,t):e.type==="TextFrame"?Ko.createFromState(i,e,t):e.type==="Empty"?ds.createFromState(i,e):e.type==="PointLight"?$l.createFromState(i,e,t):e.type==="SpotLight"?ec.createFromState(i,e,t):e.type==="DirectionalLight"?Zl.createFromState(i,e,t):Qs.is(e.type)?Bn.createFromState(i,e):(console.error(e),new ds)}function _F(i,e){e.uniforms[`f${e.id}_transmissionSamplerMap`].value=i.texture,e.uniforms[`f${e.id}_transmissionDepthMap`].value=i.depthTexture}function J1(i,e,t){if(!t.userData.layers)return!1;let r=!1,n=t.userData.layers.getLayersOfType("transmission");return n.length>0?(e.layers.set(3),r=!0,i!==void 0&&n.forEach(s=>_F(i,s))):e.layers.set(0),r}function Q1(i,e){let t=!1;return e.traverseEntity(r=>{if(r instanceof Xt)if(Array.isArray(r.material))for(let n=0;n<r.material.length;n++)J1(i,r,r.material[n])&&(t=!0);else J1(i,r,r.material)&&(t=!0)}),t}function K1(i,e){"material"in i&&CF(i.material,e),"geometry"in i&&i.geometry.dispose()}function CF(i,e){GS(i).forEach(t=>{e.isSharedMaterial(t)||t.dispose()})}var Z1=new A,Iv=class extends xp(sn){constructor(t,r){super();this.objectType="Scene";this.alpha=1;this.backupFog=new _o(16777215,.1,2e3);this.fogUseBGColor=!1;this.wireframeState=!1;this.needsTransmissionDirty=!0;this._needsTransmission=!1;this._color=new xe(1,0,0);this.bgColor=new xe(1,1,1);this.entityByUuid={};this.ambientLight=new zs(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.personalCamera=this.createPersonalCamera(),this.activeCamera=this.personalCamera,this.sharedAssetManager=r,this.init(t,r)}needsTransmission(t){return this.needsTransmissionDirty&&(this._needsTransmission=Q1(t,this),t!==void 0&&(this.needsTransmissionDirty=!1)),this._needsTransmission}find(t){if(t===""||t===void 0)return;let r=this.entityByUuid[t];return r===void 0?this.getObjectByProperty("uuid",t):r}get color(){return this._color}set color(t){this.fogUseBGColor===!0&&this.backupFog.color.copy(t),this._color.copy(t)}get enableFog(){return this.fog!==null}set enableFog(t){this.fog=t===!0?this.backupFog:null}init(t,r){if(this.createChildrenObjects(t.objects,this,r),this.personalCamera.removeFromParent(),this.add(this.personalCamera),this.ambientLight.removeFromParent(),this.add(this.ambientLight),this.setBackgroundColor(fr(t.backgroundColor,r)),this.updateFog(t.fog,r),this.updateAmbientLight(t.environment.ambientLight,r),this.activeCamera=this.personalCamera,t.publish.playCamera!==null){let n=this.find(t.publish.playCamera);n instanceof Bn&&this.switchActiveCamera(n)}}clearScene(t){this.traverseEntity(r=>{K1(r,t)});for(let r of this.children)Xn(r)&&r.removeFromParent()}resetAfterClear(t,r){this.init(t,r)}createPersonalCamera(){let t=Bn.createFromState(Iv.PERSONAL_CAMERA_ID,be(se({},op.defaultData),{name:"Personal Camera"}));return t.enableHelper=!1,t.objectHelper.visible=!1,delete t.isEntity,this.registerObjectCreatedInLegacy(t),t}raycast(t){let r=[],n=s=>{for(let o of s.children)Xn(o)&&!o.raycastLock&&o.visible&&((us(o)||hs(o)&&o.enableHelper&&o.objectHelper.parent)&&t.intersectObject(o,!1,r),n(o))};return n(this),r}traverseEntity(t){for(let r of this.children)Xn(r)&&r.traverseEntity(t)}updateFog(t,r){this.enableFog=t.enabled,this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=fr(t.color,r),this.backupFog.near=t.near,this.backupFog.far=t.far}toJSON(t){return{}}fromJSON(t){return this}dispose(){this.clearScene(this.sharedAssetManager),this.sharedAssetManager.dispose()}updateAmbientLight(t,r){b1(this.ambientLight,t,r),t.groundColor!==void 0&&(this.ambientLight.groundColor=fr(t.groundColor,r)),t.enabled!==void 0&&(this.ambientLight.visible=t.enabled)}switchActiveCamera(t){this.activeCamera!==this.personalCamera&&(this.activeCamera.enableHelper=!0),this.activeCamera=t,t.enableHelper=!1}setBackgroundColor(t){this.bgColor=t,this.alpha=t.a}createChildrenObjects(t,r,n){for(let s of t)this.createChildObject(s.id,s.data,s.children,r,n)}registerObjectCreatedInLegacy(t){this.entityByUuid[t.uuid]=t}unregisterObject(t){delete this.entityByUuid[t.uuid];for(let r of t.children)this.unregisterObject(r)}createChildObject(t,r,n,s,o){let a=Y1(t,r,o);return a&&(this.entityByUuid[t]=a,s.add(a),this.createChildrenObjects(n,a,o)),a}getCenter(t){let r=[];for(let s=0,o=t.length;s<o;++s){let{id:a,recursive:l}=t[s],c=this.find(a),u=l?c.recursiveBBox:c.singleBBox;r.push(...u.vertices)}let n=new Qt;return n.setFromPoints(r),n.getCenter(Z1),Z1}copyMatrixWorld(t,r){if(t===null){r.identity();return}let n=this.find(t);n?r.copy(n.matrixWorld):r.identity()}copyParentMatrixWorld(t,r){var s;if(t===null){r.identity();return}let n=(s=this.find(t))==null?void 0:s.parent;n?r.copy(n.matrixWorld):r.identity()}traverseMaterial(t){this.traverseEntity(r=>{if(r instanceof Xt)if(Array.isArray(r.material))for(let n=0;n<r.material.length;n++)t(r.material[n]);else t(r.material)})}updateCanvasSize(t,r){this.activeCamera.setViewplaneSize(t,r);let n,s;t>=r?(n=r/t,s=1):(n=1,s=t/r),this.traverseMaterial(o=>{o.layersList.getLayersOfType("transmission").forEach(l=>{l.uniforms[`f${l.id}_aspectRatio`].value.x=n,l.uniforms[`f${l.id}_aspectRatio`].value.y=s})})}},gh=Iv;gh.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";var sA={RED:0,GREEN:1,BLUE:2,ALPHA:3};var yh="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}";var LF=`#ifdef FRAMEBUFFER_PRECISION_HIGH
|
|
3950
|
+
`)}return r}copy(t){return super.copy(t),t.color&&(this.color=t.color.clone()),this.roughness=t.roughness.clone(),this.metalness=t.metalness.clone(),t.position&&(this.position=t.position.clone()),t.afterColor&&(this.afterColor=t.afterColor.clone()),t.alpha&&(this.alpha=t.alpha.clone()),t.reflectivity&&(this.reflectivity=t.reflectivity.clone()),t.shadingAlpha&&(this.shadingAlpha=t.shadingAlpha.clone()),t.shadingBlend&&(this.shadingBlend=t.shadingBlend.clone()),this}};var Ip=class extends In{constructor(t=new Pp,r){super(t,t,r);this.type="StandardNodeMaterial",this.fragment=t}get color(){return this.fragment.color}set color(t){this.fragment.color=t}get afterColor(){return this.fragment.afterColor}set afterColor(t){this.fragment.afterColor=t}get alpha(){return this.fragment.alpha}set alpha(t){this.fragment.alpha=t}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(t){this.fragment.shadingAlpha=t}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(t){this.fragment.shadingBlend=t}get position(){return this.fragment.position}set position(t){this.fragment.position=t}get roughness(){return this.fragment.roughness}set roughness(t){this.fragment.roughness=t}get metalness(){return this.fragment.metalness}set metalness(t){this.fragment.metalness=t}get reflectivity(){return this.fragment.reflectivity}set reflectivity(t){this.fragment.reflectivity=t}};var jl=class extends Ip{constructor(e,t,r){super(t,e),this.userData.type="PhysicalMaterial",this.userData.category="Physical",this.userData.layers=r!=null?r: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 Zr){let t=e.userData.layers,r=e.fragment;super.copy(e);let n=r.clone();this.fragment=n,this.vertex=n;let s=t.clone(this);this.userData.layers=s,n.shadingAlpha.value=r.shadingAlpha.value,n.shadingBlend.value=r.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,r){let n=r.getNode(t.vertex),s=new jl(void 0,n);return s.fromJSON(t,r),s}dispose(){super.dispose()}};function Rp(i,e){switch(i.data.type){case"light":return pi(i);case"fresnel":return iF(i,e);case"gradient":return sF(i);case"depth":return oF(i);case"normal":return aF(i);case"noise":return lF(i,e);case"texture":return cF(i,e);case"rainbow":return uF(i);case"transmission":return hF(i,e);case"matcap":return fF(i,e);case"displace":return dF(i);case"color":default:return nF(i,e)}}function C1(i){return{type:i.data.type}}function pi(i){let{alpha:e,mode:t}=i.data;return be(se({},C1(i)),{alpha:e,mode:t})}function nF(i,e){return be(se({},pi(i)),{color:fr(i.data.color,e)})}function iF(i,e){let{bias:t,scale:r,intensity:n,factor:s,color:o}=i.data;return be(se({},pi(i)),{color:fr(o,e),bias:t,scale:r,intensity:n,factor:s})}function sF(i){let{gradientType:e,smooth:t,colors:r,steps:n,angle:s,offset:o,morph:a}=i.data;return be(se({},pi(i)),{gradientType:e,smooth:t,colors:r.map(l=>new Qe(l[0],l[1],l[2],l[3])),num:r.length,steps:n,offset:new N(...o),morph:new N(...a),angle:s})}function oF(i){let{gradientType:e,near:t,far:r,isVector:n,isWorldSpace:s,origin:o,direction:a,colors:l,steps:c,smooth:u,num:h}=i.data;return be(se({},pi(i)),{gradientType:e,near:t,far:r,isVector:n,isWorldSpace:s,origin:new A(...o),direction:a?new A(...a):new A(1,0,0),num:h,colors:l.map(f=>new Qe(f[0],f[1],f[2],f[3])),steps:c,smooth:u})}function aF(i){let{cnormal:e}=i.data;return be(se({},pi(i)),{cnormal:new A(e[0],e[1],e[2])})}function lF(i,e){let{data:t}=i;return be(se({},pi(i)),{scale:t.scale,move:t.move,fA:new N(...t.fA),fB:new N(...t.fB),size:new A(...t.size),distortion:new N(...t.distortion),colorA:fr(t.colorA,e),colorB:fr(t.colorB,e),colorC:fr(t.colorC,e),colorD:fr(t.colorD,e),noiseType:t.noiseType})}function cF(i,e){let{projection:t,axis:r,crop:n,size:s}=i.data,{image:o,wrapping:a,repeat:l,offset:c}=i.data.texture,u=new _t,h;if(typeof o=="string")h=e==null?void 0:e.getImage(o);else{let f=new Image;f.src=o.data,f.onload=()=>{e!=null&&e.onImageLoad&&(e==null||e.onImageLoad(o.data))},h=f}return u.image=h,u.repeat.set(l[0],l[1]),u.offset.set(c[0],c[1]),u.wrapS=u.wrapT=a,be(se({},pi(i)),{texture:u,mat:new Nt().setUvTransform(c[0],c[1],l[0],l[1],0,0,0),crop:n,projection:t,axis:["x","y","z"].indexOf(r),size:s})}function uF(i){let{data:e}=i;return be(se({},pi(i)),{filmThickness:e.filmThickness,movement:e.movement,wavelengths:new A(...e.wavelengths),noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,offset:new A(...e.offset)})}function hF(i,e){let{data:t}=i;return be(se({},pi(i)),{thickness:t.thickness,ior:t.ior,roughness:t.roughness,transmissionSamplerMap:e.transmissionSamplerMap,transmissionDepthMap:e.transmissionDepthMap})}function fF(i,e){let t=new _t,{image:r}=i.data.texture,n;if(typeof r=="string")n=e==null?void 0:e.getImage(r);else{let o=new Image;o.src=r.data,o.onload=()=>{e!=null&&e.onImageLoad&&(e==null||e.onImageLoad(r.data))},n=o}t.image=n;let s=16777215;return be(se({},pi(i)),{color:s,texture:t})}function dF(i){let{data:e}=i,t=be(se({},C1(i)),{intensity:e.intensity});if(e.displacementType==="noise")return be(se({},t),{offset:new A(...e.offset),scale:e.scale,movement:e.movement,noiseType:e.noiseType});{let r=new _t,n=new Nt().setUvTransform(0,0,1,1,0,0,0);return be(se({},t),{texture:r,mat:n,crop:e.crop})}}function Bp(i,e,t){if(t.type==="displace"&&(i==="intensity"||i==="visible")){let r=e.uniforms[`f${e.id}_intensity`];return r?(r.value=t.intensity*(t.visible?1:0),r):void 0}if(t.type!=="displace"&&(i==="alpha"||i==="visible")){let r=e.uniforms[`f${e.id}_alpha`];return r?(r.value=t.alpha*(t.visible?1:0),r):void 0}}var ql;(e=>{function i(t){return new xe(t.x,t.y,t.z).getHex()}e.getHex=i})(ql||(ql={}));var L1;(e=>{function i(t){return new Qe(t.r,t.g,t.b,t.a)}e.getThreeVector4=i})(L1||(L1={}));var D1;(t=>{function i(r,n){r.setRGB(n.r,n.g,n.b)}t.setThreeColor=i;function e(r){return new xe(r.r,r.g,r.b).getHex()}t.getHex=e})(D1||(D1={}));function mh(i,e){return typeof i=="string"?e.getMaterialOrDeletedPlaceholder(i):Ev(i,e)}function P1(i,e){return i.map(t=>mh(t,e))}function Ev(i,e){var o,a;let t=(o=i.layers)!=null?o:Ri.defaultTwoLayerData("phong").layers,r=pF(t),n;switch(r.category){case"basic":n=new jr;break;case"lambert":{n=new Hl;break}case"toon":{n=new Wl;break}case"physical":n=new jl;break;case"phong":default:{n=new Rn;break}}n.name=(a=i.name)!=null?a:"Untitled Material";let s=n.userData.layers;mF(s);for(let l=t.length-1;l>=0;l--)gF(s,t[l],e);switch(r.category){case"basic":break;case"lambert":{let u=n,f=fr(r.emissive,e);f instanceof xe?u.emissive.value=f:u.emissive.value.setHex(ql.getHex(f));break}case"toon":{let u=n,h=r;u.shininess.value=h.shininess;let f=fr(h.specular,e);f instanceof xe?u.specular.value=f:u.specular.value.setHex(ql.getHex(f));break}case"physical":let l=n,c=r;l.metalness.value=c.metalness,l.roughness.value=c.roughness,l.reflectivity.value=c.reflectivity;break;case"phong":default:{let u=n,h=r;u.shininess.value=h.shininess;let f=fr(h.specular,e);f instanceof xe?u.specular.value=f:u.specular.value.setHex(ql.getHex(f));break}}return s.blendColors(),s.blendAfterColors(),s.blendPositions(),n}function pF(i){for(let e of i)if(e.data.type==="light")return e.data;return{type:"light",category:"basic",visible:!0,alpha:1,mode:0}}function mF(i){for(let e of i.getLayers())i.removeLayer(e.id)}function gF(i,e,t){let r=Rp(e,t);r.type==="transmission"&&(r.transmissionSamplerMap=t==null?void 0:t.transmissionSamplerMap,r.transmissionDepthMap=t==null?void 0:t.transmissionDepthMap);let n=i.addLayer(r);n.uuid=e.id;for(let s in e.data)Bp(s,n,e.data)}var I1=i=>i.tagName==="VIDEO",Qo=class{static resize(e,t,r){let n=e/t,s;if(!r.image)return;let o=r.image;I1(o)?s=o.videoWidth/o.videoHeight:s=o.width/o.height,n>s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*s/n):r.repeat.set(1,1*s/n)),n<s&&(r.imageType=="WEBCAM"?r.repeat.set(1*n/s*-1,1):r.repeat.set(1*n/s,1)),n==s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(e,t,r){let n=e/t,s=r.image!==void 0?r.image.width/r.image.height:1,o;n>s?o={x:1,y:s/n}:n<s?o={x:n/s,y:1}:o={x:1,y:1},r.repeat.set(o.x,o.y),r.updateMatrix()}static resizeTextureLayers(e,t,r){let n=r.userData.layers,s=n.getLayers();for(let o=0;o<s.length;o++){let a=s[o];E1(a)&&(Qo.resizeTextureLayer(e,t,a.uniforms[`f${a.id}_texture`].value),n.updateLayerUniform())}}static resizeComplex(e,t,r,n){let s=e/t,o,a=r.image;I1(a)?o=a.videoWidth/a.videoHeight:o=a.width/a.height,n.geometry.type.includes("Shape")?(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t*o/s):r.repeat.set(1/e,1/t*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*s/o*-1,1/t):r.repeat.set(1/e*s/o,1/t)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t):r.repeat.set(1/e,1/t))):(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*o/s):r.repeat.set(1,1*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1*s/o*-1,1):r.repeat.set(1*s/o,1)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1)))}};var Xl=class extends Xt{constructor(t,r=new jr){super(t,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(t){super.updateGeometry(t),this.material.userData.layers&&Qo.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}resizeGeometry(t,r){super.resizeGeometry(t,r,0),this.material.userData.layers&&Qo.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}toJSON(t){let r=super.toJSON(t);return r.object.objectType="Mesh2D",r}clone(){let t=super.clone();return t.updateGeometry({}),t}static fromTexture(t){let r,n;if(t instanceof eu){let a=t.image;r=a.videoWidth*.5,n=a.videoHeight*.5}else{let a=t.image;r=a.width*.5,n=a.height*.5}let s=gp.create({parameters:{width:r,height:n}}),o=new jr;return o.layersList.changeLayer(0,{type:"texture",texture:t}),o.layersList.moveLayer(0,1),o.dispose(),new Xl(s,o)}};var yF=new A(0,0,1),R1=new A,B1=new A,N1=new Nt,ao=class extends Xt{constructor(t=Gr.create({}),r=new jr({side:ir})){var n;super(t,r);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new jt;this._onShapeUpdate=()=>{if(this.geometry instanceof so){if(this.geometry.updateFromShape()){let t=this.geometry.drawCount,r=this.geometry.userData;this.updateGeometry(Object.assign(this.geometry.userData,{parameters:Object.assign(r.parameters,{surfaceMaxCount:t+1e3})}))}}else this.updateGeometry({});this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=t.userData.shape,(n=this.shape.eventDispatcher)==null||n.addEventListener("update",this._onShapeUpdate)}toJSON(t){let r=super.toJSON(t);return r.object.objectType="VectorObject",r}fromState(t){return super.fromState(t),this.shape.update(),this}setHelperVisibility(){}updateGeometry(t){if(super.updateGeometry(t),"userData"in this.geometry){let r=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:r})}}setShape(t){var r,n;this.shape&&((r=this.shape.eventDispatcher)==null||r.removeEventListener("update",this._onShapeUpdate)),this.shape=t,(n=this.shape.eventDispatcher)==null||n.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),N1.getNormalMatrix(this.matrixWorld),R1.copy(yF).applyMatrix3(N1).normalize(),B1.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(R1,B1)}clone(t){let r=this.shape.clone(),n=this.material.clone(),s=this.geometry.userData,o=Gr.create(Object.assign({},s,{shape:r})),a=new ao(o,n).copy(this,t);return a.shape=r,r.update(),a}raycast(t,r){Xt.prototype.raycast.call(this,t,r)}};var Ui=i=>{var e;return e=class extends i{constructor(){super(...arguments);this.isObjectHelper=!0}},e.geometryHelper=new mn(30,30,30),e};var Np=new si,_v=new Yr,O1=new Ee,zi=(i,e,t,r,n=!1)=>{let s=e,o=i.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),_v.copy(s.boundingSphere),_v.applyMatrix4(o),t.ray.intersectsSphere(_v)===!1||(O1.copy(o).invert(),Np.copy(t.ray).applyMatrix4(O1),s.boundingBox!==null&&Np.intersectsBox(s.boundingBox)===!1))return;let a,l,c,u,h=s.index,f=s.attributes.position,d=s.drawRange,m,p;if(n===!1){let y=Math.max(0,d.start),v=Math.min(h.count,d.start+d.count);for(m=y,p=v;m<p;m+=3)if(l=h.getX(m),c=h.getX(m+1),u=h.getX(m+2),a=g(i,t,Np,f,l,c,u),a){a.faceIndex=Math.floor(m/3),r.push(a);return}}else{let v=s.attributes.position,b=new A,w=new A,x=new A,E=new A,T=2,I=1/((i.scale.x+i.scale.y+i.scale.z)/3),C=I*I,M=Math.max(0,d.start),_=Math.min(v.count,d.start+d.count);for(let R=M,B=_-1;R<B;R+=T){if(b.fromBufferAttribute(v,R),w.fromBufferAttribute(v,R+1),Np.distanceSqToSegment(b,w,E,x)>C)continue;E.applyMatrix4(i.matrixWorld);let z=t.ray.origin.distanceTo(E);z<t.near||z>t.far||r.push({distance:z,point:x.clone().applyMatrix4(i.matrixWorld),object:i})}}function g(y,v,b,w,x,E,T){let S=new A,I=new A,C=new A,M=new A,_=new A;if(S.fromBufferAttribute(w,x),I.fromBufferAttribute(w,E),C.fromBufferAttribute(w,T),b.intersectTriangle(S,I,C,!1,M)===null)return null;_.copy(M),_.applyMatrix4(y.matrixWorld);let B=v.ray.origin.distanceTo(_);return B<v.near||B>v.far?null:{faceIndex:1,distance:B,point:_.clone(),object:y}}};var Op=new A,Jn=new zn,Cv=class extends ai{constructor(t){let r=new Ie,n=new Ur({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],o=[],a={},l=new xe(15711266),c=new xe(15711266),u=new xe(2857471);h("n1","n2",l),h("n2","n4",l),h("n4","n3",l),h("n3","n1",l),h("f1","f2",l),h("f2","f4",l),h("f4","f3",l),h("f3","f1",l),h("n1","f1",l),h("n2","f2",l),h("n3","f3",l),h("n4","f4",l),h("p","n1",c),h("p","n2",c),h("p","n3",c),h("p","n4",c),h("u1","u2",u),h("u2","u3",u),h("u3","u1",u);function h(d,m,p){f(d,p),f(m,p)}function f(d,m){s.push(0,0,0),o.push(m.r,m.g,m.b),a[d]===void 0&&(a[d]=[]),a[d].push(s.length/3-1)}r.setAttribute("position",new Le(s,3)),r.setAttribute("color",new Le(o,3));super(r,n);this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let t=this.geometry,r=this.pointMap,n=!0;Jn.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,o=1,a=n?.8:1e-4;mi("n1",r,t,Jn,-s,-o,a),mi("n2",r,t,Jn,s,-o,a),mi("n3",r,t,Jn,-s,o,a),mi("n4",r,t,Jn,s,o,a);let l=a;mi("f1",r,t,Jn,-s,-o,l),mi("f2",r,t,Jn,s,-o,l),mi("f3",r,t,Jn,-s,o,l),mi("f4",r,t,Jn,s,o,l);let c=l,u=.5;mi("u1",r,t,Jn,s*.7*u,o*1.1,c),mi("u2",r,t,Jn,-s*.7*u,o*1.1,c),mi("u3",r,t,Jn,0,o*(1.1+.9*u),c),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function mi(i,e,t,r,n,s,o){Op.set(n,s,o).unproject(r);let a=e[i];if(a!==void 0){let l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],Op.x,Op.y,Op.z)}}var Fp=class extends Ui(Cv){constructor(t){super(t);this.object=t;this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,r){zi(this.object,this.geometry,t,r,!0)}};var Yl=class extends Ui(Xf){constructor(t,r=15,n=10066329){super(t,r,n);this.object=t;this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,r){zi(this.object,Yl.geometryHelper,t,r)}};var Jl=class extends Ui(Yf){constructor(t,r=15){super(r);this.object=t;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}raycast(t,r){zi(this.object,Jl.geometryHelper,t,r)}update(){}};var Ql=class extends Ui(qf){constructor(t,r=15,n=6710886){super(t,r,n);this.object=t;this.name=`PointLightHelper: ${t.uuid}`}raycast(t,r){zi(this.object,Ql.geometryHelper,t,r)}};var Up=class extends Ui(jf){constructor(t,r=6710886){super(t,r);this.object=t;this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,r){zi(this.object,Up.geometryHelper,t,r)}update(){if(this.object!==void 0){let t=Up._vector,r=this.object.distance?this.object.distance:1e3,n=r*Math.tan(this.object.angle);this.cone.scale.set(n,n,r),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let o=0,a=this.cone.material.length;o<a;o++)this.cone.material[o].color.set(s);else this.cone.material.color.set(s)}}},gh=Up;gh._vector=new A;var Gi=(i,e)=>class extends i{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 s of this.children)Xn(s)&&s.traverseEntity(o=>{hs(o)&&o.visible&&(o.objectHelper.visible=n)})}raycast(n,s){this.objectHelper.raycast(n,s)}copy(n,s=!0){return super.copy(n,s),n.enableHelper!==void 0&&(this.enableHelper=n.enableHelper),n.objectHelper!==void 0&&(this.objectHelper.visible=n.objectHelper.visible),this}toJSON(n){let s=super.toJSON(n),o=s.object;return o.enableHelper=this.enableHelper,s}fromJSON(n){return super.fromJSON(n),n.enableHelper!==void 0&&(this.enableHelper=!0),this}fromLightState(n,s){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let o=this;n.color!==void 0&&(o.color=fr(n.color,s)),n.intensity!==void 0&&(o.intensity=n.intensity),n.depth!==void 0&&(o.shadow.camera.far=n.depth,o.shadow.needsUpdate=!0),n.shadows!==void 0&&(this.castShadow=n.shadows),n.helper!==void 0&&(this.enableHelper=n.helper,o.gizmos.shadowmap.visible=n.helper)}return this}};var Kl=new A,Lv=new A,Bn=class extends Gi(Yn(zn),Fp){constructor(t=window.innerWidth,r=window.innerHeight,n=45,s,o=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=ko.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=t,this.height=r,this.orthoCamera=new Eo(t*-.5,t*.5,r*.5,r*-.5,s!=null?s:-5e4,o),this.perspCamera=new nr(n,t/r,s!=null?s:50,o),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)}static createFromState(t,r){let n=new Bn().fromState(r);return n.enableHelper=!0,n.objectHelper.update(),n.uuid=t,n}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(t,r){t==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(t,r){r>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t){super.lookAt(t),this.getWorldPosition(Kl),this.targetOffset=Kl.distanceTo(t)}getTarget(t=new A){return this.getWorldDirection(Lv),this.getWorldPosition(Kl),Lv.multiplyScalar(this.targetOffset),t.copy(Kl).add(Lv),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(Kl),Kl.distanceTo(t)}updateUp(){let t=this.getWorldQuaternion(new Ut),r=new A(0,0,1).applyQuaternion(t),n=new A().copy(ot.DefaultUp);this.isUpVectorFlipped&&n.negate(),n.applyQuaternion(t);let s=new A().copy(ot.DefaultUp).projectOnPlane(r),o=new A().crossVectors(s,n).dot(r)>=0?1:-1;this.angleOffsetFromUp=s.angleTo(n)*o}getViewFrontToObject(t){let r=t.getWorldPosition(new A),s=t.getWorldDirection(new A).multiplyScalar(this.targetOffset);return{position:r.clone().add(s),target:r}}getViewToObject(t){let r=t.getWorldPosition(new A),s=this.getWorldDirection(new A).multiplyScalar(this.targetOffset);return{position:r.clone().sub(s),target:r}}setViewplaneSize(t,r){this.left=-t*.5,this.right=t*.5,this.top=r*.5,this.bottom=-r*.5,this.aspect=t/r,this.updateProjectionMatrix()}toOrthographic(t){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||t===!0)&&this.objectHelper.update()}toPerspective(t){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||t===!0)&&this.objectHelper.update()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,r,n,s,o,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,r,n,s,o,a):this.orthoCamera.setViewOffset(t,r,n,s,o,a)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(t){this._cameraType==="PerspectiveCamera"?this.toPerspective(t):this._cameraType==="OrthographicCamera"&&this.toOrthographic(t)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,r){return super.copy(t,r),this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=t.targetOffset,this.updateProjectionMatrix(),this}fromCameraRender(t){let r={near:this.orthoCamera.near,far:this.orthoCamera.far},n={near:this.perspCamera.near,far:this.perspCamera.far};return this.copy(t),this.name="",this.enableHelper=!0,this.objectHelper.visible=!0,this.orthoCamera.near=r.near,this.orthoCamera.far=r.far,this.perspCamera.near=n.near,this.perspCamera.far=n.far,this.updateProjectionMatrix(),this}toJSON(t){let r=super.toJSON(t),n=r.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,r}fromJSON(t){var r;if(super.fromJSON(t),this.cameraType=t.cameraType,t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.orbitControlsTarget!==void 0){let n=this.getWorldPosition(new A),s=new A().fromArray(t.orbitControlsTarget);this.targetOffset=s.distanceTo(n)}else t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset);return this.isUpVectorFlipped=!1,this.angleOffsetFromUp=(r=t.angleOffsetFromUp)!=null?r:0,t.left!==void 0&&(this.left=t.left),t.right!==void 0&&(this.right=t.right),t.top!==void 0&&(this.top=t.top),t.bottom!==void 0&&(this.bottom=t.bottom),t.view!==void 0&&(this.view=Object.assign({},t.view)),t.zoomOrtho!==void 0&&(this.orthoCamera.zoom=t.zoomOrtho),t.nearOrtho!==void 0&&(this.orthoCamera.near=t.nearOrtho),t.far!==void 0&&(this.far=t.far),t.aspect!==void 0&&(this.aspect=t.aspect),t.fov!==void 0&&(this.fov=t.fov),t.focus!==void 0&&(this.focus=t.focus),t.filmGauge!==void 0&&(this.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(this.filmOffset=t.filmOffset),t.zoomPersp!==void 0&&(this.perspCamera.zoom=t.zoomPersp),t.nearPersp!==void 0&&(this.perspCamera.near=t.nearPersp),this.updateProjectionMatrix(),this}toCameraState(t=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return xl(r,t)}fromCameraState(t){let{orthographic:r,perspective:n}=t;return t.type!==void 0&&(this.cameraType=t.type),t.far!==void 0&&(this.far=t.far),r!==void 0&&(r.near!==void 0&&(this.orthoCamera.near=r.near),r.zoom!==void 0&&(this.orthoCamera.zoom=r.zoom)),n!==void 0&&(n.near!==void 0&&(this.perspCamera.near=n.near),n.fov!==void 0&&(this.perspCamera.fov=n.fov),n.zoom!==void 0&&(this.perspCamera.zoom=n.zoom)),t.up!==void 0&&this.up.fromArray(t.up),t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(t){return be(se(se({},super.toState(t)),this.toCameraState(t)),{type:this.cameraType})}fromState(t){return super.fromState(t),this.fromCameraState(t),this}};var ds=class extends Gi(Yn(Zi),Jl){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(t,r){let n=new ds().fromState(r);return n.uuid=t,n.enableHelper=!0,n.objectHelper.update(),n}toJSON(t){let r=super.toJSON(t);return r.object.objectType="EmptyObject",r}};var Zl=class extends Gi(Yn(cu),Yl){constructor(...t){super(...t);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 s=new Vn(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,n){let s=new Zl().fromState(r,n);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Vn&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Vn&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Vn&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),n=r.object;return n.objectType="LightDirectional",n.color=this.color.getHex(),n.intensity=this.intensity,n.shadow=this.shadow.toJSON(),r}fromJSON(t){var s;super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.shadow.normalBias=(s=t.shadow.normalBias)!=null?s:0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray(t.shadow.mapSize);let r=this.shadow.camera,n=t.shadow.camera;return r.near=n.near,r.far=n.far,r.zoom=n.zoom,r.left=n.left,r.right=n.right,r.top=n.top,r.bottom=n.bottom,n.view!==void 0&&(r.view=Object.assign({},n.view)),this}fromDirectionalLightState(t,r){let n=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;return super.fromLightState(t,r),t.size!==void 0&&w1(this,t.size),n&&this.update(),this}fromState(t,r){return super.fromState(t),this.fromDirectionalLightState(t,r),this}};var $l=class extends Gi(Yn(lu),Ql){constructor(...t){super(...t);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 s=new A(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),o=new A(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z),a=new Qt(s,o),l=new No(a,new xe(16755200));l.visible=!1,this._gizmos.shadowmap=l,this.update()}static createFromState(t,r,n){let s=new $l().fromState(r,n);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof No&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof No&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let t in this._gizmos){let r=this._gizmos[t];if(r instanceof No){let n=this.shadow.camera,s=new A(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),o=new A(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z);r.box.set(s,o),r.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),n=r.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(),r}fromJSON(t){var s,o;super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.distance=t.distance,this.decay=t.decay,this.shadow.normalBias=(s=t.shadow.normalBias)!=null?s:0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray((o=t.shadow.mapSize)!=null?o:[512,512]),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null);let r=this.shadow.camera,n=t.shadow.camera;return r.near=n.near,r.far=n.far,r.zoom=n.zoom,r.fov=n.fov,r.focus=n.focus,r.aspect=n.aspect,r.filmGauge=n.filmGauge,r.filmOffset=n.filmOffset,n.view!==void 0&&(r.view=Object.assign({},n.view)),this}fromPointLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,r){return super.fromState(t),this.fromPointLightState(t,r),this}};var F1=new A,U1=new A,z1=new Ut,ec=class extends Gi(Yn(au),gh){constructor(...t){super(...t);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=et.RAD2DEG*2*this.angle,n.aspect=1,n.near=100,n.far=2500;let s=new Vn(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,n){let s=new ec().fromState(r,n);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Vn&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Vn&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Vn&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),U1.setFromMatrixPosition(this.matrixWorld),z1.setFromRotationMatrix(this.matrixWorld),F1.copy(this.up).applyQuaternion(z1).negate().multiplyScalar(this.distance),this.target.position.copy(U1).add(F1),this.target.updateMatrixWorld(),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),n=r.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(),r}fromJSON(t){var s;super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.distance=t.distance,this.angle=t.angle,this.decay=t.decay,this.penumbra=t.penumbra,this.shadow.normalBias=(s=t.shadow.normalBias)!=null?s:0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray(t.shadow.mapSize);let r=this.shadow.camera,n=t.shadow.camera;return r.near=n.near,r.far=n.far,r.zoom=n.zoom,r.fov=n.fov,r.focus=n.focus,r.aspect=n.aspect,r.filmGauge=n.filmGauge,r.filmOffset=n.filmOffset,n.view!==void 0&&(r.view=Object.assign({},n.view)),this}fromSpotLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),this}fromState(t,r){return super.fromState(t),this.fromSpotLightState(t,r),this}};var tc=class extends Xt{constructor(t,r=new Rn){super(t,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}toJSON(t){let r=super.toJSON(t);return r.object.objectType="Mesh3D",r}};var rc=class extends tc{constructor(t,r=new Rn){super(t,r);this.objectType="NonParametric"}toJSON(t){let r=super.toJSON(t);return r.object.objectType="NonParametric",r}};var zp=class extends ln{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new is(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{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)},r,n)}parse(e){return new Gp(e)}},Gp=class{constructor(e){this.type="Font",this.data=e}generateShapes(e,t=100){let r=[],n=xF(e,t,this.data);for(let s=0,o=n.length;s<o;s++)Array.prototype.push.apply(r,n[s].toShapes());return r}};function xF(i,e,t){let r=Array.from(i),n=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*n,o=[],a=0,l=0;for(let c=0;c<r.length;c++){let u=r[c];if(u===`
|
|
3951
|
+
`)a=0,l-=s;else{let h=bF(u,n,a,l,t);a+=h.offsetX,o.push(h.path)}}return o}function bF(i,e,t,r,n){let s=n.glyphs[i]||n.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+n.familyName+".");return}let o=new Jf,a,l,c,u,h,f,d,m;if(s.o){let p=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let g=0,y=p.length;g<y;)switch(p[g++]){case"m":a=p[g++]*e+t,l=p[g++]*e+r,o.moveTo(a,l);break;case"l":a=p[g++]*e+t,l=p[g++]*e+r,o.lineTo(a,l);break;case"q":c=p[g++]*e+t,u=p[g++]*e+r,h=p[g++]*e+t,f=p[g++]*e+r,o.quadraticCurveTo(h,f,c,u);break;case"b":c=p[g++]*e+t,u=p[g++]*e+r,h=p[g++]*e+t,f=p[g++]*e+r,d=p[g++]*e+t,m=p[g++]*e+r,o.bezierCurveTo(h,f,d,m,c,u);break}}return{offsetX:s.ha*e,path:o}}Gp.prototype.isFont=!0;var dr=class extends Gt{constructor({char:t,originalChar:r,fontFamily:n,letterSpacing:s,fontSize:o,LOD:a=16},l=new Un({color:0,opacity:1,visible:!0,transparent:!0,side:ir})){let c=dr.loadChar(t,n,a);super(c.geometry,l);this.char=t,this.originalChar=r!=null?r:t,this.fontFamily=n,this.letterSpacing=s,this.fontSize=o,this.LOD=a,this.resolution=c.resolution,this.glyphsHa=c.glyphsHa,this.localPosition=new N,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 dr._fontPath}static set FONTS_PATH(t){dr._fontPath=t}updatePosition(t,r){this.localPosition.copy(t);let n=new A(this.localPosition.x,-this.localPosition.y,0);this.position.copy(n).add(r)}updateFontSize(t){let r=t/this.resolution;this.fontSize=t,this.scale.set(this.fontSize,this.fontSize,1),this.charSize=this.glyphsHa*r*this.letterSpacing}updateFontFamily(t){if(this.fontFamily===t)return;this.fontFamily=t;let r=dr.loadChar(this.char,t,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.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(t){if(this.char===t)return;this.char=t;let r=dr.loadChar(t,this.fontFamily,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.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(t){this.letterSpacing!==t&&(this.letterSpacing=t,this.updateFontSize(this.fontSize))}updateLOD(t){if(this.LOD===t)return;this.LOD=t;let r=dr.loadChar(this.char,this.fontFamily,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.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 t={char:this.char,originalChar:this.originalChar,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,LOD:this.LOD};return new dr(t).copy(this)}static loadFont(t){return new Promise(function(r,n){dr.fontCache[t]?r(dr.fontCache[t]):new zp().load(dr.FONTS_PATH+t+".json",o=>{dr.fontCache[t]=o,r(o)},void 0,n)})}static loadChar(t,r,n){if(dr.charCache[t]){if(dr.charCache[t][n]&&dr.charCache[t][n].fontFamily===r)return dr.charCache[t][n]}else dr.charCache[t]={};let s=dr.fontCache[r],o=s.generateShapes(t,1);return dr.charCache[t][n]={geometry:new Do(o,n),fontFamily:r,resolution:s.data.resolution,glyphsHa:s.data.glyphs[t].ha},dr.charCache[t][n]}},dn=dr;dn.charCache={},dn.fontCache={},dn._fontPath="/_assets/_fonts/";var kp=new N,lo=class{constructor(e,t,r){this.message=[];this.endLine=!0;this.yLinePos=e,this.lineHeight=t,this.maxCharSize=r,this.nextChar3DPos=new N(0,this.yLinePos+this.maxCharSize*this.lineHeight),this.align=1}addChar3D(e,t,r=this.message.length){this.message.splice(r,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 r=t,n=this.message.length;r<n;r+=1)this.message[r].updatePosition(this.nextChar3DPos,e),this.nextChar3DPos.x+=this.message[r].charSize}checkOverFlow(e){let t,r=this.message.length-1;if(r<=0)return!1;for(;r>=0;){if(this.message[r].char!==" "){t=this.message[r];break}r-=1}return!!(r>=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=[],r=!0,n;for(n=e;n>=0;n-=1)if(this.message[n].char===" "){r=!1,t.length===0&&(n-=1,t.splice(0,0,this.message[n]));break}else t.splice(0,0,this.message[n]);return r?t=[]:this.message.splice(n+1,t.length),t}getWord(e=0,t=1){let r=[],n=e;for(n=e;;n+=t){if(!this.message[n]||this.message[n].char===" "){r.length===0&&this.message[n]&&(r.push(this.message[n]),this.message.splice(n,1));break}t>0?(r.push(this.message[n]),this.message.splice(n,1),n-=t):(r.splice(0,0,this.message[n]),this.message.splice(n,1))}return r}getWordAtIndex(e){let t=[];for(let r=e;r<this.message.length&&this.message[r].char!==" ";r++)t.push(this.message[r]);for(let r=e-1;r>=0&&this.message[r].char!==" ";r--)t.splice(0,0,this.message[r]);return t}wordSize(e=0,t=-1){let r=0,n=e;for(;n>=0&&n<this.message.length;){if(this.message[n].char===" "){r===0&&(r=this.message[n].charSize);break}r+=this.message[n].charSize,n+=t}return(n<0||n>=this.message.length)&&!this.endLine?this.message[e]?this.message[e].charSize:999999999:r===0?999999999:r}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,r=this.message.length-1){for(let n=t;n<=r;n+=1)this.message[n].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,r,n,s){switch(r){case 1:this.leftAlign(e,s);break;case 3:this.centerAlign(this.spaceLeft(t),e,s);break;case 2:this.rightAlign(this.spaceLeft(t),e,s);break;case 4:this.justifyAlign(this.spaceLeft(t),e,s);break}}offsetCharacters(e,t,r){kp.set(t,r);let n=this.message.length;for(let s=0;s<n;s++)this.message[s].updatePosition(this.message[s].localPosition.add(kp),e)}leftAlign(e,t){this.align=1,this.offsetCharacters(e,0,t)}centerAlign(e,t,r){this.align=3,this.offsetCharacters(t,e/2,r)}rightAlign(e,t,r){this.align=2,this.offsetCharacters(t,e,r)}justifyAlign(e,t,r){if(this.align=4,this.endLine){this.offsetCharacters(t,0,r);return}let n=this.countSpaces();if(n===0){this.offsetCharacters(t,0,r);return}let s=e/n,o=0;for(let a=0;a<this.message.length;a++)this.message[a].char===" "&&(o+=s),kp.set(o,r),this.message[a].updatePosition(this.message[a].localPosition.add(kp),t)}clone(){let e=new lo(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 Dv=class extends Xt{constructor(t,r=new jr({transparent:!0,opacity:1,visible:!1,side:ir})){super(t,r);this.objectType="TextFrame";this.charContainer=new ot,this.add(this.charContainer),this.material.visible=!1,this._geometryUserData=t.userData,this.userData.textFrame={hexColor:null,opacity:1,visible:!0,text:"",fontSize:16,lineHeight:1.5,letterSpacing:1,fontFamily:"roboto_regular",textTransform:1,horizontalAlignment:1,verticalAlignment:1,LOD:16,maxLineSize:this._geometryUserData.parameters.width,textOrigin:new A(this._geometryUserData.parameters.width*-.5,this._geometryUserData.parameters.height*.5,0),textLines:[]},this.createTextLine()}static createFromState(t,r,n){let s=yp.create({parameters:{width:r.width,height:r.height}}),o=new Dv(s).fromState(r,n);return o.uuid=t,o}async updateText(t){this.clearText();let r=this.userData.textFrame,n=r.fontFamily;await dn.loadFont(n),r.text=t;let s=r.textOrigin,o=new Un({visible:r.visible,transparent:!0,side:ir}),a=t.split(`
|
|
3952
|
+
`),l=0;this.userData.textFrame.textLines=a.map((c,u)=>{let h=new lo(l,r.lineHeight,r.fontSize);return h.message=c.split("").map(f=>{let d={char:f,fontFamily:n,letterSpacing:r.letterSpacing,fontSize:r.fontSize,LOD:16},m=o.clone();m.color=r.hexColor,m.opacity=r.opacity;let p=new dn(d,m);return h.addChar3D(p,s),this.charContainer.add(p),p}),l+=h.maxCharSize*h.lineHeight,h}),this.textFullUpdate(),this.checkOverFlow()}clearText(){let t=this.userData.textFrame.textLines;for(;this.charContainer.children.length;){let r=this.charContainer.children[0];this.charContainer.remove(r)}for(;t.length;)t.pop()}raycast(t,r){let n=[];if(super.raycast(t,n),n.length>0){r.push(n[0]);return}let s=[];for(let o=0,a=this.charContainer.children.length;o<a;++o)if(this.charContainer.children[o]instanceof dn&&(t.intersectObject(this.charContainer.children[o],!1,s),s.length>0)){s[0].object=this,r.push(s[0]);return}}updateGeometry(t){var u,h,f,d;let r=this.userData,n=this.geometry.userData,s=n.parameters.width,o=n.parameters.height,a=(h=(u=t.parameters)==null?void 0:u.width)!=null?h:s,l=(d=(f=t.parameters)==null?void 0:f.height)!=null?d:o,c=r.textFrame;super.updateGeometry(t),c.maxLineSize=a,c.textOrigin.set(-.5*a,.5*l,0),l!==o?(this.checkOverFlow(),this.checkCapacity()):a!==s&&(s<a?this.checkCapacity():s>a&&this.checkOverFlow())}checkOverFlow(t=0){let r=this.userData,n=r.textFrame.textOrigin,s=r.textFrame.textLines;for(let o=t;o<s.length;o++){s[o].updateYLinePos(this.getNewLinePosition(o)),s[o].fullUpdate(n);let a=[];for(;s[o].checkOverFlow(r.textFrame.maxLineSize);)s[o].containSpaceOverFlow()?a.unshift(s[o].getWord(s[o].message.length-1,-1)):a.unshift(s[o].popChar());if(a.length>0){s[o+1]===void 0?(s[o].isEndLine(!1),this.createTextLine()):s[o].endLine&&(this.createTextLine(o+1),s[o].isEndLine(!1),s[o+1].isEndLine(!0));let l=0;for(let c=0;c<a.length;c+=1)for(let u=0;u<a[c].length;u+=1)s[o+1].addChar3D(a[c][u],n,l),l+=1;s[o+1].fullUpdate(n)}s[o].fullUpdate(n)}this.textFullUpdate(t)}checkCapacity(t=0){let r=this.userData,n=r.textFrame.textOrigin,s=r.textFrame.maxLineSize,o=r.textFrame.textLines;for(let a=t;a<o.length;a+=1)if(o[a].updateYLinePos(this.getNewLinePosition(a)),o[a].fullUpdate(n),!!o[a-1])for(;!o[a-1].endLine;){let l,c=o[a-1].spaceLeft(s);if(o[a].wordSize(0,1)<=c){o[a].containSpace()?l=o[a].getWord(0,1):l=o[a].popChar(0);for(let u=0;u<l.length;u+=1)l[u]&&o[a-1].addChar3D(l[u],n)}else{o[a].isEmpty()?(o[a].endLine&&o[a-1].isEndLine(!0),o.splice(a,1),a-=1):(o[a].updateYLinePos(this.getNewLinePosition(a)),o[a].fullUpdate(n));break}}this.textFullUpdate(t)}createTextLine(t=this.userData.textFrame.textLines.length){let n=this.userData.textFrame;n.textLines.splice(t,0,new lo(this.getNewLinePosition(t),n.lineHeight,n.fontSize))}textFullUpdate(t=0){let n=this.userData.textFrame,s=n.textLines,o=this.getVerticalAlignmentOffSet();for(let a=t;a<s.length;a++)s[a].updateYLinePos(this.getNewLinePosition(a)),s[a].fullUpdate(n.textOrigin),s[a].alignText(n.textOrigin,n.maxLineSize,n.horizontalAlignment,n.verticalAlignment,o)}getVerticalAlignmentOffSet(){switch(this.userData.textFrame.verticalAlignment){case 1:return 0;case 2:return this.getRemainingVerticalSpace()/2;case 3:return this.getRemainingVerticalSpace();default:return 0}}getRemainingVerticalSpace(){let r=this.userData.textFrame.textLines;return this.geometry.userData.parameters.height-this.getNewLinePosition(r.length)}getNewLinePosition(t){let n=this.userData.textFrame.textLines,s=0;for(let o=0;o<t;o+=1)s+=n[o].maxCharSize*n[o].lineHeight;return s}updateColor(t){var s;let r=this.userData;r.textFrame.hexColor=t;let n=r.textFrame.textLines;for(let o=0;o<n.length;o++){let a=n[o].message;for(let l=0;l<a.length;l++){let c=a[l].material;(s=c.color)!=null&&s.isColor&&(c.color=t)}}}updateOpacity(t){let r=this.userData;r.textFrame.opacity=t;let n=r.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;l.opacity=t}}}updateVisible(t){let r=this.userData;r.textFrame.visible=t;let n=r.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;l.visible=t}}}async updateFontFamily(t){await dn.loadFont(t);let n=this.userData.textFrame,s=n.textLines;n.fontFamily=t;for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)a[l].updateFontFamily(t)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateFontSize(t){let n=this.userData.textFrame,s=n.textLines,o=n.fontSize;n.fontSize=t;for(let a=0;a<s.length;a++)s[a].updateFontSize(t);this.textFullUpdate(),t>o?this.checkOverFlow():t<o&&this.checkCapacity()}async updateTextTransform(t){let n=this.userData.textFrame;await dn.loadFont(n.fontFamily);let s=n.textLines;switch(n.textTransform=t,t){case 2:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].char.toUpperCase())}break;case 3:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].char.toLowerCase())}break;default:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].originalChar)}}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLetterSpacing(t){let r=this.userData,n=r.textFrame.textLines;r.textFrame.letterSpacing=t;for(let s=0;s<n.length;s++){let o=n[s].message;for(let a=0;a<o.length;a++)o[a].updateLetterSpacing(t)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLOD(t){let r=this.userData;r.textFrame.LOD=t;let n=r.textFrame.textLines;for(let s=0;s<n.length;s++);this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLineHeight(t){let r=this.userData,n=r.textFrame.textLines;r.textFrame.lineHeight=t;for(let s=0;s<n.length;s++)n[s].updatelineHeight(t);this.textFullUpdate()}updateVerticalAlignment(t){let r=this.userData;r.textFrame.verticalAlignment=t,this.textFullUpdate()}updateHorizontalAlignment(t){let r=this.userData;r.textFrame.horizontalAlignment=t,this.textFullUpdate()}toJSON(t){let r=super.toJSON(t),n=r.object;n.objectType="TextFrame";let o=this.userData.textFrame.textLines.map(a=>{let l=a.message.map(c=>({char:c.char,originalChar:c.originalChar,fontFamily:c.fontFamily,letterSpacing:c.letterSpacing,fontSize:c.fontSize,LOD:c.LOD}));return{align:a.align,endLine:a.endLine,lineHeight:a.lineHeight,maxCharSize:a.maxCharSize,yLinePos:a.yLinePos,message:l}});return n.userData.textFrame.textLinesData=o,r}async fromJSONasync(t){if(super.fromJSON(t),t.userData!==void 0){let r=t.userData.textFrame;await dn.loadFont(r.fontFamily),r.textOrigin=new A(r.textOrigin.x,r.textOrigin.y,r.textOrigin.z);let n=new Un({color:r.hexColor,opacity:r.opacity,visible:r.visible,transparent:!0,side:ir});r.textLinesData&&(r.textLines=r.textLinesData.map((s,o)=>{let a=new lo(Number(s.yLinePos),Number(s.lineHeight),Number(s.maxCharSize)),l=s.message.map((c,u)=>{if(c.char===void 0){let d=r.textLines[o].message[u];if("geometries"in d){let m=d.geometries[0].userData.parameters;Object.assign(c,{LOD:m.lod,char:m.char,fontFamily:m.fontFamily,fontSize:m.fontSize,letterSpacing:m.letterSpacing,originalChar:m.char})}}let h={char:c.char,fontFamily:c.fontFamily,letterSpacing:Number(c.letterSpacing),fontSize:Number(c.fontSize),LOD:c.LOD},f=new dn(h,n.clone());return a.addChar3D(f,r.textOrigin),this.charContainer.add(f),f});return a.message=l,a}),this.userData.textFrame=r),this.textFullUpdate()}return this}fromTextFrameData(t,r){if(t.color!==void 0){let n=fr(t.color,r);this.updateColor(n),this.updateOpacity(n.a)}t.alpha!==void 0&&this.updateOpacity(t.alpha),t.font!==void 0&&this.updateFontFamily(t.font),t.horizontalAlign!==void 0&&this.updateHorizontalAlignment(t.horizontalAlign),t.verticalAlign!==void 0&&this.updateVerticalAlignment(t.verticalAlign),t.textTransform!==void 0&&this.updateTextTransform(t.textTransform),t.fontSize!==void 0&&this.updateFontSize(t.fontSize),t.lineHeight!==void 0&&this.updateLineHeight(t.lineHeight),t.letterSpacing!==void 0&&this.updateLetterSpacing(t.letterSpacing),t.text!==void 0&&t.text!==""&&this.updateText(t.text),(t.width!==void 0||t.height!==void 0)&&this.updateGeometry({parameters:{width:t.width,height:t.height}})}fromState(t,r){return super.fromState(t),this.fromTextFrameData(t,r),this}convertToVector(){let{fontFamily:t,hexColor:r}=this.userData.textFrame,n=new ds;n.name="Text Shape";let s=dn.fontCache[t];for(let o of this.charContainer.children)o instanceof dn&&s.generateShapes(o.char,1).forEach(a=>{let l=new At().fromShape(a);l.applyScale(o.scale.x,o.scale.y);let c=Gr.create({shape:l}),u=new jr({side:ir});u.color=r;let h=new ao(c,u);h.name=o.char,h.position.copy(o.position),h.rotation.copy(o.rotation),n.attach(h)});return n}},Ko=Dv;Ko.VerticalAlign=zy,Ko.HorizontalAlign=Uy,Ko.TextTransform=Gy;function G1(i,e){return wF(i)}function wF(i){let e={parameters:i,type:i.type};if(i.type==="VectorGeometry"){let r=At.createFromState(i.shape,i.width,i.height);e.shape=r}else i.type==="NonParametricGeometry"&&(i.data.groups&&i.data.groups.forEach(r=>{var n;return r.materialIndex=Math.max((n=r.materialIndex)!=null?n:0,0)}),e.geometry=new Gs().parse(i));let t;try{t=Ju(e)}catch(r){console.error(r)}if(!t){let r=At.createFromState(Tl.defaultData(),100,100);e.shape=r,t=Ju(e)}return t}var W1=mT(V1());var Pv;vp.then(i=>{Pv=i});var j1=new Ee,SF=new Ee,MF=new Ee,gi=new Qt,co=new A,AF=new Ee,TF=new Ee,uo=class extends Xt{constructor(t,r,n,s=new Rn){super(n!=null?n:r,s);this.subdivPointer=t;this.originalGeometry=r;this.subdividedGeometry=n;this.objectType="SubdivObject";this.hiddenMatrixOld=new Ee;this.smoothShading=!0;this.matrixWorldRigid=new Ee;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(t,r,n){let{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}=Pn.build(r.geometry,void 0,void 0,!r.flatShading),l=mh(r.material,n),c=new uo(s,o,a||void 0,l);return c.calcBoundingBox(),c.freeSubdivPointer(),c.uuid=t,c.fromState(r),c}shallowClone(t){return new rc(this.geometry,this.material).shallowCopy(this,t)}toJSON(t){let r=super.toJSON(t);return r.object.objectType="SubdivObject",r}buildFromStore(t){var o,a,l;let{originalGeometry:r,subdividedGeometry:n,subdivPointer:s}=Pn.build(t,this.subdivPointer,void 0,this.smoothShading,this.shearScale);if(this.subdivPointer=s,r!==void 0&&((o=this.originalGeometry)==null||o.dispose(),this.originalGeometry=r),n!==void 0&&((a=this.subdividedGeometry)==null||a.dispose(),this.subdividedGeometry=n!=null?n:void 0),this.geometry=(l=this.subdividedGeometry)!=null?l:this.originalGeometry,this.cloner)for(let c of this.cloner.children)c.geometry=this.geometry;t.width&&(this.geometry.userData.parameters={width:t.width,height:t.height,depth:t.depth})}updateMesh(t=!1){Pn.buildLevel(this.subdivPointer,!0,this.smoothShading,this.originalGeometry,t?this.shearScaleInv:void 0),this.subdividedGeometry&&Pn.buildLevel(this.subdivPointer,!1,this.smoothShading,this.subdividedGeometry,t?this.shearScaleInv:void 0)}updateTopology(){var t;this.originalGeometry.dispose(),this.originalGeometry=Pn.buildLevel(this.subdivPointer,!0,this.smoothShading),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Pn.buildLevel(this.subdivPointer,!1,this.smoothShading)),this.geometry=(t=this.subdividedGeometry)!=null?t:this.originalGeometry}raycast(t,r){var n;this.geometry=this.originalGeometry,Xt.prototype.raycast.call(this,t,r),this.geometry=(n=this.subdividedGeometry)!=null?n:this.originalGeometry}updateMatrixWorldSVD(){let t=this.matrixWorld.elements,r=[[t[0],t[4],t[8]],[t[1],t[5],t[9]],[t[2],t[6],t[10]]],{u:n,v:s,q:o}=(0,W1.SVD)(r),a=j1.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),l=SF.set(s[0][0],s[0][1],s[0][2],0,s[1][0],s[1][1],s[1][2],0,s[2][0],s[2][1],s[2][2],0,0,0,0,1),c=MF.copy(l).transpose();this.shearScale=AF.makeScale(o[0],o[1],o[2]).multiply(c).premultiply(l),this.shearScaleInv=TF.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(a,c),o.every(u=>Math.abs(o[0]-u)<.01)&&(this.shearScale=void 0,this.shearScaleInv=void 0)}activateSVDCompensation(){this.shearScale!==void 0&&(this.matrixAutoUpdate=!1,this.matrix.copy(this.matrixWorldRigid).copyPosition(this.matrixWorld),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateSVDCompensation(){this.shearScale!==void 0&&(this.shearScale=void 0,this.shearScaleInv=void 0,this.matrixAutoUpdate=!0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new Yr);let r=t.attributes.position,n=t.boundingSphere.center;gi.setFromBufferAttribute(r),gi.getCenter(n),t.boundingSphere.radius=n.distanceTo(gi.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),gi.getSize(co);let s={width:co.x,height:co.y,depth:co.z};return this.geometry.userData.parameters=s,s}updateBoundingBox(t){let r=this.originalGeometry;gi.min.set(t[0],t[2],t[4]),gi.max.set(t[1],t[3],t[5]),this.shearScaleInv&&(gi.min.applyMatrix4(this.shearScaleInv),gi.max.applyMatrix4(this.shearScaleInv)),r.boundingSphere===null&&(r.boundingSphere=new Yr);let n=r.boundingSphere.center;gi.getCenter(n),r.boundingSphere.radius=n.distanceTo(gi.max),isNaN(r.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),gi.getSize(co);let s={width:co.x,height:co.y,depth:co.z};return this.geometry.userData.parameters=s,s}freeSubdivPointer(){this.subdivPointer&&(Pv.free_bvh(this.subdivPointer),Pv.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(t){this.geometry.userData.scale||(this.geometry.userData.scale=Array(3)),this.geometry.userData.scale[0]=this.geometry.userData.parameters.width===0?1:t.parameters.width/this.geometry.userData.parameters.width,this.geometry.userData.scale[1]=this.geometry.userData.parameters.height===0?1:t.parameters.height/this.geometry.userData.parameters.height,this.geometry.userData.scale[2]=this.geometry.userData.parameters.depth===0?1:t.parameters.depth/this.geometry.userData.parameters.depth,H1(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(H1(this.subdividedGeometry.attributes,...this.subdividedGeometry.userData.scale),this.subdividedGeometry.attributes.position.needsUpdate=!0,this.subdividedGeometry.attributes.normal.needsUpdate=!0),this.geometry.userData.parameters=se({},t.parameters)}};function H1(i,e,t,r){let n=i.position.array,s=i.normal.array,o=j1.makeScale(e,t,r).invert().elements,a,l,c;for(var u=0,h=n.length;u<h;u+=3)n[u]*=e,n[u+1]*=t,n[u+2]*=r,a=s[u],l=s[u+1],c=s[u+2],s[u]=o[0]*a+o[4]*l+o[8]*c,s[u+1]=o[1]*a+o[5]*l+o[9]*c,s[u+2]=o[2]*a+o[6]*l+o[10]*c}function q1(i,e){e.flatShading!==void 0&&(i.flatShading=e.flatShading,i.needsUpdate=!0),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.side!==void 0&&(e.side===0?i.side=ii:e.side===1?i.side=Cr:i.side=ir)}function EF(i,e){if(Array.isArray(i.material))for(let t of i.material)q1(t,e);else{let t=i.material;q1(t,e)}i.objectType==="SubdivObject"&&e.flatShading!==void 0&&(i.material.flatShading=!1,i.smoothShading=!e.flatShading,i.updateMesh())}function X1(i,e,t){let r;if(e.geometry.type==="SubdivGeometry")r=uo.createFromState(i,e,t);else{let n=G1(e.geometry,t),s="materials"in e?P1(e.materials,t):mh(e.material,t);ip.is2DParametricMesh(n.userData.type)?r=new Xl(n,s):(n==null?void 0:n.userData.type)==="VectorGeometry"?r=new ao(n,s):e.geometry.type==="NonParametricGeometry"?r=new rc(n,s):r=new tc(n,s),r.uuid=i,r.fromState(e)}return EF(r,e),r}function Y1(i,e,t){return e.type==="Mesh"?X1(i,e,t):e.type==="TextFrame"?Ko.createFromState(i,e,t):e.type==="Empty"?ds.createFromState(i,e):e.type==="PointLight"?$l.createFromState(i,e,t):e.type==="SpotLight"?ec.createFromState(i,e,t):e.type==="DirectionalLight"?Zl.createFromState(i,e,t):Qs.is(e.type)?Bn.createFromState(i,e):(console.error(e),new ds)}function _F(i,e){e.uniforms[`f${e.id}_transmissionSamplerMap`].value=i.texture,e.uniforms[`f${e.id}_transmissionDepthMap`].value=i.depthTexture}function J1(i,e,t){if(!t.userData.layers)return!1;let r=!1,n=t.userData.layers.getLayersOfType("transmission");return n.length>0?(e.layers.set(3),r=!0,i!==void 0&&n.forEach(s=>_F(i,s))):e.layers.set(0),r}function Q1(i,e){let t=!1;return e.traverseEntity(r=>{if(r instanceof Xt)if(Array.isArray(r.material))for(let n=0;n<r.material.length;n++)J1(i,r,r.material[n])&&(t=!0);else J1(i,r,r.material)&&(t=!0)}),t}function K1(i,e){"material"in i&&CF(i.material,e),"geometry"in i&&i.geometry.dispose()}function CF(i,e){GS(i).forEach(t=>{e.isSharedMaterial(t)||t.dispose()})}var Z1=new A,Iv=class extends xp(sn){constructor(t,r){super();this.objectType="Scene";this.alpha=1;this.backupFog=new _o(16777215,.1,2e3);this.fogUseBGColor=!1;this.wireframeState=!1;this.needsTransmissionDirty=!0;this._needsTransmission=!1;this._color=new xe(1,0,0);this.bgColor=new xe(1,1,1);this.entityByUuid={};this.ambientLight=new zs(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.personalCamera=this.createPersonalCamera(),this.activeCamera=this.personalCamera,this.sharedAssetManager=r,this.init(t,r)}needsTransmission(t){return this.needsTransmissionDirty&&(this._needsTransmission=Q1(t,this),t!==void 0&&(this.needsTransmissionDirty=!1)),this._needsTransmission}find(t){if(t===""||t===void 0)return;let r=this.entityByUuid[t];return r===void 0?this.getObjectByProperty("uuid",t):r}get color(){return this._color}set color(t){this.fogUseBGColor===!0&&this.backupFog.color.copy(t),this._color.copy(t)}get enableFog(){return this.fog!==null}set enableFog(t){this.fog=t===!0?this.backupFog:null}init(t,r){if(this.createChildrenObjects(t.objects,this,r),this.personalCamera.removeFromParent(),this.add(this.personalCamera),this.ambientLight.removeFromParent(),this.add(this.ambientLight),this.setBackgroundColor(fr(t.backgroundColor,r)),this.updateFog(t.fog,r),this.updateAmbientLight(t.environment.ambientLight,r),this.activeCamera=this.personalCamera,t.publish.playCamera!==null){let n=this.find(t.publish.playCamera);n instanceof Bn&&this.switchActiveCamera(n)}}clearScene(t){this.traverseEntity(r=>{K1(r,t)});for(let r of this.children)Xn(r)&&r.removeFromParent()}resetAfterClear(t,r){this.init(t,r)}createPersonalCamera(){let t=Bn.createFromState(Iv.PERSONAL_CAMERA_ID,be(se({},op.defaultData),{name:"Personal Camera"}));return t.enableHelper=!1,t.objectHelper.visible=!1,delete t.isEntity,this.registerObjectCreatedInLegacy(t),t}raycast(t){let r=[],n=s=>{for(let o of s.children)Xn(o)&&!o.raycastLock&&o.visible&&((us(o)||hs(o)&&o.enableHelper&&o.objectHelper.parent)&&t.intersectObject(o,!1,r),n(o))};return n(this),r}traverseEntity(t){for(let r of this.children)Xn(r)&&r.traverseEntity(t)}updateFog(t,r){this.enableFog=t.enabled,this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=fr(t.color,r),this.backupFog.near=t.near,this.backupFog.far=t.far}toJSON(t){return{}}fromJSON(t){return this}dispose(){this.clearScene(this.sharedAssetManager),this.sharedAssetManager.dispose()}updateAmbientLight(t,r){b1(this.ambientLight,t,r),t.groundColor!==void 0&&(this.ambientLight.groundColor=fr(t.groundColor,r)),t.enabled!==void 0&&(this.ambientLight.visible=t.enabled)}switchActiveCamera(t){this.activeCamera!==this.personalCamera&&(this.activeCamera.enableHelper=!0),this.activeCamera=t,t.enableHelper=!1}setBackgroundColor(t){this.bgColor=t,this.alpha=t.a}createChildrenObjects(t,r,n){for(let s of t)this.createChildObject(s.id,s.data,s.children,r,n)}registerObjectCreatedInLegacy(t){this.entityByUuid[t.uuid]=t}unregisterObject(t){delete this.entityByUuid[t.uuid];for(let r of t.children)this.unregisterObject(r)}createChildObject(t,r,n,s,o){let a=Y1(t,r,o);return a&&(this.entityByUuid[t]=a,s.add(a),this.createChildrenObjects(n,a,o)),a}getCenter(t){let r=[];for(let s=0,o=t.length;s<o;++s){let{id:a,recursive:l}=t[s],c=this.find(a),u=l?c.recursiveBBox:c.singleBBox;r.push(...u.vertices)}let n=new Qt;return n.setFromPoints(r),n.getCenter(Z1),Z1}copyMatrixWorld(t,r){if(t===null){r.identity();return}let n=this.find(t);n?r.copy(n.matrixWorld):r.identity()}copyParentMatrixWorld(t,r){var s;if(t===null){r.identity();return}let n=(s=this.find(t))==null?void 0:s.parent;n?r.copy(n.matrixWorld):r.identity()}traverseMaterial(t){this.traverseEntity(r=>{if(r instanceof Xt)if(Array.isArray(r.material))for(let n=0;n<r.material.length;n++)t(r.material[n]);else t(r.material)})}updateCanvasSize(t,r){this.activeCamera.setViewplaneSize(t,r);let n,s;t>=r?(n=r/t,s=1):(n=1,s=t/r),this.traverseMaterial(o=>{o.layersList.getLayersOfType("transmission").forEach(l=>{l.uniforms[`f${l.id}_aspectRatio`].value.x=n,l.uniforms[`f${l.id}_aspectRatio`].value.y=s})})}},yh=Iv;yh.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";var sA={RED:0,GREEN:1,BLUE:2,ALPHA:3};var vh="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}";var LF=`#ifdef FRAMEBUFFER_PRECISION_HIGH
|
|
3953
3953
|
uniform mediump sampler2D inputBuffer;
|
|
3954
3954
|
#else
|
|
3955
3955
|
uniform lowp sampler2D inputBuffer;
|
|
@@ -3977,7 +3977,7 @@ vec4 acc=vec4(0.0);for(int i=0;i<32;++i){vec4 kernel=kernel64[i];vec2 uv=step*ke
|
|
|
3977
3977
|
#else
|
|
3978
3978
|
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;
|
|
3979
3979
|
#endif
|
|
3980
|
-
}}`,Hp=class extends St{constructor(i=!1,e=!1){super({name:"BokehMaterial",defines:{PASS:i?"2":"1"},uniforms:{kernel64:new Te(null),kernel16:new Te(null),inputBuffer:new Te(null),cocBuffer:new Te(null),texelSize:new Te(new N),scale:new Te(1)},blending:kt,depthWrite:!1,depthTest:!1,fragmentShader:LF,vertexShader:
|
|
3980
|
+
}}`,Hp=class extends St{constructor(i=!1,e=!1){super({name:"BokehMaterial",defines:{PASS:i?"2":"1"},uniforms:{kernel64:new Te(null),kernel16:new Te(null),inputBuffer:new Te(null),cocBuffer:new Te(null),texelSize:new Te(new N),scale:new Te(1)},blending:kt,depthWrite:!1,depthTest:!1,fragmentShader:LF,vertexShader:vh}),this.toneMapped=!1,e&&(this.defines.FOREGROUND="1"),this.generateKernel()}set inputBuffer(i){this.uniforms.inputBuffer.value=i}setInputBuffer(i){this.uniforms.inputBuffer.value=i}set cocBuffer(i){this.uniforms.cocBuffer.value=i}setCoCBuffer(i){this.uniforms.cocBuffer.value=i}get scale(){return this.uniforms.scale.value}set scale(i){this.uniforms.scale.value=i}getScale(i){return this.uniforms.scale.value=i}setScale(i){this.uniforms.scale.value=i}generateKernel(){let i=2.39996323,e=new Float32Array(128),t=new Float32Array(32),r=0,n=0;for(let a=0;a<80;++a){let l=a*i,c=Math.sqrt(a)/Math.sqrt(80),u=c*Math.cos(l),h=c*Math.sin(l);a%5===0?(t[n++]=u,t[n++]=h):(e[r++]=u,e[r++]=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(i,e){this.uniforms.texelSize.value.set(i,e)}setSize(i,e){this.uniforms.texelSize.value.set(1/i,1/e)}};function $1(i,e,t){return i*(e-t)-e}function Fv(i,e,t){return Math.min(Math.max((i+e)/(e-t),0),1)}var DF=`#include <common>
|
|
3981
3981
|
#include <packing>
|
|
3982
3982
|
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
3983
3983
|
uniform highp sampler2D depthBuffer;
|
|
@@ -3996,7 +3996,7 @@ float viewZ=perspectiveDepthToViewZ(depth,cameraNear,cameraFar);float linearDept
|
|
|
3996
3996
|
#else
|
|
3997
3997
|
float linearDepth=depth;
|
|
3998
3998
|
#endif
|
|
3999
|
-
float signedDistance=linearDepth-focusDistance;float magnitude=smoothstep(0.0,focusRange,abs(signedDistance));gl_FragColor.rg=magnitude*vec2(step(signedDistance,0.0),step(0.0,signedDistance));}`,PF=class extends St{constructor(i){super({name:"CircleOfConfusionMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new Te(null),focusDistance:new Te(0),focusRange:new Te(0),cameraNear:new Te(.3),cameraFar:new Te(1e3)},blending:kt,depthWrite:!1,depthTest:!1,fragmentShader:DF,vertexShader:
|
|
3999
|
+
float signedDistance=linearDepth-focusDistance;float magnitude=smoothstep(0.0,focusRange,abs(signedDistance));gl_FragColor.rg=magnitude*vec2(step(signedDistance,0.0),step(0.0,signedDistance));}`,PF=class extends St{constructor(i){super({name:"CircleOfConfusionMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new Te(null),focusDistance:new Te(0),focusRange:new Te(0),cameraNear:new Te(.3),cameraFar:new Te(1e3)},blending:kt,depthWrite:!1,depthTest:!1,fragmentShader:DF,vertexShader:vh}),this.toneMapped=!1,this.uniforms.focalLength=this.uniforms.focusRange,this.adoptCameraSettings(i)}get near(){return this.uniforms.cameraNear.value}get far(){return this.uniforms.cameraFar.value}set depthBuffer(i){this.uniforms.depthBuffer.value=i}set depthPacking(i){this.defines.DEPTH_PACKING=i.toFixed(0),this.needsUpdate=!0}setDepthBuffer(i,e=Lr){this.depthBuffer=i,this.depthPacking=e}get focusDistance(){return this.uniforms.focusDistance.value}set focusDistance(i){this.uniforms.focusDistance.value=i}get worldFocusDistance(){return-$1(this.focusDistance,this.near,this.far)}set worldFocusDistance(i){this.focusDistance=Fv(-i,this.near,this.far)}getFocusDistance(i){this.uniforms.focusDistance.value=i}setFocusDistance(i){this.uniforms.focusDistance.value=i}get focalLength(){return this.focusRange}set focalLength(i){this.focusRange=i}get focusRange(){return this.uniforms.focusRange.value}set focusRange(i){this.uniforms.focusRange.value=i}get worldFocusRange(){return-$1(this.focusRange,this.near,this.far)}set worldFocusRange(i){this.focusRange=Fv(-i,this.near,this.far)}getFocalLength(i){return this.focusRange}setFocalLength(i){this.focusRange=i}adoptCameraSettings(i){i&&(this.uniforms.cameraNear.value=i.near,this.uniforms.cameraFar.value=i.far,i instanceof nr?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},IF=`#include <common>
|
|
4000
4000
|
#include <dithering_pars_fragment>
|
|
4001
4001
|
#ifdef FRAMEBUFFER_PRECISION_HIGH
|
|
4002
4002
|
uniform mediump sampler2D inputBuffer;
|
|
@@ -4013,7 +4013,7 @@ uniform lowp sampler2D inputBuffer;
|
|
|
4013
4013
|
#endif
|
|
4014
4014
|
uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel;
|
|
4015
4015
|
#include <encodings_fragment>
|
|
4016
|
-
}`,NF=class extends St{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new Te(null),opacity:new Te(1)},blending:kt,depthWrite:!1,depthTest:!1,fragmentShader:BF,vertexShader:
|
|
4016
|
+
}`,NF=class extends St{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new Te(null),opacity:new Te(1)},blending:kt,depthWrite:!1,depthTest:!1,fragmentShader:BF,vertexShader:vh}),this.toneMapped=!1}set inputBuffer(i){this.uniforms.inputBuffer.value=i}setInputBuffer(i){this.uniforms.inputBuffer.value=i}getOpacity(i){return this.uniforms.opacity.value}setOpacity(i){this.uniforms.opacity.value=i}};var OF=`varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;
|
|
4017
4017
|
#if EDGE_DETECTION_MODE != 0
|
|
4018
4018
|
varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;
|
|
4019
4019
|
#endif
|
|
@@ -4123,7 +4123,7 @@ gl_FragColor=vec4(texel.rgb*l,l);
|
|
|
4123
4123
|
#else
|
|
4124
4124
|
gl_FragColor=vec4(l);
|
|
4125
4125
|
#endif
|
|
4126
|
-
}`,VF=class extends St{constructor(i=!1,e=null){super({name:"LuminanceMaterial",uniforms:{inputBuffer:new Te(null),threshold:new Te(0),smoothing:new Te(1),range:new Te(null)},blending:kt,depthWrite:!1,depthTest:!1,fragmentShader:kF,vertexShader:
|
|
4126
|
+
}`,VF=class extends St{constructor(i=!1,e=null){super({name:"LuminanceMaterial",uniforms:{inputBuffer:new Te(null),threshold:new Te(0),smoothing:new Te(1),range:new Te(null)},blending:kt,depthWrite:!1,depthTest:!1,fragmentShader:kF,vertexShader:vh}),this.toneMapped=!1,this.colorOutput=i,this.luminanceRange=e}set inputBuffer(i){this.uniforms.inputBuffer.value=i}setInputBuffer(i){this.uniforms.inputBuffer.value=i}get threshold(){return this.uniforms.threshold.value}set threshold(i){this.smoothing>0||i>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=i}getThreshold(){return this.threshold}setThreshold(i){this.threshold=i}get smoothing(){return this.uniforms.smoothing.value}set smoothing(i){this.threshold>0||i>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=i}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(i){this.smoothing=i}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(i){}get colorOutput(){return this.defines.COLOR!==void 0}set colorOutput(i){i?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(i){return this.colorOutput}setColorOutputEnabled(i){this.colorOutput=i}get useRange(){return this.luminanceRange!==null}set useRange(i){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(i){i!==null?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=i,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(i){this.luminanceRange=i}},HF=`#ifdef FRAMEBUFFER_PRECISION_HIGH
|
|
4127
4127
|
uniform mediump sampler2D inputBuffer;
|
|
4128
4128
|
#else
|
|
4129
4129
|
uniform lowp sampler2D inputBuffer;
|
|
@@ -4163,7 +4163,7 @@ gl_FragColor=vec4(mask*texture2D(inputBuffer,vUv).rgb,mask);
|
|
|
4163
4163
|
#else
|
|
4164
4164
|
gl_FragColor=mask*texture2D(inputBuffer,vUv);
|
|
4165
4165
|
#endif
|
|
4166
|
-
}`,oA={DISCARD:0,MULTIPLY:1,MULTIPLY_RGB_SET_ALPHA:2},WF=class extends St{constructor(i=null){super({name:"MaskMaterial",uniforms:{maskTexture:new Te(i),inputBuffer:new Te(null),strength:new Te(1)},blending:kt,depthWrite:!1,depthTest:!1,fragmentShader:HF,vertexShader:
|
|
4166
|
+
}`,oA={DISCARD:0,MULTIPLY:1,MULTIPLY_RGB_SET_ALPHA:2},WF=class extends St{constructor(i=null){super({name:"MaskMaterial",uniforms:{maskTexture:new Te(i),inputBuffer:new Te(null),strength:new Te(1)},blending:kt,depthWrite:!1,depthTest:!1,fragmentShader:HF,vertexShader:vh}),this.toneMapped=!1,this.setColorChannel(sA.RED),this.setMaskFunction(oA.DISCARD)}set inputBuffer(i){this.uniforms.inputBuffer.value=i}setInputBuffer(i){this.uniforms.inputBuffer.value=i}set maskTexture(i){this.uniforms.maskTexture.value=i,delete this.defines.MASK_PRECISION_HIGH,i.type!==Wt&&(this.defines.MASK_PRECISION_HIGH="1"),this.needsUpdate=!0}setMaskTexture(i){this.maskTexture=i}set colorChannel(i){this.defines.COLOR_CHANNEL=i.toFixed(0),this.needsUpdate=!0}setColorChannel(i){this.colorChannel=i}set maskFunction(i){this.defines.MASK_FUNCTION=i.toFixed(0),this.needsUpdate=!0}setMaskFunction(i){this.maskFunction=i}get inverted(){return this.defines.INVERTED!==void 0}set inverted(i){this.inverted&&!i?delete this.defines.INVERTED:i&&(this.defines.INVERTED="1"),this.needsUpdate=!0}isInverted(){return this.inverted}setInverted(i){this.inverted=i}get strength(){return this.uniforms.strength.value}set strength(i){this.uniforms.strength.value=i}getStrength(){return this.strength}setStrength(i){this.strength=i}};var jF=`#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + offset * texelSize)
|
|
4167
4167
|
#if __VERSION__ < 300
|
|
4168
4168
|
#define round(v) floor(v + 0.5)
|
|
4169
4169
|
#endif
|
|
@@ -4203,7 +4203,7 @@ vec2 d;vec3 coords;coords.x=searchXLeft(vOffset[0].xy,vOffset[2].x);coords.y=vOf
|
|
|
4203
4203
|
|
|
4204
4204
|
`;e.set(i.FRAGMENT_MAIN_IMAGE,f+e.get(i.FRAGMENT_MAIN_IMAGE))}this.needsDepthTexture=this.getDepthTexture()===null}else this.needsDepthTexture=!1;if(c){let f=`vec2 transformedUv = vUv;
|
|
4205
4205
|
`;e.set(i.FRAGMENT_MAIN_UV,f+e.get(i.FRAGMENT_MAIN_UV)),r.set("UV","transformedUv")}else r.set("UV","vUv");e.forEach((f,d,m)=>m.set(d,f.trim().replace(/^#/,`
|
|
4206
|
-
#`))),this.uniformCount=n.size,this.varyingCount=a,this.skipRendering=o===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderParts(e).setExtensions(s).setUniforms(n).setDefines(r)}recompile(){this.updateMaterial(),this.verifyResources()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(i,e=Lr){this.fullscreenMaterial.depthBuffer=i,this.fullscreenMaterial.depthPacking=e;for(let t of this.effects)t.setDepthTexture(i,e)}render(i,e,t,r,n){for(let s of this.effects)s.update(i,e,r);if(!this.skipRendering||this.renderToScreen){let s=this.fullscreenMaterial;s.inputBuffer=e.texture,s.time+=r,i.setRenderTarget(this.renderToScreen?null:t),i.render(this.scene,this.camera)}}setSize(i,e){this.fullscreenMaterial.setSize(i,e);for(let t of this.effects)t.setSize(i,e)}initialize(i,e,t){this.renderer=i;for(let r of this.effects)r.initialize(i,e,t),r.addEventListener("change",n=>this.handleEvent(n));this.updateMaterial(),this.verifyResources(),t!==void 0&&t!==Wt&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(let i of this.effects)i.dispose()}handleEvent(i){switch(i.type){case"change":this.recompile();break}}},vU=[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])],aA=class extends ps{constructor({resolutionScale:i=.5,width:e=vi.AUTO_SIZE,height:t=vi.AUTO_SIZE,kernelSize:r=Hv.LARGE}={}){super("KawaseBlurPass"),this.renderTargetA=new mt(1,1,{minFilter:ct,magFilter:ct,stencilBuffer:!1,depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";let n=this.resolution=new vi(this,e,t,i);n.addEventListener("change",s=>this.setSize(n.baseWidth,n.baseHeight)),this.blurMaterial=new eA,this.ditheredBlurMaterial=new eA,this.ditheredBlurMaterial.uniforms.scale=this.blurMaterial.uniforms.scale,this.ditheredBlurMaterial.dithering=!0,this.dithering=!1,this.kernelSize=r}getResolution(){return this.resolution}get width(){return this.resolution.width}set width(i){this.resolution.preferredWidth=i}get height(){return this.resolution.height}set height(i){this.resolution.preferredHeight=i}get scale(){return this.blurMaterial.scale}set scale(i){this.blurMaterial.scale=i}getScale(){return this.blurMaterial.scale}setScale(i){this.blurMaterial.scale=i}getKernelSize(){return this.kernelSize}setKernelSize(i){this.kernelSize=i}getResolutionScale(){return this.resolution.scale}setResolutionScale(i){this.resolution.scale=i}render(i,e,t,r,n){let s=this.scene,o=this.camera,a=this.renderTargetA,l=this.renderTargetB,c=vU[this.kernelSize],u=this.blurMaterial,h=e,f,d;for(this.fullscreenMaterial=u,f=0,d=c.length-1;f<d;++f){let m=(f&1)===0?a:l;u.kernel=c[f],u.inputBuffer=h.texture,i.setRenderTarget(m),i.render(s,o),h=m}this.dithering&&(u=this.ditheredBlurMaterial,this.fullscreenMaterial=u),u.kernel=c[f],u.inputBuffer=h.texture,i.setRenderTarget(this.renderToScreen?null:t),i.render(s,o)}setSize(i,e){let t=this.resolution;t.setBaseSize(i,e);let r=t.width,n=t.height;this.renderTargetA.setSize(r,n),this.renderTargetB.setSize(r,n),this.blurMaterial.setSize(r,n),this.ditheredBlurMaterial.setSize(r,n)}initialize(i,e,t){t!==void 0&&(this.renderTargetA.texture.type=t,this.renderTargetB.texture.type=t,t!==Wt?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.ditheredBlurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):i.outputEncoding===je&&(this.renderTargetA.texture.encoding=je,this.renderTargetB.texture.encoding=je))}static get AUTO_SIZE(){return vi.AUTO_SIZE}};var xU=class extends ps{constructor({width:i=vi.AUTO_SIZE,height:e=vi.AUTO_SIZE,renderTarget:t,luminanceRange:r,colorOutput:n}={}){super("LuminancePass"),this.fullscreenMaterial=new VF(n,r),this.needsSwap=!1,this.renderTarget=t,this.renderTarget===void 0&&(this.renderTarget=new mt(1,1,{minFilter:ct,magFilter:ct,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target",this.renderTarget.texture.generateMipmaps=!1);let s=this.resolution=new vi(this,i,e);s.addEventListener("change",o=>this.setSize(s.baseWidth,s.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(i,e,t,r,n){let s=this.fullscreenMaterial;s.inputBuffer=e.texture,i.setRenderTarget(this.renderToScreen?null:this.renderTarget),i.render(this.scene,this.camera)}setSize(i,e){let t=this.resolution;t.setBaseSize(i,e),this.renderTarget.setSize(t.width,t.height)}initialize(i,e,t){t!==void 0&&t!==Wt&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},bU=class extends ps{constructor(i,e){super("MaskPass",i,e),this.needsSwap=!1,this.clearPass=new kv(!1,!1,!0),this.inverse=!1}get inverted(){return this.inverse}set inverted(i){this.inverse=i}get clear(){return this.clearPass.enabled}set clear(i){this.clearPass.enabled=i}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(i){this.inverted=i}render(i,e,t,r,n){let s=i.getContext(),o=i.state.buffers,a=this.scene,l=this.camera,c=this.clearPass,u=this.inverted?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.clearPass.enabled&&(this.renderToScreen?c.render(i,null):(c.render(i,e),c.render(i,t))),this.renderToScreen?(i.setRenderTarget(null),i.render(a,l)):(i.setRenderTarget(e),i.render(a,l),i.setRenderTarget(t),i.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 po=class extends ps{constructor(i,e="inputBuffer"){super("ShaderPass"),this.fullscreenMaterial=i,this.inputBufferUniform=null,this.setInput(e)}setInput(i){if(this.inputBufferUniform=null,this.fullscreenMaterial!==null){let e=this.fullscreenMaterial.uniforms;e!==void 0&&e[i]!==void 0&&(this.inputBufferUniform=e[i])}}render(i,e,t,r,n){this.inputBufferUniform!==null&&e!==null&&(this.inputBufferUniform.value=e.texture),i.setRenderTarget(this.renderToScreen?null:t),i.render(this.scene,this.camera)}initialize(i,e,t){t!==void 0&&t!==Wt&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},Nv=1/1e3,wU=1e3,SU=class{constructor(){this.previousTime=0,this.currentTime=0,this.delta=0,this.fixedDelta=1e3/60,this.elapsed=0,this.timescale=1,this.fixedDeltaEnabled=!1,this.autoReset=!1}setFixedDeltaEnabled(i){return this.fixedDeltaEnabled=i,this}isAutoResetEnabled(i){return this.autoReset}setAutoResetEnabled(i){return typeof document<"u"&&document.hidden!==void 0&&(i?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this.autoReset=i),this}getDelta(){return this.delta*Nv}getFixedDelta(){return this.fixedDelta*Nv}setFixedDelta(i){return this.fixedDelta=i*wU,this}getElapsed(){return this.elapsed*Nv}getTimescale(){return this.timescale}setTimescale(i){return this.timescale=i,this}update(i){return this.fixedDeltaEnabled?this.delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=i!==void 0?i:performance.now(),this.delta=this.currentTime-this.previousTime),this.delta*=this.timescale,this.elapsed+=this.delta,this}reset(){return this.delta=0,this.elapsed=0,this.currentTime=performance.now(),this}handleEvent(i){document.hidden||(this.currentTime=performance.now())}dispose(){this.setAutoResetEnabled(!1)}},lA=class{constructor(i=null,{depthBuffer:e=!0,stencilBuffer:t=!1,multisampling:r=0,frameBufferType:n}={}){this.renderer=null,this.inputBuffer=this.createBuffer(e,t,n,r),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new Gv,this.depthTexture=null,this.passes=[],this.timer=new SU,this.autoRenderToScreen=!0,this.setRenderer(i)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(i){let e=this.inputBuffer,t=this.multisampling;t>0&&i>0?(this.inputBuffer.samples=i,this.outputBuffer.samples=i,this.inputBuffer.dispose(),this.outputBuffer.dispose()):t!==i&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(e.depthBuffer,e.stencilBuffer,e.texture.type,i),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(i){if(this.renderer=i,i!==null){let e=i.getSize(new N),t=i.getContext().getContextAttributes().alpha,r=this.inputBuffer.texture.type;r===Wt&&i.outputEncoding===je&&(this.inputBuffer.texture.encoding=je,this.outputBuffer.texture.encoding=je,this.inputBuffer.dispose(),this.outputBuffer.dispose()),i.autoClear=!1,this.setSize(e.width,e.height);for(let n of this.passes)n.initialize(i,t,r)}}replaceRenderer(i,e=!0){let t=this.renderer,r=t.domElement.parentNode;return this.setRenderer(i),e&&r!==null&&(r.removeChild(t.domElement),r.appendChild(i.domElement)),t}createDepthTexture(){let i=this.depthTexture=new oi;return this.inputBuffer.depthTexture=i,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(i.format=Ps,i.type=_s):i.type=Ca,i}deleteDepthTexture(){if(this.depthTexture!==null){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(let i of this.passes)i.setDepthTexture(null)}}createBuffer(i,e,t,r){let n=this.renderer,s=n===null?new N:n.getDrawingBufferSize(new N),o={minFilter:ct,magFilter:ct,stencilBuffer:e,depthBuffer:i,type:t},a;return r>0?(a=Number(Oo.replace(/\D+/g,""))<138?new Jf(s.width,s.height,o):new mt(s.width,s.height,o),a.ignoreDepthForMultisampleCopy=!1,a.samples=r):a=new mt(s.width,s.height,o),t===Wt&&n!==null&&n.outputEncoding===je&&(a.texture.encoding=je),a.texture.name="EffectComposer.Buffer",a.texture.generateMipmaps=!1,a}addPass(i,e){let t=this.passes,r=this.renderer,n=r.getDrawingBufferSize(new N),s=r.getContext().getContextAttributes().alpha,o=this.inputBuffer.texture.type;if(i.setRenderer(r),i.setSize(n.width,n.height),i.initialize(r,s,o),this.autoRenderToScreen&&(t.length>0&&(t[t.length-1].renderToScreen=!1),i.renderToScreen&&(this.autoRenderToScreen=!1)),e!==void 0?t.splice(e,0,i):t.push(i),this.autoRenderToScreen&&(t[t.length-1].renderToScreen=!0),i.needsDepthTexture||this.depthTexture!==null)if(this.depthTexture===null){let a=this.createDepthTexture();for(i of t)i.setDepthTexture(a)}else i.setDepthTexture(this.depthTexture)}removePass(i){let e=this.passes,t=e.indexOf(i);if(t!==-1&&e.splice(t,1).length>0){if(this.depthTexture!==null){let s=(a,l)=>a||l.needsDepthTexture;e.reduce(s,!1)||(i.getDepthTexture()===this.depthTexture&&i.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&t===e.length&&(i.renderToScreen=!1,e.length>0&&(e[e.length-1].renderToScreen=!0))}}removeAllPasses(){let i=this.passes;this.deleteDepthTexture(),i.length>0&&(this.autoRenderToScreen&&(i[i.length-1].renderToScreen=!1),this.passes=[])}render(i){let e=this.renderer,t=this.copyPass,r=this.inputBuffer,n=this.outputBuffer,s=!1,o,a,l;i===void 0&&(i=this.timer.update().getDelta());for(let c of this.passes)c.enabled&&(c.render(e,r,n,i,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,r,n,i,s),a.setFunc(o.EQUAL,1,4294967295)),l=r,r=n,n=l),c instanceof bU?s=!0:c instanceof QF&&(s=!1))}setSize(i,e,t){let r=this.renderer;if(i===void 0||e===void 0){let s=r.getSize(new N);i=s.width,e=s.height}r.setSize(i,e,t);let n=r.getDrawingBufferSize(new N);this.inputBuffer.setSize(n.width,n.height),this.outputBuffer.setSize(n.width,n.height);for(let s of this.passes)s.setSize(n.width,n.height)}reset(){let i=this.timer.isAutoResetEnabled();this.dispose(),this.autoRenderToScreen=!0,this.timer.setAutoResetEnabled(i)}dispose(){for(let i of this.passes)i.dispose();this.passes=[],this.inputBuffer!==null&&this.inputBuffer.dispose(),this.outputBuffer!==null&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose()}};var Hv={VERY_SMALL:0,SMALL:1,MEDIUM:2,LARGE:3,VERY_LARGE:4,HUGE:5};var MU=`#ifdef FRAMEBUFFER_PRECISION_HIGH
|
|
4206
|
+
#`))),this.uniformCount=n.size,this.varyingCount=a,this.skipRendering=o===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderParts(e).setExtensions(s).setUniforms(n).setDefines(r)}recompile(){this.updateMaterial(),this.verifyResources()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(i,e=Lr){this.fullscreenMaterial.depthBuffer=i,this.fullscreenMaterial.depthPacking=e;for(let t of this.effects)t.setDepthTexture(i,e)}render(i,e,t,r,n){for(let s of this.effects)s.update(i,e,r);if(!this.skipRendering||this.renderToScreen){let s=this.fullscreenMaterial;s.inputBuffer=e.texture,s.time+=r,i.setRenderTarget(this.renderToScreen?null:t),i.render(this.scene,this.camera)}}setSize(i,e){this.fullscreenMaterial.setSize(i,e);for(let t of this.effects)t.setSize(i,e)}initialize(i,e,t){this.renderer=i;for(let r of this.effects)r.initialize(i,e,t),r.addEventListener("change",n=>this.handleEvent(n));this.updateMaterial(),this.verifyResources(),t!==void 0&&t!==Wt&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(let i of this.effects)i.dispose()}handleEvent(i){switch(i.type){case"change":this.recompile();break}}},vU=[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])],aA=class extends ps{constructor({resolutionScale:i=.5,width:e=vi.AUTO_SIZE,height:t=vi.AUTO_SIZE,kernelSize:r=Hv.LARGE}={}){super("KawaseBlurPass"),this.renderTargetA=new mt(1,1,{minFilter:ct,magFilter:ct,stencilBuffer:!1,depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";let n=this.resolution=new vi(this,e,t,i);n.addEventListener("change",s=>this.setSize(n.baseWidth,n.baseHeight)),this.blurMaterial=new eA,this.ditheredBlurMaterial=new eA,this.ditheredBlurMaterial.uniforms.scale=this.blurMaterial.uniforms.scale,this.ditheredBlurMaterial.dithering=!0,this.dithering=!1,this.kernelSize=r}getResolution(){return this.resolution}get width(){return this.resolution.width}set width(i){this.resolution.preferredWidth=i}get height(){return this.resolution.height}set height(i){this.resolution.preferredHeight=i}get scale(){return this.blurMaterial.scale}set scale(i){this.blurMaterial.scale=i}getScale(){return this.blurMaterial.scale}setScale(i){this.blurMaterial.scale=i}getKernelSize(){return this.kernelSize}setKernelSize(i){this.kernelSize=i}getResolutionScale(){return this.resolution.scale}setResolutionScale(i){this.resolution.scale=i}render(i,e,t,r,n){let s=this.scene,o=this.camera,a=this.renderTargetA,l=this.renderTargetB,c=vU[this.kernelSize],u=this.blurMaterial,h=e,f,d;for(this.fullscreenMaterial=u,f=0,d=c.length-1;f<d;++f){let m=(f&1)===0?a:l;u.kernel=c[f],u.inputBuffer=h.texture,i.setRenderTarget(m),i.render(s,o),h=m}this.dithering&&(u=this.ditheredBlurMaterial,this.fullscreenMaterial=u),u.kernel=c[f],u.inputBuffer=h.texture,i.setRenderTarget(this.renderToScreen?null:t),i.render(s,o)}setSize(i,e){let t=this.resolution;t.setBaseSize(i,e);let r=t.width,n=t.height;this.renderTargetA.setSize(r,n),this.renderTargetB.setSize(r,n),this.blurMaterial.setSize(r,n),this.ditheredBlurMaterial.setSize(r,n)}initialize(i,e,t){t!==void 0&&(this.renderTargetA.texture.type=t,this.renderTargetB.texture.type=t,t!==Wt?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.ditheredBlurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):i.outputEncoding===je&&(this.renderTargetA.texture.encoding=je,this.renderTargetB.texture.encoding=je))}static get AUTO_SIZE(){return vi.AUTO_SIZE}};var xU=class extends ps{constructor({width:i=vi.AUTO_SIZE,height:e=vi.AUTO_SIZE,renderTarget:t,luminanceRange:r,colorOutput:n}={}){super("LuminancePass"),this.fullscreenMaterial=new VF(n,r),this.needsSwap=!1,this.renderTarget=t,this.renderTarget===void 0&&(this.renderTarget=new mt(1,1,{minFilter:ct,magFilter:ct,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target",this.renderTarget.texture.generateMipmaps=!1);let s=this.resolution=new vi(this,i,e);s.addEventListener("change",o=>this.setSize(s.baseWidth,s.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(i,e,t,r,n){let s=this.fullscreenMaterial;s.inputBuffer=e.texture,i.setRenderTarget(this.renderToScreen?null:this.renderTarget),i.render(this.scene,this.camera)}setSize(i,e){let t=this.resolution;t.setBaseSize(i,e),this.renderTarget.setSize(t.width,t.height)}initialize(i,e,t){t!==void 0&&t!==Wt&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},bU=class extends ps{constructor(i,e){super("MaskPass",i,e),this.needsSwap=!1,this.clearPass=new kv(!1,!1,!0),this.inverse=!1}get inverted(){return this.inverse}set inverted(i){this.inverse=i}get clear(){return this.clearPass.enabled}set clear(i){this.clearPass.enabled=i}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(i){this.inverted=i}render(i,e,t,r,n){let s=i.getContext(),o=i.state.buffers,a=this.scene,l=this.camera,c=this.clearPass,u=this.inverted?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.clearPass.enabled&&(this.renderToScreen?c.render(i,null):(c.render(i,e),c.render(i,t))),this.renderToScreen?(i.setRenderTarget(null),i.render(a,l)):(i.setRenderTarget(e),i.render(a,l),i.setRenderTarget(t),i.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 po=class extends ps{constructor(i,e="inputBuffer"){super("ShaderPass"),this.fullscreenMaterial=i,this.inputBufferUniform=null,this.setInput(e)}setInput(i){if(this.inputBufferUniform=null,this.fullscreenMaterial!==null){let e=this.fullscreenMaterial.uniforms;e!==void 0&&e[i]!==void 0&&(this.inputBufferUniform=e[i])}}render(i,e,t,r,n){this.inputBufferUniform!==null&&e!==null&&(this.inputBufferUniform.value=e.texture),i.setRenderTarget(this.renderToScreen?null:t),i.render(this.scene,this.camera)}initialize(i,e,t){t!==void 0&&t!==Wt&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},Nv=1/1e3,wU=1e3,SU=class{constructor(){this.previousTime=0,this.currentTime=0,this.delta=0,this.fixedDelta=1e3/60,this.elapsed=0,this.timescale=1,this.fixedDeltaEnabled=!1,this.autoReset=!1}setFixedDeltaEnabled(i){return this.fixedDeltaEnabled=i,this}isAutoResetEnabled(i){return this.autoReset}setAutoResetEnabled(i){return typeof document<"u"&&document.hidden!==void 0&&(i?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this.autoReset=i),this}getDelta(){return this.delta*Nv}getFixedDelta(){return this.fixedDelta*Nv}setFixedDelta(i){return this.fixedDelta=i*wU,this}getElapsed(){return this.elapsed*Nv}getTimescale(){return this.timescale}setTimescale(i){return this.timescale=i,this}update(i){return this.fixedDeltaEnabled?this.delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=i!==void 0?i:performance.now(),this.delta=this.currentTime-this.previousTime),this.delta*=this.timescale,this.elapsed+=this.delta,this}reset(){return this.delta=0,this.elapsed=0,this.currentTime=performance.now(),this}handleEvent(i){document.hidden||(this.currentTime=performance.now())}dispose(){this.setAutoResetEnabled(!1)}},lA=class{constructor(i=null,{depthBuffer:e=!0,stencilBuffer:t=!1,multisampling:r=0,frameBufferType:n}={}){this.renderer=null,this.inputBuffer=this.createBuffer(e,t,n,r),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new Gv,this.depthTexture=null,this.passes=[],this.timer=new SU,this.autoRenderToScreen=!0,this.setRenderer(i)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(i){let e=this.inputBuffer,t=this.multisampling;t>0&&i>0?(this.inputBuffer.samples=i,this.outputBuffer.samples=i,this.inputBuffer.dispose(),this.outputBuffer.dispose()):t!==i&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(e.depthBuffer,e.stencilBuffer,e.texture.type,i),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(i){if(this.renderer=i,i!==null){let e=i.getSize(new N),t=i.getContext().getContextAttributes().alpha,r=this.inputBuffer.texture.type;r===Wt&&i.outputEncoding===je&&(this.inputBuffer.texture.encoding=je,this.outputBuffer.texture.encoding=je,this.inputBuffer.dispose(),this.outputBuffer.dispose()),i.autoClear=!1,this.setSize(e.width,e.height);for(let n of this.passes)n.initialize(i,t,r)}}replaceRenderer(i,e=!0){let t=this.renderer,r=t.domElement.parentNode;return this.setRenderer(i),e&&r!==null&&(r.removeChild(t.domElement),r.appendChild(i.domElement)),t}createDepthTexture(){let i=this.depthTexture=new oi;return this.inputBuffer.depthTexture=i,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(i.format=Ps,i.type=_s):i.type=Ca,i}deleteDepthTexture(){if(this.depthTexture!==null){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(let i of this.passes)i.setDepthTexture(null)}}createBuffer(i,e,t,r){let n=this.renderer,s=n===null?new N:n.getDrawingBufferSize(new N),o={minFilter:ct,magFilter:ct,stencilBuffer:e,depthBuffer:i,type:t},a;return r>0?(a=Number(Oo.replace(/\D+/g,""))<138?new Qf(s.width,s.height,o):new mt(s.width,s.height,o),a.ignoreDepthForMultisampleCopy=!1,a.samples=r):a=new mt(s.width,s.height,o),t===Wt&&n!==null&&n.outputEncoding===je&&(a.texture.encoding=je),a.texture.name="EffectComposer.Buffer",a.texture.generateMipmaps=!1,a}addPass(i,e){let t=this.passes,r=this.renderer,n=r.getDrawingBufferSize(new N),s=r.getContext().getContextAttributes().alpha,o=this.inputBuffer.texture.type;if(i.setRenderer(r),i.setSize(n.width,n.height),i.initialize(r,s,o),this.autoRenderToScreen&&(t.length>0&&(t[t.length-1].renderToScreen=!1),i.renderToScreen&&(this.autoRenderToScreen=!1)),e!==void 0?t.splice(e,0,i):t.push(i),this.autoRenderToScreen&&(t[t.length-1].renderToScreen=!0),i.needsDepthTexture||this.depthTexture!==null)if(this.depthTexture===null){let a=this.createDepthTexture();for(i of t)i.setDepthTexture(a)}else i.setDepthTexture(this.depthTexture)}removePass(i){let e=this.passes,t=e.indexOf(i);if(t!==-1&&e.splice(t,1).length>0){if(this.depthTexture!==null){let s=(a,l)=>a||l.needsDepthTexture;e.reduce(s,!1)||(i.getDepthTexture()===this.depthTexture&&i.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&t===e.length&&(i.renderToScreen=!1,e.length>0&&(e[e.length-1].renderToScreen=!0))}}removeAllPasses(){let i=this.passes;this.deleteDepthTexture(),i.length>0&&(this.autoRenderToScreen&&(i[i.length-1].renderToScreen=!1),this.passes=[])}render(i){let e=this.renderer,t=this.copyPass,r=this.inputBuffer,n=this.outputBuffer,s=!1,o,a,l;i===void 0&&(i=this.timer.update().getDelta());for(let c of this.passes)c.enabled&&(c.render(e,r,n,i,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,r,n,i,s),a.setFunc(o.EQUAL,1,4294967295)),l=r,r=n,n=l),c instanceof bU?s=!0:c instanceof QF&&(s=!1))}setSize(i,e,t){let r=this.renderer;if(i===void 0||e===void 0){let s=r.getSize(new N);i=s.width,e=s.height}r.setSize(i,e,t);let n=r.getDrawingBufferSize(new N);this.inputBuffer.setSize(n.width,n.height),this.outputBuffer.setSize(n.width,n.height);for(let s of this.passes)s.setSize(n.width,n.height)}reset(){let i=this.timer.isAutoResetEnabled();this.dispose(),this.autoRenderToScreen=!0,this.timer.setAutoResetEnabled(i)}dispose(){for(let i of this.passes)i.dispose();this.passes=[],this.inputBuffer!==null&&this.inputBuffer.dispose(),this.outputBuffer!==null&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose()}};var Hv={VERY_SMALL:0,SMALL:1,MEDIUM:2,LARGE:3,VERY_LARGE:4,HUGE:5};var MU=`#ifdef FRAMEBUFFER_PRECISION_HIGH
|
|
4207
4207
|
uniform mediump sampler2D map;
|
|
4208
4208
|
#else
|
|
4209
4209
|
uniform lowp sampler2D map;
|
|
@@ -4225,5 +4225,5 @@ float d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offse
|
|
|
4225
4225
|
#else
|
|
4226
4226
|
vec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord));
|
|
4227
4227
|
#endif
|
|
4228
|
-
outputColor=vec4(color,inputColor.a);}`,Wp={DEFAULT:0,ESKIL:1},vA=class extends Vi{constructor({blendFunction:i=yt.NORMAL,technique:e=Wp.DEFAULT,eskil:t=!1,offset:r=.5,darkness:n=.5}={}){super("VignetteEffect",BU,{blendFunction:i,defines:new Map([["VIGNETTE_TECHNIQUE",e.toFixed(0)]]),uniforms:new Map([["offset",new Te(r)],["darkness",new Te(n)]])})}get technique(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))}set technique(i){this.technique!==i&&(this.defines.set("VIGNETTE_TECHNIQUE",i.toFixed(0)),this.setChanged())}get eskil(){return this.technique===Wp.ESKIL}set eskil(i){this.technique=i?Wp.ESKIL:Wp.DEFAULT}getTechnique(){return this.technique}setTechnique(i){this.technique=i}get offset(){return this.uniforms.get("offset").value}set offset(i){this.uniforms.get("offset").value=i}getOffset(){return this.offset}setOffset(i){this.offset=i}get darkness(){return this.uniforms.get("darkness").value}set darkness(i){this.uniforms.get("darkness").value=i}getDarkness(){return this.darkness}setDarkness(i){this.darkness=i}},uoe=[new Float32Array(3),new Float32Array(3)],hoe=[new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3)],foe=[[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 doe=[new Float32Array(2),new Float32Array(2)];var poe=new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),moe=[new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125])],goe=[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])],yoe=[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 voe=new Map([[$r(0,0,0,0),new Float32Array([0,0,0,0])],[$r(0,0,0,1),new Float32Array([0,0,0,1])],[$r(0,0,1,0),new Float32Array([0,0,1,0])],[$r(0,0,1,1),new Float32Array([0,0,1,1])],[$r(0,1,0,0),new Float32Array([0,1,0,0])],[$r(0,1,0,1),new Float32Array([0,1,0,1])],[$r(0,1,1,0),new Float32Array([0,1,1,0])],[$r(0,1,1,1),new Float32Array([0,1,1,1])],[$r(1,0,0,0),new Float32Array([1,0,0,0])],[$r(1,0,0,1),new Float32Array([1,0,0,1])],[$r(1,0,1,0),new Float32Array([1,0,1,0])],[$r(1,0,1,1),new Float32Array([1,0,1,1])],[$r(1,1,0,0),new Float32Array([1,1,0,0])],[$r(1,1,0,1),new Float32Array([1,1,0,1])],[$r(1,1,1,0),new Float32Array([1,1,1,0])],[$r(1,1,1,1),new Float32Array([1,1,1,1])]]);function Ov(i,e,t){return i+(e-i)*t}function $r(i,e,t,r){let n=Ov(i,e,.75),s=Ov(t,r,1-.25);return Ov(n,s,1-.125)}var pr=class{constructor(e,t){this.enabled=!1;this.effect=new e(t),Object.defineProperty(this,"opacity",{enumerable:!0,set(r){this.effect.blendMode.opacity.value=r},get(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set(r){this.effect.blendMode.setBlendFunction(Number(r))},get(){return this.effect.blendMode.blendFunction}}),this.blendFunction=yt.NORMAL}toJSON(){let e=["constructor","effect","subscriptions"],t=se({},this),r=Object.getPrototypeOf(this),n=Object.getOwnPropertyNames(r);for(let s of n){let o=Object.getOwnPropertyDescriptor(r,s);o&&typeof o.get=="function"&&(t[s]=this[s])}return e.forEach(s=>delete t[s]),t}};var nc=class extends pr{constructor(){super(cA),this.blendFunction=yt.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 ic=class extends pr{constructor(){super(uA)}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 sc=class extends pr{constructor(){super(fA),this.effect.offset=new N(.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 oc=class extends pr{constructor(){super(hA)}};var ac=class extends pr{constructor(){super(pA);this._hue=0}set hue(t){this._hue=t,this.effect.setHue(t)}get hue(){return this._hue}set saturation(t){this.effect.uniforms.get("saturation").value=t}get saturation(){return this.effect.uniforms.get("saturation").value}};var lc=class extends pr{constructor(){super(mA),this.blendFunction=yt.OVERLAY}};var cc=class extends pr{constructor(){super(vA)}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 uc=class extends pr{constructor(e){super(dA,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 hc=class extends pr{constructor(){super(gA)}get granularity(){return this.effect.getGranularity()}set granularity(e){this.effect.setGranularity(e)}};function xA(i,e){return e&&e.enabled&&i.push(e.effect),i}var vh=class extends jt{constructor(){super();this._scene=new sn;this._camera=new Bn;this.effects=new Map;this.loadingManager=new Ro;this.renderPass=new Vv;this._renderToScreen=!0;this._hasSmaa=!1;this.clock=new Vf,this.enabled=!1,this.debug=!1,this.effects.set("bloom",new nc),this.effects.set("chromaticAberration",new sc),this.effects.set("vignette",new cc),this.effects.set("noise",new lc),this.effects.set("colorAverage",new oc),this.effects.set("hueSaturation",new ac),this.effects.set("brightnessContrast",new ic),this.effects.set("depthOfField",new uc),this.effects.set("pixelation",new hc)}get scene(){return this._scene}set scene(t){this._scene=t}get camera(){return this._camera}set camera(t){this._camera=t}_initSmaa(){if(!this.effectComposer)return;let t=this.effectComposer.passes.length,r=new yA({preset:Zo.ULTRA,edgeDetectionMode:jp.COLOR}),n=()=>{r.removeEventListener("load",n),this.dispatchEvent({type:"smaaloaded"})};r.addEventListener("load",n),r.edgeDetectionMaterial.setPredicationMode(zv.DEPTH),r.edgeDetectionMaterial.setEdgeDetectionThreshold(.05),r.edgeDetectionMaterial.setPredicationThreshold(.002),r.edgeDetectionMaterial.setPredicationScale(1),this.effectComposer.addPass(new qp(this.camera,r),t),this._hasSmaa=!0}_initPasses(){if(!this.effectComposer||!this.renderer)return;let t;if(this.effectComposer.removeAllPasses(),this._hasSmaa=!1,this.renderPass=new Vv(this.scene,this.camera),this.enabled){this.effectComposer.addPass(this.renderPass),this._initSmaa();let r=[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(xA,[]),n=[this.effects.get("pixelation")].reduce(xA,[]);n.length>0&&this.effectComposer.addPass(new qp(this.camera,...n)),this.effectComposer.addPass(new qp(this.camera,...r))}else this.effectComposer.addPass(this.renderPass);if(t)return t}reinit(){if(!this.renderer)return Promise.all([]);this.effectComposer=new lA(this.renderer),this._initPasses()}init({renderer:t,camera:r,scene:n}){this.renderer=t,this.scene=n,this.camera=r,this._initCopyPass(),this.reinit()}_initCopyPass(){if(this._savePass)return;let t=new N;this.renderer.getDrawingBufferSize(t),this._rt=new mt(t.x,t.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:Da,wrapT:Da}),this._rt.samples=this.renderer.capabilities.isWebGL2?4:0,this._savePass=new Gv(this._rt,!1),this._savePass.renderToScreen=!1}get renderToScreen(){return this._renderToScreen}set renderToScreen(t){var n,s;let r=this.effectComposer;!r||(t===!0?((n=this.renderer)!=null&&n.capabilities.isWebGL2&&(r.multisampling=0),r.removePass(this._savePass),r.passes[r.passes.length-1].renderToScreen=!0,r.autoRenderToScreen=!0):(((s=this.renderer)==null?void 0:s.capabilities.isWebGL2)&&!this._hasSmaa&&(r.multisampling=4),r.autoRenderToScreen=!1,r.passes[r.passes.length-1].renderToScreen=!1,this._savePass.renderToScreen=!1,this.enabled||(this._savePass.needsDepthTexture=!0),r.addPass(this._savePass)),this._renderToScreen=t)}get texture(){return this._rt&&this._rt.texture}get renderTarget(){return this._rt}fromJSON(t){t&&(Object.keys(t).forEach(r=>{let n=t[r],s=this.effects.get(r);Object.keys(n).forEach(o=>{s[o]=n[o]})}),this.enabled=t.enabled)}toJSON(){let t={};return this.effects.forEach((r,n)=>{t[n]=r.toJSON()},t),se({enabled:this.enabled},t)}render(){var t;(t=this.effectComposer)==null||t.render(this.clock.getDelta())}setScissor(t,r,n,s){if(!this.effectComposer||!this.renderer)return;t instanceof Qe?(this.effectComposer.inputBuffer.scissor.set(t.x,t.y,t.z,t.w),this.effectComposer.outputBuffer.scissor.set(t.x,t.y,t.z,t.w)):(this.effectComposer.inputBuffer.scissor.set(t,r,n,s),this.effectComposer.outputBuffer.scissor.set(t,r,n,s));let o=this.renderer.getPixelRatio();this.effectComposer.inputBuffer.scissor.multiplyScalar(o),this.effectComposer.outputBuffer.scissor.multiplyScalar(o),this.renderer.setScissor(t,r,n,s)}setScissorTest(t){!this.effectComposer||!this.renderer||(this.effectComposer.inputBuffer.scissorTest=t,this.effectComposer.outputBuffer.scissorTest=t,this.renderer.setScissorTest(t))}setViewport(t,r,n,s){!this.effectComposer||(t instanceof Qe?(this.effectComposer.inputBuffer.viewport.copy(t),this.effectComposer.outputBuffer.viewport.copy(t)):(this.effectComposer.inputBuffer.viewport.set(t,r,n,s),this.effectComposer.outputBuffer.viewport.set(t,r,n,s)))}resize(t,r){var n,s;if((n=this.effectComposer)==null||n.setSize(t,r),this._rt){let o=((s=this.renderer)==null?void 0:s.getPixelRatio())||window.devicePixelRatio;this._rt.setSize(t*o,r*o)}}dispose(){var t;this._listeners=void 0,(t=this.effectComposer)==null||t.dispose()}};var Xp=class extends gh{constructor(t,r){super(t,r);this.postprocessing=new vh;this.initPostprocessing(t.postprocessing)}resetAfterClear(t,r){super.resetAfterClear(t,r),this.initPostprocessing(t.postprocessing)}initPostprocessing(t){let s=t,{enabled:r}=s,n=px(s,["enabled"]);for(let o of Object.entries(n)){let a=o[1],l=this.postprocessing.effects.get(o[0]);if(l){l.enabled=a.enabled;for(let[c,u]of Object.entries(a))l[c]=u}}this.postprocessing.enabled=r,this.postprocessing.reinit()}dispose(){super.dispose(),this.postprocessing.dispose()}switchActiveCamera(t){super.switchActiveCamera(t),this.postprocessing&&(this.postprocessing.camera=t)}};var Wv=new WeakMap,Yp=class extends ln{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,r,n){let s=new is(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(n)},r,n)}decodeDracoFile(e,t,r,n){let s={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r};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 r=JSON.stringify(t);if(Wv.has(e)){let l=Wv.get(e);if(l.key===r)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 n,s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(n=l,new Promise((c,u)=>{n._callbacks[s]={resolve:c,reject:u},n.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{n&&s&&this._releaseTask(n,s)}),Wv.set(e,{key:r,promise:a}),a}_createGeometry(e){let t=new Ie;e.index&&t.setIndex(new Ue(e.index.array,1));for(let r=0;r<e.attributes.length;r++){let n=e.attributes[r],s=n.name,o=n.array,a=n.itemSize;t.setAttribute(s,new Ue(o,a))}return t}_loadLibrary(e,t){let r=new is(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((n,s)=>{r.load(e,n,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(r=>{let n=r[0];e||(this.decoderConfig.wasmBinary=r[1]);let s=OU.toString(),o=["/* draco decoder */",n,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
|
|
4229
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(s){let o=s.data;switch(o.type){case"decode":n._callbacks[o.id].resolve(o);break;case"error":n._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,s){return n._taskLoad>s._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_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 OU(){let i,e;onmessage=function(o){let a=o.data;switch(a.type){case"init":i=a.decoderConfig,e=new Promise(function(u){i.onModuleLoaded=function(h){u({draco:h})},DracoDecoderModule(i)});break;case"decode":let l=a.buffer,c=a.taskConfig;e.then(u=>{let h=u.draco,f=new h.Decoder,d=new h.DecoderBuffer;d.Init(new Int8Array(l),l.byteLength);try{let m=t(h,f,d,c),p=m.attributes.map(g=>g.array.buffer);m.index&&p.push(m.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:m},p)}catch(m){console.error(m),self.postMessage({type:"error",id:a.id,error:m.message})}finally{h.destroy(d),h.destroy(f)}});break}};function t(o,a,l,c){let u=c.attributeIDs,h=c.attributeTypes,f,d,m=a.GetEncodedGeometryType(l);if(m===o.TRIANGULAR_MESH)f=new o.Mesh,d=a.DecodeBufferToMesh(l,f);else if(m===o.POINT_CLOUD)f=new o.PointCloud,d=a.DecodeBufferToPointCloud(l,f);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||f.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());let p={index:null,attributes:[]};for(let g in u){let y=self[h[g]],v,b;if(c.useUniqueIDs)b=u[g],v=a.GetAttributeByUniqueId(f,b);else{if(b=a.GetAttributeId(f,o[u[g]]),b===-1)continue;v=a.GetAttribute(f,b)}p.attributes.push(n(o,a,f,g,y,v))}return m===o.TRIANGULAR_MESH&&(p.index=r(o,a,f)),o.destroy(f),p}function r(o,a,l){let u=l.num_faces()*3,h=u*4,f=o._malloc(h);a.GetTrianglesUInt32Array(l,h,f);let d=new Uint32Array(o.HEAPF32.buffer,f,u).slice();return o._free(f),{array:d,itemSize:1}}function n(o,a,l,c,u,h){let f=h.num_components(),m=l.num_points()*f,p=m*u.BYTES_PER_ELEMENT,g=s(o,u),y=o._malloc(p);a.GetAttributeDataArrayForAllPoints(l,h,g,p,y);let v=new u(o.HEAPF32.buffer,y,m).slice();return o._free(y),{name:c,array:v,itemSize:f}}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}}}var mo;function FU(){return mo||(mo=new Yp,mo.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),mo.decoderPending}async function UU(i){if(mo){let e={attributeIDs:mo.defaultAttributeIDs,attributeTypes:mo.defaultAttributeTypes,useUniqueIDs:!1},t;try{t=await mo.decodeGeometry(new Int8Array(i).buffer,e)}catch(r){console.error(r)}if(t)return{index:t.index?{array:t.index.array}:void 0,attributes:Object.entries(t.attributes).map(([r,n])=>({name:r,itemSize:n.itemSize,array:n.array}))}}return null}async function bA(i){let[e,t]=Sy($d.deserialize(new Uint8Array(i))),r=[];e.scene.objects.traverse((n,s)=>{s.type==="Mesh"&&s.geometry.type==="NonParametricGeometry"&&s.geometry.data.draco!==void 0&&r.push(s)}),r.length&&await FU();for(let n of r){let s=await UU(Ay(n.geometry.data.draco));if(s){s.index&&(n.geometry.data.index={array:s.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let o={};s.attributes.forEach(({name:a,array:l,itemSize:c})=>{o[a]={array:l,itemSize:c,type:"Float32Array",normalized:!1}}),n.geometry.data.attributes=o,n.geometry.data.draco=void 0}}return t.result().data}var EA={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},Yv={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},zU=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],Qp={CSS:{},springs:{}};function Hi(i,e,t){return Math.min(Math.max(i,e),t)}function xh(i,e){return i.indexOf(e)>-1}function jv(i,e){return i.apply(null,e)}var Je={arr:function(i){return Array.isArray(i)},obj:function(i){return xh(Object.prototype.toString.call(i),"Object")},pth:function(i){return Je.obj(i)&&i.hasOwnProperty("totalLength")},svg:function(i){return i instanceof SVGElement},inp:function(i){return i instanceof HTMLInputElement},dom:function(i){return!("isNode"in i)&&(i.nodeType||Je.svg(i))},str:function(i){return typeof i=="string"},fnc:function(i){return typeof i=="function"},und:function(i){return typeof i>"u"},hex:function(i){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(i)},rgb:function(i){return/^rgb/.test(i)},hsl:function(i){return/^hsl/.test(i)},col:function(i){return Je.hex(i)||Je.rgb(i)||Je.hsl(i)},key:function(i){return!EA.hasOwnProperty(i)&&!Yv.hasOwnProperty(i)&&i!=="targets"&&i!=="keyframes"}};function _A(i){var e=/\(([^)]+)\)/.exec(i);return e?e[1].split(",").map(function(t){return parseFloat(t)}):[]}function CA(i,e){var t=_A(i),r=Hi(Je.und(t[0])?1:t[0],.1,100),n=Hi(Je.und(t[1])?100:t[1],.1,100),s=Hi(Je.und(t[2])?10:t[2],.1,100),o=Hi(Je.und(t[3])?0:t[3],.1,100),a=Math.sqrt(n/r),l=s/(2*Math.sqrt(n*r)),c=l<1?a*Math.sqrt(1-l*l):0,u=1,h=l<1?(l*a+-o)/c:-o+a;function f(m){var p=e?e*m/1e3:m;return l<1?p=Math.exp(-p*l*a)*(u*Math.cos(c*p)+h*Math.sin(c*p)):p=(u+h*p)*Math.exp(-p*a),m===0||m===1?m:1-p}function d(){var m=Qp.springs[i];if(m)return m;for(var p=1/6,g=0,y=0;;)if(g+=p,f(g)===1){if(y++,y>=16)break}else y=0;var v=g*p*1e3;return Qp.springs[i]=v,v}return e?f:d}function GU(i){return i===void 0&&(i=10),function(e){return Math.ceil(Hi(e,1e-6,1)*i)*(1/i)}}var kU=function(){var i=11,e=1/(i-1);function t(u,h){return 1-3*h+3*u}function r(u,h){return 3*h-6*u}function n(u){return 3*u}function s(u,h,f){return((t(h,f)*u+r(h,f))*u+n(h))*u}function o(u,h,f){return 3*t(h,f)*u*u+2*r(h,f)*u+n(h)}function a(u,h,f,d,m){var p,g,y=0;do g=h+(f-h)/2,p=s(g,d,m)-u,p>0?f=g:h=g;while(Math.abs(p)>1e-7&&++y<10);return g}function l(u,h,f,d){for(var m=0;m<4;++m){var p=o(h,f,d);if(p===0)return h;var g=s(h,f,d)-u;h-=g/p}return h}function c(u,h,f,d){if(!(0<=u&&u<=1&&0<=f&&f<=1))return;var m=new Float32Array(i);if(u!==h||f!==d)for(var p=0;p<i;++p)m[p]=s(p*e,u,f);function g(y){for(var v=0,b=1,w=i-1;b!==w&&m[b]<=y;++b)v+=e;--b;var x=(y-m[b])/(m[b+1]-m[b]),E=v+x*e,T=o(E,u,f);return T>=.001?l(y,E,u,f):T===0?E:a(y,v,v+e,u,f)}return function(y){return u===h&&f===d||y===0||y===1?y:s(g(y),h,d)}}return c}(),LA=function(){var i={linear:function(){return function(r){return r}}},e={Sine:function(){return function(r){return 1-Math.cos(r*Math.PI/2)}},Circ:function(){return function(r){return 1-Math.sqrt(1-r*r)}},Back:function(){return function(r){return r*r*(3*r-2)}},Bounce:function(){return function(r){for(var n,s=4;r<((n=Math.pow(2,--s))-1)/11;);return 1/Math.pow(4,3-s)-7.5625*Math.pow((n*3-2)/22-r,2)}},Elastic:function(r,n){r===void 0&&(r=1),n===void 0&&(n=.5);var s=Hi(r,1,10),o=Hi(n,.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(r,n){e[r]=function(){return function(s){return Math.pow(s,n+2)}}}),Object.keys(e).forEach(function(r){var n=e[r];i["easeIn"+r]=n,i["easeOut"+r]=function(s,o){return function(a){return 1-n(s,o)(1-a)}},i["easeInOut"+r]=function(s,o){return function(a){return a<.5?n(s,o)(a*2)/2:1-n(s,o)(a*-2+2)/2}}}),i}();function Jv(i,e){if(Je.fnc(i))return i;var t=i.split("(")[0],r=LA[t],n=_A(i);switch(t){case"spring":return CA(i,e);case"cubicBezier":return jv(kU,n);case"steps":return jv(GU,n);default:return jv(r,n)}}function DA(i){try{var e=document.querySelectorAll(i);return e}catch{return}}function Kp(i,e){for(var t=i.length,r=arguments.length>=2?arguments[1]:void 0,n=[],s=0;s<t;s++)if(s in i){var o=i[s];e.call(r,o,s,i)&&n.push(o)}return n}function Zp(i){return i.reduce(function(e,t){return e.concat(Je.arr(t)?Zp(t):t)},[])}function wA(i){return Je.arr(i)?i:(Je.str(i)&&(i=DA(i)||i),i instanceof NodeList||i instanceof HTMLCollection?[].slice.call(i):[i])}function Qv(i,e){return i.some(function(t){return t===e})}function Kv(i){var e={};for(var t in i)e[t]=i[t];return e}function qv(i,e){var t=Kv(i);for(var r in i)t[r]=e.hasOwnProperty(r)?e[r]:i[r];return t}function $p(i,e){var t=Kv(i);for(var r in e)t[r]=Je.und(i[r])?e[r]:i[r];return t}function VU(i){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(i);return e?"rgba("+e[1]+",1)":i}function HU(i){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,t=i.replace(e,function(a,l,c,u){return l+l+c+c+u+u}),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),n=parseInt(r[1],16),s=parseInt(r[2],16),o=parseInt(r[3],16);return"rgba("+n+","+s+","+o+",1)"}function WU(i){var e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(i)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(i),t=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,n=parseInt(e[3],10)/100,s=e[4]||1;function o(f,d,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?f+(d-f)*6*m:m<1/2?d:m<2/3?f+(d-f)*(2/3-m)*6:f}var a,l,c;if(r==0)a=l=c=n;else{var u=n<.5?n*(1+r):n+r-n*r,h=2*n-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 jU(i){if(Je.rgb(i))return VU(i);if(Je.hex(i))return HU(i);if(Je.hsl(i))return WU(i)}function ms(i){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(i);if(e)return e[1]}function qU(i){if(xh(i,"translate")||i==="perspective")return"px";if(xh(i,"rotate")||xh(i,"skew"))return"deg"}function Xv(i,e){return Je.fnc(i)?i(e.target,e.id,e.total):i}function Wi(i,e){return i.getAttribute(e)}function Zv(i,e,t){var r=ms(e);if(Qv([t,"deg","rad","turn"],r))return e;var n=Qp.CSS[e+t];if(!Je.und(n))return n;var s=100,o=document.createElement(i.tagName),a=i.parentNode&&i.parentNode!==document?i.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 Qp.CSS[e+t]=c,c}function PA(i,e,t){if(e in i.style){var r=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),n=i.style[e]||getComputedStyle(i).getPropertyValue(r)||"0";return t?Zv(i,n,t):n}}function $v(i,e){if(Je.dom(i)&&!Je.inp(i)&&(Wi(i,e)||Je.svg(i)&&i[e]))return"attribute";if(Je.dom(i)&&Qv(zU,e))return"transform";if(Je.dom(i)&&e!=="transform"&&PA(i,e))return"css";if(i[e]!=null)return"object"}function IA(i){if(!!Je.dom(i)){for(var e=i.style.transform||"",t=/(\w+)\(([^)]*)\)/g,r=new Map,n;n=t.exec(e);)r.set(n[1],n[2]);return r}}function XU(i,e,t,r){var n=xh(e,"scale")?1:0+qU(e),s=IA(i).get(e)||n;return t&&(t.transforms.list.set(e,s),t.transforms.last=e),r?Zv(i,s,r):s}function ex(i,e,t,r){switch($v(i,e)){case"transform":return XU(i,e,r,t);case"css":return PA(i,e,t);case"attribute":return Wi(i,e);default:return i[e]||0}}function tx(i,e){var t=/^(\*=|\+=|-=)/.exec(i);if(!t)return i;var r=ms(i)||0,n=parseFloat(e),s=parseFloat(i.replace(t[0],""));switch(t[0][0]){case"+":return n+s+r;case"-":return n-s+r;case"*":return n*s+r}}function RA(i,e){if(Je.col(i))return jU(i);if(/\s/g.test(i))return i;var t=ms(i),r=t?i.substr(0,i.length-t.length):i;return e?r+e:r}function rx(i,e){return Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2))}function YU(i){return Math.PI*2*Wi(i,"r")}function JU(i){return Wi(i,"width")*2+Wi(i,"height")*2}function QU(i){return rx({x:Wi(i,"x1"),y:Wi(i,"y1")},{x:Wi(i,"x2"),y:Wi(i,"y2")})}function BA(i){for(var e=i.points,t=0,r,n=0;n<e.numberOfItems;n++){var s=e.getItem(n);n>0&&(t+=rx(r,s)),r=s}return t}function KU(i){var e=i.points;return BA(i)+rx(e.getItem(e.numberOfItems-1),e.getItem(0))}function NA(i){if(i.getTotalLength)return i.getTotalLength();switch(i.tagName.toLowerCase()){case"circle":return YU(i);case"rect":return JU(i);case"line":return QU(i);case"polyline":return BA(i);case"polygon":return KU(i)}}function ZU(i){var e=NA(i);return i.setAttribute("stroke-dasharray",e),e}function $U(i){for(var e=i.parentNode;Je.svg(e)&&Je.svg(e.parentNode);)e=e.parentNode;return e}function OA(i,e){var t=e||{},r=t.el||$U(i),n=r.getBoundingClientRect(),s=Wi(r,"viewBox"),o=n.width,a=n.height,l=t.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function ez(i,e){var t=Je.str(i)?DA(i)[0]:i,r=e||100;return function(n){return{property:n,el:t,svg:OA(t),totalLength:NA(t)*(r/100)}}}function tz(i,e){function t(a){a===void 0&&(a=0);var l=e+a>=1?e+a:0;return i.el.getPointAtLength(l)}var r=OA(i.el,i.svg),n=t(),s=t(-1),o=t(1);switch(i.property){case"x":return(n.x-r.x)*r.w;case"y":return(n.y-r.y)*r.h;case"angle":return Math.atan2(o.y-s.y,o.x-s.x)*180/Math.PI}}function SA(i,e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=RA(Je.pth(i)?i.totalLength:i,e)+"";return{original:r,numbers:r.match(t)?r.match(t).map(Number):[0],strings:Je.str(i)||e?r.split(t):[]}}function FA(i){var e=i?Zp(Je.arr(i)?i.map(wA):wA(i)):[];return Kp(e,function(t,r,n){return n.indexOf(t)===r})}function UA(i){var e=FA(i);return e.map(function(t,r){return{target:t,id:r,total:e.length,transforms:{list:IA(t)}}})}function rz(i,e){var t=Kv(e);if(/^spring/.test(t.easing)&&(t.duration=CA(t.easing)),Je.arr(i)){var r=i.length,n=r===2&&!Je.obj(i[0]);n?i={value:i}:Je.fnc(e.duration)||(t.duration=e.duration/r)}var s=Je.arr(i)?i:[i];return s.map(function(o,a){var l=Je.obj(o)&&!Je.pth(o)?o:{value:o};return Je.und(l.delay)&&(l.delay=a?0:e.delay),Je.und(l.endDelay)&&(l.endDelay=a===s.length-1?e.endDelay:0),l}).map(function(o){return $p(o,t)})}function nz(i){for(var e=Kp(Zp(i.map(function(s){return Object.keys(s)})),function(s){return Je.key(s)}).reduce(function(s,o){return s.indexOf(o)<0&&s.push(o),s},[]),t={},r=function(s){var o=e[s];t[o]=i.map(function(a){var l={};for(var c in a)Je.key(c)?c==o&&(l.value=a[c]):l[c]=a[c];return l})},n=0;n<e.length;n++)r(n);return t}function iz(i,e){var t=[],r=e.keyframes;r&&(e=$p(nz(r),e));for(var n in e)Je.key(n)&&t.push({name:n,tweens:rz(e[n],i)});return t}function sz(i,e){var t={};for(var r in i){var n=Xv(i[r],e);Je.arr(n)&&(n=n.map(function(s){return Xv(s,e)}),n.length===1&&(n=n[0])),t[r]=n}return t.duration=parseFloat(t.duration),t.delay=parseFloat(t.delay),t}function oz(i,e){var t;return i.tweens.map(function(r){var n=sz(r,e),s=n.value,o=Je.arr(s)?s[1]:s,a=ms(o),l=ex(e.target,i.name,a,e),c=t?t.to.original:l,u=Je.arr(s)?s[0]:c,h=ms(u)||ms(l),f=a||h;return Je.und(o)&&(o=c),n.from=SA(u,f),n.to=SA(tx(o,u),f),n.start=t?t.end:0,n.end=n.start+n.delay+n.duration+n.endDelay,n.easing=Jv(n.easing,n.duration),n.isPath=Je.pth(s),n.isColor=Je.col(n.from.original),n.isColor&&(n.round=1),t=n,n})}var zA={css:function(i,e,t){return i.style[e]=t},attribute:function(i,e,t){return i.setAttribute(e,t)},object:function(i,e,t){return i[e]=t},transform:function(i,e,t,r,n){if(r.list.set(e,t),e===r.last||n){var s="";r.list.forEach(function(o,a){s+=a+"("+o+") "}),i.style.transform=s}}};function GA(i,e){var t=UA(i);t.forEach(function(r){for(var n in e){var s=Xv(e[n],r),o=r.target,a=ms(s),l=ex(o,n,a,r),c=a||ms(l),u=tx(RA(s,c),l),h=$v(o,n);zA[h](o,n,u,r.transforms,!0)}})}function az(i,e){var t=$v(i.target,e.name);if(t){var r=oz(e,i),n=r[r.length-1];return{type:t,property:e.name,animatable:i,tweens:r,duration:n.end,delay:r[0].delay,endDelay:n.endDelay}}}function lz(i,e){return Kp(Zp(i.map(function(t){return e.map(function(r){return az(t,r)})})),function(t){return!Je.und(t)})}function kA(i,e){var t=i.length,r=function(s){return s.timelineOffset?s.timelineOffset:0},n={};return n.duration=t?Math.max.apply(Math,i.map(function(s){return r(s)+s.duration})):e.duration,n.delay=t?Math.min.apply(Math,i.map(function(s){return r(s)+s.delay})):e.delay,n.endDelay=t?n.duration-Math.max.apply(Math,i.map(function(s){return r(s)+s.duration-s.endDelay})):e.endDelay,n}var MA=0;function cz(i){var e=qv(EA,i),t=qv(Yv,i),r=iz(t,i),n=UA(i.targets),s=lz(n,r),o=kA(s,t),a=MA;return MA++,$p(e,{id:a,children:[],animatables:n,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}var Sn=[],AA=[],Jp,uz=function(){function i(){Jp=requestAnimationFrame(e)}function e(t){var r=Sn.length;if(r){for(var n=0;n<r;){var s=Sn[n];if(!s.paused)s.tick(t);else{var o=Sn.indexOf(s);o>-1&&(Sn.splice(o,1),r=Sn.length)}n++}i()}else Jp=cancelAnimationFrame(Jp)}return i}();function hz(){document.hidden?(Sn.forEach(function(i){return i.pause()}),AA=Sn.slice(0),br.running=Sn=[]):AA.forEach(function(i){return i.play()})}typeof document<"u"&&document.addEventListener("visibilitychange",hz);function br(i){i===void 0&&(i={});var e=0,t=0,r=0,n,s=0,o=null;function a(b){var w=window.Promise&&new Promise(function(x){return o=x});return b.finished=w,w}var l=cz(i),c=a(l);function u(){var b=l.direction;b!=="alternate"&&(l.direction=b!=="normal"?"normal":"reverse"),l.reversed=!l.reversed,n.forEach(function(w){return w.reversed=l.reversed})}function h(b){return l.reversed?l.duration-b:b}function f(){e=0,t=h(l.currentTime)*(1/br.speed)}function d(b,w){w&&w.seek(b-w.timelineOffset)}function m(b){if(l.reversePlayback)for(var x=s;x--;)d(b,n[x]);else for(var w=0;w<s;w++)d(b,n[w])}function p(b){var w=0,x=l.animations,E=x.length;for(l.reversePlayback===!0&&l.rewind===!1&&(b=l.duration-b);w<E;){var T=x[w],S=T.animatable,I=T.tweens,C=I.length-1,M=I[C];C&&(M=Kp(I,function(ae){return b<ae.end})[0]||M);for(var _=Hi(b-M.start-M.delay,0,M.duration)/M.duration,R=isNaN(_)?1:M.easing(_),B=M.to.strings,O=M.round,z=[],q=M.to.numbers.length,F=void 0,ee=0;ee<q;ee++){var k=void 0;if(l.reversePlayback===!0&&l.rewind===!1)var V=M.to.numbers[ee],U=M.from.numbers[ee]||0;else var U=M.to.numbers[ee],V=M.from.numbers[ee]||0;M.isPath?k=tz(M.value,R*U):k=V+R*(U-V),O&&(M.isColor&&ee>2||(k=Math.round(k*O)/O)),z.push(k)}var J=B.length;if(!J)F=z[0];else{F=B[0];for(var K=0;K<J;K++){var $=B[K],j=B[K+1],ge=z[K];isNaN(ge)||(j?F+=ge+j:F+=ge+" ")}}zA[T.type](S.target,T.property,F,S.transforms),T.currentValue=F,w++}}function g(b){l[b]&&!l.passThrough&&l[b](l)}function y(){l.remaining&&l.remaining!==!0&&l.remaining--}function v(b){var w=l.duration,x=l.delay,E=w-l.endDelay,T=h(b);l.progress=Hi(T/w*100,0,100),l.reversePlayback=T<l.currentTime,n&&m(T),!l.began&&l.currentTime>=0&&(l.began=!0,g("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,g("loopBegin")),T<=x&&l.currentTime!==0&&p(0),(T>=E&&l.currentTime!==w||!w)&&p(w),T>x&&T<E?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,g("changeBegin")),g("change"),p(T)):l.changeBegan?(l.changeCompleted=!0,l.changeBegan=!1,g("change"),g("changeComplete")):l.began&&T>E&&(g("change"),g("changeComplete")),l.currentTime=Hi(T,0,w),l.began&&g("update"),b>=w&&(t=0,y(),l.remaining?(e=r,g("loopComplete"),l.loopBegan=!1,l.direction==="alternate"&&u()):(l.paused=!0,l.completed||(l.completed=!0,g("loopComplete"),g("complete"),!l.passThrough&&"Promise"in window&&(o(),c=a(l)))))}return l.reset=function(){var b=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=b==="reverse",l.remaining=l.loop,n=l.children,s=n.length;for(var w=s;w--;)l.children[w].reset();(l.reversed&&l.loop!==!0||b==="alternate"&&l.loop===1)&&l.remaining++,p(l.reversed?l.duration:0)},l.set=function(b,w){return GA(b,w),l},l.tick=function(b){r=b,e||(e=r),v((r+(t-e))*br.speed)},l.seek=function(b){v(h(b))},l.pause=function(){l.paused=!0,f()},l.play=function(){!l.paused||(l.completed&&l.reset(),l.paused=!1,Sn.push(l),f(),Jp||uz())},l.reverse=function(){u(),l.completed=!l.reversed,f()},l.restart=function(){l.reset(),l.play()},l.reset(),l.autoplay&&l.play(),l}function TA(i,e){for(var t=e.length;t--;)Qv(i,e[t].animatable.target)&&e.splice(t,1)}function fz(i){for(var e=FA(i),t=Sn.length;t--;){var r=Sn[t],n=r.animations,s=r.children;TA(e,n);for(var o=s.length;o--;){var a=s[o],l=a.animations;TA(e,l),!l.length&&!a.children.length&&s.splice(o,1)}!n.length&&!s.length&&r.pause()}}function dz(i,e){e===void 0&&(e={});var t=e.direction||"normal",r=e.easing?Jv(e.easing):null,n=e.grid,s=e.axis,o=e.from||0,a=o==="first",l=o==="center",c=o==="last",u=Je.arr(i),h=parseFloat(u?i[0]:i),f=u?parseFloat(i[1]):0,d=ms(u?i[1]:i)||0,m=e.start||0+(u?h:0),p=[],g=0;return function(y,v,b){if(a&&(o=0),l&&(o=(b-1)/2),c&&(o=b-1),!p.length){for(var w=0;w<b;w++){if(!n)p.push(Math.abs(o-w));else{var x=l?(n[0]-1)/2:o%n[0],E=l?(n[1]-1)/2:Math.floor(o/n[0]),T=w%n[0],S=Math.floor(w/n[0]),I=x-T,C=E-S,M=Math.sqrt(I*I+C*C);s==="x"&&(M=-I),s==="y"&&(M=-C),p.push(M)}g=Math.max.apply(Math,p)}r&&(p=p.map(function(R){return r(R/g)*g})),t==="reverse"&&(p=p.map(function(R){return s?R<0?R*-1:-R:Math.abs(g-R)}))}var _=u?(f-h)/g:h;return m+_*(Math.round(p[v]*100)/100)+d}}function pz(i){i===void 0&&(i={});var e=br(i);return e.duration=0,e.add=function(t,r){var n=Sn.indexOf(e),s=e.children;n>-1&&Sn.splice(n,1);function o(f){f.passThrough=!0}for(var a=0;a<s.length;a++)o(s[a]);var l=$p(t,qv(Yv,i));l.targets=l.targets||i.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=Je.und(r)?c:tx(r,c),o(e),l.rewind=e.rewind,e.seek(l.timelineOffset);var u=br(l);o(u),s.push(u);var h=kA(s,i);return e.delay=h.delay,e.endDelay=h.endDelay,e.duration=h.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e}br.version="3.2.0";br.speed=1;br.running=Sn;br.remove=fz;br.get=ex;br.set=GA;br.convertPx=Zv;br.path=ez;br.setDashoffset=ZU;br.stagger=dz;br.timeline=pz;br.easing=Jv;br.penner=LA;br.random=function(i,e){return Math.floor(Math.random()*(e-i+1))+i};var bh=br;function VA(i,e,t){var n,s;let r=i.cameraType==="OrthographicCamera"?(n=e.orthographic)==null?void 0:n.zoom:(s=e.perspective)==null?void 0:s.zoom;if(r!==void 0){let o=i.zoom;o!==r&&t.push({change:a=>{i.zoom=et.lerp(o,r,a),i.updateProjectionMatrix()}})}if(e.targetOffset!==void 0){let o=i.targetOffset,a=e.targetOffset;o!==a&&t.push({change:l=>{i.targetOffset=et.lerp(o,a,l)}})}}function HA(i,e,t){if(e.width!==void 0&&e.height!==void 0&&e.depth!==void 0){let{width:r,height:n,depth:s}=i.geometry.userData.parameters,o=[r,n,s],a=[e.width,e.height,e.depth];vr.isEqual(o,a)||t.push({change:l=>{let[c,u,h]=vr.lerp(o,a,l);i.updateGeometry({parameters:{width:c,height:u,depth:h}})}})}}function WA(i,e,t,r){if(e.intensity!==void 0){let n=i.intensity,s=e.intensity;n!==s&&t.push({change:o=>{i.intensity=et.lerp(n,s,o)}})}if(e.color!==void 0){let n=i.color.clone(),s=typeof e.color=="string"?r.getColor(e.color):e.color;if(!Sr.equals(n,s)){let o=n.clone();i.color=o,t.push({change:a=>{let{r:l,g:c,b:u}=Sr.lerp(n,s,a);o.setRGB(l,c,u)}})}}}function jA(i,e,t,r){var s,o;let n=i.layersList.head;for(;n;){let a=e.layers.data(n.uuid);if(a&&((s=n.visible)!=null?s:!0)&&((o=a.visible)!=null?o:!0)){let l=n.getNames().filter(c=>!mM.some(u=>c.includes(u)));for(let c of l)try{let u=n.getValue(c);if(c==="steps")bz(n,a,c,t);else if(c==="colors")wz(n,a,c,t);else if(typeof u=="number")mz(n,a,c,t);else{if(typeof u=="boolean")continue;"isVector2"in u?gz(n,a,c,t):"isVector3"in u?yz(n,a,c,t):"isColorA"in u?xz(n,a,c,t,r):"isColor"in u?vz(n,a,c,t,r):"isTexture"in u&&Sz(n,a,c,t)}}catch(u){console.error(`animateMaterial: unexpected material layer for ${c}`,u)}}n=n.next}}function mz(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=e[t];n!==s&&r.push({change:o=>{i.setValue(t,et.lerp(n,s,o))}})}function gz(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=n.toArray(),o=e[t];ls.isEqual(s,o)||r.push({change:a=>{n.fromArray(ls.lerp(s,o,a))}})}function yz(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=n.toArray(),o=e[t];vr.isEqual(s,o)||r.push({change:a=>{n.fromArray(vr.lerp(s,o,a))}})}function vz(i,e,t,r,n){if(!i.hasValue(t)||!(t in e))return;let s=i.getValue(t).clone(),o=e[t],a=typeof o=="string"?n.getColor(o):o;if(Sr.equals(s,a))return;let l=s.clone();i.setValue(t,l),r.push({change:c=>{let{r:u,g:h,b:f}=Sr.lerp(s,a,c);l.setRGB(u,h,f)}})}function xz(i,e,t,r,n){if(!i.hasValue(t)||!(t in e))return;let s=i.getValue(t).clone(),o=e[t],a=typeof o=="string"?n.getColor(o):o;if(Ln.equals(s,a))return;let l=s.clone();i.setValue(t,l),r.push({change:c=>{let{r:u,g:h,b:f,a:d}=Ln.lerp(s,a,c);l.setRGBA(u,h,f,d)}})}function bz(i,e,t="steps",r){if(!i.hasValue(t)||!(t in e))return;let n=[...i.getValue(t)],s=e[t];for(let o=0;o<n.length;++o){let a=n[o],l=s[o];a!==l&&r.push({change:c=>{n[o]=et.lerp(a,l,c),i.setValue("steps",n)}})}}function wz(i,e,t="colors",r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=e[t];for(let o=0;o<n.length;++o){let a=n[o].toArray(),l=s[o];Cu.isEqual(a,l)||r.push({change:c=>{n[o].fromArray(Cu.lerp(a,l,c))}})}}function Sz(i,e,t="texture",r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue("texture"),s=e[t],o=n.repeat.toArray(),a=n.offset.toArray(),l=s.repeat,c=s.offset;(!ls.isEqual(o,l)||!ls.isEqual(a,c))&&r.push({change:u=>{n.repeat.fromArray(ls.lerp(o,l,u)),n.offset.fromArray(ls.lerp(a,c,u)),n.updateMatrix(),n.needsUpdate=!0}})}function qA(i,e,t,r){if(r===0)return t.copy(i);if(r===1)return t.copy(e);let n=i.w*e.w+i.x*e.x+i.y*e.y+i.z*e.z;if(n>=1)return t.copy(i);let s=1-n*n;if(s<=Number.EPSILON){let u=1-r;return t.w=u*i.w+r*e.w,t.x=u*i.x+r*e.x,t.y=u*i.y+r*e.y,t.z=u*i.z+r*e.z,t.normalize(),t}let o=Math.sqrt(s),a=Math.atan2(o,n),l=Math.sin((1-r)*a)/o,c=Math.sin(r*a)/o;return t.w=i.w*l+e.w*c,t.x=i.x*l+e.x*c,t.y=i.y*l+e.y*c,t.z=i.z*l+e.z*c,t}function XA(i,e,t=0){let r=Array.isArray(i.material)?i.material[t]:i.material,n;return"materials"in e?n=e.materials[t]:"material"in e&&(n=e.material),[r,n]}var nx=new A,ix=new A,YA=new Ut,Mz=new pn,Az=new Ee;function JA(i,e,t,r){if(t.position!==void 0){let n=i.position.toArray(),s=t.position;vr.isEqual(n,s)||r.push({change:o=>{i.position.fromArray(vr.lerp(n,s,o)),i.updateMatrix()}})}if(t.scale!==void 0){let n=i.scale.toArray(),s=t.scale;vr.isEqual(n,s)||r.push({change:o=>{i.scale.fromArray(vr.lerp(n,s,o)),i.updateMatrix()}})}Tz(i,e,t,r),Ez(i,t,r)}function Tz(i,e,t,r){if(t.rotation===void 0)return;let n=nx.setFromEuler(i.rotation).toArray(),s=t.rotation;if(vr.isEqual(n,s))return;if(vr.sub(t.rotation,e?e.rotation:i.rotation).every(a=>Math.abs(a)<2*Math.PI)){let a=i.quaternion.clone(),l=new Ut().setFromEuler(Mz.set(t.rotation[0],t.rotation[1],t.rotation[2]));r.push({change:c=>{qA(a,l,i.quaternion,c),i.updateMatrix()}})}else r.push({change:a=>{i.rotation.setFromVector3(ix.fromArray(vr.lerp(n,s,a))),i.updateMatrix()}})}function Ez(i,e,t){if(e.hiddenMatrix!==void 0&&!_i.isEqual(i.hiddenMatrix.toArray(),e.hiddenMatrix)){let r=new A,n=new Ut,s=new A;i.hiddenMatrix.decompose(r,n,s);let o=new A,a=new Ut,l=new A;Az.fromArray(e.hiddenMatrix).decompose(o,a,l),t.push({change:c=>{YA.slerpQuaternions(n,a,c),nx.lerpVectors(r,o,c),ix.lerpVectors(s,l,c),i.hiddenMatrix.compose(nx,YA,ix)}})}}function QA(i,e,t,r){let n=[];if(JA(i,e==null?void 0:e.objectState,t.objectState,n),us(i)){if("geometry"in t.objectState&&HA(i,t.objectState.geometry,n),"material"in t.objectState||"materials"in t.objectState){let[s,o]=XA(i,t.objectState,i.selectedMaterial);s&&o&&typeof o!="string"&&jA(s,o,n,r)}}else x1(i)?WA(i,t.objectState,n,r):v1(i)&&VA(i,t.objectState,n);return{change:s=>{n.forEach(o=>{o.change&&o.change(s)})}}}function em(i,e,t){switch(i){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 5:let{control1:r,control2:n}=e;return`cubicBezier( ${r[0]}, ${r[1]}, ${n[0]}, ${n[1]} )`;case 6:let{mass:s,stiffness:o,damping:a,velocity:l}=t;return`spring( ${s}, ${o}, ${a}, ${l} )`}}var tm=class{constructor(e,t){this.object=e;this.sharedAssets=t;this.uuid=et.generateUUID();this.states=[];this.events={};this._scrollCounter=null}get animation(){return this._animation}start(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0,this._scrollCounter=null),this.states.length>1&&(this.states[0].execute(this.object,this.sharedAssets),this._currentState=this.states[0],this._prevState=void 0)}end(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0),this.states.length>1&&this.states[0].execute(this.object,this.sharedAssets),this._currentState=void 0,this._prevState=void 0}play(e,t){this.object.visible&&e.state!==void 0&&this.animate(e.state,e,!0,t)}reverse(e,t){this.object.visible&&this._prevState!==void 0&&this.animate(this._prevState,e,!0,t)}seek(e,t,r,n){var s;this._scrollCounter===null&&(this.object.visible&&e.state!==void 0&&this.animate(e.state,e,!1,n),this._scrollCounter=0),this._scrollCounter+=t,this._scrollCounter=Math.min(Math.max(this._scrollCounter,0),r),(s=this._animation)==null||s.seek(this._scrollCounter/r*e.duration)}animate(e,t,r=!0,n){var s,o,a,l,c,u;if(this._currentState===e){if((s=this._animation)!=null&&s.reversed){let h=(a=(o=this._animation)==null?void 0:o.currentTime)!=null?a:0;(l=this._animation)==null||l.reset(),(c=this._animation)==null||c.seek(h),(u=this._animation)==null||u.play()}}else{this._prevState=this._currentState,this._currentState=e,this._animation!==void 0&&this._animation.pause(),t.cycle===!0&&t.repeat===!0?this._animation=bh.timeline({duration:t.duration,delay:t.delay/2,endDelay:t.delay/2,direction:"alternate",loop:!0,rewind:t.rewind,easing:em(t.easing,t.cubicControls,t.springParameters),autoplay:r}):t.cycle===!0&&t.repeat===!1?this._animation=bh.timeline({duration:t.duration,delay:t.delay,endDelay:t.delay/2,direction:"alternate",rewind:t.rewind,easing:em(t.easing,t.cubicControls,t.springParameters),autoplay:r}):t.cycle===!1&&t.repeat===!0?this._animation=bh.timeline({duration:t.duration,delay:t.delay,direction:"normal",loop:!0,easing:em(t.easing,t.cubicControls,t.springParameters),autoplay:r}):this._animation=bh.timeline({duration:t.duration,delay:t.delay,direction:"normal",easing:em(t.easing,t.cubicControls,t.springParameters),autoplay:r}),r&&this._animation.finished.then(()=>{this._animation=void 0});let h=QA(this.object,this._prevState,this._currentState,this.sharedAssets),f={t:0};this._animation.add({targets:f,t:1,change:()=>{var d;h.change&&(h.change(f.t),(d=n==null?void 0:n.change)==null||d.call(this,f.t))}},0)}}emitEvent(e){if(e==="keyDown"||e==="keyUp"||e==="mouseDown"||e==="mouseUp"||e==="mouseHover"||e==="scroll"||e==="start"){let t=this.events[e];if(t)for(let r of t)r.targets.forEach(n=>this.play(n))}}emitEventReverse(e){if(e==="keyDown"||e==="keyUp"||e==="mouseDown"||e==="mouseUp"||e==="mouseHover"||e==="scroll"||e==="start"){let t=this.events[e];if(t)for(let r of t)r.targets.forEach(n=>this.reverse(n))}}};var fc=class{constructor(e){this.targetState=e}static create(e,t){var n;let r=new fc(e);if(e.object){let s=t.find(e.object);if(r.object=s,s!=null&&s.interaction){let o=s.interaction.states;r.state=e.state&&(n=o.find(a=>a.uuid===e.state))!=null?n:o[0]}}return r}get cubicControls(){let e=this.targetState;return e.easing===5?{control1:e.control1,control2:e.control2}:se({},Nd.defaultData)}get springParameters(){let e=this.targetState;return e.easing===6?e:se({},Bd.defaultData)}get easing(){return this.targetState.easing}get duration(){return this.targetState.duration}get delay(){return this.targetState.delay}get repeat(){return this.targetState.repeat}get cycle(){return this.targetState.cycle}get rewind(){return this.targetState.rewind}};var KA=new jr,$o=class extends kr{},rm=class{constructor(e){this.materials={};this.images={};this.colors={};this.transmissionRenderTarget=new mt(2048,2048,{generateMipmaps:!0,minFilter:ks,magFilter:ct,wrapS:_r,wrapT:_r}),this.transmissionRenderTarget.depthTexture=new oi(2048,2048),this.reset(e)}reset(e){for(let[t,r]of Object.entries(e.images))this.addImage(t,r.data);for(let[t,r]of Object.entries(e.colors))this.addColor(t,r);for(let[t,r]of Object.entries(e.materials))this.addMaterial(t,Ev(r,this))}get transmissionSamplerMap(){return this.transmissionRenderTarget.texture}get transmissionDepthMap(){return this.transmissionRenderTarget.depthTexture}addMaterial(e,t){t.uuid=e,this.materials[e]=t}deleteMaterial(e){this.materials[e]&&(this.materials[e].dispose(),delete this.materials[e])}isSharedMaterial(e){return e.uuid in this.materials||e===KA}getMaterial(e){let t=this.materials[e];return t}getMaterialOrDeletedPlaceholder(e){var t;return(t=this.materials[e])!=null?t:KA}getMaterials(){return this.materials}addImage(e,t){if(this.images[e])return this.images[e].onload=()=>{this.onImageLoad&&this.onImageLoad(e)},this.images[e].src=t,!0;{let r=new Image;return r.src=t,r.onload=()=>{this.onImageLoad&&this.onImageLoad(e)},this.images[e]=r,!1}}deleteImage(e){this.images[e]&&delete this.images[e]}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]}getImages(){return this.images}addColor(e,t){return this.colors[e]?("a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):("a"in t?this.colors[e]=new $o(t.r,t.g,t.b,t.a):this.colors[e]=new $o(t.r,t.g,t.b,1),!1)}updateColor(e,t){var r,n,s,o;if(this.colors[e]){let a=this.colors[e];return this.colors[e].r=(r=t.r)!=null?r:a.r,this.colors[e].g=(n=t.g)!=null?n:a.g,this.colors[e].b=(s=t.b)!=null?s:a.b,this.colors[e].a=(o=t.a)!=null?o:a.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this.transmissionRenderTarget.depthTexture.dispose(),this.transmissionRenderTarget.dispose(),this.onImageLoad=void 0}};function _z(i,e){switch(i.type){case"noise":return e==="noiseType";case"texture":return e==="projection"||e==="axis";case"displace":return e==="noiseType";case"depth":return e==="num"||e==="smooth"||e==="isWorldSpace"||e==="gradientType";default:return!1}}function sx(i,e,t,r,n){var o;let s=!1;for(let[a,l]of Object.entries(i)){if(!a||l===void 0||Bp(a,t,n))continue;t.visible=n.visible;let c=t.uniforms[`f${t.id}_${a}`];if(!!c)switch(c.constructor){case Rt:if(typeof l=="string"){let u=e.getColor(l);u&&(c.value=u);break}else{let u=l;c.value instanceof $o?c.value=new kr(u.r,u.g,u.b,u.a):c.setRGBA(u);break}case hi:if(typeof l=="string"){let u=e.getColor(l);u&&(c.value=u);break}else{let u=l;c.value instanceof $o?c.value=new kr(u.r,u.g,u.b,u.a):c.value.setRGBA(u.r,u.g,u.b,u.a);break}case Ir:{let u=l;c.value.setX(u[0]),c.value.setY(u[1]);break}case Rr:{let u=l;c.value.setX(u[0]),c.value.setY(u[1]),c.value.setZ(u[2]);break}case Hr:{let u=l;if("image"in u){let h=e.getImage(u.image);if(h)c.value.image=h;else{let f=new Image;f.src=u.image.data,c.value.image=f}}"wrapping"in u&&(c.value.wrapS=c.value.wrapT=u.wrapping),"repeat"in u&&c.value.repeat.fromArray(u.repeat),"offset"in u&&c.value.offset.fromArray(u.offset),c.value.needsUpdate=!0;break}case fs:{l.forEach((u,h)=>{c.value[h].setX(u[0]),c.value[h].setY(u[1]),c.value[h].setZ(u[2]),c.value[h].setW(u[3])});break}default:{s=s||_z(t,a),c.value=l;break}}}if(s&&n){let a=Rp({id:"0",fi:0,data:n},e);(o=r.userData.layers)==null||o.changeLayer(t.id,se({},a)),r.dispose(),r.needsUpdate=!0}}var ox=new A,ZA=new Fr,$A=new Ee,pc={type:"follow",normal:new A,raycaster:new to},dc;(t=>{function i(r){if(r.type===10)return{type:"follow"}}t.create=i;function e({target:r,normal:n,raycaster:s,begin:o,change:a}){!r||!r.interaction||!n||!s||(o&&o("follow",r.uuid),ZA.setFromNormalAndCoplanarPoint(n,r.getWorldPosition(ox)),s.ray.intersectPlane(ZA,ox),r.position.copy(ox),r.parent!==null&&r.position.applyMatrix4($A.copy(r.parent.matrixWorld).invert()),r.position.applyMatrix4($A.copy(r.hiddenMatrix).invert()),r.updateMatrix(),a&&a())}t.listener=e})(dc||(dc={}));var nm={type:"keyDown"},im={type:"keyUp"},mc;(t=>{function i(r){if(r.type===5&&r.key)return{type:"keyDown",targets:[],key:r.key}}t.create=i;function e({target:r,begin:n,change:s,domEvent:o}){if(!r||!r.interaction||!o)return;let a=r.interaction.events.keyDown;if(!(a!=null&&a.length))return;let l=!1;for(let c of a)c.key===o.key&&(c.targets.forEach(u=>{var h,f;return(f=(h=u.object)==null?void 0:h.interaction)==null?void 0:f.play(u,{change:s})}),l=!0);l&&n&&n("keyDown",r.uuid)}t.listener=e})(mc||(mc={}));var gc;(t=>{function i(r){if(!(r.type!==6||!r.key))return{type:"keyUp",targets:[],key:r.key}}t.create=i;function e({target:r,begin:n,change:s,domEvent:o}){if(!r||!r.interaction||!o)return;let a=r.interaction.events.keyUp;if(!(a!=null&&a.length))return;let l=!1;for(let c of a)c.key===o.key&&(c.targets.forEach(u=>{var h,f;return(f=(h=u.object)==null?void 0:h.interaction)==null?void 0:f.play(u,{change:s})}),l=!0);l&&n&&n("keyUp",r.uuid)}t.listener=e})(gc||(gc={}));var ax=new A,eT=new Fr,vc={type:"lookAt",normal:new A,raycaster:new to},yc;(t=>{function i(r){if(r.type===9&&r.distance)return{type:"lookAt",distance:r.distance}}t.create=i;function e({target:r,normal:n,raycaster:s,begin:o,change:a}){var u;if(!r||!r.interaction||!n||!s)return;let l=r.interaction.events.lookAt;if(!(l!=null&&l.length))return;o&&o("lookAt",r.uuid);let c=l[0].distance;eT.set(n,-c),s.ray.intersectPlane(eT,ax),r.lookAt(ax),r.updateMatrix(),(u=r.interaction.animation)==null||u.finished.then(()=>{r.lookAt(ax),r.updateMatrix()}),a&&a()}t.listener=e})(yc||(yc={}));var sm={type:"mouseDown"},om={type:"mouseUp"},xc;(t=>{function i(r){if(r.type===0)return{type:"mouseDown",targets:[]}}t.create=i;function e({target:r,begin:n,change:s}){if(!r||!r.interaction)return;let o=r.interaction.events.mouseDown;!(o!=null&&o.length)||(n&&n("mouseDown",r.uuid),o.forEach(a=>{a.targets.forEach(l=>{var c,u;return(u=(c=l.object)==null?void 0:c.interaction)==null?void 0:u.play(l,{change:s})})}))}t.listener=e})(xc||(xc={}));var bc;(t=>{function i(r){if(r.type===1)return{type:"mouseUp",targets:[]}}t.create=i;function e({target:r,begin:n,change:s}){if(!r||!r.interaction)return;let o=r.interaction.events.mouseUp;!(o!=null&&o.length)||(n&&n("mouseUp",r.uuid),o.forEach(a=>{a.targets.forEach(l=>{var c,u;return(u=(c=l.object)==null?void 0:c.interaction)==null?void 0:u.play(l,{change:s})})}))}t.listener=e})(bc||(bc={}));var lx={type:"start"},wc;(t=>{function i(r){if(r.type===7)return{type:"start",targets:[]}}t.create=i;function e({target:r,begin:n,change:s}){if(!r||!r.interaction)return;let o=r.interaction.events.start;!(o!=null&&o.length)||(n&&n("start",r.uuid),o.forEach(a=>{a.targets.forEach(l=>{var c,u;return(u=(c=l.object)==null?void 0:c.interaction)==null?void 0:u.play(l,{change:s})})}))}t.listener=e})(wc||(wc={}));var Mn={type:"link"},Sc;(t=>{function i(r){let n;if(r.type===0)n={type:"mousedown"};else if(r.type===1)n={type:"mouseup"};else if(r.type===5){if(!r.key)return;n={type:"keydown",key:r.key}}else if(r.type===6){if(!r.key)return;n={type:"keyup",key:r.key}}else return;if(r.url)return{type:"link",subEvent:n,url:r.url}}t.create=i;function e({target:r,begin:n,domEvent:s,subType:o}){var c;if(!r||!r.interaction||!o||!s)return;let a=r.interaction.events.link;if(!a)return;let l;if(o==="keydown"||o==="keyup"){let u=s.key;l=(c=a[o])==null?void 0:c.filter(h=>h.subEvent.type===o&&h.subEvent.key===u)}else l=a[o];if(!!(l!=null&&l.length)){n&&n("link",r.uuid);for(let u of l)_u?window.location.assign(u.url):window.open(u.url,"_blank")}}t.listener=e})(Sc||(Sc={}));var am={type:"scroll"},Mc;(t=>{function i(r){if(!(r.type!==11||r.steps===void 0))return{type:"scroll",targets:[],steps:r.steps}}t.create=i;function e({target:r,begin:n,change:s,domEvent:o}){if(!r||!r.interaction||!o)return;let a=r.interaction.events.scroll;if(!(a!=null&&a.length))return;n&&n("scroll",r.uuid);let l=o.deltaY>0?1:-1;a.forEach(c=>{c.targets.forEach(u=>{var h,f;return(f=(h=u.object)==null?void 0:h.interaction)==null?void 0:f.seek(u,l,c.steps,{change:s})})})}t.listener=e})(Mc||(Mc={}));var go={type:"mouseHover"},Ac;(t=>{function i(r){if(r.type===2)return{type:"mouseHover",targets:[]}}t.create=i;function e({target:r,begin:n,change:s,enter:o}){if(!r||!r.interaction||o===void 0)return;let a=r.interaction.events.mouseHover;!(a!=null&&a.length)||(n&&n("mouseHover",r.uuid),o?a.forEach(l=>{l.targets.forEach(c=>{var u,h;return(h=(u=c.object)==null?void 0:u.interaction)==null?void 0:h.play(c,{change:s})})}):a.forEach(l=>{l.targets.forEach(c=>{var u,h;return(h=(u=c.object)==null?void 0:u.interaction)==null?void 0:h.reverse(c,{change:s})})}))}t.listener=e})(Ac||(Ac={}));function Cz(i){let e,{type:t}=i;return t===10?e=dc.create(i):t===5?e=mc.create(i):t===6?e=gc.create(i):t===9?e=yc.create(i):t===0?e=xc.create(i):t===1?e=bc.create(i):t===2?e=Ac.create(i):t===11?e=Mc.create(i):t===7&&(e=wc.create(i)),e}function tT(i,e,t){let r=[];i.objects.traverse((n,s)=>{var u;if(s.states===void 0)return;let o=e.find(n),a=new tm(o,t),l=a.states;l.push(ea.create(n,s));for(let h of s.states){let f=Nu.patch(s,h.data);l.push(ea.create(h.id,f))}let c=a.events;if(s.events)for(let{data:h}of s.events){let f=Cz(h);if(!f)continue;let d=f.type;c[d]?(u=c[d])==null||u.push(f):c[d]=[f],"targets"in h&&r.push([h,f]);let m=Sc.create(h);if(m){c.link||(c.link={});let p=m.subEvent.type;c.link[p]?c.link[p].push(m):c.link[p]=[m]}}l.length>0||Object.keys(c).length>0?(o.interaction=a,cx(o,s,null,t)):delete o.interaction});for(let[n,s]of r)if("targets"in n&&"targets"in s)for(let{data:o}of n.targets){let a=fc.create(o,e);s.targets.push(a)}}function cx(i,e,t,r,n=!1){if(!n&&e.states.length===0)return;let s=t===null?e:Nu.patch(e,e.states.data(t));if(pv(i,s),i instanceof Xt&&s.type==="Mesh"){if(i instanceof uo?i.buildFromStore(s.geometry):i.updateGeometry({parameters:s.geometry}),"material"in s){if(i.material instanceof Array)return;if(typeof s.material!="string"){let a=s.material.layers;for(let l of a){let c=i.material.userData.layers.getLayerByUuid(l.id);sx(l.data,r,c,i.material,l.data)}}}else if("materials"in s){if(!(i.material instanceof Array))return;var o=0;for(let a of s.materials){if(typeof a!="string"){let l=a.layers;for(let c of l){let u=i.material[o].userData.layers.getLayerByUuid(c.id);sx(c.data,r,u,i.material[o],c.data)}}o++}}}else if(s.type==="DirectionalLight")i.fromDirectionalLightState(s,r);else if(s.type==="PointLight")i.fromPointLightState(s,r);else if(s.type==="SpotLight")i.fromSpotLightState(s,r);else if(i instanceof Bn&&Qs.is(s.type)){let a=s;i.setZoom("PerspectiveCamera",a.perspective.zoom),i.setZoom("OrthographicCamera",a.orthographic.zoom)}}var ea=class{constructor(e){this.objectState=e;this.uuid=et.generateUUID()}static create(e,t){let r=new ea(t);return r.uuid=e,r}execute(e,t){cx(e,this.objectState,null,t,!0)}};var Qn=new to,Kn=new A,Lz=new Qe,ux={follow:dc.listener,keyDown:mc.listener,keyUp:gc.listener,link:Sc.listener,lookAt:yc.listener,mouseDown:xc.listener,mouseUp:bc.listener,mouseHover:Ac.listener,scroll:Mc.listener,start:wc.listener},rT={follow:pc,keyDown:nm,keyUp:im,link:Mn,lookAt:vc,mouseDown:sm,mouseUp:om,mouseHover:go,scroll:am,start:lx};function Dz(i){if(i.style.transform!==""){let e=getComputedStyle(i).getPropertyValue("transform");if(e!=="none"){let t=e.replace("matrix(","").split(",");return{x:parseFloat(t[0]),y:parseFloat(t[3])}}}return{x:1,y:1}}function wh(i,e){if(us(e)){if(!e.raycastLock&&e.visible){let t=i.intersectObject(e,!1);return t.length?t[0]:void 0}}else if(e.objectType==="EmptyObject")return nT(i,e)}function nT(i,e){if(us(e)&&!e.raycastLock&&e.visible){let t=i.intersectObject(e,!1);if(t.length)return t[0]}for(let t of e.children)if(qo(t)){let r=nT(i,t);if(r)return r}}var lm=class{constructor(e,t,r,n){this.isEnable=!1;this.splineEvents={};this._map={};this._prevObjects=[];this._onMouseDown=e=>{Qn.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Kn),Kn.negate(),this._handleMouseDownEvent(e)};this._onMouseUp=e=>{Qn.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Kn),Kn.negate(),this._handleMouseUpEvent(e)};this._onMouseMove=e=>{Qn.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Kn),Kn.negate(),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e)};this._onTouchStart=e=>{e.touches.length===1&&(Qn.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(Kn),Kn.negate(),this._handleMouseDownEvent(e),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e))};this._onTouchEnd=e=>{this._handleMouseUpEvent(e),this._handleMouseHoverEvent(e,!0)};this._onTouchMove=e=>{e.touches.length===1&&(Qn.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(Kn),Kn.negate(),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e))};this._onWheel=e=>{this._handleWheelEvent(e)};this._onKeyDown=e=>{this._handleKeyDownEvent(e)};this._onKeyUp=e=>{this._handleKeyUpEvent(e)};this._renderer=e,this._domElement=e.domElement,this._camera=r,this._scene=t,this._app=n}activate(){var e,t,r,n,s,o,a,l,c,u,h,f,d,m,p,g,y,v,b,w,x,E,T,S,I,C,M,_,R,B;this.isEnable=!0,this._map={},this._scene.traverseEntity(O=>{O.interaction!==void 0&&(O.interaction.start(),Object.keys(O.interaction.events).forEach(z=>{let q=z;this._addDOMCustomEvent(q,O),this._addSPEEvent(q,ux[q],O)}))}),Pd?((((e=this._map.mouseDown)==null?void 0:e.length)||((r=(t=this._map.link)==null?void 0:t.mousedown)==null?void 0:r.length)||((n=this._map.mouseHover)==null?void 0:n.length)||((s=this._map.lookAt)==null?void 0:s.length)||((o=this._map.follow)==null?void 0:o.length))&&this._domElement.addEventListener("touchstart",this._onTouchStart),(((a=this._map.mouseUp)==null?void 0:a.length)||((c=(l=this._map.link)==null?void 0:l.mouseup)==null?void 0:c.length)||((u=this._map.mouseHover)==null?void 0:u.length))&&this._domElement.addEventListener("touchend",this._onTouchEnd),(((h=this._map.mouseHover)==null?void 0:h.length)||((f=this._map.lookAt)==null?void 0:f.length)||((d=this._map.follow)==null?void 0:d.length))&&this._domElement.addEventListener("touchmove",this._onTouchMove)):((((m=this._map.mouseDown)==null?void 0:m.length)||((g=(p=this._map.link)==null?void 0:p.mousedown)==null?void 0:g.length))&&this._domElement.addEventListener("pointerdown",this._onMouseDown),(((y=this._map.mouseUp)==null?void 0:y.length)||((b=(v=this._map.link)==null?void 0:v.mouseup)==null?void 0:b.length))&&this._domElement.addEventListener("pointerup",this._onMouseUp),(((w=this._map.mouseHover)==null?void 0:w.length)||((x=this._map.lookAt)==null?void 0:x.length)||((E=this._map.follow)==null?void 0:E.length))&&this._domElement.addEventListener("pointermove",this._onMouseMove)),(T=this._map.scroll)!=null&&T.length&&this._domElement.addEventListener("wheel",this._onWheel),(((S=this._map.keyDown)==null?void 0:S.length)||((C=(I=this._map.link)==null?void 0:I.keydown)==null?void 0:C.length))&&document.addEventListener("keydown",this._onKeyDown),(((M=this._map.keyUp)==null?void 0:M.length)||((R=(_=this._map.link)==null?void 0:_.keyup)==null?void 0:R.length))&&document.addEventListener("keyup",this._onKeyUp),(B=this._map.start)!=null&&B.length&&this._handleStartEvent()}deactivate(){this._scene.traverseEntity(e=>{if(!e.interaction)return;e.interaction.end();let t=e;Object.keys(ux).forEach(r=>{let n=r;t.removeEventListener(n,ux[n])})}),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),this._domElement.removeEventListener("wheel",this._onWheel),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("keyup",this._onKeyUp),this._map={},this.isEnable=!1}reset(){this._scene.traverseEntity(e=>{var t;(t=e.interaction)==null||t.start()}),this._handleStartEvent()}_getPointer(e,t){let r=this._domElement.getBoundingClientRect(),n=this._renderer.getViewport(Lz),s=Dz(this._domElement),o=n.x*s.x,a=n.y*s.y,l=n.z*s.x,c=n.w*s.y,u=r.height-c,h=(e-o-r.left)*(r.width/l),f=(t-u+a-r.top)*(r.height/c);return{x:h/r.width*2-1,y:-(f/r.height)*2+1}}_handleStartEvent(){var e;(e=this._map.start)==null||e.forEach(t=>t.dispatchEvent(lx))}_handleWheelEvent(e){var t;(t=this._map.scroll)!=null&&t.length&&(am.domEvent=e,this._map.scroll.forEach(r=>r.dispatchEvent(am)))}_handleMouseDownEvent(e){var t,r,n;(t=this._map.mouseDown)==null||t.forEach(s=>{wh(Qn,s)&&(sm.domEvent=e,s.dispatchEvent(sm))}),(n=(r=this._map.link)==null?void 0:r.mousedown)==null||n.forEach(s=>{wh(Qn,s)&&(Mn.domEvent=e,Mn.subType="mousedown",s.dispatchEvent(Mn))})}_handleMouseUpEvent(e){var t,r,n;(t=this._map.mouseUp)==null||t.forEach(s=>{wh(Qn,s)&&(om.domEvent=e,s.dispatchEvent(om))}),(n=(r=this._map.link)==null?void 0:r.mouseup)==null||n.forEach(s=>{wh(Qn,s)&&(Mn.domEvent=e,Mn.subType="mouseup",s.dispatchEvent(Mn))})}_handleMouseHoverEvent(e,t=!1){var n;let r=[];t||(n=this._map.mouseHover)==null||n.forEach(s=>{wh(Qn,s)&&r.push(s)}),this._prevObjects.length&&(go.domEvent=e,go.enter=!1,this._prevObjects.forEach(s=>{r.includes(s)||s.dispatchEvent(go)})),r.length&&(go.domEvent=e,go.enter=!0,r.forEach(s=>s.dispatchEvent(go))),this._prevObjects=r}_handleLookAtEvent(e){var t;(t=this._map.lookAt)!=null&&t.length&&(vc.domEvent=e,vc.normal=Kn,vc.raycaster=Qn,this._map.lookAt.forEach(r=>r.dispatchEvent(vc)))}_handleFollowEvent(e){this._map.follow&&(pc.domEvent=e,pc.normal=Kn,pc.raycaster=Qn,this._map.follow.forEach(t=>t.dispatchEvent(pc)))}_handleKeyDownEvent(e){var t,r,n;(t=this._map.keyDown)!=null&&t.length&&(nm.domEvent=e,this._map.keyDown.forEach(s=>s.dispatchEvent(nm))),(n=(r=this._map.link)==null?void 0:r.keydown)!=null&&n.length&&(Mn.domEvent=e,Mn.subType="keydown",this._map.link.keydown.forEach(s=>s.dispatchEvent(Mn)))}_handleKeyUpEvent(e){var t,r,n;(t=this._map.keyUp)!=null&&t.length&&(im.domEvent=e,this._map.keyUp.forEach(s=>s.dispatchEvent(im))),(n=(r=this._map.link)==null?void 0:r.keyup)!=null&&n.length&&(Mn.domEvent=e,Mn.subType="keyup",this._map.link.keyup.forEach(s=>s.dispatchEvent(Mn)))}_addSPEEvent(e,t,r){var n;if(!!r.interaction)if(rT[e].begin=this._dispatchDOMCustomEvent.bind(this),rT[e].change=this._app.requestRender.bind(this),e==="link"){let s=r.interaction.events[e];if(s){let o=!1;Object.keys(s).forEach(a=>{let l=a;this._map[e]===void 0&&(this._map[e]={});let c=this._map[e];c[l]===void 0?c[l]=[r]:c[l].push(r),o=!0}),o&&r.addEventListener(e,t)}}else(n=r.interaction.events[e])!=null&&n.length&&(r.addEventListener(e,t),this._map[e]===void 0?this._map[e]=[r]:this._map[e].push(r))}_addDOMCustomEvent(e,t){if(e){let r=new CustomEvent(e,{bubbles:!0});Object.defineProperty(r,"target",{writable:!1,value:{id:t.uuid,name:t.name}}),this.splineEvents[e]?this.splineEvents[e][t.uuid]=r:this.splineEvents[e]={[t.uuid]:r}}}_dispatchDOMCustomEvent(e,t){var n;let r=(n=this.splineEvents[e])==null?void 0:n[t];r&&this._domElement.dispatchEvent(r)}};var cm=class{constructor(e,t,r,n,s){this._aspect=1;this._renderer=e,this._camera=t,this._frameSize=new N().copy(r),this._editorSize=new N().copy(n),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)}updateViewportForImageExport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,n=this._editorSize.y;this._aspect=e/t,this._camera.zoom*=Math.min(r/e,n/t),this._renderer.setViewport(0,0,e,t)}updateViewport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,n=this._editorSize.y,s=0,o=0,a=e,l=t;e<r&&(s=(r-e)*.5,s=-s,a=r),t<n&&(o=(n-t)*.5,o=-o,l=n),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,r=this._fov;if(e>t){let n=Pz(e,1080,2160,1,15)/100;r*=e/t,r*=1-n}this._camera.aspect=this._aspect,this._camera.fov=r,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 Pz(i,e,t,r,n){return(i-e)/(t-e)*(n-r)+r}var um=class{constructor(e){this.sharedAssets=new rm(e.shared),this.scene=new Xp(e.scene,this.sharedAssets),this.scene.switchActiveCamera(this.scene.activeCamera)}reset(e,t){this.scene.clearScene(this.sharedAssets),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}dispose(){this.scene.dispose()}};var hm=class{constructor({x:e=10,y:t=10}){this._startTime=0;let r=document.getElementById("spe-perfs");r?this.element=r:(this.element=document.createElement("div"),document.body.appendChild(this.element),this.element.style.position="absolute",this.element.style.zIndex="10000",this.element.style.fontFamily="monospace",this.element.style.background="black",this.element.style.color="white",this.element.style.padding="10px",this.element.style.opacity="0.5",this.element.style.fontSize="11px",this.element.setAttribute("id","spe-perfs")),this.element.style.left=`${e}px`,this.element.style.top=`${t}px`}dispose(){var e;(e=this.element.parentElement)==null||e.removeChild(this.element)}start(){this._startTime=performance.now()}end(){let t=performance.now()-this._startTime;this.element.innerHTML=t.toFixed(3)+" ms"}};function Iz(i){let e;if(!!i.index)for(let t=0;t<i.index.array.length;t+=3)e=i.index.array[t],i.index.array[t]=i.index.array[t+2],i.index.array[t+2]=e}function hx(i){return i==="SubdivObject"||i==="NonParametric"?i:"Mesh"}function Rz(i,e){let t={};return i.traverseEntity(r=>{var c;if(r.type!=="Mesh"||!("material"in r)||!r.visible||!(r instanceof Xt)||Array.isArray(r.material)||r&&r.interaction&&r.interaction.states.length>0)return;let n=r.parent;for(;n;){if(n instanceof Xt&&n.interaction&&n.interaction.states.length>1)return;n=n.parent}let s=r.material.uuid,o=e.shared.materials[s];if(o){if(!Ri.isMergable(o))return}else{let u=(c=e.scene.objects.get(r.uuid))==null?void 0:c.data;if(u&&"material"in u&&typeof u.material!="string"){if(!Ri.isMergable(u.material))return;s=Ri.getHash(u.material)}}t[s]||(t[s]={});let l=t[s][hx(r.objectType)];if(l){if(l.push(r),r.cloner)for(let u of r.cloner.children)l.push(u)}else if(t[s][hx(r.objectType)]=[r],r.cloner)for(let u of r.cloner.children)t[s][hx(r.objectType)].push(u)}),t}function Bz(i){let e=0;return Object.values(i).forEach(t=>{Object.values(t).forEach(r=>{let n=r.length;n>e&&(e=n)})}),e}function iT(i,e){let t=Rz(e,i),r=Bz(t),n=new Array(r),s=0,o=new Array(r),a=0,l=new Array(r),c=0,u=new Array(r),h=0;for(let f of Object.values(t))for(let d of Object.values(f)){if(a=0,c=0,d.forEach(p=>{p instanceof Xt&&(o[a++]=p.geometry.clone(),l[c++]=p)}),c<2)continue;for(let p=0;p<c;p++)l[p].updateWorldMatrix(!0,!1),o[p].applyMatrix4(l[p].matrixWorld),l[p].matrixWorld.determinant()<0&&Iz(o[p]);let m=wM(o.slice(0,a),!1);if(m){let p;switch(d[0].objectType){case"SubdivObject":{console.warn("Turning subdiv object into mesh"),p=new Gt(m,l[0].material);break}default:{p=new Gt(m,l[0].material);break}}p.castShadow=l[0].castShadow,p.receiveShadow=l[0].receiveShadow,e.add(p);let g=y=>{h=0;for(let v of y)v.children&&g(v.children),v instanceof Xt&&(Array.isArray(v.material)||t[v.material.uuid]&&t[v.material.uuid][v.objectType]&&t[v.material.uuid][v.objectType].length>1||(u[h++]=v));for(let v=0;v<h;v++)e.attach(u[v])};for(let y=0;y<c;y++){let v=l[y];g(v.children),n[s++]=v}}}for(let f=0;f<s;f++)n[f].removeFromParent()}var sT=class{constructor(e,{autoRender:t=!1}={}){this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this._proxyObjectCache=new Map;this._skipRender=!0;this.autoRender=!1;this.disposed=!1;this.requestRender=()=>{this._skipRender=!1};this.render=()=>{var e,t,r;!this._renderer||(this._rafId=requestAnimationFrame(this.render),(e=this._perfs)==null||e.start(),!(!this.autoRender&&this._skipRender)&&(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._transmissionRenderTarget&&(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)),(t=this._scene.postprocessing)!=null&&t.enabled?(this._renderer.autoClear=!1,this._scene.postprocessing.render()):(this._renderer.autoClear=!0,this._renderer.render(this._scene,this._camera))),(r=this._perfs)==null||r.end()))};this.resize=()=>{var e,t,r,n;!this._renderer||(this._viewportMode===1&&(this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._frameView&&(this._frameView.frameSize=new N(this._viewportWidth,this._viewportHeight))),(e=this._frameView)==null||e.updateRenderer(),(t=this._scene)!=null&&t.postprocessing&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight),this._viewportMode!==1&&((r=this._frameView)==null||r.updateViewport()),this._camera&&((n=this._frameView)==null||n.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&this._viewportMode===1&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.requestRender())};this.canvas=e,this.autoRender=t,window.addEventListener("resize",Mu(this.resize,200)),window.location.search.includes("perfs")&&(this._perfs=new hm({x:10,y:10}))}async load(e){let r=await(await fetch(e)).arrayBuffer();await this.start(r)}async start(e){var o;if(this.disposed)return;let t=await bA(e);this._publishData=t.scene.publish;let r=new um(t);if(window.location.search.includes("merge-geometries")){let a=performance.now();iT(t,r.scene);let l=performance.now();console.log("Merged geometries in ",l-a," ms")}this._scene=r.scene,this._sharedAssetsManager=r.sharedAssets,this._sharedAssetsManager.onImageLoad=()=>{this.requestRender()},tT(t.scene,this._scene,this._sharedAssetsManager),this._camera=this._scene.activeCamera;let n=Object.values(t.frames)[0];n&&(n.preset==="fullscreen"?(this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight):(this._viewportMode=2,this._viewportWidth=n.size[0],this._viewportHeight=n.size[1])),(o=this._scene.postprocessing)!=null&&o.enabled?(this._renderer=new Ct({canvas:this.canvas,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._scene.postprocessing.addEventListener("smaaloaded",this.requestRender)):this._renderer=new Ct({canvas:this.canvas,antialias:!0,alpha:!0,stencil:!0,depth:!0,powerPreference:"high-performance"}),this._scene.needsTransmission(void 0)&&(this._transmissionRenderTarget=new mt(2048,2048,{generateMipmaps:!0,minFilter:ks,magFilter:ct,wrapS:_r,wrapT:_r}),this._transmissionRenderTarget.depthTexture=new oi(2048,2048),this._scene.needsTransmission(this._transmissionRenderTarget)),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=Qg,this._renderer.setClearColor(this._scene.bgColor,this._scene.alpha),this._frameView=new cm(this._renderer,this._camera,new N(this._viewportWidth,this._viewportHeight),new N(window.innerWidth,window.innerHeight)),!0&&(this._controls=new ap(this._camera,this._renderer.domElement),this._publishData&&(this._controls.fromJSON(this._publishData.orbitControls),this._controls.useKeyEvents=!1),this._controls.addEventListener("change",this.requestRender),this._controls.addEventListener("start",this.requestRender)),this._playmode=new lm(this._renderer,this._scene,this._camera,this),this.resize(),this.render()}findObjectById(e){var r;let t=(r=this._scene)==null?void 0:r.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){var r;let t=(r=this._scene)==null?void 0:r.getObjectByName(e);return this._createProxyObject(t)}getSplineEvents(){var e;return(e=this._playmode)==null?void 0:e.splineEvents}emitEvent(e,t){let r=this.findObjectById(t);r==null||r.emitEvent(e)}emitEventReverse(e,t){let r=this.findObjectById(t);r==null||r.emitEventReverse(e)}addEventListener(e,t){var r;(r=this._renderer)==null||r.domElement.addEventListener(e,t)}removeEventListener(e,t){var r;(r=this._renderer)==null||r.domElement.removeEventListener(e,t)}setZoom(e){var t;(t=this._controls)==null||t.zoomOut(e)}dispose(){var e,t,r,n,s,o,a;this.disposed=!0,(e=this._playmode)==null||e.deactivate(),(t=this._scene)==null||t.dispose(),this._rafId&&cancelAnimationFrame(this._rafId),this._proxyObjectCache.forEach(l=>{fy.unsubscribe(l)}),(r=this._renderer)==null||r.dispose(),(n=this._transmissionRenderTarget)==null||n.dispose(),(o=(s=this._transmissionRenderTarget)==null?void 0:s.depthTexture)==null||o.dispose(),(a=this._sharedAssetsManager)==null||a.dispose()}_createProxyObject(e){if(e==null)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);let t={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,emitEvent(n){var s;(s=e.interaction)==null||s.emitEvent(n)},emitEventReverse(n){var s;(s=e.interaction)==null||s.emitEventReverse(n)}},r=fy(t,(n,s)=>{var a;typeof e[n]!="object"&&((a=Object.getOwnPropertyDescriptor(e,n))==null?void 0:a.writable)&&(e[n]=s),this.requestRender(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,r),r}};export{sT as Application};
|
|
4228
|
+
outputColor=vec4(color,inputColor.a);}`,Wp={DEFAULT:0,ESKIL:1},vA=class extends Vi{constructor({blendFunction:i=yt.NORMAL,technique:e=Wp.DEFAULT,eskil:t=!1,offset:r=.5,darkness:n=.5}={}){super("VignetteEffect",BU,{blendFunction:i,defines:new Map([["VIGNETTE_TECHNIQUE",e.toFixed(0)]]),uniforms:new Map([["offset",new Te(r)],["darkness",new Te(n)]])})}get technique(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))}set technique(i){this.technique!==i&&(this.defines.set("VIGNETTE_TECHNIQUE",i.toFixed(0)),this.setChanged())}get eskil(){return this.technique===Wp.ESKIL}set eskil(i){this.technique=i?Wp.ESKIL:Wp.DEFAULT}getTechnique(){return this.technique}setTechnique(i){this.technique=i}get offset(){return this.uniforms.get("offset").value}set offset(i){this.uniforms.get("offset").value=i}getOffset(){return this.offset}setOffset(i){this.offset=i}get darkness(){return this.uniforms.get("darkness").value}set darkness(i){this.uniforms.get("darkness").value=i}getDarkness(){return this.darkness}setDarkness(i){this.darkness=i}},uoe=[new Float32Array(3),new Float32Array(3)],hoe=[new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3)],foe=[[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 doe=[new Float32Array(2),new Float32Array(2)];var poe=new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),moe=[new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125])],goe=[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])],yoe=[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 voe=new Map([[$r(0,0,0,0),new Float32Array([0,0,0,0])],[$r(0,0,0,1),new Float32Array([0,0,0,1])],[$r(0,0,1,0),new Float32Array([0,0,1,0])],[$r(0,0,1,1),new Float32Array([0,0,1,1])],[$r(0,1,0,0),new Float32Array([0,1,0,0])],[$r(0,1,0,1),new Float32Array([0,1,0,1])],[$r(0,1,1,0),new Float32Array([0,1,1,0])],[$r(0,1,1,1),new Float32Array([0,1,1,1])],[$r(1,0,0,0),new Float32Array([1,0,0,0])],[$r(1,0,0,1),new Float32Array([1,0,0,1])],[$r(1,0,1,0),new Float32Array([1,0,1,0])],[$r(1,0,1,1),new Float32Array([1,0,1,1])],[$r(1,1,0,0),new Float32Array([1,1,0,0])],[$r(1,1,0,1),new Float32Array([1,1,0,1])],[$r(1,1,1,0),new Float32Array([1,1,1,0])],[$r(1,1,1,1),new Float32Array([1,1,1,1])]]);function Ov(i,e,t){return i+(e-i)*t}function $r(i,e,t,r){let n=Ov(i,e,.75),s=Ov(t,r,1-.25);return Ov(n,s,1-.125)}var pr=class{constructor(e,t){this.enabled=!1;this.effect=new e(t),Object.defineProperty(this,"opacity",{enumerable:!0,set(r){this.effect.blendMode.opacity.value=r},get(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set(r){this.effect.blendMode.setBlendFunction(Number(r))},get(){return this.effect.blendMode.blendFunction}}),this.blendFunction=yt.NORMAL}toJSON(){let e=["constructor","effect","subscriptions"],t=se({},this),r=Object.getPrototypeOf(this),n=Object.getOwnPropertyNames(r);for(let s of n){let o=Object.getOwnPropertyDescriptor(r,s);o&&typeof o.get=="function"&&(t[s]=this[s])}return e.forEach(s=>delete t[s]),t}};var nc=class extends pr{constructor(){super(cA),this.blendFunction=yt.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 ic=class extends pr{constructor(){super(uA)}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 sc=class extends pr{constructor(){super(fA),this.effect.offset=new N(.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 oc=class extends pr{constructor(){super(hA)}};var ac=class extends pr{constructor(){super(pA);this._hue=0}set hue(t){this._hue=t,this.effect.setHue(t)}get hue(){return this._hue}set saturation(t){this.effect.uniforms.get("saturation").value=t}get saturation(){return this.effect.uniforms.get("saturation").value}};var lc=class extends pr{constructor(){super(mA),this.blendFunction=yt.OVERLAY}};var cc=class extends pr{constructor(){super(vA)}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 uc=class extends pr{constructor(e){super(dA,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 hc=class extends pr{constructor(){super(gA)}get granularity(){return this.effect.getGranularity()}set granularity(e){this.effect.setGranularity(e)}};function xA(i,e){return e&&e.enabled&&i.push(e.effect),i}var xh=class extends jt{constructor(){super();this._scene=new sn;this._camera=new Bn;this.effects=new Map;this.loadingManager=new Ro;this.renderPass=new Vv;this._renderToScreen=!0;this._hasSmaa=!1;this.clock=new Hf,this.enabled=!1,this.debug=!1,this.effects.set("bloom",new nc),this.effects.set("chromaticAberration",new sc),this.effects.set("vignette",new cc),this.effects.set("noise",new lc),this.effects.set("colorAverage",new oc),this.effects.set("hueSaturation",new ac),this.effects.set("brightnessContrast",new ic),this.effects.set("depthOfField",new uc),this.effects.set("pixelation",new hc)}get scene(){return this._scene}set scene(t){this._scene=t}get camera(){return this._camera}set camera(t){this._camera=t}_initSmaa(){if(!this.effectComposer)return;let t=this.effectComposer.passes.length,r=new yA({preset:Zo.ULTRA,edgeDetectionMode:jp.COLOR}),n=()=>{r.removeEventListener("load",n),this.dispatchEvent({type:"smaaloaded"})};r.addEventListener("load",n),r.edgeDetectionMaterial.setPredicationMode(zv.DEPTH),r.edgeDetectionMaterial.setEdgeDetectionThreshold(.05),r.edgeDetectionMaterial.setPredicationThreshold(.002),r.edgeDetectionMaterial.setPredicationScale(1),this.effectComposer.addPass(new qp(this.camera,r),t),this._hasSmaa=!0}_initPasses(){if(!this.effectComposer||!this.renderer)return;let t;if(this.effectComposer.removeAllPasses(),this._hasSmaa=!1,this.renderPass=new Vv(this.scene,this.camera),this.enabled){this.effectComposer.addPass(this.renderPass),this._initSmaa();let r=[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(xA,[]),n=[this.effects.get("pixelation")].reduce(xA,[]);n.length>0&&this.effectComposer.addPass(new qp(this.camera,...n)),this.effectComposer.addPass(new qp(this.camera,...r))}else this.effectComposer.addPass(this.renderPass);if(t)return t}reinit(){if(!this.renderer)return Promise.all([]);this.effectComposer=new lA(this.renderer),this._initPasses()}init({renderer:t,camera:r,scene:n}){this.renderer=t,this.scene=n,this.camera=r,this._initCopyPass(),this.reinit()}_initCopyPass(){if(this._savePass)return;let t=new N;this.renderer.getDrawingBufferSize(t),this._rt=new mt(t.x,t.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:Da,wrapT:Da}),this._rt.samples=this.renderer.capabilities.isWebGL2?4:0,this._savePass=new Gv(this._rt,!1),this._savePass.renderToScreen=!1}get renderToScreen(){return this._renderToScreen}set renderToScreen(t){var n,s;let r=this.effectComposer;!r||(t===!0?((n=this.renderer)!=null&&n.capabilities.isWebGL2&&(r.multisampling=0),r.removePass(this._savePass),r.passes[r.passes.length-1].renderToScreen=!0,r.autoRenderToScreen=!0):(((s=this.renderer)==null?void 0:s.capabilities.isWebGL2)&&!this._hasSmaa&&(r.multisampling=4),r.autoRenderToScreen=!1,r.passes[r.passes.length-1].renderToScreen=!1,this._savePass.renderToScreen=!1,this.enabled||(this._savePass.needsDepthTexture=!0),r.addPass(this._savePass)),this._renderToScreen=t)}get texture(){return this._rt&&this._rt.texture}get renderTarget(){return this._rt}fromJSON(t){t&&(Object.keys(t).forEach(r=>{let n=t[r],s=this.effects.get(r);Object.keys(n).forEach(o=>{s[o]=n[o]})}),this.enabled=t.enabled)}toJSON(){let t={};return this.effects.forEach((r,n)=>{t[n]=r.toJSON()},t),se({enabled:this.enabled},t)}render(){var t;(t=this.effectComposer)==null||t.render(this.clock.getDelta())}setScissor(t,r,n,s){if(!this.effectComposer||!this.renderer)return;t instanceof Qe?(this.effectComposer.inputBuffer.scissor.set(t.x,t.y,t.z,t.w),this.effectComposer.outputBuffer.scissor.set(t.x,t.y,t.z,t.w)):(this.effectComposer.inputBuffer.scissor.set(t,r,n,s),this.effectComposer.outputBuffer.scissor.set(t,r,n,s));let o=this.renderer.getPixelRatio();this.effectComposer.inputBuffer.scissor.multiplyScalar(o),this.effectComposer.outputBuffer.scissor.multiplyScalar(o),this.renderer.setScissor(t,r,n,s)}setScissorTest(t){!this.effectComposer||!this.renderer||(this.effectComposer.inputBuffer.scissorTest=t,this.effectComposer.outputBuffer.scissorTest=t,this.renderer.setScissorTest(t))}setViewport(t,r,n,s){!this.effectComposer||(t instanceof Qe?(this.effectComposer.inputBuffer.viewport.copy(t),this.effectComposer.outputBuffer.viewport.copy(t)):(this.effectComposer.inputBuffer.viewport.set(t,r,n,s),this.effectComposer.outputBuffer.viewport.set(t,r,n,s)))}resize(t,r){var n,s;if((n=this.effectComposer)==null||n.setSize(t,r),this._rt){let o=((s=this.renderer)==null?void 0:s.getPixelRatio())||window.devicePixelRatio;this._rt.setSize(t*o,r*o)}}dispose(){var t;this._listeners=void 0,(t=this.effectComposer)==null||t.dispose()}};var Xp=class extends yh{constructor(t,r){super(t,r);this.postprocessing=new xh;this.initPostprocessing(t.postprocessing)}resetAfterClear(t,r){super.resetAfterClear(t,r),this.initPostprocessing(t.postprocessing)}initPostprocessing(t){let s=t,{enabled:r}=s,n=px(s,["enabled"]);for(let o of Object.entries(n)){let a=o[1],l=this.postprocessing.effects.get(o[0]);if(l){l.enabled=a.enabled;for(let[c,u]of Object.entries(a))l[c]=u}}this.postprocessing.enabled=r,this.postprocessing.reinit()}dispose(){super.dispose(),this.postprocessing.dispose()}switchActiveCamera(t){super.switchActiveCamera(t),this.postprocessing&&(this.postprocessing.camera=t)}};var Wv=new WeakMap,Yp=class extends ln{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,r,n){let s=new is(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(n)},r,n)}decodeDracoFile(e,t,r,n){let s={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r};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 r=JSON.stringify(t);if(Wv.has(e)){let l=Wv.get(e);if(l.key===r)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 n,s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(n=l,new Promise((c,u)=>{n._callbacks[s]={resolve:c,reject:u},n.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{n&&s&&this._releaseTask(n,s)}),Wv.set(e,{key:r,promise:a}),a}_createGeometry(e){let t=new Ie;e.index&&t.setIndex(new Ue(e.index.array,1));for(let r=0;r<e.attributes.length;r++){let n=e.attributes[r],s=n.name,o=n.array,a=n.itemSize;t.setAttribute(s,new Ue(o,a))}return t}_loadLibrary(e,t){let r=new is(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((n,s)=>{r.load(e,n,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(r=>{let n=r[0];e||(this.decoderConfig.wasmBinary=r[1]);let s=OU.toString(),o=["/* draco decoder */",n,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
|
|
4229
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(s){let o=s.data;switch(o.type){case"decode":n._callbacks[o.id].resolve(o);break;case"error":n._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,s){return n._taskLoad>s._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_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 OU(){let i,e;onmessage=function(o){let a=o.data;switch(a.type){case"init":i=a.decoderConfig,e=new Promise(function(u){i.onModuleLoaded=function(h){u({draco:h})},DracoDecoderModule(i)});break;case"decode":let l=a.buffer,c=a.taskConfig;e.then(u=>{let h=u.draco,f=new h.Decoder,d=new h.DecoderBuffer;d.Init(new Int8Array(l),l.byteLength);try{let m=t(h,f,d,c),p=m.attributes.map(g=>g.array.buffer);m.index&&p.push(m.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:m},p)}catch(m){console.error(m),self.postMessage({type:"error",id:a.id,error:m.message})}finally{h.destroy(d),h.destroy(f)}});break}};function t(o,a,l,c){let u=c.attributeIDs,h=c.attributeTypes,f,d,m=a.GetEncodedGeometryType(l);if(m===o.TRIANGULAR_MESH)f=new o.Mesh,d=a.DecodeBufferToMesh(l,f);else if(m===o.POINT_CLOUD)f=new o.PointCloud,d=a.DecodeBufferToPointCloud(l,f);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||f.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());let p={index:null,attributes:[]};for(let g in u){let y=self[h[g]],v,b;if(c.useUniqueIDs)b=u[g],v=a.GetAttributeByUniqueId(f,b);else{if(b=a.GetAttributeId(f,o[u[g]]),b===-1)continue;v=a.GetAttribute(f,b)}p.attributes.push(n(o,a,f,g,y,v))}return m===o.TRIANGULAR_MESH&&(p.index=r(o,a,f)),o.destroy(f),p}function r(o,a,l){let u=l.num_faces()*3,h=u*4,f=o._malloc(h);a.GetTrianglesUInt32Array(l,h,f);let d=new Uint32Array(o.HEAPF32.buffer,f,u).slice();return o._free(f),{array:d,itemSize:1}}function n(o,a,l,c,u,h){let f=h.num_components(),m=l.num_points()*f,p=m*u.BYTES_PER_ELEMENT,g=s(o,u),y=o._malloc(p);a.GetAttributeDataArrayForAllPoints(l,h,g,p,y);let v=new u(o.HEAPF32.buffer,y,m).slice();return o._free(y),{name:c,array:v,itemSize:f}}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}}}var mo;function FU(){return mo||(mo=new Yp,mo.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),mo.decoderPending}async function UU(i){if(mo){let e={attributeIDs:mo.defaultAttributeIDs,attributeTypes:mo.defaultAttributeTypes,useUniqueIDs:!1},t;try{t=await mo.decodeGeometry(new Int8Array(i).buffer,e)}catch(r){console.error(r)}if(t)return{index:t.index?{array:t.index.array}:void 0,attributes:Object.entries(t.attributes).map(([r,n])=>({name:r,itemSize:n.itemSize,array:n.array}))}}return null}async function bA(i){let[e,t]=Sy($d.deserialize(new Uint8Array(i))),r=[];e.scene.objects.traverse((n,s)=>{s.type==="Mesh"&&s.geometry.type==="NonParametricGeometry"&&s.geometry.data.draco!==void 0&&r.push(s)}),r.length&&await FU();for(let n of r){let s=await UU(Ay(n.geometry.data.draco));if(s){s.index&&(n.geometry.data.index={array:s.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let o={};s.attributes.forEach(({name:a,array:l,itemSize:c})=>{o[a]={array:l,itemSize:c,type:"Float32Array",normalized:!1}}),n.geometry.data.attributes=o,n.geometry.data.draco=void 0}}return t.result().data}var EA={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},Yv={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},zU=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],Qp={CSS:{},springs:{}};function Hi(i,e,t){return Math.min(Math.max(i,e),t)}function bh(i,e){return i.indexOf(e)>-1}function jv(i,e){return i.apply(null,e)}var Je={arr:function(i){return Array.isArray(i)},obj:function(i){return bh(Object.prototype.toString.call(i),"Object")},pth:function(i){return Je.obj(i)&&i.hasOwnProperty("totalLength")},svg:function(i){return i instanceof SVGElement},inp:function(i){return i instanceof HTMLInputElement},dom:function(i){return!("isNode"in i)&&(i.nodeType||Je.svg(i))},str:function(i){return typeof i=="string"},fnc:function(i){return typeof i=="function"},und:function(i){return typeof i>"u"},hex:function(i){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(i)},rgb:function(i){return/^rgb/.test(i)},hsl:function(i){return/^hsl/.test(i)},col:function(i){return Je.hex(i)||Je.rgb(i)||Je.hsl(i)},key:function(i){return!EA.hasOwnProperty(i)&&!Yv.hasOwnProperty(i)&&i!=="targets"&&i!=="keyframes"}};function _A(i){var e=/\(([^)]+)\)/.exec(i);return e?e[1].split(",").map(function(t){return parseFloat(t)}):[]}function CA(i,e){var t=_A(i),r=Hi(Je.und(t[0])?1:t[0],.1,100),n=Hi(Je.und(t[1])?100:t[1],.1,100),s=Hi(Je.und(t[2])?10:t[2],.1,100),o=Hi(Je.und(t[3])?0:t[3],.1,100),a=Math.sqrt(n/r),l=s/(2*Math.sqrt(n*r)),c=l<1?a*Math.sqrt(1-l*l):0,u=1,h=l<1?(l*a+-o)/c:-o+a;function f(m){var p=e?e*m/1e3:m;return l<1?p=Math.exp(-p*l*a)*(u*Math.cos(c*p)+h*Math.sin(c*p)):p=(u+h*p)*Math.exp(-p*a),m===0||m===1?m:1-p}function d(){var m=Qp.springs[i];if(m)return m;for(var p=1/6,g=0,y=0;;)if(g+=p,f(g)===1){if(y++,y>=16)break}else y=0;var v=g*p*1e3;return Qp.springs[i]=v,v}return e?f:d}function GU(i){return i===void 0&&(i=10),function(e){return Math.ceil(Hi(e,1e-6,1)*i)*(1/i)}}var kU=function(){var i=11,e=1/(i-1);function t(u,h){return 1-3*h+3*u}function r(u,h){return 3*h-6*u}function n(u){return 3*u}function s(u,h,f){return((t(h,f)*u+r(h,f))*u+n(h))*u}function o(u,h,f){return 3*t(h,f)*u*u+2*r(h,f)*u+n(h)}function a(u,h,f,d,m){var p,g,y=0;do g=h+(f-h)/2,p=s(g,d,m)-u,p>0?f=g:h=g;while(Math.abs(p)>1e-7&&++y<10);return g}function l(u,h,f,d){for(var m=0;m<4;++m){var p=o(h,f,d);if(p===0)return h;var g=s(h,f,d)-u;h-=g/p}return h}function c(u,h,f,d){if(!(0<=u&&u<=1&&0<=f&&f<=1))return;var m=new Float32Array(i);if(u!==h||f!==d)for(var p=0;p<i;++p)m[p]=s(p*e,u,f);function g(y){for(var v=0,b=1,w=i-1;b!==w&&m[b]<=y;++b)v+=e;--b;var x=(y-m[b])/(m[b+1]-m[b]),E=v+x*e,T=o(E,u,f);return T>=.001?l(y,E,u,f):T===0?E:a(y,v,v+e,u,f)}return function(y){return u===h&&f===d||y===0||y===1?y:s(g(y),h,d)}}return c}(),LA=function(){var i={linear:function(){return function(r){return r}}},e={Sine:function(){return function(r){return 1-Math.cos(r*Math.PI/2)}},Circ:function(){return function(r){return 1-Math.sqrt(1-r*r)}},Back:function(){return function(r){return r*r*(3*r-2)}},Bounce:function(){return function(r){for(var n,s=4;r<((n=Math.pow(2,--s))-1)/11;);return 1/Math.pow(4,3-s)-7.5625*Math.pow((n*3-2)/22-r,2)}},Elastic:function(r,n){r===void 0&&(r=1),n===void 0&&(n=.5);var s=Hi(r,1,10),o=Hi(n,.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(r,n){e[r]=function(){return function(s){return Math.pow(s,n+2)}}}),Object.keys(e).forEach(function(r){var n=e[r];i["easeIn"+r]=n,i["easeOut"+r]=function(s,o){return function(a){return 1-n(s,o)(1-a)}},i["easeInOut"+r]=function(s,o){return function(a){return a<.5?n(s,o)(a*2)/2:1-n(s,o)(a*-2+2)/2}}}),i}();function Jv(i,e){if(Je.fnc(i))return i;var t=i.split("(")[0],r=LA[t],n=_A(i);switch(t){case"spring":return CA(i,e);case"cubicBezier":return jv(kU,n);case"steps":return jv(GU,n);default:return jv(r,n)}}function DA(i){try{var e=document.querySelectorAll(i);return e}catch{return}}function Kp(i,e){for(var t=i.length,r=arguments.length>=2?arguments[1]:void 0,n=[],s=0;s<t;s++)if(s in i){var o=i[s];e.call(r,o,s,i)&&n.push(o)}return n}function Zp(i){return i.reduce(function(e,t){return e.concat(Je.arr(t)?Zp(t):t)},[])}function wA(i){return Je.arr(i)?i:(Je.str(i)&&(i=DA(i)||i),i instanceof NodeList||i instanceof HTMLCollection?[].slice.call(i):[i])}function Qv(i,e){return i.some(function(t){return t===e})}function Kv(i){var e={};for(var t in i)e[t]=i[t];return e}function qv(i,e){var t=Kv(i);for(var r in i)t[r]=e.hasOwnProperty(r)?e[r]:i[r];return t}function $p(i,e){var t=Kv(i);for(var r in e)t[r]=Je.und(i[r])?e[r]:i[r];return t}function VU(i){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(i);return e?"rgba("+e[1]+",1)":i}function HU(i){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,t=i.replace(e,function(a,l,c,u){return l+l+c+c+u+u}),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),n=parseInt(r[1],16),s=parseInt(r[2],16),o=parseInt(r[3],16);return"rgba("+n+","+s+","+o+",1)"}function WU(i){var e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(i)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(i),t=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,n=parseInt(e[3],10)/100,s=e[4]||1;function o(f,d,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?f+(d-f)*6*m:m<1/2?d:m<2/3?f+(d-f)*(2/3-m)*6:f}var a,l,c;if(r==0)a=l=c=n;else{var u=n<.5?n*(1+r):n+r-n*r,h=2*n-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 jU(i){if(Je.rgb(i))return VU(i);if(Je.hex(i))return HU(i);if(Je.hsl(i))return WU(i)}function ms(i){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(i);if(e)return e[1]}function qU(i){if(bh(i,"translate")||i==="perspective")return"px";if(bh(i,"rotate")||bh(i,"skew"))return"deg"}function Xv(i,e){return Je.fnc(i)?i(e.target,e.id,e.total):i}function Wi(i,e){return i.getAttribute(e)}function Zv(i,e,t){var r=ms(e);if(Qv([t,"deg","rad","turn"],r))return e;var n=Qp.CSS[e+t];if(!Je.und(n))return n;var s=100,o=document.createElement(i.tagName),a=i.parentNode&&i.parentNode!==document?i.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 Qp.CSS[e+t]=c,c}function PA(i,e,t){if(e in i.style){var r=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),n=i.style[e]||getComputedStyle(i).getPropertyValue(r)||"0";return t?Zv(i,n,t):n}}function $v(i,e){if(Je.dom(i)&&!Je.inp(i)&&(Wi(i,e)||Je.svg(i)&&i[e]))return"attribute";if(Je.dom(i)&&Qv(zU,e))return"transform";if(Je.dom(i)&&e!=="transform"&&PA(i,e))return"css";if(i[e]!=null)return"object"}function IA(i){if(!!Je.dom(i)){for(var e=i.style.transform||"",t=/(\w+)\(([^)]*)\)/g,r=new Map,n;n=t.exec(e);)r.set(n[1],n[2]);return r}}function XU(i,e,t,r){var n=bh(e,"scale")?1:0+qU(e),s=IA(i).get(e)||n;return t&&(t.transforms.list.set(e,s),t.transforms.last=e),r?Zv(i,s,r):s}function ex(i,e,t,r){switch($v(i,e)){case"transform":return XU(i,e,r,t);case"css":return PA(i,e,t);case"attribute":return Wi(i,e);default:return i[e]||0}}function tx(i,e){var t=/^(\*=|\+=|-=)/.exec(i);if(!t)return i;var r=ms(i)||0,n=parseFloat(e),s=parseFloat(i.replace(t[0],""));switch(t[0][0]){case"+":return n+s+r;case"-":return n-s+r;case"*":return n*s+r}}function RA(i,e){if(Je.col(i))return jU(i);if(/\s/g.test(i))return i;var t=ms(i),r=t?i.substr(0,i.length-t.length):i;return e?r+e:r}function rx(i,e){return Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2))}function YU(i){return Math.PI*2*Wi(i,"r")}function JU(i){return Wi(i,"width")*2+Wi(i,"height")*2}function QU(i){return rx({x:Wi(i,"x1"),y:Wi(i,"y1")},{x:Wi(i,"x2"),y:Wi(i,"y2")})}function BA(i){for(var e=i.points,t=0,r,n=0;n<e.numberOfItems;n++){var s=e.getItem(n);n>0&&(t+=rx(r,s)),r=s}return t}function KU(i){var e=i.points;return BA(i)+rx(e.getItem(e.numberOfItems-1),e.getItem(0))}function NA(i){if(i.getTotalLength)return i.getTotalLength();switch(i.tagName.toLowerCase()){case"circle":return YU(i);case"rect":return JU(i);case"line":return QU(i);case"polyline":return BA(i);case"polygon":return KU(i)}}function ZU(i){var e=NA(i);return i.setAttribute("stroke-dasharray",e),e}function $U(i){for(var e=i.parentNode;Je.svg(e)&&Je.svg(e.parentNode);)e=e.parentNode;return e}function OA(i,e){var t=e||{},r=t.el||$U(i),n=r.getBoundingClientRect(),s=Wi(r,"viewBox"),o=n.width,a=n.height,l=t.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function ez(i,e){var t=Je.str(i)?DA(i)[0]:i,r=e||100;return function(n){return{property:n,el:t,svg:OA(t),totalLength:NA(t)*(r/100)}}}function tz(i,e){function t(a){a===void 0&&(a=0);var l=e+a>=1?e+a:0;return i.el.getPointAtLength(l)}var r=OA(i.el,i.svg),n=t(),s=t(-1),o=t(1);switch(i.property){case"x":return(n.x-r.x)*r.w;case"y":return(n.y-r.y)*r.h;case"angle":return Math.atan2(o.y-s.y,o.x-s.x)*180/Math.PI}}function SA(i,e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=RA(Je.pth(i)?i.totalLength:i,e)+"";return{original:r,numbers:r.match(t)?r.match(t).map(Number):[0],strings:Je.str(i)||e?r.split(t):[]}}function FA(i){var e=i?Zp(Je.arr(i)?i.map(wA):wA(i)):[];return Kp(e,function(t,r,n){return n.indexOf(t)===r})}function UA(i){var e=FA(i);return e.map(function(t,r){return{target:t,id:r,total:e.length,transforms:{list:IA(t)}}})}function rz(i,e){var t=Kv(e);if(/^spring/.test(t.easing)&&(t.duration=CA(t.easing)),Je.arr(i)){var r=i.length,n=r===2&&!Je.obj(i[0]);n?i={value:i}:Je.fnc(e.duration)||(t.duration=e.duration/r)}var s=Je.arr(i)?i:[i];return s.map(function(o,a){var l=Je.obj(o)&&!Je.pth(o)?o:{value:o};return Je.und(l.delay)&&(l.delay=a?0:e.delay),Je.und(l.endDelay)&&(l.endDelay=a===s.length-1?e.endDelay:0),l}).map(function(o){return $p(o,t)})}function nz(i){for(var e=Kp(Zp(i.map(function(s){return Object.keys(s)})),function(s){return Je.key(s)}).reduce(function(s,o){return s.indexOf(o)<0&&s.push(o),s},[]),t={},r=function(s){var o=e[s];t[o]=i.map(function(a){var l={};for(var c in a)Je.key(c)?c==o&&(l.value=a[c]):l[c]=a[c];return l})},n=0;n<e.length;n++)r(n);return t}function iz(i,e){var t=[],r=e.keyframes;r&&(e=$p(nz(r),e));for(var n in e)Je.key(n)&&t.push({name:n,tweens:rz(e[n],i)});return t}function sz(i,e){var t={};for(var r in i){var n=Xv(i[r],e);Je.arr(n)&&(n=n.map(function(s){return Xv(s,e)}),n.length===1&&(n=n[0])),t[r]=n}return t.duration=parseFloat(t.duration),t.delay=parseFloat(t.delay),t}function oz(i,e){var t;return i.tweens.map(function(r){var n=sz(r,e),s=n.value,o=Je.arr(s)?s[1]:s,a=ms(o),l=ex(e.target,i.name,a,e),c=t?t.to.original:l,u=Je.arr(s)?s[0]:c,h=ms(u)||ms(l),f=a||h;return Je.und(o)&&(o=c),n.from=SA(u,f),n.to=SA(tx(o,u),f),n.start=t?t.end:0,n.end=n.start+n.delay+n.duration+n.endDelay,n.easing=Jv(n.easing,n.duration),n.isPath=Je.pth(s),n.isColor=Je.col(n.from.original),n.isColor&&(n.round=1),t=n,n})}var zA={css:function(i,e,t){return i.style[e]=t},attribute:function(i,e,t){return i.setAttribute(e,t)},object:function(i,e,t){return i[e]=t},transform:function(i,e,t,r,n){if(r.list.set(e,t),e===r.last||n){var s="";r.list.forEach(function(o,a){s+=a+"("+o+") "}),i.style.transform=s}}};function GA(i,e){var t=UA(i);t.forEach(function(r){for(var n in e){var s=Xv(e[n],r),o=r.target,a=ms(s),l=ex(o,n,a,r),c=a||ms(l),u=tx(RA(s,c),l),h=$v(o,n);zA[h](o,n,u,r.transforms,!0)}})}function az(i,e){var t=$v(i.target,e.name);if(t){var r=oz(e,i),n=r[r.length-1];return{type:t,property:e.name,animatable:i,tweens:r,duration:n.end,delay:r[0].delay,endDelay:n.endDelay}}}function lz(i,e){return Kp(Zp(i.map(function(t){return e.map(function(r){return az(t,r)})})),function(t){return!Je.und(t)})}function kA(i,e){var t=i.length,r=function(s){return s.timelineOffset?s.timelineOffset:0},n={};return n.duration=t?Math.max.apply(Math,i.map(function(s){return r(s)+s.duration})):e.duration,n.delay=t?Math.min.apply(Math,i.map(function(s){return r(s)+s.delay})):e.delay,n.endDelay=t?n.duration-Math.max.apply(Math,i.map(function(s){return r(s)+s.duration-s.endDelay})):e.endDelay,n}var MA=0;function cz(i){var e=qv(EA,i),t=qv(Yv,i),r=iz(t,i),n=UA(i.targets),s=lz(n,r),o=kA(s,t),a=MA;return MA++,$p(e,{id:a,children:[],animatables:n,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}var Sn=[],AA=[],Jp,uz=function(){function i(){Jp=requestAnimationFrame(e)}function e(t){var r=Sn.length;if(r){for(var n=0;n<r;){var s=Sn[n];if(!s.paused)s.tick(t);else{var o=Sn.indexOf(s);o>-1&&(Sn.splice(o,1),r=Sn.length)}n++}i()}else Jp=cancelAnimationFrame(Jp)}return i}();function hz(){document.hidden?(Sn.forEach(function(i){return i.pause()}),AA=Sn.slice(0),br.running=Sn=[]):AA.forEach(function(i){return i.play()})}typeof document<"u"&&document.addEventListener("visibilitychange",hz);function br(i){i===void 0&&(i={});var e=0,t=0,r=0,n,s=0,o=null;function a(b){var w=window.Promise&&new Promise(function(x){return o=x});return b.finished=w,w}var l=cz(i),c=a(l);function u(){var b=l.direction;b!=="alternate"&&(l.direction=b!=="normal"?"normal":"reverse"),l.reversed=!l.reversed,n.forEach(function(w){return w.reversed=l.reversed})}function h(b){return l.reversed?l.duration-b:b}function f(){e=0,t=h(l.currentTime)*(1/br.speed)}function d(b,w){w&&w.seek(b-w.timelineOffset)}function m(b){if(l.reversePlayback)for(var x=s;x--;)d(b,n[x]);else for(var w=0;w<s;w++)d(b,n[w])}function p(b){var w=0,x=l.animations,E=x.length;for(l.reversePlayback===!0&&l.rewind===!1&&(b=l.duration-b);w<E;){var T=x[w],S=T.animatable,I=T.tweens,C=I.length-1,M=I[C];C&&(M=Kp(I,function(ae){return b<ae.end})[0]||M);for(var _=Hi(b-M.start-M.delay,0,M.duration)/M.duration,R=isNaN(_)?1:M.easing(_),B=M.to.strings,O=M.round,z=[],q=M.to.numbers.length,F=void 0,ee=0;ee<q;ee++){var k=void 0;if(l.reversePlayback===!0&&l.rewind===!1)var V=M.to.numbers[ee],U=M.from.numbers[ee]||0;else var U=M.to.numbers[ee],V=M.from.numbers[ee]||0;M.isPath?k=tz(M.value,R*U):k=V+R*(U-V),O&&(M.isColor&&ee>2||(k=Math.round(k*O)/O)),z.push(k)}var J=B.length;if(!J)F=z[0];else{F=B[0];for(var K=0;K<J;K++){var $=B[K],j=B[K+1],ge=z[K];isNaN(ge)||(j?F+=ge+j:F+=ge+" ")}}zA[T.type](S.target,T.property,F,S.transforms),T.currentValue=F,w++}}function g(b){l[b]&&!l.passThrough&&l[b](l)}function y(){l.remaining&&l.remaining!==!0&&l.remaining--}function v(b){var w=l.duration,x=l.delay,E=w-l.endDelay,T=h(b);l.progress=Hi(T/w*100,0,100),l.reversePlayback=T<l.currentTime,n&&m(T),!l.began&&l.currentTime>=0&&(l.began=!0,g("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,g("loopBegin")),T<=x&&l.currentTime!==0&&p(0),(T>=E&&l.currentTime!==w||!w)&&p(w),T>x&&T<E?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,g("changeBegin")),g("change"),p(T)):l.changeBegan?(l.changeCompleted=!0,l.changeBegan=!1,g("change"),g("changeComplete")):l.began&&T>E&&(g("change"),g("changeComplete")),l.currentTime=Hi(T,0,w),l.began&&g("update"),b>=w&&(t=0,y(),l.remaining?(e=r,g("loopComplete"),l.loopBegan=!1,l.direction==="alternate"&&u()):(l.paused=!0,l.completed||(l.completed=!0,g("loopComplete"),g("complete"),!l.passThrough&&"Promise"in window&&(o(),c=a(l)))))}return l.reset=function(){var b=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=b==="reverse",l.remaining=l.loop,n=l.children,s=n.length;for(var w=s;w--;)l.children[w].reset();(l.reversed&&l.loop!==!0||b==="alternate"&&l.loop===1)&&l.remaining++,p(l.reversed?l.duration:0)},l.set=function(b,w){return GA(b,w),l},l.tick=function(b){r=b,e||(e=r),v((r+(t-e))*br.speed)},l.seek=function(b){v(h(b))},l.pause=function(){l.paused=!0,f()},l.play=function(){!l.paused||(l.completed&&l.reset(),l.paused=!1,Sn.push(l),f(),Jp||uz())},l.reverse=function(){u(),l.completed=!l.reversed,f()},l.restart=function(){l.reset(),l.play()},l.reset(),l.autoplay&&l.play(),l}function TA(i,e){for(var t=e.length;t--;)Qv(i,e[t].animatable.target)&&e.splice(t,1)}function fz(i){for(var e=FA(i),t=Sn.length;t--;){var r=Sn[t],n=r.animations,s=r.children;TA(e,n);for(var o=s.length;o--;){var a=s[o],l=a.animations;TA(e,l),!l.length&&!a.children.length&&s.splice(o,1)}!n.length&&!s.length&&r.pause()}}function dz(i,e){e===void 0&&(e={});var t=e.direction||"normal",r=e.easing?Jv(e.easing):null,n=e.grid,s=e.axis,o=e.from||0,a=o==="first",l=o==="center",c=o==="last",u=Je.arr(i),h=parseFloat(u?i[0]:i),f=u?parseFloat(i[1]):0,d=ms(u?i[1]:i)||0,m=e.start||0+(u?h:0),p=[],g=0;return function(y,v,b){if(a&&(o=0),l&&(o=(b-1)/2),c&&(o=b-1),!p.length){for(var w=0;w<b;w++){if(!n)p.push(Math.abs(o-w));else{var x=l?(n[0]-1)/2:o%n[0],E=l?(n[1]-1)/2:Math.floor(o/n[0]),T=w%n[0],S=Math.floor(w/n[0]),I=x-T,C=E-S,M=Math.sqrt(I*I+C*C);s==="x"&&(M=-I),s==="y"&&(M=-C),p.push(M)}g=Math.max.apply(Math,p)}r&&(p=p.map(function(R){return r(R/g)*g})),t==="reverse"&&(p=p.map(function(R){return s?R<0?R*-1:-R:Math.abs(g-R)}))}var _=u?(f-h)/g:h;return m+_*(Math.round(p[v]*100)/100)+d}}function pz(i){i===void 0&&(i={});var e=br(i);return e.duration=0,e.add=function(t,r){var n=Sn.indexOf(e),s=e.children;n>-1&&Sn.splice(n,1);function o(f){f.passThrough=!0}for(var a=0;a<s.length;a++)o(s[a]);var l=$p(t,qv(Yv,i));l.targets=l.targets||i.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=Je.und(r)?c:tx(r,c),o(e),l.rewind=e.rewind,e.seek(l.timelineOffset);var u=br(l);o(u),s.push(u);var h=kA(s,i);return e.delay=h.delay,e.endDelay=h.endDelay,e.duration=h.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e}br.version="3.2.0";br.speed=1;br.running=Sn;br.remove=fz;br.get=ex;br.set=GA;br.convertPx=Zv;br.path=ez;br.setDashoffset=ZU;br.stagger=dz;br.timeline=pz;br.easing=Jv;br.penner=LA;br.random=function(i,e){return Math.floor(Math.random()*(e-i+1))+i};var wh=br;function VA(i,e,t){var n,s;let r=i.cameraType==="OrthographicCamera"?(n=e.orthographic)==null?void 0:n.zoom:(s=e.perspective)==null?void 0:s.zoom;if(r!==void 0){let o=i.zoom;o!==r&&t.push({change:a=>{i.zoom=et.lerp(o,r,a),i.updateProjectionMatrix()}})}if(e.targetOffset!==void 0){let o=i.targetOffset,a=e.targetOffset;o!==a&&t.push({change:l=>{i.targetOffset=et.lerp(o,a,l)}})}}function HA(i,e,t){if(e.width!==void 0&&e.height!==void 0&&e.depth!==void 0){let{width:r,height:n,depth:s}=i.geometry.userData.parameters,o=[r,n,s],a=[e.width,e.height,e.depth];vr.isEqual(o,a)||t.push({change:l=>{let[c,u,h]=vr.lerp(o,a,l);i.updateGeometry({parameters:{width:c,height:u,depth:h}})}})}}function WA(i,e,t,r){if(e.intensity!==void 0){let n=i.intensity,s=e.intensity;n!==s&&t.push({change:o=>{i.intensity=et.lerp(n,s,o)}})}if(e.color!==void 0){let n=i.color.clone(),s=typeof e.color=="string"?r.getColor(e.color):e.color;if(!Sr.equals(n,s)){let o=n.clone();i.color=o,t.push({change:a=>{let{r:l,g:c,b:u}=Sr.lerp(n,s,a);o.setRGB(l,c,u)}})}}}function jA(i,e,t,r){var s,o;let n=i.layersList.head;for(;n;){let a=e.layers.data(n.uuid);if(a&&((s=n.visible)!=null?s:!0)&&((o=a.visible)!=null?o:!0)){let l=n.getNames().filter(c=>!mM.some(u=>c.includes(u)));for(let c of l)try{let u=n.getValue(c);if(c==="steps")bz(n,a,c,t);else if(c==="colors")wz(n,a,c,t);else if(typeof u=="number")mz(n,a,c,t);else{if(typeof u=="boolean")continue;"isVector2"in u?gz(n,a,c,t):"isVector3"in u?yz(n,a,c,t):"isColorA"in u?xz(n,a,c,t,r):"isColor"in u?vz(n,a,c,t,r):"isTexture"in u&&Sz(n,a,c,t)}}catch(u){console.error(`animateMaterial: unexpected material layer for ${c}`,u)}}n=n.next}}function mz(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=e[t];n!==s&&r.push({change:o=>{i.setValue(t,et.lerp(n,s,o))}})}function gz(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=n.toArray(),o=e[t];ls.isEqual(s,o)||r.push({change:a=>{n.fromArray(ls.lerp(s,o,a))}})}function yz(i,e,t,r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=n.toArray(),o=e[t];vr.isEqual(s,o)||r.push({change:a=>{n.fromArray(vr.lerp(s,o,a))}})}function vz(i,e,t,r,n){if(!i.hasValue(t)||!(t in e))return;let s=i.getValue(t).clone(),o=e[t],a=typeof o=="string"?n.getColor(o):o;if(Sr.equals(s,a))return;let l=s.clone();i.setValue(t,l),r.push({change:c=>{let{r:u,g:h,b:f}=Sr.lerp(s,a,c);l.setRGB(u,h,f)}})}function xz(i,e,t,r,n){if(!i.hasValue(t)||!(t in e))return;let s=i.getValue(t).clone(),o=e[t],a=typeof o=="string"?n.getColor(o):o;if(Ln.equals(s,a))return;let l=s.clone();i.setValue(t,l),r.push({change:c=>{let{r:u,g:h,b:f,a:d}=Ln.lerp(s,a,c);l.setRGBA(u,h,f,d)}})}function bz(i,e,t="steps",r){if(!i.hasValue(t)||!(t in e))return;let n=[...i.getValue(t)],s=e[t];for(let o=0;o<n.length;++o){let a=n[o],l=s[o];a!==l&&r.push({change:c=>{n[o]=et.lerp(a,l,c),i.setValue("steps",n)}})}}function wz(i,e,t="colors",r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue(t),s=e[t];for(let o=0;o<n.length;++o){let a=n[o].toArray(),l=s[o];Lu.isEqual(a,l)||r.push({change:c=>{n[o].fromArray(Lu.lerp(a,l,c))}})}}function Sz(i,e,t="texture",r){if(!i.hasValue(t)||!(t in e))return;let n=i.getValue("texture"),s=e[t],o=n.repeat.toArray(),a=n.offset.toArray(),l=s.repeat,c=s.offset;(!ls.isEqual(o,l)||!ls.isEqual(a,c))&&r.push({change:u=>{n.repeat.fromArray(ls.lerp(o,l,u)),n.offset.fromArray(ls.lerp(a,c,u)),n.updateMatrix(),n.needsUpdate=!0}})}function qA(i,e,t,r){if(r===0)return t.copy(i);if(r===1)return t.copy(e);let n=i.w*e.w+i.x*e.x+i.y*e.y+i.z*e.z;if(n>=1)return t.copy(i);let s=1-n*n;if(s<=Number.EPSILON){let u=1-r;return t.w=u*i.w+r*e.w,t.x=u*i.x+r*e.x,t.y=u*i.y+r*e.y,t.z=u*i.z+r*e.z,t.normalize(),t}let o=Math.sqrt(s),a=Math.atan2(o,n),l=Math.sin((1-r)*a)/o,c=Math.sin(r*a)/o;return t.w=i.w*l+e.w*c,t.x=i.x*l+e.x*c,t.y=i.y*l+e.y*c,t.z=i.z*l+e.z*c,t}function XA(i,e,t=0){let r=Array.isArray(i.material)?i.material[t]:i.material,n;return"materials"in e?n=e.materials[t]:"material"in e&&(n=e.material),[r,n]}var nx=new A,ix=new A,YA=new Ut,Mz=new pn,Az=new Ee;function JA(i,e,t,r){if(t.position!==void 0){let n=i.position.toArray(),s=t.position;vr.isEqual(n,s)||r.push({change:o=>{i.position.fromArray(vr.lerp(n,s,o)),i.updateMatrix()}})}if(t.scale!==void 0){let n=i.scale.toArray(),s=t.scale;vr.isEqual(n,s)||r.push({change:o=>{i.scale.fromArray(vr.lerp(n,s,o)),i.updateMatrix()}})}Tz(i,e,t,r),Ez(i,t,r)}function Tz(i,e,t,r){if(t.rotation===void 0)return;let n=nx.setFromEuler(i.rotation).toArray(),s=t.rotation;if(vr.isEqual(n,s))return;if(vr.sub(t.rotation,e?e.rotation:i.rotation).every(a=>Math.abs(a)<2*Math.PI)){let a=i.quaternion.clone(),l=new Ut().setFromEuler(Mz.set(t.rotation[0],t.rotation[1],t.rotation[2]));r.push({change:c=>{qA(a,l,i.quaternion,c),i.updateMatrix()}})}else r.push({change:a=>{i.rotation.setFromVector3(ix.fromArray(vr.lerp(n,s,a))),i.updateMatrix()}})}function Ez(i,e,t){if(e.hiddenMatrix!==void 0&&!_i.isEqual(i.hiddenMatrix.toArray(),e.hiddenMatrix)){let r=new A,n=new Ut,s=new A;i.hiddenMatrix.decompose(r,n,s);let o=new A,a=new Ut,l=new A;Az.fromArray(e.hiddenMatrix).decompose(o,a,l),t.push({change:c=>{YA.slerpQuaternions(n,a,c),nx.lerpVectors(r,o,c),ix.lerpVectors(s,l,c),i.hiddenMatrix.compose(nx,YA,ix)}})}}function QA(i,e,t,r){let n=[];if(JA(i,e==null?void 0:e.objectState,t.objectState,n),us(i)){if("geometry"in t.objectState&&HA(i,t.objectState.geometry,n),"material"in t.objectState||"materials"in t.objectState){let[s,o]=XA(i,t.objectState,i.selectedMaterial);s&&o&&typeof o!="string"&&jA(s,o,n,r)}}else x1(i)?WA(i,t.objectState,n,r):v1(i)&&VA(i,t.objectState,n);return{change:s=>{n.forEach(o=>{o.change&&o.change(s)})}}}function em(i,e,t){switch(i){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 5:let{control1:r,control2:n}=e;return`cubicBezier( ${r[0]}, ${r[1]}, ${n[0]}, ${n[1]} )`;case 6:let{mass:s,stiffness:o,damping:a,velocity:l}=t;return`spring( ${s}, ${o}, ${a}, ${l} )`}}var tm=class{constructor(e,t){this.object=e;this.sharedAssets=t;this.uuid=et.generateUUID();this.states=[];this.events={};this._scrollCounter=null}get animation(){return this._animation}start(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0,this._scrollCounter=null),this.states.length>1&&(this.states[0].execute(this.object,this.sharedAssets),this._currentState=this.states[0],this._prevState=void 0)}end(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0),this.states.length>1&&this.states[0].execute(this.object,this.sharedAssets),this._currentState=void 0,this._prevState=void 0}play(e,t){this.object.visible&&e.state!==void 0&&this.animate(e.state,e,!0,t)}reverse(e,t){this.object.visible&&this._prevState!==void 0&&this.animate(this._prevState,e,!0,t)}seek(e,t,r,n){var s;this._scrollCounter===null&&(this.object.visible&&e.state!==void 0&&this.animate(e.state,e,!1,n),this._scrollCounter=0),this._scrollCounter+=t,this._scrollCounter=Math.min(Math.max(this._scrollCounter,0),r),(s=this._animation)==null||s.seek(this._scrollCounter/r*e.duration)}animate(e,t,r=!0,n){var s,o,a,l,c,u;if(this._currentState===e){if((s=this._animation)!=null&&s.reversed){let h=(a=(o=this._animation)==null?void 0:o.currentTime)!=null?a:0;(l=this._animation)==null||l.reset(),(c=this._animation)==null||c.seek(h),(u=this._animation)==null||u.play()}}else{this._prevState=this._currentState,this._currentState=e,this._animation!==void 0&&this._animation.pause(),t.cycle===!0&&t.repeat===!0?this._animation=wh.timeline({duration:t.duration,delay:t.delay/2,endDelay:t.delay/2,direction:"alternate",loop:!0,rewind:t.rewind,easing:em(t.easing,t.cubicControls,t.springParameters),autoplay:r}):t.cycle===!0&&t.repeat===!1?this._animation=wh.timeline({duration:t.duration,delay:t.delay,endDelay:t.delay/2,direction:"alternate",rewind:t.rewind,easing:em(t.easing,t.cubicControls,t.springParameters),autoplay:r}):t.cycle===!1&&t.repeat===!0?this._animation=wh.timeline({duration:t.duration,delay:t.delay,direction:"normal",loop:!0,easing:em(t.easing,t.cubicControls,t.springParameters),autoplay:r}):this._animation=wh.timeline({duration:t.duration,delay:t.delay,direction:"normal",easing:em(t.easing,t.cubicControls,t.springParameters),autoplay:r}),r&&this._animation.finished.then(()=>{this._animation=void 0});let h=QA(this.object,this._prevState,this._currentState,this.sharedAssets),f={t:0};this._animation.add({targets:f,t:1,change:()=>{var d;h.change&&(h.change(f.t),(d=n==null?void 0:n.change)==null||d.call(this,f.t))}},0)}}emitEvent(e){if(e==="keyDown"||e==="keyUp"||e==="mouseDown"||e==="mouseUp"||e==="mouseHover"||e==="scroll"||e==="start"){let t=this.events[e];if(t)for(let r of t)r.targets.forEach(n=>this.play(n))}}emitEventReverse(e){if(e==="keyDown"||e==="keyUp"||e==="mouseDown"||e==="mouseUp"||e==="mouseHover"||e==="scroll"||e==="start"){let t=this.events[e];if(t)for(let r of t)r.targets.forEach(n=>this.reverse(n))}}};var fc=class{constructor(e){this.targetState=e}static create(e,t){var n;let r=new fc(e);if(e.object){let s=t.find(e.object);if(r.object=s,s!=null&&s.interaction){let o=s.interaction.states;r.state=e.state&&(n=o.find(a=>a.uuid===e.state))!=null?n:o[0]}}return r}get cubicControls(){let e=this.targetState;return e.easing===5?{control1:e.control1,control2:e.control2}:se({},Nd.defaultData)}get springParameters(){let e=this.targetState;return e.easing===6?e:se({},Bd.defaultData)}get easing(){return this.targetState.easing}get duration(){return this.targetState.duration}get delay(){return this.targetState.delay}get repeat(){return this.targetState.repeat}get cycle(){return this.targetState.cycle}get rewind(){return this.targetState.rewind}};var KA=new jr,$o=class extends kr{},rm=class{constructor(e){this.materials={};this.images={};this.colors={};this.transmissionRenderTarget=new mt(2048,2048,{generateMipmaps:!0,minFilter:ks,magFilter:ct,wrapS:_r,wrapT:_r}),this.transmissionRenderTarget.depthTexture=new oi(2048,2048),this.reset(e)}reset(e){for(let[t,r]of Object.entries(e.images))this.addImage(t,r.data);for(let[t,r]of Object.entries(e.colors))this.addColor(t,r);for(let[t,r]of Object.entries(e.materials))this.addMaterial(t,Ev(r,this))}get transmissionSamplerMap(){return this.transmissionRenderTarget.texture}get transmissionDepthMap(){return this.transmissionRenderTarget.depthTexture}addMaterial(e,t){t.uuid=e,this.materials[e]=t}deleteMaterial(e){this.materials[e]&&(this.materials[e].dispose(),delete this.materials[e])}isSharedMaterial(e){return e.uuid in this.materials||e===KA}getMaterial(e){let t=this.materials[e];return t}getMaterialOrDeletedPlaceholder(e){var t;return(t=this.materials[e])!=null?t:KA}getMaterials(){return this.materials}addImage(e,t){if(this.images[e])return this.images[e].onload=()=>{this.onImageLoad&&this.onImageLoad(e)},this.images[e].src=t,!0;{let r=new Image;return r.src=t,r.onload=()=>{this.onImageLoad&&this.onImageLoad(e)},this.images[e]=r,!1}}deleteImage(e){this.images[e]&&delete this.images[e]}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]}getImages(){return this.images}addColor(e,t){return this.colors[e]?("a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):("a"in t?this.colors[e]=new $o(t.r,t.g,t.b,t.a):this.colors[e]=new $o(t.r,t.g,t.b,1),!1)}updateColor(e,t){var r,n,s,o;if(this.colors[e]){let a=this.colors[e];return this.colors[e].r=(r=t.r)!=null?r:a.r,this.colors[e].g=(n=t.g)!=null?n:a.g,this.colors[e].b=(s=t.b)!=null?s:a.b,this.colors[e].a=(o=t.a)!=null?o:a.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this.transmissionRenderTarget.depthTexture.dispose(),this.transmissionRenderTarget.dispose(),this.onImageLoad=void 0}};function _z(i,e){switch(i.type){case"noise":return e==="noiseType";case"texture":return e==="projection"||e==="axis";case"displace":return e==="noiseType";case"depth":return e==="num"||e==="smooth"||e==="isWorldSpace"||e==="gradientType";default:return!1}}function sx(i,e,t,r,n){var o;let s=!1;for(let[a,l]of Object.entries(i)){if(!a||l===void 0||Bp(a,t,n))continue;t.visible=n.visible;let c=t.uniforms[`f${t.id}_${a}`];if(!!c)switch(c.constructor){case Rt:if(typeof l=="string"){let u=e.getColor(l);u&&(c.value=u);break}else{let u=l;c.value instanceof $o?c.value=new kr(u.r,u.g,u.b,u.a):c.setRGBA(u);break}case hi:if(typeof l=="string"){let u=e.getColor(l);u&&(c.value=u);break}else{let u=l;c.value instanceof $o?c.value=new kr(u.r,u.g,u.b,u.a):c.value.setRGBA(u.r,u.g,u.b,u.a);break}case Ir:{let u=l;c.value.setX(u[0]),c.value.setY(u[1]);break}case Rr:{let u=l;c.value.setX(u[0]),c.value.setY(u[1]),c.value.setZ(u[2]);break}case Hr:{let u=l;if("image"in u){let h=e.getImage(u.image);if(h)c.value.image=h;else{let f=new Image;f.src=u.image.data,c.value.image=f}}"wrapping"in u&&(c.value.wrapS=c.value.wrapT=u.wrapping),"repeat"in u&&c.value.repeat.fromArray(u.repeat),"offset"in u&&c.value.offset.fromArray(u.offset),c.value.needsUpdate=!0;break}case fs:{l.forEach((u,h)=>{c.value[h].setX(u[0]),c.value[h].setY(u[1]),c.value[h].setZ(u[2]),c.value[h].setW(u[3])});break}default:{s=s||_z(t,a),c.value=l;break}}}if(s&&n){let a=Rp({id:"0",fi:0,data:n},e);(o=r.userData.layers)==null||o.changeLayer(t.id,se({},a)),r.dispose(),r.needsUpdate=!0}}var ox=new A,ZA=new Fr,$A=new Ee,pc={type:"follow",normal:new A,raycaster:new to},dc;(t=>{function i(r){if(r.type===10)return{type:"follow"}}t.create=i;function e({target:r,normal:n,raycaster:s,begin:o,change:a}){!r||!r.interaction||!n||!s||(o&&o("follow",r.uuid),ZA.setFromNormalAndCoplanarPoint(n,r.getWorldPosition(ox)),s.ray.intersectPlane(ZA,ox),r.position.copy(ox),r.parent!==null&&r.position.applyMatrix4($A.copy(r.parent.matrixWorld).invert()),r.position.applyMatrix4($A.copy(r.hiddenMatrix).invert()),r.updateMatrix(),a&&a())}t.listener=e})(dc||(dc={}));var nm={type:"keyDown"},im={type:"keyUp"},mc;(t=>{function i(r){if(r.type===5&&r.key)return{type:"keyDown",targets:[],key:r.key}}t.create=i;function e({target:r,begin:n,change:s,domEvent:o}){if(!r||!r.interaction||!o)return;let a=r.interaction.events.keyDown;if(!(a!=null&&a.length))return;let l=!1;for(let c of a)c.key===o.key&&(c.targets.forEach(u=>{var h,f;return(f=(h=u.object)==null?void 0:h.interaction)==null?void 0:f.play(u,{change:s})}),l=!0);l&&n&&n("keyDown",r.uuid)}t.listener=e})(mc||(mc={}));var gc;(t=>{function i(r){if(!(r.type!==6||!r.key))return{type:"keyUp",targets:[],key:r.key}}t.create=i;function e({target:r,begin:n,change:s,domEvent:o}){if(!r||!r.interaction||!o)return;let a=r.interaction.events.keyUp;if(!(a!=null&&a.length))return;let l=!1;for(let c of a)c.key===o.key&&(c.targets.forEach(u=>{var h,f;return(f=(h=u.object)==null?void 0:h.interaction)==null?void 0:f.play(u,{change:s})}),l=!0);l&&n&&n("keyUp",r.uuid)}t.listener=e})(gc||(gc={}));var ax=new A,eT=new Fr,vc={type:"lookAt",normal:new A,raycaster:new to},yc;(t=>{function i(r){if(r.type===9&&r.distance)return{type:"lookAt",distance:r.distance}}t.create=i;function e({target:r,normal:n,raycaster:s,begin:o,change:a}){var u;if(!r||!r.interaction||!n||!s)return;let l=r.interaction.events.lookAt;if(!(l!=null&&l.length))return;o&&o("lookAt",r.uuid);let c=l[0].distance;eT.set(n,-c),s.ray.intersectPlane(eT,ax),r.lookAt(ax),r.updateMatrix(),(u=r.interaction.animation)==null||u.finished.then(()=>{r.lookAt(ax),r.updateMatrix()}),a&&a()}t.listener=e})(yc||(yc={}));var sm={type:"mouseDown"},om={type:"mouseUp"},xc;(t=>{function i(r){if(r.type===0)return{type:"mouseDown",targets:[]}}t.create=i;function e({target:r,begin:n,change:s}){if(!r||!r.interaction)return;let o=r.interaction.events.mouseDown;!(o!=null&&o.length)||(n&&n("mouseDown",r.uuid),o.forEach(a=>{a.targets.forEach(l=>{var c,u;return(u=(c=l.object)==null?void 0:c.interaction)==null?void 0:u.play(l,{change:s})})}))}t.listener=e})(xc||(xc={}));var bc;(t=>{function i(r){if(r.type===1)return{type:"mouseUp",targets:[]}}t.create=i;function e({target:r,begin:n,change:s}){if(!r||!r.interaction)return;let o=r.interaction.events.mouseUp;!(o!=null&&o.length)||(n&&n("mouseUp",r.uuid),o.forEach(a=>{a.targets.forEach(l=>{var c,u;return(u=(c=l.object)==null?void 0:c.interaction)==null?void 0:u.play(l,{change:s})})}))}t.listener=e})(bc||(bc={}));var lx={type:"start"},wc;(t=>{function i(r){if(r.type===7)return{type:"start",targets:[]}}t.create=i;function e({target:r,begin:n,change:s}){if(!r||!r.interaction)return;let o=r.interaction.events.start;!(o!=null&&o.length)||(n&&n("start",r.uuid),o.forEach(a=>{a.targets.forEach(l=>{var c,u;return(u=(c=l.object)==null?void 0:c.interaction)==null?void 0:u.play(l,{change:s})})}))}t.listener=e})(wc||(wc={}));var Mn={type:"link"},Sc;(t=>{function i(r){let n;if(r.type===0)n={type:"mousedown"};else if(r.type===1)n={type:"mouseup"};else if(r.type===5){if(!r.key)return;n={type:"keydown",key:r.key}}else if(r.type===6){if(!r.key)return;n={type:"keyup",key:r.key}}else return;if(r.url)return{type:"link",subEvent:n,url:r.url}}t.create=i;function e({target:r,begin:n,domEvent:s,subType:o}){var c;if(!r||!r.interaction||!o||!s)return;let a=r.interaction.events.link;if(!a)return;let l;if(o==="keydown"||o==="keyup"){let u=s.key;l=(c=a[o])==null?void 0:c.filter(h=>h.subEvent.type===o&&h.subEvent.key===u)}else l=a[o];if(!!(l!=null&&l.length)){n&&n("link",r.uuid);for(let u of l)_u?window.location.assign(u.url):window.open(u.url,"_blank")}}t.listener=e})(Sc||(Sc={}));var am={type:"scroll"},Mc;(t=>{function i(r){if(!(r.type!==11||r.steps===void 0))return{type:"scroll",targets:[],steps:r.steps}}t.create=i;function e({target:r,begin:n,change:s,domEvent:o}){if(!r||!r.interaction||!o)return;let a=r.interaction.events.scroll;if(!(a!=null&&a.length))return;n&&n("scroll",r.uuid);let l=o.deltaY>0?1:-1;a.forEach(c=>{c.targets.forEach(u=>{var h,f;return(f=(h=u.object)==null?void 0:h.interaction)==null?void 0:f.seek(u,l,c.steps,{change:s})})})}t.listener=e})(Mc||(Mc={}));var go={type:"mouseHover"},Ac;(t=>{function i(r){if(r.type===2)return{type:"mouseHover",targets:[]}}t.create=i;function e({target:r,begin:n,change:s,enter:o}){if(!r||!r.interaction||o===void 0)return;let a=r.interaction.events.mouseHover;!(a!=null&&a.length)||(n&&n("mouseHover",r.uuid),o?a.forEach(l=>{l.targets.forEach(c=>{var u,h;return(h=(u=c.object)==null?void 0:u.interaction)==null?void 0:h.play(c,{change:s})})}):a.forEach(l=>{l.targets.forEach(c=>{var u,h;return(h=(u=c.object)==null?void 0:u.interaction)==null?void 0:h.reverse(c,{change:s})})}))}t.listener=e})(Ac||(Ac={}));function Cz(i){let e,{type:t}=i;return t===10?e=dc.create(i):t===5?e=mc.create(i):t===6?e=gc.create(i):t===9?e=yc.create(i):t===0?e=xc.create(i):t===1?e=bc.create(i):t===2?e=Ac.create(i):t===11?e=Mc.create(i):t===7&&(e=wc.create(i)),e}function tT(i,e,t){let r=[];i.objects.traverse((n,s)=>{var u;if(s.states===void 0)return;let o=e.find(n),a=new tm(o,t),l=a.states;l.push(ea.create(n,s));for(let h of s.states){let f=Ou.patch(s,h.data);l.push(ea.create(h.id,f))}let c=a.events;if(s.events)for(let{data:h}of s.events){let f=Cz(h);if(!f)continue;let d=f.type;c[d]?(u=c[d])==null||u.push(f):c[d]=[f],"targets"in h&&r.push([h,f]);let m=Sc.create(h);if(m){c.link||(c.link={});let p=m.subEvent.type;c.link[p]?c.link[p].push(m):c.link[p]=[m]}}l.length>0||Object.keys(c).length>0?(o.interaction=a,cx(o,s,null,t)):delete o.interaction});for(let[n,s]of r)if("targets"in n&&"targets"in s)for(let{data:o}of n.targets){let a=fc.create(o,e);s.targets.push(a)}}function cx(i,e,t,r,n=!1){if(!n&&e.states.length===0)return;let s=t===null?e:Ou.patch(e,e.states.data(t));if(pv(i,s),i instanceof Xt&&s.type==="Mesh"){if(i instanceof uo?i.buildFromStore(s.geometry):i.updateGeometry({parameters:s.geometry}),"material"in s){if(i.material instanceof Array)return;if(typeof s.material!="string"){let a=s.material.layers;for(let l of a){let c=i.material.userData.layers.getLayerByUuid(l.id);sx(l.data,r,c,i.material,l.data)}}}else if("materials"in s){if(!(i.material instanceof Array))return;var o=0;for(let a of s.materials){if(typeof a!="string"){let l=a.layers;for(let c of l){let u=i.material[o].userData.layers.getLayerByUuid(c.id);sx(c.data,r,u,i.material[o],c.data)}}o++}}}else if(s.type==="DirectionalLight")i.fromDirectionalLightState(s,r);else if(s.type==="PointLight")i.fromPointLightState(s,r);else if(s.type==="SpotLight")i.fromSpotLightState(s,r);else if(i instanceof Bn&&Qs.is(s.type)){let a=s;i.setZoom("PerspectiveCamera",a.perspective.zoom),i.setZoom("OrthographicCamera",a.orthographic.zoom)}}var ea=class{constructor(e){this.objectState=e;this.uuid=et.generateUUID()}static create(e,t){let r=new ea(t);return r.uuid=e,r}execute(e,t){cx(e,this.objectState,null,t,!0)}};var Qn=new to,Kn=new A,Lz=new Qe,ux={follow:dc.listener,keyDown:mc.listener,keyUp:gc.listener,link:Sc.listener,lookAt:yc.listener,mouseDown:xc.listener,mouseUp:bc.listener,mouseHover:Ac.listener,scroll:Mc.listener,start:wc.listener},rT={follow:pc,keyDown:nm,keyUp:im,link:Mn,lookAt:vc,mouseDown:sm,mouseUp:om,mouseHover:go,scroll:am,start:lx};function Dz(i){if(i.style.transform!==""){let e=getComputedStyle(i).getPropertyValue("transform");if(e!=="none"){let t=e.replace("matrix(","").split(",");return{x:parseFloat(t[0]),y:parseFloat(t[3])}}}return{x:1,y:1}}function Sh(i,e){if(us(e)){if(!e.raycastLock&&e.visible){let t=i.intersectObject(e,!1);return t.length?t[0]:void 0}}else if(e.objectType==="EmptyObject")return nT(i,e)}function nT(i,e){if(us(e)&&!e.raycastLock&&e.visible){let t=i.intersectObject(e,!1);if(t.length)return t[0]}for(let t of e.children)if(qo(t)){let r=nT(i,t);if(r)return r}}var lm=class{constructor(e,t,r,n){this.isEnable=!1;this.splineEvents={};this._map={};this._prevObjects=[];this._onMouseDown=e=>{Qn.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Kn),Kn.negate(),this._handleMouseDownEvent(e)};this._onMouseUp=e=>{Qn.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Kn),Kn.negate(),this._handleMouseUpEvent(e)};this._onMouseMove=e=>{Qn.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Kn),Kn.negate(),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e)};this._onTouchStart=e=>{e.touches.length===1&&(Qn.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(Kn),Kn.negate(),this._handleMouseDownEvent(e),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e))};this._onTouchEnd=e=>{this._handleMouseUpEvent(e),this._handleMouseHoverEvent(e,!0)};this._onTouchMove=e=>{e.touches.length===1&&(Qn.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(Kn),Kn.negate(),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e))};this._onWheel=e=>{this._handleWheelEvent(e)};this._onKeyDown=e=>{this._handleKeyDownEvent(e)};this._onKeyUp=e=>{this._handleKeyUpEvent(e)};this._renderer=e,this._domElement=e.domElement,this._camera=r,this._scene=t,this._app=n}activate(){var e,t,r,n,s,o,a,l,c,u,h,f,d,m,p,g,y,v,b,w,x,E,T,S,I,C,M,_,R,B;this.isEnable=!0,this._map={},this._scene.traverseEntity(O=>{O.interaction!==void 0&&(O.interaction.start(),Object.keys(O.interaction.events).forEach(z=>{let q=z;this._addDOMCustomEvent(q,O),this._addSPEEvent(q,ux[q],O)}))}),Id?((((e=this._map.mouseDown)==null?void 0:e.length)||((r=(t=this._map.link)==null?void 0:t.mousedown)==null?void 0:r.length)||((n=this._map.mouseHover)==null?void 0:n.length)||((s=this._map.lookAt)==null?void 0:s.length)||((o=this._map.follow)==null?void 0:o.length))&&this._domElement.addEventListener("touchstart",this._onTouchStart),(((a=this._map.mouseUp)==null?void 0:a.length)||((c=(l=this._map.link)==null?void 0:l.mouseup)==null?void 0:c.length)||((u=this._map.mouseHover)==null?void 0:u.length))&&this._domElement.addEventListener("touchend",this._onTouchEnd),(((h=this._map.mouseHover)==null?void 0:h.length)||((f=this._map.lookAt)==null?void 0:f.length)||((d=this._map.follow)==null?void 0:d.length))&&this._domElement.addEventListener("touchmove",this._onTouchMove)):((((m=this._map.mouseDown)==null?void 0:m.length)||((g=(p=this._map.link)==null?void 0:p.mousedown)==null?void 0:g.length))&&this._domElement.addEventListener("pointerdown",this._onMouseDown),(((y=this._map.mouseUp)==null?void 0:y.length)||((b=(v=this._map.link)==null?void 0:v.mouseup)==null?void 0:b.length))&&this._domElement.addEventListener("pointerup",this._onMouseUp),(((w=this._map.mouseHover)==null?void 0:w.length)||((x=this._map.lookAt)==null?void 0:x.length)||((E=this._map.follow)==null?void 0:E.length))&&this._domElement.addEventListener("pointermove",this._onMouseMove)),(T=this._map.scroll)!=null&&T.length&&this._domElement.addEventListener("wheel",this._onWheel),(((S=this._map.keyDown)==null?void 0:S.length)||((C=(I=this._map.link)==null?void 0:I.keydown)==null?void 0:C.length))&&document.addEventListener("keydown",this._onKeyDown),(((M=this._map.keyUp)==null?void 0:M.length)||((R=(_=this._map.link)==null?void 0:_.keyup)==null?void 0:R.length))&&document.addEventListener("keyup",this._onKeyUp),(B=this._map.start)!=null&&B.length&&this._handleStartEvent()}deactivate(){this._scene.traverseEntity(e=>{if(!e.interaction)return;e.interaction.end();let t=e;Object.keys(ux).forEach(r=>{let n=r;t.removeEventListener(n,ux[n])})}),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),this._domElement.removeEventListener("wheel",this._onWheel),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("keyup",this._onKeyUp),this._map={},this.isEnable=!1}reset(){this._scene.traverseEntity(e=>{var t;(t=e.interaction)==null||t.start()}),this._handleStartEvent()}_getPointer(e,t){let r=this._domElement.getBoundingClientRect(),n=this._renderer.getViewport(Lz),s=Dz(this._domElement),o=n.x*s.x,a=n.y*s.y,l=n.z*s.x,c=n.w*s.y,u=r.height-c,h=(e-o-r.left)*(r.width/l),f=(t-u+a-r.top)*(r.height/c);return{x:h/r.width*2-1,y:-(f/r.height)*2+1}}_handleStartEvent(){var e;(e=this._map.start)==null||e.forEach(t=>t.dispatchEvent(lx))}_handleWheelEvent(e){var t;(t=this._map.scroll)!=null&&t.length&&(am.domEvent=e,this._map.scroll.forEach(r=>r.dispatchEvent(am)))}_handleMouseDownEvent(e){var t,r,n;(t=this._map.mouseDown)==null||t.forEach(s=>{Sh(Qn,s)&&(sm.domEvent=e,s.dispatchEvent(sm))}),(n=(r=this._map.link)==null?void 0:r.mousedown)==null||n.forEach(s=>{Sh(Qn,s)&&(Mn.domEvent=e,Mn.subType="mousedown",s.dispatchEvent(Mn))})}_handleMouseUpEvent(e){var t,r,n;(t=this._map.mouseUp)==null||t.forEach(s=>{Sh(Qn,s)&&(om.domEvent=e,s.dispatchEvent(om))}),(n=(r=this._map.link)==null?void 0:r.mouseup)==null||n.forEach(s=>{Sh(Qn,s)&&(Mn.domEvent=e,Mn.subType="mouseup",s.dispatchEvent(Mn))})}_handleMouseHoverEvent(e,t=!1){var n;let r=[];t||(n=this._map.mouseHover)==null||n.forEach(s=>{Sh(Qn,s)&&r.push(s)}),this._prevObjects.length&&(go.domEvent=e,go.enter=!1,this._prevObjects.forEach(s=>{r.includes(s)||s.dispatchEvent(go)})),r.length&&(go.domEvent=e,go.enter=!0,r.forEach(s=>s.dispatchEvent(go))),this._prevObjects=r}_handleLookAtEvent(e){var t;(t=this._map.lookAt)!=null&&t.length&&(vc.domEvent=e,vc.normal=Kn,vc.raycaster=Qn,this._map.lookAt.forEach(r=>r.dispatchEvent(vc)))}_handleFollowEvent(e){this._map.follow&&(pc.domEvent=e,pc.normal=Kn,pc.raycaster=Qn,this._map.follow.forEach(t=>t.dispatchEvent(pc)))}_handleKeyDownEvent(e){var t,r,n;(t=this._map.keyDown)!=null&&t.length&&(nm.domEvent=e,this._map.keyDown.forEach(s=>s.dispatchEvent(nm))),(n=(r=this._map.link)==null?void 0:r.keydown)!=null&&n.length&&(Mn.domEvent=e,Mn.subType="keydown",this._map.link.keydown.forEach(s=>s.dispatchEvent(Mn)))}_handleKeyUpEvent(e){var t,r,n;(t=this._map.keyUp)!=null&&t.length&&(im.domEvent=e,this._map.keyUp.forEach(s=>s.dispatchEvent(im))),(n=(r=this._map.link)==null?void 0:r.keyup)!=null&&n.length&&(Mn.domEvent=e,Mn.subType="keyup",this._map.link.keyup.forEach(s=>s.dispatchEvent(Mn)))}_addSPEEvent(e,t,r){var n;if(!!r.interaction)if(rT[e].begin=this._dispatchDOMCustomEvent.bind(this),rT[e].change=this._app.requestRender.bind(this),e==="link"){let s=r.interaction.events[e];if(s){let o=!1;Object.keys(s).forEach(a=>{let l=a;this._map[e]===void 0&&(this._map[e]={});let c=this._map[e];c[l]===void 0?c[l]=[r]:c[l].push(r),o=!0}),o&&r.addEventListener(e,t)}}else(n=r.interaction.events[e])!=null&&n.length&&(r.addEventListener(e,t),this._map[e]===void 0?this._map[e]=[r]:this._map[e].push(r))}_addDOMCustomEvent(e,t){if(e){let r=new CustomEvent(e,{bubbles:!0});Object.defineProperty(r,"target",{writable:!1,value:{id:t.uuid,name:t.name}}),this.splineEvents[e]?this.splineEvents[e][t.uuid]=r:this.splineEvents[e]={[t.uuid]:r}}}_dispatchDOMCustomEvent(e,t){var n;let r=(n=this.splineEvents[e])==null?void 0:n[t];r&&this._domElement.dispatchEvent(r)}};var cm=class{constructor(e,t,r,n,s){this._aspect=1;this._renderer=e,this._camera=t,this._frameSize=new N().copy(r),this._editorSize=new N().copy(n),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)}updateViewportForImageExport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,n=this._editorSize.y;this._aspect=e/t,this._camera.zoom*=Math.min(r/e,n/t),this._renderer.setViewport(0,0,e,t)}updateViewport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,n=this._editorSize.y,s=0,o=0,a=e,l=t;e<r&&(s=(r-e)*.5,s=-s,a=r),t<n&&(o=(n-t)*.5,o=-o,l=n),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,r=this._fov;if(e>t){let n=Pz(e,1080,2160,1,15)/100;r*=e/t,r*=1-n}this._camera.aspect=this._aspect,this._camera.fov=r,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 Pz(i,e,t,r,n){return(i-e)/(t-e)*(n-r)+r}var um=class{constructor(e){this.sharedAssets=new rm(e.shared),this.scene=new Xp(e.scene,this.sharedAssets),this.scene.switchActiveCamera(this.scene.activeCamera)}reset(e,t){this.scene.clearScene(this.sharedAssets),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}dispose(){this.scene.dispose()}};var hm=class{constructor({x:e=10,y:t=10}){this._startTime=0;let r=document.getElementById("spe-perfs");r?this.element=r:(this.element=document.createElement("div"),document.body.appendChild(this.element),this.element.style.position="absolute",this.element.style.zIndex="10000",this.element.style.fontFamily="monospace",this.element.style.background="black",this.element.style.color="white",this.element.style.padding="10px",this.element.style.opacity="0.5",this.element.style.fontSize="11px",this.element.setAttribute("id","spe-perfs")),this.element.style.left=`${e}px`,this.element.style.top=`${t}px`}dispose(){var e;(e=this.element.parentElement)==null||e.removeChild(this.element)}start(){this._startTime=performance.now()}end(){let t=performance.now()-this._startTime;this.element.innerHTML=t.toFixed(3)+" ms"}};function Iz(i){let e;if(!!i.index)for(let t=0;t<i.index.array.length;t+=3)e=i.index.array[t],i.index.array[t]=i.index.array[t+2],i.index.array[t+2]=e}function hx(i){return i==="SubdivObject"||i==="NonParametric"?i:"Mesh"}function Rz(i,e){let t={};return i.traverseEntity(r=>{var c;if(r.type!=="Mesh"||!("material"in r)||!r.visible||!(r instanceof Xt)||Array.isArray(r.material)||r&&r.interaction&&r.interaction.states.length>0)return;let n=r.parent;for(;n;){if(n instanceof Xt&&n.interaction&&n.interaction.states.length>1)return;n=n.parent}let s=r.material.uuid,o=e.shared.materials[s];if(o){if(!Ri.isMergable(o))return}else{let u=(c=e.scene.objects.get(r.uuid))==null?void 0:c.data;if(u&&"material"in u&&typeof u.material!="string"){if(!Ri.isMergable(u.material))return;s=Ri.getHash(u.material)}}t[s]||(t[s]={});let l=t[s][hx(r.objectType)];if(l){if(l.push(r),r.cloner)for(let u of r.cloner.children)l.push(u)}else if(t[s][hx(r.objectType)]=[r],r.cloner)for(let u of r.cloner.children)t[s][hx(r.objectType)].push(u)}),t}function Bz(i){let e=0;return Object.values(i).forEach(t=>{Object.values(t).forEach(r=>{let n=r.length;n>e&&(e=n)})}),e}function iT(i,e){let t=Rz(e,i),r=Bz(t),n=new Array(r),s=0,o=new Array(r),a=0,l=new Array(r),c=0,u=new Array(r),h=0;for(let f of Object.values(t))for(let d of Object.values(f)){if(a=0,c=0,d.forEach(p=>{p instanceof Xt&&(o[a++]=p.geometry.clone(),l[c++]=p)}),c<2)continue;for(let p=0;p<c;p++)l[p].updateWorldMatrix(!0,!1),o[p].applyMatrix4(l[p].matrixWorld),l[p].matrixWorld.determinant()<0&&Iz(o[p]);let m=wM(o.slice(0,a),!1);if(m){let p;switch(d[0].objectType){case"SubdivObject":{console.warn("Turning subdiv object into mesh"),p=new Gt(m,l[0].material);break}default:{p=new Gt(m,l[0].material);break}}p.castShadow=l[0].castShadow,p.receiveShadow=l[0].receiveShadow,e.add(p);let g=y=>{h=0;for(let v of y)v.children&&g(v.children),v instanceof Xt&&(Array.isArray(v.material)||t[v.material.uuid]&&t[v.material.uuid][v.objectType]&&t[v.material.uuid][v.objectType].length>1||(u[h++]=v));for(let v=0;v<h;v++)e.attach(u[v])};for(let y=0;y<c;y++){let v=l[y];g(v.children),n[s++]=v}}}for(let f=0;f<s;f++)n[f].removeFromParent()}var sT=class{constructor(e,{autoRender:t=!1}={}){this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this._proxyObjectCache=new Map;this._skipRender=!0;this.autoRender=!1;this.disposed=!1;this.requestRender=()=>{this._skipRender=!1};this.render=()=>{var e,t,r;!this._renderer||(this._rafId=requestAnimationFrame(this.render),(e=this._perfs)==null||e.start(),!(!this.autoRender&&this._skipRender)&&(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._transmissionRenderTarget&&(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)),(t=this._scene.postprocessing)!=null&&t.enabled?(this._renderer.autoClear=!1,this._scene.postprocessing.render()):(this._renderer.autoClear=!0,this._renderer.render(this._scene,this._camera))),(r=this._perfs)==null||r.end()))};this.resize=()=>{var e,t,r,n;!this._renderer||(this._viewportMode===1&&(this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._frameView&&(this._frameView.frameSize=new N(this._viewportWidth,this._viewportHeight))),(e=this._frameView)==null||e.updateRenderer(),(t=this._scene)!=null&&t.postprocessing&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight),this._viewportMode!==1&&((r=this._frameView)==null||r.updateViewport()),this._camera&&((n=this._frameView)==null||n.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&this._viewportMode===1&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.requestRender())};this.canvas=e,this.autoRender=t,window.addEventListener("resize",Mu(this.resize,200)),window.location.search.includes("perfs")&&(this._perfs=new hm({x:10,y:10}))}async load(e){let r=await(await fetch(e)).arrayBuffer();await this.start(r)}async start(e){var o;if(this.disposed)return;let t=await bA(e);this._publishData=t.scene.publish;let r=new um(t);if(window.location.search.includes("merge-geometries")){let a=performance.now();iT(t,r.scene);let l=performance.now();console.log("Merged geometries in ",l-a," ms")}this._scene=r.scene,this._sharedAssetsManager=r.sharedAssets,this._sharedAssetsManager.onImageLoad=()=>{this.requestRender()},tT(t.scene,this._scene,this._sharedAssetsManager),this._camera=this._scene.activeCamera;let n=Object.values(t.frames)[0];n&&(n.preset==="fullscreen"?(this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight):(this._viewportMode=2,this._viewportWidth=n.size[0],this._viewportHeight=n.size[1])),(o=this._scene.postprocessing)!=null&&o.enabled?(this._renderer=new Ct({canvas:this.canvas,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._scene.postprocessing.addEventListener("smaaloaded",this.requestRender)):this._renderer=new Ct({canvas:this.canvas,antialias:!0,alpha:!0,stencil:!0,depth:!0,powerPreference:"high-performance"}),this._scene.needsTransmission(void 0)&&(this._transmissionRenderTarget=new mt(2048,2048,{generateMipmaps:!0,minFilter:ks,magFilter:ct,wrapS:_r,wrapT:_r}),this._transmissionRenderTarget.depthTexture=new oi(2048,2048),this._scene.needsTransmission(this._transmissionRenderTarget)),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=Qg,this._renderer.setClearColor(this._scene.bgColor,this._scene.alpha),this._frameView=new cm(this._renderer,this._camera,new N(this._viewportWidth,this._viewportHeight),new N(window.innerWidth,window.innerHeight)),!0&&(this._controls=new ap(this._camera,this._renderer.domElement),this._publishData&&(this._controls.fromJSON(this._publishData.orbitControls),this._controls.useKeyEvents=!1),this._controls.addEventListener("change",this.requestRender),this._controls.addEventListener("start",this.requestRender)),this._playmode=new lm(this._renderer,this._scene,this._camera,this),this.resize(),this.render()}findObjectById(e){var r;let t=(r=this._scene)==null?void 0:r.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){var r;let t=(r=this._scene)==null?void 0:r.getObjectByName(e);return this._createProxyObject(t)}getSplineEvents(){var e;return(e=this._playmode)==null?void 0:e.splineEvents}emitEvent(e,t){let r=this.findObjectById(t);r==null||r.emitEvent(e)}emitEventReverse(e,t){let r=this.findObjectById(t);r==null||r.emitEventReverse(e)}addEventListener(e,t){var r;(r=this._renderer)==null||r.domElement.addEventListener(e,t)}removeEventListener(e,t){var r;(r=this._renderer)==null||r.domElement.removeEventListener(e,t)}setZoom(e){var t;(t=this._controls)==null||t.zoomOut(e)}dispose(){var e,t,r,n,s,o,a;this.disposed=!0,(e=this._playmode)==null||e.deactivate(),(t=this._scene)==null||t.dispose(),this._rafId&&cancelAnimationFrame(this._rafId),this._proxyObjectCache.forEach(l=>{fy.unsubscribe(l)}),(r=this._renderer)==null||r.dispose(),(n=this._transmissionRenderTarget)==null||n.dispose(),(o=(s=this._transmissionRenderTarget)==null?void 0:s.depthTexture)==null||o.dispose(),(a=this._sharedAssetsManager)==null||a.dispose()}_createProxyObject(e){if(e==null)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);let t={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,emitEvent(n){var s;(s=e.interaction)==null||s.emitEvent(n)},emitEventReverse(n){var s;(s=e.interaction)==null||s.emitEventReverse(n)}},r=fy(t,(n,s)=>{var a;typeof e[n]!="object"&&((a=Object.getOwnPropertyDescriptor(e,n))==null?void 0:a.writable)&&(e[n]=s),this.requestRender(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,r),r}};export{sT as Application};
|