PageSourceSearch

https://caterai-staging.netlify.app/assets/room-designer-CXK-MJnd.js

js caterai-staging.netlify.app collected 2026-10-03 10:35:03 UTC 958,092 bytes, 4,099 lines download raw bytes

1import{W as Ys,r as ee,m5 as OS,eB as FS,j as T,m6 as Xp,m7 as BS,i as Ev,m8 as kS,m9 as zS,ma as VS,mb as GS,mc as HS,md as Sp,me as WS,mf as jS,mg as XS,mh as YS,mi as Mp,mj as qS,u as ZS,g as JS,b3 as KS,eG as QS,ba as Ti,b5 as $S,bk as eM,fs as tM,bs as Tv,ag as bp,B as Er,cz as nM,L as mf,bA as iM,D as rM,d as sM,e as oM,f as aM,T as lM,O as cM,Q as uM,aW as hM,af as dM,s as fM,n as pM,bS as mM,bC as gM,b$ as xM,_ as vM,a2 as Av,a3 as Cv,a4 as Rv,a5 as Iv,a6 as Ha,cC as yM,G as _M}from"./index-DNBzpCbc.js";import{S as Ya}from"./separator-B2fXCzaI.js";import{T as SM}from"./tag-BLiaMQqW.js";import{U as MM}from"./undo-2-DOr7WS3v.js";import{R as bM}from"./redo-2-CjAIFja-.js";import{R as Pv}from"./rotate-cw-JYCQXyQz.js";import{S as wM}from"./square-sGHv-zTV.js";import{A as EM}from"./armchair-DcIIKGtW.js";import{M as TM}from"./minus-mCTcsBbJ.js";const AM=Ys("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);const CM=Ys("Flower2",[["path",{d:"M12 5a3 3 0 1 1 3 3m-3-3a3 3 0 1 0-3 3m3-3v1M9 8a3 3 0 1 0 3 3M9 8h1m5 0a3 3 0 1 1-3 3m3-3h-1m-2 3v-1",key:"3pnvol"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M12 10v12",key:"6ubwww"}],["path",{d:"M12 22c4.2 0 7-1.667 7-5-4.2 0-7 1.667-7 5Z",key:"9hd38g"}],["path",{d:"M12 22c-4.2 0-7-1.667-7-5 4.2 0 7 1.667 7 5Z",key:"ufn41s"}]]);const RM=Ys("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);const Lv=Ys("RectangleHorizontal",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);const IM=Ys("Speaker",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["circle",{cx:"12",cy:"14",r:"4",key:"1jruaj"}],["path",{d:"M12 14h.01",key:"1etili"}]]);const PM=Ys("Tent",[["path",{d:"M3.5 21 14 3",key:"1szst5"}],["path",{d:"M20.5 21 10 3",key:"1310c3"}],["path",{d:"M15.5 21 12 15l-3.5 6",key:"1ddtfw"}],["path",{d:"M2 21h20",key:"1nyx9w"}]]);const LM=Ys("TreePine",[["path",{d:"m17 14 3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17Z",key:"cpyugq"}],["path",{d:"M12 22v-3",key:"kmzjlo"}]]);function sl(){return sl=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},sl.apply(null,arguments)}const Sh="183",hi={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Fi={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Dv=0,wp=1,Nv=2,DM=3,Uv=0,jo=1,qa=2,Ls=3,Cr=0,jn=1,hn=2,sr=0,Os=1,Ep=2,Tp=3,Ap=4,Ov=5,NM=6,qr=100,Fv=101,Bv=102,kv=103,zv=104,Vv=200,Gv=201,Hv=202,Wv=203,Cu=204,Ru=205,jv=206,Xv=207,Yv=208,qv=209,Zv=210,Jv=211,Kv=212,Qv=213,$v=214,Iu=0,Pu=1,Lu=2,zs=3,Du=4,Nu=5,Uu=6,Ou=7,Ml=0,ey=1,ty=2,Ci=0,Yp=1,qp=2,Zp=3,Mh=4,Jp=5,Kp=6,Qp=7,Cp="attached",ny="detached",bh=300,or=301,Qr=302,Za=303,Ja=304,ta=306,ol=1e3,ti=1001,al=1002,an=1003,$p=1004,UM=1004,Vo=1005,OM=1005,Xt=1006,Ka=1007,FM=1007,ir=1008,BM=1008,Hn=1009,em=1010,tm=1011,qo=1012,wh=1013,Ri=1014,Un=1015,Hi=1016,Eh=1017,Th=1018,Zo=1020,nm=35902,im=35899,rm=1021,sm=1022,On=1023,ar=1026,Zr=1027,Ah=1028,bl=1029,Vs=1030,Ch=1031,kM=1032,Rh=1033,Qa=33776,$a=33777,el=33778,tl=33779,Fu=35840,Bu=35841,ku=35842,zu=35843,Vu=36196,Gu=37492,Hu=37496,Wu=37488,ju=37489,Xu=37490,Yu=37491,qu=37808,Zu=37809,Ju=37810,Ku=37811,Qu=37812,$u=37813,eh=37814,th=37815,nh=37816,ih=37817,rh=37818,sh=37819,oh=37820,ah=37821,lh=36492,ch=36494,uh=36495,hh=36283,dh=36284,fh=36285,ph=36286,iy=2200,ry=2201,sy=2202,ll=2300,mh=2301,wu=2302,Rp=2303,Ds=2400,Ns=2401,cl=2402,Ih=2500,om=2501,zM=0,VM=1,GM=2,oy=3200,HM=3201,WM=3202,jM=3203,ts=0,ay=1,br="",$n="srgb",Gs="srgb-linear",ul="linear",Vt="srgb",XM="",YM="rg",qM="ga",ZM=0,Is=7680,JM=7681,KM=7682,QM=7683,$M=34055,e1=34056,t1=5386,n1=512,i1=513,r1=514,s1=515,o1=516,a1=517,l1=518,Ip=519,ly=512,cy=513,uy=514,Ph=515,hy=516,dy=517,Lh=518,fy=519,hl=35044,c1=35048,u1=35040,h1=35045,d1=35049,f1=35041,p1=35046,m1=35050,g1=35042,x1="100",Pp="300 es",di=2e3,Hs=2001,v1={COMPUTE:"compute",RENDER:"render"},y1={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},_1={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},S1={TEXTURE_COMPARE:"depthTextureCompare"};function M1(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const b1={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Go(r,e){return new b1[r](e)}function py(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function dl(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function my(){const r=dl("canvas");return r.style.display="block",r}const _0={};let $r=null;function w1(r){$r=r}function E1(){return $r}function fl(...r){const e="THREE."+r.shift();$r?$r("log",e,...r):console.log(e,...r)}function gy(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function ke(...r){r=gy(r);const e="THREE."+r.shift();if($r)$r("warn",e,...r);else{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function ot(...r){r=gy(r);const e="THREE."+r.shift();if($r)$r("error",e,...r);else{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function pl(...r){const e=r.join(" ");e in _0||(_0[e]=!0,ke(...r))}function T1(r,e,t){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}const A1={[Iu]:Pu,[Lu]:Uu,[Du]:Ou,[zs]:Nu,[Pu]:Iu,[Uu]:Lu,[Ou]:Du,[Nu]:zs};let lr=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}};const Pn=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","5
15","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let S0=1234567;const Fs=Math.PI/180,Jo=180/Math.PI;function fi(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Pn[r&255]+Pn[r>>8&255]+Pn[r>>16&255]+Pn[r>>24&255]+"-"+Pn[e&255]+Pn[e>>8&255]+"-"+Pn[e>>16&15|64]+Pn[e>>24&255]+"-"+Pn[t&63|128]+Pn[t>>8&255]+"-"+Pn[t>>16&255]+Pn[t>>24&255]+Pn[n&255]+Pn[n>>8&255]+Pn[n>>16&255]+Pn[n>>24&255]).toLowerCase()}function gt(r,e,t){return Math.max(e,Math.min(t,r))}function am(r,e){return(r%e+e)%e}function C1(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function R1(r,e,t){return r!==e?(t-r)/(e-r):0}function nl(r,e,t){return(1-t)*r+t*e}function I1(r,e,t,n){return nl(r,e,1-Math.exp(-t*n))}function P1(r,e=1){return e-Math.abs(am(r,e*2)-e)}function L1(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function D1(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function N1(r,e){return r+Math.floor(Math.random()*(e-r+1))}function U1(r,e){return r+Math.random()*(e-r)}function O1(r){return r*(.5-Math.random())}function F1(r){r!==void 0&&(S0=r);let e=S0+=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 B1(r){return r*Fs}function k1(r){return r*Jo}function z1(r){return(r&r-1)===0&&r!==0}function V1(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function G1(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function H1(r,e,t,n,i){const s=Math.cos,o=Math.sin,c=s(t/2),u=o(t/2),h=s((e+n)/2),d=o((e+n)/2),f=s((e-n)/2),m=o((e-n)/2),g=s((n-e)/2),x=o((n-e)/2);switch(i){case"XYX":r.set(c*d,u*f,u*m,c*h);break;case"YZY":r.set(u*m,c*d,u*f,c*h);break;case"ZXZ":r.set(u*f,u*m,c*d,c*h);break;case"XZX":r.set(c*d,u*x,u*g,c*h);break;case"YXY":r.set(u*g,c*d,u*x,c*h);break;case"ZYZ":r.set(u*x,u*g,c*d,c*h);break;default:ke("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Wn(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function wt(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const W1={DEG2RAD:Fs,RAD2DEG:Jo,generateUUID:fi,clamp:gt,euclideanModulo:am,mapLinear:C1,inverseLerp:R1,lerp:nl,damp:I1,pingpong:P1,smoothstep:L1,smootherstep:D1,randInt:N1,randFloat:U1,randFloatSpread:O1,seededRandom:F1,degToRad:B1,radToDeg:k1,isPowerOfTwo:z1,ceilPowerOfTwo:V1,floorPowerOfTwo:G1,setQuaternionFromProperEuler:H1,normalize:wt,denormalize:Wn};class ge{constructor(e=0,t=0){ge.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 11,279 bytes, line 1
1sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(gt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(gt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class wn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,o,c){let u=n[i+0],h=n[i+1],d=n[i+2],f=n[i+3],m=s[o+0],g=s[o+1],x=s[o+2],M=s[o+3];if(f!==M||u!==m||h!==g||d!==x){let _=u*m+h*g+d*x+f*M;_<0&&(m=-m,g=-g,x=-x,M=-M,_=-_);let v=1-c;if(_<.9995){const S=Math.acos(_),b=Math.sin(S);v=Math.sin(v*S)/b,c=Math.sin(c*S)/b,u=u*v+m*c,h=h*v+g*c,d=d*v+x*c,f=f*v+M*c}else{u=u*v+m*c,h=h*v+g*c,d=d*v+x*c,f=f*v+M*c;const S=1/Math.sqrt(u*u+h*h+d*d+f*f);u*=S,h*=S,d*=S,f*=S}}e[t]=u,e[t+1]=h,e[t+2]=d,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,i,s,o){const c=n[i],u=n[i+1],h=n[i+2],d=n[i+3],f=s[o],m=s[o+1],g=s[o+2],x=s[o+3];return e[t]=c*x+d*f+u*g-h*m,e[t+1]=u*x+d*m+h*f-c*g,e[t+2]=h*x+d*g+c*m-u*f,e[t+3]=d*x-c*f-u*m-h*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,s=e._z,o=e._order,c=Math.cos,u=Math.sin,h=c(n/2),d=c(i/2),f=c(s/2),m=u(n/2),g=u(i/2),x=u(s/2);switch(o){case"XYZ":this._x=m*d*f+h*g*x,this._y=h*g*f-m*d*x,this._z=h*d*x+m*g*f,this._w=h*d*f-m*g*x;break;case"YXZ":this._x=m*d*f+h*g*x,this._y=h*g*f-m*d*x,this._z=h*d*x-m*g*f,this._w=h*d*f+m*g*x;break;case"ZXY":this._x=m*d*f-h*g*x,this._y=h*g*f+m*d*x,this._z=h*d*x+m*g*f,this._w=h*d*f-m*g*x;break;case"ZYX":this._x=m*d*f-h*g*x,this._y=h*g*f+m*d*x,this._z=h*d*x-m*g*f,this._w=h*d*f+m*g*x;break;case"YZX":this._x=m*d*f+h*g*x,this._y=h*g*f+m*d*x,this._z=h*d*x-m*g*f,this._w=h*d*f-m*g*x;break;case"XZY":this._x=m*d*f-h*g*x,this._y=h*g*f-m*d*x,this._z=h*d*x+m*g*f,this._w=h*d*f+m*g*x;break;default:ke("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],o=t[1],c=t[5],u=t[9],h=t[2],d=t[6],f=t[10],m=n+c+f;if(m>0){const g=.5/Math.sqrt(m+1);this._w=.25/g,this._x=(d-u)*g,this._y=(s-h)*g,this._z=(o-i)*g}else if(n>c&&n>f){const g=2*Math.sqrt(1+n-c-f);this._w=(d-u)/g,this._x=.25*g,this._y=(i+o)/g,this._z=(s+h)/g}else if(c>f){const g=2*Math.sqrt(1+c-n-f);this._w=(s-h)/g,this._x=(i+o)/g,this._y=.25*g,this._z=(u+d)/g}else{const g=2*Math.sqrt(1+f-n-c);this._w=(o-i)/g,this._x=(s+h)/g,this._y=(u+d)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(gt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,o=e._w,c=t._x,u=t._y,h=t._z,d=t._w;return this._x=n*d+o*c+i*h-s*u,this._y=i*d+o*u+s*c-n*h,this._z=s*d+o*h+n*u-i*c,this._w=o*d-n*c-i*u-s*h,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,s=e._z,o=e._w,c=this.dot(e);c<0&&(n=-n,i=-i,s=-s,o=-o,c=-c);let u=1-t;if(c<.9995){const h=Math.acos(c),d=Math.sin(h);u=Math.sin(u*h)/d,t=Math.sin(t*h)/d,this._x=this._x*u+n*t,this._y=this._y*u+i*t,this._z=this._z*u+s*t,this._w=this._w*u+o*t,this._onChangeCallback()}else this._x=this._x*u+n*t,this._y=this._y*u+i*t,this._z=this._z*u+s*t,this._w=this._w*u+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,n=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(M0.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(M0.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,c=e.z,u=e.w,h=2*(o*i-c*n),d=2*(c*t-s*i),f=2*(s*n-o*t);return this.x=t+u*h+o*f-c*d,this.y=n+u*d+c*h-s*f,this.z=i+u*f+s*d-o*h,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this.z=gt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this.z=gt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(gt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}
vendor: 4,130 bytes, line 1
1round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,o=t.x,c=t.y,u=t.z;return this.x=i*u-s*c,this.y=s*o-n*u,this.z=n*c-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return gf.copy(this).projectOnVector(e),this.sub(gf)}reflect(e){return this.sub(gf.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(gt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const gf=new F,M0=new wn;class bt{constructor(e,t,n,i,s,o,c,u,h){bt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,c,u,h)}set(e,t,n,i,s,o,c,u,h){const d=this.elements;return d[0]=e,d[1]=i,d[2]=c,d[3]=t,d[4]=s,d[5]=u,d[6]=n,d[7]=o,d[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,o=n[0],c=n[3],u=n[6],h=n[1],d=n[4],f=n[7],m=n[2],g=n[5],x=n[8],M=i[0],_=i[3],v=i[6],S=i[1],b=i[4],E=i[7],P=i[2],D=i[5],N=i[8];
vendor: 53,035 bytes, line 1
1return s[0]=o*M+c*S+u*P,s[3]=o*_+c*b+u*D,s[6]=o*v+c*E+u*N,s[1]=h*M+d*S+f*P,s[4]=h*_+d*b+f*D,s[7]=h*v+d*E+f*N,s[2]=m*M+g*S+x*P,s[5]=m*_+g*b+x*D,s[8]=m*v+g*E+x*N,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],c=e[5],u=e[6],h=e[7],d=e[8];return t*o*d-t*c*h-n*s*d+n*c*u+i*s*h-i*o*u}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],c=e[5],u=e[6],h=e[7],d=e[8],f=d*o-c*h,m=c*u-d*s,g=h*s-o*u,x=t*f+n*m+i*g;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const M=1/x;return e[0]=f*M,e[1]=(i*h-d*n)*M,e[2]=(c*n-i*o)*M,e[3]=m*M,e[4]=(d*t-i*u)*M,e[5]=(i*s-c*t)*M,e[6]=g*M,e[7]=(n*u-h*t)*M,e[8]=(o*t-n*s)*M,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,o,c){const u=Math.cos(s),h=Math.sin(s);return this.set(n*u,n*h,-n*(u*o+h*c)+o+e,-i*h,i*u,-i*(-h*o+u*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(xf.makeScale(e,t)),this}rotate(e){return this.premultiply(xf.makeRotation(-e)),this}translate(e,t){return this.premultiply(xf.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const xf=new bt,b0=new bt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),w0=new bt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function j1(){const r={enabled:!0,workingColorSpace:Gs,spaces:{},convert:function(i,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Vt&&(i.r=Tr(i.r),i.g=Tr(i.g),i.b=Tr(i.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Vt&&(i.r=Xo(i.r),i.g=Xo(i.g),i.b=Xo(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===br?ul:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,o){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return pl("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return pl("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Gs]:{primaries:e,whitePoint:n,transfer:ul,toXYZ:b0,fromXYZ:w0,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:$n},outputColorSpaceConfig:{drawingBufferColorSpace:$n}},[$n]:{primaries:e,whitePoint:n,transfer:Vt,toXYZ:b0,fromXYZ:w0,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:$n}}}),r}const Dt=j1();function Tr(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Xo(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let go;class xy{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{go===void 0&&(go=dl("canvas")),go.width=e.width,go.height=e.height;const i=go.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=go}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=dl("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o<s.length;o++)s[o]=Tr(s[o]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Tr(t[n]/255)*255):t[n]=Tr(t[n]);return{data:t,width:e.width,height:e.height}}else return ke("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let X1=0;class Jr{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:X1++}),this.uuid=fi(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let o=0,c=i.length;o<c;o++)i[o].isDataTexture?s.push(vf(i[o].image)):s.push(vf(i[o]))}else s=vf(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function vf(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?xy.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(ke("Texture: Unable to serialize Texture."),{})}let Y1=0;const yf=new F;class rn extends lr{constructor(e=rn.DEFAULT_IMAGE,t=rn.DEFAULT_MAPPING,n=ti,i=ti,s=Xt,o=ir,c=On,u=Hn,h=rn.DEFAULT_ANISOTROPY,d=br){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Y1++}),this.uuid=fi(),this.name="",this.source=new Jr(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=h,this.format=c,this.internalFormat=null,this.type=u,this.offset=new ge(0,0),this.repeat=new ge(1,1),this.center=new ge(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new bt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(yf).x}get height(){return this.source.getSize(yf).y}get depth(){return this.source.getSize(yf).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){ke(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==bh)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ol:e.x=e.x-Math.floor(e.x);break;case ti:e.x=e.x<0?0:1;break;case al: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 ol:e.y=e.y-Math.floor(e.y);break;case ti:e.y=e.y<0?0:1;break;case al:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}rn.DEFAULT_IMAGE=null;rn.DEFAULT_MAPPING=bh;rn.DEFAULT_ANISOTROPY=1;class jt{constructor(e=0,t=0,n=0,i=1){jt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const u=e.elements,h=u[0],d=u[4],f=u[8],m=u[1],g=u[5],x=u[9],M=u[2],_=u[6],v=u[10];if(Math.abs(d-m)<.01&&Math.abs(f-M)<.01&&Math.abs(x-_)<.01){if(Math.abs(d+m)<.1&&Math.abs(f+M)<.1&&Math.abs(x+_)<.1&&Math.abs(h+g+v-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const b=(h+1)/2,E=(g+1)/2,P=(v+1)/2,D=(d+m)/4,N=(f+M)/4,A=(x+_)/4;return b>E&&b>P?b<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(b),i=D/n,s=N/n):E>P?E<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(E),n=D/i,s=A/i):P<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(P),n=N/s,i=A/s),this.set(n,i,s,t),this}let S=Math.sqrt((_-x)*(_-x)+(f-M)*(f-M)+(m-d)*(m-d));return Math.abs(S)<.001&&(S=1),this.x=(_-x)/S,this.y=(f-M)/S,this.z=(m-d)/S,this.w=Math.acos((h+g+v-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=gt(this.x,e.x,t.x),this.y=gt(this.y,e.y,t.y),this.z=gt(this.z,e.z,t.z),this.w=gt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=gt(this.x,e,t),this.y=gt(this.y,e,t),this.z=gt(this.z,e,t),this.w=gt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(gt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class lm extends lr{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Xt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new jt(0,0,e,t),this.scissorTest=!1,this.viewport=new jt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},s=new rn(i),o=n.count;for(let c=0;c<o;c++)this.textures[c]=s.clone(),this.textures[c].isRenderTargetTexture=!0,this.textures[c].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:Xt,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new Jr(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ni extends lm{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Dh extends rn{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=an,this.minFilter=an,this.wrapR=ti,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class q1 extends ni{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Dh(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Nh extends rn{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=an,this.minFilter=an,this.wrapR=ti,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Z1 extends ni{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Nh(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class yt{constructor(e,t,n,i,s,o,c,u,h,d,f,m,g,x,M,_){yt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,c,u,h,d,f,m,g,x,M,_)}set(e,t,n,i,s,o,c,u,h,d,f,m,g,x,M,_){const v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=i,v[1]=s,v[5]=o,v[9]=c,v[13]=u,v[2]=h,v[6]=d,v[10]=f,v[14]=m,v[3]=g,v[7]=x,v[11]=M,v[15]=_,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 yt().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,n=e.elements,i=1/xo.setFromMatrixColumn(e,0).length(),s=1/xo.setFromMatrixColumn(e,1).length(),o=1/xo.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,o=Math.cos(n),c=Math.sin(n),u=Math.cos(i),h=Math.sin(i),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const m=o*d,g=o*f,x=c*d,M=c*f;t[0]=u*d,t[4]=-u*f,t[8]=h,t[1]=g+x*h,t[5]=m-M*h,t[9]=-c*u,t[2]=M-m*h,t[6]=x+g*h,t[10]=o*u}else if(e.order==="YXZ"){const m=u*d,g=u*f,x=h*d,M=h*f;t[0]=m+M*c,t[4]=x*c-g,t[8]=o*h,t[1]=o*f,t[5]=o*d,t[9]=-c,t[2]=g*c-x,t[6]=M+m*c,t[10]=o*u}else if(e.order==="ZXY"){const m=u*d,g=u*f,x=h*d,M=h*f;t[0]=m-M*c,t[4]=-o*f,t[8]=x+g*c,t[1]=g+x*c,t[5]=o*d,t[9]=M-m*c,t[2]=-o*h,t[6]=c,t[10]=o*u}else if(e.order==="ZYX"){const m=o*d,g=o*f,x=c*d,M=c*f;t[0]=u*d,t[4]=x*h-g,t[8]=m*h+M,t[1]=u*f,t[5]=M*h+m,t[9]=g*h-x,t[2]=-h,t[6]=c*u,t[10]=o*u}else if(e.order==="YZX"){const m=o*u,g=o*h,x=c*u,M=c*h;t[0]=u*d,t[4]=M-m*f,t[8]=x*f+g,t[1]=f,t[5]=o*d,t[9]=-c*d,t[2]=-h*d,t[6]=g*f+x,t[10]=m-M*f}else if(e.order==="XZY"){const m=o*u,g=o*h,x=c*u,M=c*h;t[0]=u*d,t[4]=-f,t[8]=h*d,t[1]=m*f+M,t[5]=o*d,t[9]=g*f-x,t[2]=x*f-g,t[6]=c*d,t[10]=M*f+m}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(J1,e,K1)}lookAt(e,t,n){const i=this.elements;return ci.subVectors(e,t),ci.lengthSq()===0&&(ci.z=1),ci.normalize(),zr.crossVectors(n,ci),zr.lengthSq()===0&&(Math.abs(n.z)===1?ci.x+=1e-4:ci.z+=1e-4,ci.normalize(),zr.crossVectors(n,ci)),zr.normalize(),Rc.crossVectors(ci,zr),i[0]=zr.x,i[4]=Rc.x,i[8]=ci.x,i[1]=zr.y,i[5]=Rc.y,i[9]=ci.y,i[2]=zr.z,i[6]=Rc.z,i[10]=ci.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,o=n[0],c=n[4],u=n[8],h=n[12],d=n[1],f=n[5],m=n[9],g=n[13],x=n[2],M=n[6],_=n[10],v=n[14],S=n[3],b=n[7],E=n[11],P=n[15],D=i[0],N=i[4],A=i[8],R=i[12],B=i[1],L=i[5],V=i[9],H=i[13],j=i[2],X=i[6],q=i[10],Y=i[14],J=i[3],te=i[7],oe=i[11],ce=i[15];return s[0]=o*D+c*B+u*j+h*J,s[4]=o*N+c*L+u*X+h*te,s[8]=o*A+c*V+u*q+h*oe,s[12]=o*R+c*H+u*Y+h*ce,s[1]=d*D+f*B+m*j+g*J,s[5]=d*N+f*L+m*X+g*te,s[9]=d*A+f*V+m*q+g*oe,s[13]=d*R+f*H+m*Y+g*ce,s[2]=x*D+M*B+_*j+v*J,s[6]=x*N+M*L+_*X+v*te,s[10]=x*A+M*V+_*q+v*oe,s[14]=x*R+M*H+_*Y+v*ce,s[3]=S*D+b*B+E*j+P*J,s[7]=S*N+b*L+E*X+P*te,s[11]=S*A+b*V+E*q+P*oe,s[15]=S*R+b*H+E*Y+P*ce,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],o=e[1],c=e[5],u=e[9],h=e[13],d=e[2],f=e[6],m=e[10],g=e[14],x=e[3],M=e[7],_=e[11],v=e[15],S=u*g-h*m,b=c*g-h*f,E=c*m-u*f,P=o*g-h*d,D=o*m-u*d,N=o*f-c*d;return t*(M*S-_*b+v*E)-n*(x*S-_*P+v*D)+i*(x*b-M*P+v*N)-s*(x*E-M*D+_*N)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],c=e[5],u=e[6],h=e[7],d=e[8],f=e[9],m=e[10],g=e[11],x=e[12],M=e[13],_=e[14],v=e[15],S=t*c-n*o,b=t*u-i*o,E=t*h-s*o,P=n*u-i*c,D=n*h-s*c,N=i*h-s*u,A=d*M-f*x,R=d*_-m*x,B=d*v-g*x,L=f*_-m*M,V=f*v-g*M,H=m*v-g*_,j=S*H-b*V+E*L+P*B-D*R+N*A;if(j===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const X=1/j;return e[0]=(c*H-u*V+h*L)*X,e[1]=(i*V-n*H-s*L)*X,e[2]=(M*N-_*D+v*P)*X,e[3]=(m*D-f*N-g*P)*X,e[4]=(u*B-o*H-h*R)*X,e[5]=(t*H-i*B+s*R)*X,e[6]=(_*E-x*N-v*b)*X,e[7]=(d*N-m*E+g*b)*X,e[8]=(o*V-c*B+h*A)*X,e[9]=(n*B-t*V-s*A)*X,e[10]=(x*D-M*E+v*S)*X,e[11]=(f*E-d*D-g*S)*X,e[12]=(c*R-o*L-u*A)*X,e[13]=(t*L-n*R+i*A)*X,e[14]=(M*b-x*P-_*S)*X,e[15]=(d*P-f*b+m*S)*X,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,o=e.x,c=e.y,u=e.z,h=s*o,d=s*c;return this.set(h*o+n,h*c-i*u,h*u+i*c,0,h*c+i*u,d*c+n,d*u-i*o,0,h*u-i*c,d*u+i*o,s*u*u+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,o=t._y,c=t._z,u=t._w,h=s+s,d=o+o,f=c+c,m=s*h,g=s*d,x=s*f,M=o*d,_=o*f,v=c*f,S=u*h,b=u*d,E=u*f,P=n.x,D=n.y,N=n.z;return i[0]=(1-(M+v))*P,i[1]=(g+E)*P,i[2]=(x-b)*P,i[3]=0,i[4]=(g-E)*D,i[5]=(1-(m+v))*D,i[6]=(_+S)*D,i[7]=0,i[8]=(x+b)*N,i[9]=(_-S)*N,i[10]=(1-(m+M))*N,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];const s=this.determinant();if(s===0)return n.set(1,1,1),t.identity(),this;let o=xo.set(i[0],i[1],i[2]).length();const c=xo.set(i[4],i[5],i[6]).length(),u=xo.set(i[8],i[9],i[10]).length();s<0&&(o=-o),Ni.copy(this);const h=1/o,d=1/c,f=1/u;return Ni.elements[0]*=h,Ni.elements[1]*=h,Ni.elements[2]*=h,Ni.elements[4]*=d,Ni.elements[5]*=d,Ni.elements[6]*=d,Ni.elements[8]*=f,Ni.elements[9]*=f,Ni.elements[10]*=f,t.setFromRotationMatrix(Ni),n.x=o,n.y=c,n.z=u,this}makePerspective(e,t,n,i,s,o,c=di,u=!1){const h=this.elements,d=2*s/(t-e),f=2*s/(n-i),m=(t+e)/(t-e),g=(n+i)/(n-i);let x,M;if(u)x=s/(o-s),M=o*s/(o-s);else if(c===di)x=-(o+s)/(o-s),M=-2*o*s/(o-s);else if(c===Hs)x=-o/(o-s),M=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);return h[0]=d,h[4]=0,h[8]=m,h[12]=0,h[1]=0,h[5]=f,h[9]=g,h[13]=0,h[2]=0,h[6]=0,h[10]=x,h[14]=M,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(e,t,n,i,s,o,c=di,u=!1){const h=this.elements,d=2/(t-e),f=2/(n-i),m=-(t+e)/(t-e),g=-(n+i)/(n-i);let x,M;if(u)x=1/(o-s),M=o/(o-s);else if(c===di)x=-2/(o-s),M=-(o+s)/(o-s);else if(c===Hs)x=-1/(o-s),M=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);return h[0]=d,h[4]=0,h[8]=0,h[12]=m,h[1]=0,h[5]=f,h[9]=0,h[13]=g,h[2]=0,h[6]=0,h[10]=x,h[14]=M,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const xo=new F,Ni=new yt,J1=new F(0,0,0),K1=new F(1,1,1),zr=new F,Rc=new F,ci=new F,E0=new yt,T0=new wn;class mi{constructor(e=0,t=0,n=0,i=mi.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],o=i[4],c=i[8],u=i[1],h=i[5],d=i[9],f=i[2],m=i[6],g=i[10];switch(t){case"XYZ":this._y=Math.asin(gt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-d,g),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(m,h),this._z=0);break;case"YXZ":this._x=Math.asin(-gt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(c,g),this._z=Math.atan2(u,h)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(gt(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-f,g),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(u,s));break;case"ZYX":this._y=Math.asin(-gt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(m,g),this._z=Math.atan2(u,s)):(this._x=0,this._z=Math.atan2(-o,h));break;case"YZX":this._z=Math.asin(gt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-d,h),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(c,g));break;case"XZY":this._z=Math.asin(-gt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(m,h),this._y=Math.atan2(c,s)):(this._x=Math.atan2(-d,g),this._y=0);break;default:ke("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return E0.makeRotationFromQuaternion(e),this.setFromRotationMatrix(E0,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return T0.setFromEuler(this),this.setFromQuaternion(T0,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}mi.DEFAULT_ORDER="XYZ";class Bs{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let Q1=0;const A0=new F,vo=new wn,xr=new yt,Ic=new F,Ca=new F,$1=new F,eb=new wn,C0=new F(1,0,0),R0=new F(0,1,0),I0=new F(0,0,1),P0={type:"added"},tb={type:"removed"},yo={type:"childadded",child:null},_f={type:"childremoved",child:null};class Ot extends lr{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Q1++}),this.uuid=fi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ot.DEFAULT_UP.clone();const e=new F,t=new mi,n=new wn,i=new F(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new yt},normalMatrix:{value:new bt}}),this.matrix=new yt,this.matrixWorld=new yt,this.matrixAutoUpdate=Ot.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ot.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Bs,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return vo.setFromAxisAngle(e,t),this.quaternion.multiply(vo),this}rotateOnWorldAxis(e,t){return vo.setFromAxisAngle(e,t),this.quaternion.premultiply(vo),this}rotateX(e){return this.rotateOnAxis(C0,e)}rotateY(e){return this.rotateOnAxis(R0,e)}rotateZ(e){return this.rotateOnAxis(I0,e)}translateOnAxis(e,t){return A0.copy(e).applyQuaternion(this.quaternion),this.position.add(A0.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(C0,e)}translateY(e){return this.translateOnAxis(R0,e)}translateZ(e){return this.translateOnAxis(I0,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(xr.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Ic.copy(e):Ic.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Ca.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?xr.lookAt(Ca,Ic,this.up):xr.lookAt(Ic,Ca,this.up),this.quaternion.setFromRotationMatrix(xr),i&&(xr.extractRotation(i.matrixWorld),vo.setFromRotationMatrix(xr),this.quaternion.premultiply(vo.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(ot("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(P0),yo.child=e,this.dispatchEvent(yo),yo.child=null):ot("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(tb),_f.child=e,this.dispatchEvent(_f),_f.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),xr.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),xr.multiply(e.parent.matrixWorld)),e.applyMatrix4(xr),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(P0),yo.child=e,this.dispatchEvent(yo),yo.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ca,e,$1),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ca,eb,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,n=e.y,i=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*i,s[13]+=n-s[1]*t-s[5]*n-s[9]*i,s[14]+=i-s[2]*t-s[6]*n-s[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(c,u){return c[u.uuid]===void 0&&(c[u.uuid]=u.toJSON(e)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const u=c.shapes;if(Array.isArray(u))for(let h=0,d=u.length;h<d;h++){const f=u[h];s(e.shapes,f)}else s(e.shapes,u)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const c=[];for(let u=0,h=this.material.length;u<h;u++)c.push(s(e.materials,this.material[u]));i.material=c}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let c=0;c<this.children.length;c++)i.children.push(this.children[c].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let c=0;c<this.animations.length;c++){const u=this.animations[c];i.animations.push(s(e.animations,u))}}if(t){const c=o(e.geometries),u=o(e.materials),h=o(e.textures),d=o(e.images),f=o(e.shapes),m=o(e.skeletons),g=o(e.animations),x=o(e.nodes);c.length>0&&(n.geometries=c),u.length>0&&(n.materials=u),h.length>0&&(n.textures=h),d.length>0&&(n.images=d),f.length>0&&(n.shapes=f),m.length>0&&(n.skeletons=m),g.length>0&&(n.animations=g),x.length>0&&(n.nodes=x)}return n.object=i,n;function o(c){const u=[];for(const h in c){const d=c[h];delete d.metadata,u.push(d)}return u}}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),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}Ot.DEFAULT_UP=new F(0,1,0);Ot.DEFAULT_MATRIX_AUTO_UPDATE=!0;Ot.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Ho extends Ot{constructor(){super(),this.isGroup=!0,this.type="Group"}}const nb={type:"move"};class Eu{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ho,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 Ho,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ho,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,o=null;const c=this._targetRay,u=this._grip,h=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(h&&e.hand){o=!0;for(const M of e.hand.values()){const _=t.getJointPose(M,n),v=this._getHandJoint(h,M);_!==null&&(v.matrix.fromArray(_.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=_.radius),v.visible=_!==null}const d=h.joints["index-finger-tip"],f=h.joints["thumb-tip"],m=d.position.distanceTo(f.position),g=.02,x=.005;h.inputState.pinching&&m>g+x?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&m<=g-x&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(u.matrix.fromArray(s.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,s.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(s.linearVelocity)):u.hasLinearVelocity=!1,s.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(s.angularVelocity)):u.hasAngularVelocity=!1));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(nb)))}return c!==null&&(c.visible=i!==null),u!==null&&(u.visible=s!==null),h!==null&&(h.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Ho;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const vy={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},Vr={h:0,s:0,l:0},Pc={h:0,s:0,l:0};function Sf(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Ke{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=$n){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Dt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Dt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Dt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Dt.workingColorSpace){if(e=am(e,1),t=gt(t,0,1),n=gt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=Sf(o,s,e+1/3),this.g=Sf(o,s,e),this.b=Sf(o,s,e-1/3)}return Dt.colorSpaceToWorking(this,i),this}setStyle(e,t=$n){function n(s){s!==void 0&&parseFloat(s)<1&&ke("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],c=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:ke("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);ke("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=$n){const n=vy[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ke("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=Tr(e.r),this.g=Tr(e.g),this.b=Tr(e.b),this}copyLinearToSRGB(e){return this.r=Xo(e.r),this.g=Xo(e.g),this.b=Xo(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=$n){return Dt.workingToColorSpace(Ln.copy(this),e),Math.round(gt(Ln.r*255,0,255))*65536+Math.round(gt(Ln.g*255,0,255))*256+Math.round(gt(Ln.b*255,0,255))}getHexString(e=$n){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Dt.workingColorSpace){Dt.workingToColorSpace(Ln.copy(this),t);const n=Ln.r,i=Ln.g,s=Ln.b,o=Math.max(n,i,s),c=Math.min(n,i,s);let u,h;const d=(c+o)/2;if(c===o)u=0,h=0;else{const f=o-c;switch(h=d<=.5?f/(o+c):f/(2-o-c),o){case n:u=(i-s)/f+(i<s?6:0);break;
vendor: 6,371 bytes, line 1
1case i:u=(s-n)/f+2;break;case s:u=(n-i)/f+4;break}u/=6}return e.h=u,e.s=h,e.l=d,e}getRGB(e,t=Dt.workingColorSpace){return Dt.workingToColorSpace(Ln.copy(this),t),e.r=Ln.r,e.g=Ln.g,e.b=Ln.b,e}getStyle(e=$n){Dt.workingToColorSpace(Ln.copy(this),e);const t=Ln.r,n=Ln.g,i=Ln.b;return e!==$n?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(Vr),this.setHSL(Vr.h+e,Vr.s+t,Vr.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Vr),e.getHSL(Pc);const n=nl(Vr.h,Pc.h,t),i=nl(Vr.s,Pc.s,t),s=nl(Vr.l,Pc.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Ln=new Ke;Ke.NAMES=vy;class Uh{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ke(e),this.density=t}clone(){return new Uh(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Oh{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Ke(e),this.near=t,this.far=n}clone(){return new Oh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class cm extends Ot{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new mi,this.environmentIntensity=1,this.environmentRotation=new mi,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Ui=new F,vr=new F,Mf=new F,yr=new F,_o=new F,So=new F,L0=new F,bf=new F,wf=new F,Ef=new F,Tf=new jt,Af=new jt,Cf=new jt;class ei{constructor(e=new F,t=new F,n=new F){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Ui.subVectors(e,t),i.cross(Ui);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){Ui.subVectors(i,t),vr.subVectors(n,t),Mf.subVectors(e,t);const o=Ui.dot(Ui),c=Ui.dot(vr),u=Ui.dot(Mf),h=vr.dot(vr),d=vr.dot(Mf),f=o*h-c*c;if(f===0)return s.set(0,0,0),null;const m=1/f,g=(h*u-c*d)*m,x=(o*d-c*u)*m;return s.set(1-g-x,x,g)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,yr)===null?!1:yr.x>=0&&yr.y>=0&&yr.x+yr.y<=1}static getInterpolation(e,t,n,i,s,o,c,u){return this.getBarycoord(e,t,n,i,yr)===null?(u.x=0,u.y=0,"z"in u&&(u.z=0),"w"in u&&(u.w=0),null):(u.setScalar(0),u.addScaledVector(s,yr.x),u.addScaledVector(o,yr.y),u.addScaledVector(c,yr.z),u)}static getInterpolatedAttribute(e,t,n,i,s,o){return Tf.setScalar(0),Af.setScalar(0),Cf.setScalar(0),Tf.fromBufferAttribute(e,t),Af.fromBufferAttribute(e,n),Cf.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(Tf,s.x),o.addScaledVector(Af,s.y),o.addScaledVector(Cf,s.z),o}static isFrontFacing(e,t,n,i){return Ui.subVectors(n,t),vr.subVectors(e,t),Ui.cross(vr).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ui.subVectors(this.c,this.b),vr.subVectors(this.a,this.b),Ui.cross(vr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ei.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ei.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return ei.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return ei.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ei.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let o,c;_o.subVectors(i,n),So.subVectors(s,n),bf.subVectors(e,n);const u=_o.dot(bf),h=So.dot(bf);
vendor: 10,480 bytes, line 1
1if(u<=0&&h<=0)return t.copy(n);wf.subVectors(e,i);const d=_o.dot(wf),f=So.dot(wf);if(d>=0&&f<=d)return t.copy(i);const m=u*f-d*h;if(m<=0&&u>=0&&d<=0)return o=u/(u-d),t.copy(n).addScaledVector(_o,o);Ef.subVectors(e,s);const g=_o.dot(Ef),x=So.dot(Ef);if(x>=0&&g<=x)return t.copy(s);const M=g*h-u*x;if(M<=0&&h>=0&&x<=0)return c=h/(h-x),t.copy(n).addScaledVector(So,c);const _=d*x-g*f;if(_<=0&&f-d>=0&&g-x>=0)return L0.subVectors(s,i),c=(f-d)/(f-d+(g-x)),t.copy(i).addScaledVector(L0,c);const v=1/(_+M+m);return o=M*v,c=m*v,t.copy(n).addScaledVector(_o,o).addScaledVector(So,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Fn{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Oi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Oi.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Oi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,c=s.count;o<c;o++)e.isMesh===!0?e.getVertexPosition(o,Oi):Oi.fromBufferAttribute(s,o),Oi.applyMatrix4(e.matrixWorld),this.expandByPoint(Oi);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Lc.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Lc.copy(n.boundingBox)),Lc.applyMatrix4(e.matrixWorld),this.union(Lc)}const i=e.children;for(let s=0,o=i.length;s<o;s++)this.expandByObject(i[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,Oi),Oi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ra),Dc.subVectors(this.max,Ra),Mo.subVectors(e.a,Ra),bo.subVectors(e.b,Ra),wo.subVectors(e.c,Ra),Gr.subVectors(bo,Mo),Hr.subVectors(wo,bo),ps.subVectors(Mo,wo);let t=[0,-Gr.z,Gr.y,0,-Hr.z,Hr.y,0,-ps.z,ps.y,Gr.z,0,-Gr.x,Hr.z,0,-Hr.x,ps.z,0,-ps.x,-Gr.y,Gr.x,0,-Hr.y,Hr.x,0,-ps.y,ps.x,0];return!Rf(t,Mo,bo,wo,Dc)||(t=[1,0,0,0,1,0,0,0,1],!Rf(t,Mo,bo,wo,Dc))?!1:(Nc.crossVectors(Gr,Hr),t=[Nc.x,Nc.y,Nc.z],Rf(t,Mo,bo,wo,Dc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Oi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Oi).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:(_r[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_r[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_r[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_r[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_r[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_r[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_r[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_r[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_r),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const _r=[new F,new F,new F,new F,new F,new F,new F,new F],Oi=new F,Lc=new Fn,Mo=new F,bo=new F,wo=new F,Gr=new F,Hr=new F,ps=new F,Ra=new F,Dc=new F,Nc=new F,ms=new F;function Rf(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){ms.fromArray(r,s);const c=i.x*Math.abs(ms.x)+i.y*Math.abs(ms.y)+i.z*Math.abs(ms.z),u=e.dot(ms),h=t.dot(ms),d=n.dot(ms);if(Math.max(-Math.max(u,h,d),Math.min(u,h,d))>c)return!1}return!0}const wr=ib();function ib(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let u=0;u<256;++u){const h=u-127;h<-27?(n[u]=0,n[u|256]=32768,i[u]=24,i[u|256]=24):h<-14?(n[u]=1024>>-h-14,n[u|256]=1024>>-h-14|32768,i[u]=-h-1,i[u|256]=-h-1):h<=15?(n[u]=h+15<<10,n[u|256]=h+15<<10|32768,i[u]=13,i[u|256]=13):h<128?(n[u]=31744,n[u|256]=64512,i[u]=24,i[u|256]=24):(n[u]=31744,n[u|256]=64512,i[u]=13,i[u|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),c=new Uint32Array(64);for(let u=1;u<1024;++u){let h=u<<13,d=0;for(;(h&8388608)===0;)h<<=1,d-=8388608;h&=-8388609,d+=947912704,s[u]=h|d}for(let u=1024;u<2048;++u)s[u]=939524096+(u-1024<<13);for(let u=1;u<31;++u)o[u]=u<<23;o[31]=1199570944,o[32]=2147483648;for(let u=33;u<63;++u)o[u]=2147483648+(u-32<<23);o[63]=3347054592;for(let u=1;u<64;++u)u!==32&&(c[u]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:c}}function Qn(r){Math.abs(r)>65504&&ke("DataUtils.toHalfFloat(): Value out of range."),r=gt(r,-65504,65504),wr.floatView[0]=r;const e=wr.uint32View[0],t=e>>23&511;return wr.baseTable[t]+((e&8388607)>>wr.shiftTable[t])}function Wa(r){const e=r>>10;return wr.uint32View[0]=wr.mantissaTable[wr.offsetTable[e]+(r&1023)]+wr.exponentTable[e],wr.floatView[0]}class rb{static toHalfFloat(e){return Qn(e)}static fromHalfFloat(e){return Wa(e)}}const un=new F,Uc=new ge;let sb=0;class Ht{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:sb++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=hl,this.updateRanges=[],this.gpuType=Un,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Uc.fromBufferAttribute(this,t),Uc.applyMatrix3(e),this.setXY(t,Uc.x,Uc.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)un.fromBufferAttribute(this,t),un.applyMatrix3(e),this.setXYZ(t,un.x,un.y,un.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)un.fromBufferAttribute(this,t),un.applyMatrix4(e),this.setXYZ(t,un.x,un.y,un.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)un.fromBufferAttribute(this,t),un.applyNormalMatrix(e),this.setXYZ(t,un.x,un.y,un.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)un.fromBufferAttribute(this,t),un.transformDirection(e),this.setXYZ(t,un.x,un.y,un.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Wn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=wt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Wn(t,this.array)),t}setX(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Wn(t,this.array)),t}setY(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Wn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Wn(t,this.array)),t}setW(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array),i=wt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array),i=wt(i,this.array),s=wt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}
vendor: 5,424 bytes, line 1
1onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==hl&&(e.usage=this.usage),e}}class ob extends Ht{constructor(e,t,n){super(new Int8Array(e),t,n)}}class ab extends Ht{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class lb extends Ht{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class cb extends Ht{constructor(e,t,n){super(new Int16Array(e),t,n)}}class um extends Ht{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class ub extends Ht{constructor(e,t,n){super(new Int32Array(e),t,n)}}class hm extends Ht{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class hb extends Ht{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Wa(this.array[e*this.itemSize]);return this.normalized&&(t=Wn(t,this.array)),t}setX(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize]=Qn(t),this}getY(e){let t=Wa(this.array[e*this.itemSize+1]);return this.normalized&&(t=Wn(t,this.array)),t}setY(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize+1]=Qn(t),this}getZ(e){let t=Wa(this.array[e*this.itemSize+2]);return this.normalized&&(t=Wn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize+2]=Qn(t),this}getW(e){let t=Wa(this.array[e*this.itemSize+3]);return this.normalized&&(t=Wn(t,this.array)),t}setW(e,t){return this.normalized&&(t=wt(t,this.array)),this.array[e*this.itemSize+3]=Qn(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array)),this.array[e+0]=Qn(t),this.array[e+1]=Qn(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array),i=wt(i,this.array)),this.array[e+0]=Qn(t),this.array[e+1]=Qn(n),this.array[e+2]=Qn(i),this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array),i=wt(i,this.array),s=wt(s,this.array)),this.array[e+0]=Qn(t),this.array[e+1]=Qn(n),this.array[e+2]=Qn(i),this.array[e+3]=Qn(s),this}}class qe extends Ht{constructor(e,t,n){super(new Float32Array(e),t,n)}}const db=new Fn,Ia=new F,If=new F;class En{constructor(e=new F,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):db.setFromPoints(e).getCenter(n);let i=0;for(let s=0,o=e.length;s<o;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ia.subVectors(e,this.center);const t=Ia.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ia,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(If.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ia.copy(e.center).add(If)),this.expandByPoint(Ia.copy(e.center).sub(If))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let fb=0;const Ei=new yt,Pf=new Ot,Eo=new F,ui=new Fn,Pa=new Fn,Mn=new F;class xt extends lr{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:fb++}),this.uuid=fi(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(M1(e)?hm:um)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}
vendor: 16,354 bytes, line 1
1addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new bt().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ei.makeRotationFromQuaternion(e),this.applyMatrix4(Ei),this}rotateX(e){return Ei.makeRotationX(e),this.applyMatrix4(Ei),this}rotateY(e){return Ei.makeRotationY(e),this.applyMatrix4(Ei),this}rotateZ(e){return Ei.makeRotationZ(e),this.applyMatrix4(Ei),this}translate(e,t,n){return Ei.makeTranslation(e,t,n),this.applyMatrix4(Ei),this}scale(e,t,n){return Ei.makeScale(e,t,n),this.applyMatrix4(Ei),this}lookAt(e){return Pf.lookAt(e),Pf.updateMatrix(),this.applyMatrix4(Pf.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Eo).negate(),this.translate(Eo.x,Eo.y,Eo.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,s=e.length;i<s;i++){const o=e[i];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new qe(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&ke("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Fn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ot("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];ui.setFromBufferAttribute(s),this.morphTargetsRelative?(Mn.addVectors(this.boundingBox.min,ui.min),this.boundingBox.expandByPoint(Mn),Mn.addVectors(this.boundingBox.max,ui.max),this.boundingBox.expandByPoint(Mn)):(this.boundingBox.expandByPoint(ui.min),this.boundingBox.expandByPoint(ui.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&ot('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 En);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ot("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new F,1/0);return}if(e){const n=this.boundingSphere.center;if(ui.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const c=t[s];Pa.setFromBufferAttribute(c),this.morphTargetsRelative?(Mn.addVectors(ui.min,Pa.min),ui.expandByPoint(Mn),Mn.addVectors(ui.max,Pa.max),ui.expandByPoint(Mn)):(ui.expandByPoint(Pa.min),ui.expandByPoint(Pa.max))}ui.getCenter(n);let i=0;for(let s=0,o=e.count;s<o;s++)Mn.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(Mn));if(t)for(let s=0,o=t.length;s<o;s++){const c=t[s],u=this.morphTargetsRelative;for(let h=0,d=c.count;h<d;h++)Mn.fromBufferAttribute(c,h),u&&(Eo.fromBufferAttribute(e,h),Mn.add(Eo)),i=Math.max(i,n.distanceToSquared(Mn))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&ot('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){ot("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ht(new Float32Array(4*n.count),4));const o=this.getAttribute("tangent"),c=[],u=[];for(let A=0;A<n.count;A++)c[A]=new F,u[A]=new F;const h=new F,d=new F,f=new F,m=new ge,g=new ge,x=new ge,M=new F,_=new F;function v(A,R,B){h.fromBufferAttribute(n,A),d.fromBufferAttribute(n,R),f.fromBufferAttribute(n,B),m.fromBufferAttribute(s,A),g.fromBufferAttribute(s,R),x.fromBufferAttribute(s,B),d.sub(h),f.sub(h),g.sub(m),x.sub(m);const L=1/(g.x*x.y-x.x*g.y);isFinite(L)&&(M.copy(d).multiplyScalar(x.y).addScaledVector(f,-g.y).multiplyScalar(L),_.copy(f).multiplyScalar(g.x).addScaledVector(d,-x.x).multiplyScalar(L),c[A].add(M),c[R].add(M),c[B].add(M),u[A].add(_),u[R].add(_),u[B].add(_))}let S=this.groups;S.length===0&&(S=[{start:0,count:e.count}]);for(let A=0,R=S.length;A<R;++A){const B=S[A],L=B.start,V=B.count;for(let H=L,j=L+V;H<j;H+=3)v(e.getX(H+0),e.getX(H+1),e.getX(H+2))}const b=new F,E=new F,P=new F,D=new F;function N(A){P.fromBufferAttribute(i,A),D.copy(P);const R=c[A];b.copy(R),b.sub(P.multiplyScalar(P.dot(R))).normalize(),E.crossVectors(D,R);const L=E.dot(u[A])<0?-1:1;o.setXYZW(A,b.x,b.y,b.z,L)}for(let A=0,R=S.length;A<R;++A){const B=S[A],L=B.start,V=B.count;for(let H=L,j=L+V;H<j;H+=3)N(e.getX(H+0)),N(e.getX(H+1)),N(e.getX(H+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Ht(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let m=0,g=n.count;m<g;m++)n.setXYZ(m,0,0,0);const i=new F,s=new F,o=new F,c=new F,u=new F,h=new F,d=new F,f=new F;if(e)for(let m=0,g=e.count;m<g;m+=3){const x=e.getX(m+0),M=e.getX(m+1),_=e.getX(m+2);i.fromBufferAttribute(t,x),s.fromBufferAttribute(t,M),o.fromBufferAttribute(t,_),d.subVectors(o,s),f.subVectors(i,s),d.cross(f),c.fromBufferAttribute(n,x),u.fromBufferAttribute(n,M),h.fromBufferAttribute(n,_),c.add(d),u.add(d),h.add(d),n.setXYZ(x,c.x,c.y,c.z),n.setXYZ(M,u.x,u.y,u.z),n.setXYZ(_,h.x,h.y,h.z)}else for(let m=0,g=t.count;m<g;m+=3)i.fromBufferAttribute(t,m+0),s.fromBufferAttribute(t,m+1),o.fromBufferAttribute(t,m+2),d.subVectors(o,s),f.subVectors(i,s),d.cross(f),n.setXYZ(m+0,d.x,d.y,d.z),n.setXYZ(m+1,d.x,d.y,d.z),n.setXYZ(m+2,d.x,d.y,d.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Mn.fromBufferAttribute(e,t),Mn.normalize(),e.setXYZ(t,Mn.x,Mn.y,Mn.z)}toNonIndexed(){function e(c,u){const h=c.array,d=c.itemSize,f=c.normalized,m=new h.constructor(u.length*d);let g=0,x=0;for(let M=0,_=u.length;M<_;M++){c.isInterleavedBufferAttribute?g=u[M]*c.data.stride+c.offset:g=u[M]*d;for(let v=0;v<d;v++)m[x++]=h[g++]}return new Ht(m,d,f)}if(this.index===null)return ke("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new xt,n=this.index.array,i=this.attributes;for(const c in i){const u=i[c],h=e(u,n);t.setAttribute(c,h)}const s=this.morphAttributes;for(const c in s){const u=[],h=s[c];for(let d=0,f=h.length;d<f;d++){const m=h[d],g=e(m,n);u.push(g)}t.morphAttributes[c]=u}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let c=0,u=o.length;c<u;c++){const h=o[c];t.addGroup(h.start,h.count,h.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const u=this.parameters;for(const h in u)u[h]!==void 0&&(e[h]=u[h]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const u in n){const h=n[u];e.data.attributes[u]=h.toJSON(e.data)}const i={};let s=!1;for(const u in this.morphAttributes){const h=this.morphAttributes[u],d=[];for(let f=0,m=h.length;f<m;f++){const g=h[f];d.push(g.toJSON(e.data))}d.length>0&&(i[u]=d,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere=c.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const h in i){const d=i[h];this.setAttribute(h,d.clone(t))}const s=e.morphAttributes;for(const h in s){const d=[],f=s[h];for(let m=0,g=f.length;m<g;m++)d.push(f[m].clone(t));this.morphAttributes[h]=d}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let h=0,d=o.length;h<d;h++){const f=o[h];this.addGroup(f.start,f.count,f.materialIndex)}const c=e.boundingBox;c!==null&&(this.boundingBox=c.clone());const u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Fh{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=hl,this.updateRanges=[],this.version=0,this.uuid=fi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=fi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=fi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Vn=new F;class Ws{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Vn.fromBufferAttribute(this,t),Vn.applyMatrix4(e),this.setXYZ(t,Vn.x,Vn.y,Vn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Vn.fromBufferAttribute(this,t),Vn.applyNormalMatrix(e),this.setXYZ(t,Vn.x,Vn.y,Vn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Vn.fromBufferAttribute(this,t),Vn.transformDirection(e),this.setXYZ(t,Vn.x,Vn.y,Vn.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Wn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=wt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=wt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=wt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=wt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=wt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Wn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Wn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Wn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Wn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array),i=wt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=wt(t,this.array),n=wt(n,this.array),i=wt(i,this.array),s=wt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){fl("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new Ht(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 Ws(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){fl("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let pb=0;class Bn extends lr{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:pb++}),this.uuid=fi(),this.name="",this.type="Material",this.blending=Os,this.side=Cr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Cu,this.blendDst=Ru,this.blendEquation=qr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ke(0,0,0),this.blendAlpha=0,this.depthFunc=zs,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Ip,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Is,this.stencilZFail=Is,this.stencilZPass=Is,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){ke(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ke(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 15,659 bytes, line 1
1n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Os&&(n.blending=this.blending),this.side!==Cr&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Cu&&(n.blendSrc=this.blendSrc),this.blendDst!==Ru&&(n.blendDst=this.blendDst),this.blendEquation!==qr&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==zs&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Ip&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Is&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Is&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Is&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const o=[];for(const c in s){const u=s[c];delete u.metadata,o.push(u)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class dm extends Bn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ke(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let To;const La=new F,Ao=new F,Co=new F,Ro=new ge,Da=new ge,yy=new yt,Oc=new F,Na=new F,Fc=new F,D0=new ge,Lf=new ge,N0=new ge;class _y extends Ot{constructor(e=new dm){if(super(),this.isSprite=!0,this.type="Sprite",To===void 0){To=new xt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Fh(t,5);To.setIndex([0,1,2,0,2,3]),To.setAttribute("position",new Ws(n,3,0,!1)),To.setAttribute("uv",new Ws(n,2,3,!1))}this.geometry=To,this.material=e,this.center=new ge(.5,.5),this.count=1}raycast(e,t){e.camera===null&&ot('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ao.setFromMatrixScale(this.matrixWorld),yy.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Co.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Ao.multiplyScalar(-Co.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const o=this.center;Bc(Oc.set(-.5,-.5,0),Co,o,Ao,i,s),Bc(Na.set(.5,-.5,0),Co,o,Ao,i,s),Bc(Fc.set(.5,.5,0),Co,o,Ao,i,s),D0.set(0,0),Lf.set(1,0),N0.set(1,1);let c=e.ray.intersectTriangle(Oc,Na,Fc,!1,La);if(c===null&&(Bc(Na.set(-.5,.5,0),Co,o,Ao,i,s),Lf.set(0,1),c=e.ray.intersectTriangle(Oc,Fc,Na,!1,La),c===null))return;const u=e.ray.origin.distanceTo(La);u<e.near||u>e.far||t.push({distance:u,point:La.clone(),uv:ei.getInterpolation(La,Oc,Na,Fc,D0,Lf,N0,new ge),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Bc(r,e,t,n,i,s){Ro.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(Da.x=s*Ro.x-i*Ro.y,Da.y=i*Ro.x+s*Ro.y):Da.copy(Ro),r.copy(e),r.x+=Da.x,r.y+=Da.y,r.applyMatrix4(yy)}const kc=new F,U0=new F;class Sy extends Ot{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let s;for(s=0;s<i.length&&!(t<i[s].distance);s++);return i.splice(s,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let s=t[n].distance;if(t[n].object.visible&&(s-=s*t[n].hysteresis),e<s)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){kc.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(kc);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){kc.setFromMatrixPosition(e.matrixWorld),U0.setFromMatrixPosition(this.matrixWorld);const n=kc.distanceTo(U0)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s;i++){let o=t[i].distance;if(t[i].object.visible&&(o-=o*t[i].hysteresis),n>=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const Sr=new F,Df=new F,zc=new F,Wr=new F,Nf=new F,Vc=new F,Uf=new F;class qs{constructor(e=new F,t=new F(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Sr)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Sr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Sr.copy(this.origin).addScaledVector(this.direction,t),Sr.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Df.copy(e).add(t).multiplyScalar(.5),zc.copy(t).sub(e).normalize(),Wr.copy(this.origin).sub(Df);const s=e.distanceTo(t)*.5,o=-this.direction.dot(zc),c=Wr.dot(this.direction),u=-Wr.dot(zc),h=Wr.lengthSq(),d=Math.abs(1-o*o);let f,m,g,x;if(d>0)if(f=o*u-c,m=o*c-u,x=s*d,f>=0)if(m>=-x)if(m<=x){const M=1/d;f*=M,m*=M,g=f*(f+o*m+2*c)+m*(o*f+m+2*u)+h}else m=s,f=Math.max(0,-(o*m+c)),g=-f*f+m*(m+2*u)+h;else m=-s,f=Math.max(0,-(o*m+c)),g=-f*f+m*(m+2*u)+h;else m<=-x?(f=Math.max(0,-(-o*s+c)),m=f>0?-s:Math.min(Math.max(-s,-u),s),g=-f*f+m*(m+2*u)+h):m<=x?(f=0,m=Math.min(Math.max(-s,-u),s),g=m*(m+2*u)+h):(f=Math.max(0,-(o*s+c)),m=f>0?s:Math.min(Math.max(-s,-u),s),g=-f*f+m*(m+2*u)+h);else m=o>0?-s:s,f=Math.max(0,-(o*m+c)),g=-f*f+m*(m+2*u)+h;return n&&n.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(Df).addScaledVector(zc,m),g}intersectSphere(e,t){Sr.subVectors(e.center,this.origin);const n=Sr.dot(this.direction),i=Sr.dot(Sr)-n*n,s=e.radius*e.radiu
vendor: 5,405 bytes, line 1
1s;if(i>s)return null;const o=Math.sqrt(s-i),c=n-o,u=n+o;return u<0?null:c<0?this.at(u,t):this.at(c,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,o,c,u;const h=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,m=this.origin;return h>=0?(n=(e.min.x-m.x)*h,i=(e.max.x-m.x)*h):(n=(e.max.x-m.x)*h,i=(e.min.x-m.x)*h),d>=0?(s=(e.min.y-m.y)*d,o=(e.max.y-m.y)*d):(s=(e.max.y-m.y)*d,o=(e.min.y-m.y)*d),n>o||s>i||((s>n||isNaN(n))&&(n=s),(o<i||isNaN(i))&&(i=o),f>=0?(c=(e.min.z-m.z)*f,u=(e.max.z-m.z)*f):(c=(e.max.z-m.z)*f,u=(e.min.z-m.z)*f),n>u||c>i)||((c>n||n!==n)&&(n=c),(u<i||i!==i)&&(i=u),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Sr)!==null}intersectTriangle(e,t,n,i,s){Nf.subVectors(t,e),Vc.subVectors(n,e),Uf.crossVectors(Nf,Vc);let o=this.direction.dot(Uf),c;if(o>0){if(i)return null;c=1}else if(o<0)c=-1,o=-o;else return null;Wr.subVectors(this.origin,e);const u=c*this.direction.dot(Vc.crossVectors(Wr,Vc));if(u<0)return null;const h=c*this.direction.dot(Nf.cross(Wr));if(h<0||u+h>o)return null;const d=-c*Wr.dot(Uf);return d<0?null:this.at(d/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)}}class ns extends Bn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ke(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mi,this.combine=Ml,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const O0=new yt,gs=new qs,Gc=new En,F0=new F,Hc=new F,Wc=new F,jc=new F,Of=new F,Xc=new F,B0=new F,Yc=new F;class dn extends Ot{constructor(e=new xt,t=new ns){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const c=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const c=this.morphTargetInfluences;if(s&&c){Xc.set(0,0,0);for(let u=0,h=s.length;u<h;u++){const d=c[u],f=s[u];d!==0&&(Of.fromBufferAttribute(f,e),o?Xc.addScaledVector(Of,d):Xc.addScaledVector(Of.sub(t),d))}t.add(Xc)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Gc.copy(n.boundingSphere),Gc.applyMatrix4(s),gs.copy(e.ray).recast(e.near),!(Gc.containsPoint(gs.origin)===!1&&(gs.intersectSphere(Gc,F0)===null||gs.origin.distanceToSquared(F0)>(e.far-e.near)**2))&&(O0.copy(s).invert(),gs.copy(e.ray).applyMatrix4(O0),!(n.boundingBox!==null&&gs.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,gs)))}_computeIntersections(e,t,n){let i;const s=this.geometry,o=this.material,c=s.index,u=s.attributes.position,h=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,m=s.groups,g=s.drawRange;if(c!==null)if(Array.isArray(o))for(let x=0,M=m.length;x<M;x++){const _=m[x],v=o[_.materialIndex],S=Math.max(_.start,g.start),b=Math.min(c.count,Math.min(_.start+_.count,g.start+g.count));for(let E=S,P=b;E<P;E+=3){const D=c.getX(E),N=c.getX(E+1),A=c.getX(E+2);i=qc(this,v,e,n,h,d,f,D,N,A),i&&(i.faceIndex=Math.floor(E/3),i.face.materialIndex=_.materialIndex,t.push(i))}}else{const x=Math.max(0,g.start),M=Math.min(c.count,g.start+g.count);for(let _=x,v=M;_<v;_+=3){const S=c.getX(_),b=c.getX(_+1),E=c.getX(_+2);
vendor: 1,224 bytes, line 1
1i=qc(this,o,e,n,h,d,f,S,b,E),i&&(i.faceIndex=Math.floor(_/3),t.push(i))}}else if(u!==void 0)if(Array.isArray(o))for(let x=0,M=m.length;x<M;x++){const _=m[x],v=o[_.materialIndex],S=Math.max(_.start,g.start),b=Math.min(u.count,Math.min(_.start+_.count,g.start+g.count));for(let E=S,P=b;E<P;E+=3){const D=E,N=E+1,A=E+2;i=qc(this,v,e,n,h,d,f,D,N,A),i&&(i.faceIndex=Math.floor(E/3),i.face.materialIndex=_.materialIndex,t.push(i))}}else{const x=Math.max(0,g.start),M=Math.min(u.count,g.start+g.count);for(let _=x,v=M;_<v;_+=3){const S=_,b=_+1,E=_+2;i=qc(this,o,e,n,h,d,f,S,b,E),i&&(i.faceIndex=Math.floor(_/3),t.push(i))}}}}function mb(r,e,t,n,i,s,o,c){let u;if(e.side===jn?u=n.intersectTriangle(o,s,i,!0,c):u=n.intersectTriangle(i,s,o,e.side===Cr,c),u===null)return null;Yc.copy(c),Yc.applyMatrix4(r.matrixWorld);const h=t.ray.origin.distanceTo(Yc);return h<t.near||h>t.far?null:{distance:h,point:Yc.clone(),object:r}}function qc(r,e,t,n,i,s,o,c,u,h){r.getVertexPosition(c,Hc),r.getVertexPosition(u,Wc),r.getVertexPosition(h,jc);const d=mb(r,e,t,n,Hc,Wc,jc,B0);if(d){const f=new F;ei.getBarycoord(B0,Hc,Wc,jc,f),i&&(d.uv=ei.getInterpolatedAttribute(i,c,u,h,f,new ge)),s&&(d.uv1=ei.getInterpolatedAttribute(s,c,u,h,f,new ge)),o&&(
vendor: 9,920 bytes, line 1
1d.normal=ei.getInterpolatedAttribute(o,c,u,h,f,new F),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));const m={a:c,b:u,c:h,normal:new F,materialIndex:0};ei.getNormal(Hc,Wc,jc,m.normal),d.face=m,d.barycoord=f}return d}const k0=new F,z0=new jt,V0=new jt,gb=new F,G0=new yt,Zc=new F,Ff=new En,H0=new yt,Bf=new qs;class My extends dn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Cp,this.bindMatrix=new yt,this.bindMatrixInverse=new yt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Fn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Zc),this.boundingBox.expandByPoint(Zc)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new En),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Zc),this.boundingSphere.expandByPoint(Zc)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ff.copy(this.boundingSphere),Ff.applyMatrix4(i),e.ray.intersectsSphere(Ff)!==!1&&(H0.copy(i).invert(),Bf.copy(e.ray).applyMatrix4(H0),!(this.boundingBox!==null&&Bf.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Bf)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new jt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Cp?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===ny?this.bindMatrixInverse.copy(this.bindMatrix).invert():ke("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;z0.fromBufferAttribute(i.attributes.skinIndex,e),V0.fromBufferAttribute(i.attributes.skinWeight,e),k0.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=V0.getComponent(s);if(o!==0){const c=z0.getComponent(s);G0.multiplyMatrices(n.bones[c].matrixWorld,n.boneInverses[c]),t.addScaledVector(gb.copy(k0).applyMatrix4(G0),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class fm extends Ot{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Vi extends rn{constructor(e=null,t=1,n=1,i,s,o,c,u,h=an,d=an,f,m){super(null,o,c,u,h,d,i,s,f,m),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const W0=new yt,xb=new yt;class Bh{constructor(e=[],t=[]){this.uuid=fi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){ke("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new yt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new yt;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const c=e[s]?e[s].matrixWorld:xb;W0.multiplyMatrices(c,t[s]),W0.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Bh(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Vi(t,e,e,On,Un);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let o=t[s];o===void 0&&(ke("Skeleton: No bone found with UUID:",s),o=new fm),this.bones.push(o),this.boneInverses.push(new yt().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const o=t[i];e.bones.push(o.uuid);const c=n[i];e.boneInverses.push(c.toArray())}return e}}class Ko extends Ht{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Io=new yt,j0=new yt,Jc=[],X0=new Fn,vb=new yt,Ua=new dn,Oa=new En;class by extends dn{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Ko(new Float32Array(n*16),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,vb)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Fn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Io),X0.copy(e.boundingBox).applyMatrix4(Io),this.boundingBox.union(X0)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new En),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Io),Oa.copy(e.boundingSphere).applyMatrix4(Io),this.boundingSphere.union(Oa)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.previousInstanceMatrix!==null&&(this.previousInstanceMatrix=e.previousInstanceMatrix.clone()),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,s=n.length+1,o=e*s+1;for(let c=0;c<n.length;c++)n[c]=i[o+c]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Ua.geometry=this.geometry,Ua.material=this.material,Ua.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Oa.copy(this.boundingSphere),Oa.applyMatrix4(n),e.ray.intersectsSphere(Oa)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,Io),j0.multiplyMatrices(n,Io),Ua.matrixWorld=j0,Ua.raycast(e,Jc);for(let o=0,c=Jc.length;o<c;o++){const u=Jc[o];u.instanceId=s,u.object=this,t.push(u)}Jc.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Ko(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new Vi(new Float32Array(i*this.count),i,this.count,Ah,Un));const s=this.morphTexture.source.data.data;let o=0;for(let h=0;h<n.length;h++)o+=n[h];const c=this.geometry.morphTargetsRelative?1:1-o,u=i*e;s[u]=c,s.set(n,u+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const kf=new F,yb=new F,_b=new bt;class Bi{constructor(e=new F(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=kf.subVectors(n,t).cross(yb.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(kf),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;
1const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||_b.getNormalMatrix(e),i=this.coplanarPoint(kf).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const xs=new En,Sb=new ge(.5,.5),Kc=new F;class na{constructor(e=new Bi,t=new Bi,n=new Bi,i=new Bi,s=new Bi,o=new Bi){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(n),c[3].copy(i),c[4].copy(s),c[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=di,n=!1){const i=this.planes,s=e.elements,o=s[0],c=s[1],u=s[2],h=s[3],d=s[4],f=s[5],m=s[6],g=s[7],x=s[8],M=s[9],_=s[10],v=s[11],S=s[12],b=s[13],E=s[14],P=s[15];if(i[0].setComponents(h-o,g-d,v-x,P-S).normalize(),i[1].setComponents(h+o,g+d,v+x,P+S).normalize(),i[2].setComponents(h+c,g+f,v+M,P+b).normalize(),i[3].setComponents(h-c,g-f,v-M,P-b).normalize(),n)i[4].setComponents(u,m,_,E).normalize(),i[5].setComponents(h-u,g-m,v-_,P-E).normalize();else if(i[4].setComponents(h-u,g-m,v-_,P-E).normalize(),t===di)i[5].setComponents(h+u,g+m,v+_,P+E).normalize();else if(t===Hs)i[5].setComponents(u,m,_,E).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),xs.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),xs.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(xs)}intersectsSprite(e){xs.center.set(0,0,0);const t=Sb.distanceTo(e.center);return xs.radius=.7071067811865476+t,xs.applyMatrix4(e.matrixWorld),this.intersectsSphere(xs)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Kc.x=i.normal.x>0?e.max.x:e.min.x,Kc.y=i.normal.y>0?e.max.y:e.min.y,Kc.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Kc)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const $i=new yt,er=new na;class kh{constructor(){this.coordinateSystem=di}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if($i.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),er.setFromProjectionMatrix($i,i.coordinateSystem,i.reversedDepth),er.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if($i.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),er.setFromProjectionMatrix($i,i.coordinateSystem,i.reversedDepth),er.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if($i.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),er.setFromProjectionMatrix($i,i.coordinateSystem,i.reversedDepth),er.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if($i.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),er.setFromProjectionMatrix($i,i.coordinateSystem,i.reversedDepth),er.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let n=0;n<t.cameras.length;n++){const i=t.cameras[n];if($i.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),er.setFromProjectionMatrix($i,i.coordinateSystem,i.reversedDepth),er.containsPoint(e))return!0}return!1}clone(){return new kh}}function zf(r,e){return r-e}function Mb(r,e){return r.z-e.z}function bb(r,e){return e.z-r.z}class wb{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const s=this.pool,o=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const c=s[this.index];o.push(c),this.index++,c.start=e,c.count=t,c.z=n,c.index=i}reset(){this.list.length=0,this.index=0}}const Kn=new yt,Eb=new Ke(1,1,1),Y0=new na,Tb=new kh,Qc=new Fn,vs=new En,Fa=new F,q0=new F,Ab=new F,Vf=new wb,Dn=new dn,$c=[];function Cb(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let s=0;s<i;s++)for(let o=0;o<n;o++)e.setComponent(s+t,o,r.getComponent(s,o))}else e.array.set(r.array,t*n);e.needsUpdate=!0}function ys(r,e){if(r.constructor!==e.constructor){const t=Math.min(r.length,e.length);for(let n=0;n<t;n++)e[n]=r[n]}else{const t=Math.min(r.length,e.length);e.set(new r.constructor(r.buffer,0,t))}}class wy extends dn{constructor(e,t,n=t*2,i){super(new xt,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Vi(t,e,e,On,Un);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new Vi(t,e,e,bl,Ri);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new Vi(t,e,e,On,Un);
1n.colorSpace=Dt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const o=e.getAttribute(s),{array:c,itemSize:u,normalized:h}=o,d=new c.constructor(n*u),f=new Ht(d,u,h);t.setAttribute(s,f)}if(e.getIndex()!==null){const s=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Ht(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),s=t.getAttribute(n);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Fn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,Kn),this.getBoundingBoxAt(s,Qc).applyMatrix4(Kn),e.union(Qc)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new En);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,Kn),this.getBoundingSphereAt(s,vs).applyMatrix4(Kn),e.union(vs)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(zf),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const s=this._matricesTexture;Kn.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(Eb.toArray(o.image.data,i*4),o.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const o=e.getIndex();if(o!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?o.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let u;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(zf),u=this._availableGeometryIds.shift(),s[u]=i):(u=this._geometryCount,this._geometryCount++,s.push(i)),this.setGeometryAt(u,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,u}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,s=n.getIndex(),o=t.getIndex(),c=this._geometryInfo[e];if(i&&o.count>c.reservedIndexCount||t.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const u=c.vertexStart,h=c.reservedVertexCount;c.vertexCount=t.getAttribute("position").count;for(const d in n.attributes){const f=t.getAttribute(d),m=n.getAttribute(d);Cb(f,m,u);const g=f.itemSize;
1for(let x=f.count,M=h;x<M;x++){const _=u+x;for(let v=0;v<g;v++)m.setComponent(_,v,0)}m.needsUpdate=!0,m.addUpdateRange(u*g,h*g)}if(i){const d=c.indexStart,f=c.reservedIndexCount;c.indexCount=t.getIndex().count;for(let m=0;m<o.count;m++)s.setX(d+m,u+o.getX(m));for(let m=o.count,g=f;m<g;m++)s.setX(d+m,u);s.needsUpdate=!0,s.addUpdateRange(d,c.reservedIndexCount)}return c.start=i?c.indexStart:c.vertexStart,c.count=i?c.indexCount:c.vertexCount,c.boundingBox=null,t.boundingBox!==null&&(c.boundingBox=t.boundingBox.clone()),c.boundingSphere=null,t.boundingSphere!==null&&(c.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,s=n.length;i<s;i++)n[i].active&&n[i].geometryIndex===e&&this.deleteInstance(i);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,i=n.map((o,c)=>c).sort((o,c)=>n[o].vertexStart-n[c].vertexStart),s=this.geometry;for(let o=0,c=n.length;o<c;o++){const u=i[o],h=n[u];if(h.active!==!1){if(s.index!==null){if(h.indexStart!==t){const{indexStart:d,vertexStart:f,reservedIndexCount:m}=h,g=s.index,x=g.array,M=e-f;for(let _=d;_<d+m;_++)x[_]=x[_]+M;g.array.copyWithin(t,d,d+m),g.addUpdateRange(t,m),g.needsUpdate=!0,h.indexStart=t}t+=h.reservedIndexCount}if(h.vertexStart!==e){const{vertexStart:d,reservedVertexCount:f}=h,m=s.attributes;for(const g in m){const x=m[g],{array:M,itemSize:_}=x;M.copyWithin(e*_,d*_,(d+f)*_),x.addUpdateRange(e*_,f*_),x.needsUpdate=!0}h.vertexStart=e}e+=h.reservedVertexCount,h.start=s.index?h.indexStart:h.vertexStart}}return this._nextIndexStart=t,this._nextVertexStart=e,this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const s=new Fn,o=n.index,c=n.attributes.position;for(let u=i.start,h=i.start+i.count;u<h;u++){let d=u;o&&(d=o.getX(d)),s.expandByPoint(Fa.fromBufferAttribute(c,d))}i.boundingBox=s}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const s=new En;this.getBoundingBoxAt(e,Qc),Qc.getCenter(s.center);const o=n.index,c=n.attributes.position;let u=0;for(let h=i.start,d=i.start+i.count;h<d;h++){let f=h;o&&(f=o.getX(f)),Fa.fromBufferAttribute(c,f),u=Math.max(u,s.center.distanceToSquared(Fa))}s.radius=Math.sqrt(u),i.boundingSphere=s}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(this._instanceInfo[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(zf);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),s=new Int32Array(e);ys(this._multiDrawCounts,i),ys(this._multiDrawStarts,s),this._multiDrawCounts=i,this._multiDrawStarts=s,this._maxInstanceCount=e;const o=this._indirectTexture,c=this._matricesTexture,u=this._colorsTexture;o.dispose(),this._initIndirectTexture(),ys(o.image.data,this._indirectTexture.image.data),c.dispose(),this._initMatricesTexture(),ys(c.image.data,this._matricesTexture.image.data),u&&(u.dispose(),this._initColorsTexture(),ys(u.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(c=>c.active);if(Math.max(...n.map(c=>c.vertexStart+c.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(u=>u.indexStart+u.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new xt,this._initializeGeometry(s));const o=this.geometry;s.index&&ys(s.index.array,o.index.array);for(const c in s.attributes)ys(s.attributes[c].array,o.attributes[c].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,o=this.geometry;Dn.material=this.material,Dn.geometry.index=o.index,Dn.geometry.attributes=o.attributes,Dn.geometry.boundingBox===null&&(Dn.geometry.boundingBox=new Fn),Dn.geometry.boundingSphere===null&&(Dn.geometry.boundingSphere=new En);for(let c=0,u=n.length;c<u;c++){if(!n[c].visible||!n[c].active)continue;const h=n[c].geometryIndex,d=i[h];Dn.geometry.setDrawRange(d.start,d.count),this.getMatrixAt(c,Dn.matrixWorld).premultiply(s),this.getBoundingBoxAt(h,Dn.geometry.boundingBox),this.getBoundingSphereAt(h,Dn.geometry.boundingSphere),Dn.raycast(e,$c);for(let f=0,m=$c.length;f<m;f++){const g=$c[f];g.object=this,g.batchId=c,t.push(g)}$c.length=0}Dn.material=null,Dn.geometry.index=null,Dn.geometry.attributes={},Dn.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex();let c=o===null?1:o.array.BYTES_PER_ELEMENT,u=1;s.wireframe&&(u=2,c=i.attributes.position.count>65535?4:2);const h=this._instanceInfo,d=this._multiDrawStarts,f=this._multiDrawCounts,m=this._geometryInfo,g=this.perObjectFrustumCulled,x=this._indirectTexture,M=x.image.data,_=n.isArrayCamera?Tb:Y0;g&&!n.isArrayCamera&&(Kn.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Y0.setFromProjectionMatrix(Kn,n.coordinateSystem,n.reversedDepth));let v=0;if(this.sortObjects){Kn.copy(this.matrixWorld).invert(),Fa.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Kn),q0.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Kn);for(let E=0,P=h.length;E<P;E++)if(h[E].visible&&h[E].active){const D=h[E].geometryIndex;this.getMatrixAt(E,Kn),this.getBoundingSphereAt(D,vs).applyMatrix4(Kn);let N=!1;if(g&&(N=!_.intersectsSphere(vs,n)),!N){const A=m[D],R=Ab.subVectors(vs.center,Fa).dot(q0);Vf.push(A.start,A.count,R,E)}}const S=Vf.list,b=this.customSort;b===null?S.sort(s.transparent?bb:Mb):b.call(this,S,n);for(let E=0,P=S.length;E<P;E++){const D=S[E];d[v]=D.start*c*u,f[v]=D.count*u,M[v]=D.index,v++}Vf.reset()}else for(let S=0,b=h.length;S<b;S++)if(h[S].visible&&h[S].active){const E=h[S].geometryIndex;let P=!1;if(g&&(this.getMatrixAt(S,Kn),this.getBoundingSphereAt(E,vs).applyMatrix4(Kn),P=!_.intersectsSphere(vs,n)),!P){const D=m[E];d[v]=D.start*c*u,f[v]=D.count*u,M[v]=S,v++}}x.needsUpdate=!0,this._multiDrawCount=v,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,s,o){this.onBeforeRender(e,null,i,s,o)}}class Xn extends Bn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ke(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const gh=new F,xh=new F,Z0=new yt,Ba=new qs,eu=new En,Gf=new F,J0=new F;class es extends Ot{constructor(e=new xt,t=new Xn){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)gh.fromBufferAttribute(t,i-1),xh.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=gh.distanceTo(xh);e.setAttribute("lineDistance",new qe(n,1))}else ke("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),eu.copy(n.boundingSphere),eu.applyMatrix4(i),eu.radius+=s,e.ray.intersectsSphere(eu)===!1)return;Z0.copy(i).invert(),Ba.copy(e.ray).applyMatrix4(Z0);const c=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=c*c,h=this.isLineSegments?2:1,d=n.index,m=n.attributes.position;if(d!==null){const g=Math.max(0,o.start),x=Math.min(d.count,o.start+o.count);for(let M=g,_=x-1;M<_;M+=h){const v=d.getX(M),S=d.getX(M+1),b=tu(this,e,Ba,u,v,S,M);b&&t.push(b)}if(this.isLineLoop){const M=d.getX(x-1),_=d.getX(g),v=tu(this,e,Ba,u,M,_,x-1);v&&t.push(v)}}else{const g=Math.max(0,o.start),x=Math.min(m.count,o.start+o.count);for(let M=g,_=x-1;M<_;M+=h){const v=tu(this,e,Ba,u,M,M+1,M);v&&t.push(v)}if(this.isLineLoop){const M=tu(this,e,Ba,u,x-1,g,x-1);M&&t.push(M)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const c=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}}function tu(r,e,t,n,i,s,o){const c=r.geometry.attributes.position;if(gh.fromBufferAttribute(c,i),xh.fromBufferAttribute(c,s),t.distanceSqToSegment(gh,xh,Gf,J0)>n)return;
vendor: 6,292 bytes, line 1
1Gf.applyMatrix4(r.matrixWorld);const h=e.ray.origin.distanceTo(Gf);if(!(h<e.near||h>e.far))return{distance:h,point:J0.clone().applyMatrix4(r.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:r}}const K0=new F,Q0=new F;class cr extends es{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)K0.fromBufferAttribute(t,i),Q0.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+K0.distanceTo(Q0);e.setAttribute("lineDistance",new qe(n,1))}else ke("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Ey extends es{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class pm extends Bn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ke(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const $0=new yt,Lp=new qs,nu=new En,iu=new F;class Ty extends Ot{constructor(e=new xt,t=new pm){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),nu.copy(n.boundingSphere),nu.applyMatrix4(i),nu.radius+=s,e.ray.intersectsSphere(nu)===!1)return;$0.copy(i).invert(),Lp.copy(e.ray).applyMatrix4($0);const c=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=c*c,h=n.index,f=n.attributes.position;if(h!==null){const m=Math.max(0,o.start),g=Math.min(h.count,o.start+o.count);for(let x=m,M=g;x<M;x++){const _=h.getX(x);iu.fromBufferAttribute(f,_),ex(iu,_,u,i,e,t,this)}}else{const m=Math.max(0,o.start),g=Math.min(f.count,o.start+o.count);for(let x=m,M=g;x<M;x++)iu.fromBufferAttribute(f,x),ex(iu,x,u,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const c=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}}function ex(r,e,t,n,i,s,o){const c=Lp.distanceSqToPoint(r);if(c<t){const u=new F;Lp.closestPointToPoint(r,u),u.applyMatrix4(n);const h=i.ray.origin.distanceTo(u);if(h<i.near||h>i.far)return;s.push({distance:h,distanceToRay:Math.sqrt(c),point:u,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class Ay extends rn{constructor(e,t,n,i,s=Xt,o=Xt,c,u,h){super(e,t,n,i,s,o,c,u,h),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const d=this;function f(){d.needsUpdate=!0,d._requestVideoFrameCallbackId=e.requestVideoFrameCallback(f)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(f))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class Rb extends Ay{constructor(e,t,n,i,s,o,c,u){super({},e,t,n,i,s,o,c,u),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class Ib extends rn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=an,this.minFilter=an,this.generateMipmaps=!1,this.needsUpdate=!0}}class zh extends rn{constructor(e,t,n,i,s,o,c,u,h,d,f,m){super(null,o,c,u,h,d,i,s,f,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Pb extends zh{constructor(e,t,n,i,s,o){super(e,t,n,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=ti,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Lb extends zh{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,or),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class wl extends rn{constructor(e=[],t=or,n,i,s,o,c,u,h,d){super(e,t,n,i,s,o,c,u,h,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Db extends rn{constructor(e,t,n,i,s,o,c,u,h){super(e,t,n,i,s,o,c,u,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class js extends rn{constructor(e,t,n=Ri,i,s,o,c=an,u=an,h,d=ar,f=1){if(d!==ar&&d!==Zr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:t,depth:f};super(m,i,s,o,c,u,d,n,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Jr(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Cy extends js{constructor(e,t=Ri,n=or,i,s,o=an,c=an,u,h=ar){const d={width:e,height:e,depth:1},f=[d,d,d,d,d,d];super(e,e,t,n,i,s,o,c,u,h),this.image=f,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class mm extends rn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Zs extends xt{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const c=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const u=[],h=[],d=[],f=[];let m=0,g=0;x("z","y","x",-1,-1,n,t,e,o,s,0),x("z","y","x",1,-1,n,t,-e,o,s,1
vendor: 4,189 bytes, line 1
1),x("x","z","y",1,1,e,n,t,i,o,2),x("x","z","y",1,-1,e,n,-t,i,o,3),x("x","y","z",1,-1,e,t,n,i,s,4),x("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(u),this.setAttribute("position",new qe(h,3)),this.setAttribute("normal",new qe(d,3)),this.setAttribute("uv",new qe(f,2));function x(M,_,v,S,b,E,P,D,N,A,R){const B=E/N,L=P/A,V=E/2,H=P/2,j=D/2,X=N+1,q=A+1;let Y=0,J=0;const te=new F;for(let oe=0;oe<q;oe++){const ce=oe*L-H;for(let ve=0;ve<X;ve++){const Ae=ve*B-V;te[M]=Ae*S,te[_]=ce*b,te[v]=j,h.push(te.x,te.y,te.z),te[M]=0,te[_]=0,te[v]=D>0?1:-1,d.push(te.x,te.y,te.z),f.push(ve/N),f.push(1-oe/A),Y+=1}}for(let oe=0;oe<A;oe++)for(let ce=0;ce<N;ce++){const ve=m+ce+X*oe,Ae=m+ce+X*(oe+1),dt=m+(ce+1)+X*(oe+1),vt=m+(ce+1)+X*oe;u.push(ve,Ae,vt),u.push(Ae,dt,vt),J+=6}c.addGroup(g,J,R),g+=J,m+=Y}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Zs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Vh extends xt{constructor(e=1,t=1,n=4,i=8,s=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:i,heightSegments:s},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),s=Math.max(1,Math.floor(s));const o=[],c=[],u=[],h=[],d=t/2,f=Math.PI/2*e,m=t,g=2*f+m,x=n*2+s,M=i+1,_=new F,v=new F;for(let S=0;S<=x;S++){let b=0,E=0,P=0,D=0;if(S<=n){const R=S/n,B=R*Math.PI/2;E=-d-e*Math.cos(B),P=e*Math.sin(B),D=-e*Math.cos(B),b=R*f}else if(S<=n+s){const R=(S-n)/s;E=-d+R*t,P=e,D=0,b=f+R*m}else{const R=(S-n-s)/n,B=R*Math.PI/2;E=d+e*Math.sin(B),P=e*Math.cos(B),D=e*Math.sin(B),b=f+m+R*f}const N=Math.max(0,Math.min(1,b/g));let A=0;S===0?A=.5/i:S===x&&(A=-.5/i);for(let R=0;R<=i;R++){const B=R/i,L=B*Math.PI*2,V=Math.sin(L),H=Math.cos(L);v.x=-P*H,v.y=E,v.z=P*V,c.push(v.x,v.y,v.z),_.set(-P*H,D,P*V),_.normalize(),u.push(_.x,_.y,_.z),h.push(B+A,N)}if(S>0){const R=(S-1)*M;for(let B=0;B<i;B++){const L=R+B,V=R+B+1,H=S*M+B,j=S*M+B+1;o.push(L,V,H),o.push(V,j,H)}}}this.setIndex(o),this.setAttribute("position",new qe(c,3)),this.setAttribute("normal",new qe(u,3)),this.setAttribute("uv",new qe(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Vh(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class Gh extends xt{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const s=[],o=[],c=[],u=[],h=new F,d=new ge;o.push(0,0,0),c.push(0,0,1),u.push(.5,.5);for(let f=0,m=3;f<=t;f++,m+=3){const g=n+f/t*i;h.x=e*Math.cos(g),h.y=e*Math.sin(g),o.push(h.x,h.y,h.z),c.push(0,0,1),d.x=(o[m]/e+1)/2,d.y=(o[m+1]/e+1)/2,u.push(d.x,d.y)}for(let f=1;f<=t;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new qe(o,3)),this.setAttribute("normal",new qe(c,3)),this.setAttribute("uv",new qe(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gh(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class El extends xt{constructor(e=1,t=1,n=1,i=32,s=1,o=!1,c=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:c,thetaLength:u};const h=this;i=Math.floor(i),s=Math.floor(s);const d=[],f=[],m=[],g=[];let x=0;const M=[],_=n/2;let v=0;S(),o===!1&&(e>0&&b(!0),t>0&&b(!1)),this.setIndex(d),this.setAttribute("position",new qe(f,3)),this.setAttribute("normal",new qe(m,3)),this.setAttribute("uv",new qe(g,2));function S(){const E=new F,P=new F;let D=0;const N=(t-e)/n;for(let A=0;A<=s;A++){const R=[],B=A/s,L=B*(t-e)+e;for(let V=0;V<=i;V++){const H=V/i,j=H*u+c,X=Math.sin(j),q=Math.cos(j);P.x=L*X,P.y=-B*n+_,P.z=L*q,f.push(P.x,P.y,P.z),E.set(X,N,q).normalize(),m.push(E.x,E.y,E.z),g.push(H,1-B),R.push(x++)}M.push(R)}for(let A=0;A<i;A++)for(let R=0;R<s;R++){const B=M[R][A],L=M[R+1][A],V=M[R+1][A+1],H=M[R][A+1];(e>0||R!==0)&&(d.push(B,L,H),D+=3),(t>0||R!==s-1)&&(d.push(L,V,H),D+=3)}h.addGroup(v,D,0),v+=D}function b(E){const P=x,D=new ge,N=new F;let A=0;const R=E===!0?e:t,B=E===!0?1:-1;for(let V=1;V<=i;
vendor: 13,620 bytes, line 1
1V++)f.push(0,_*B,0),m.push(0,B,0),g.push(.5,.5),x++;const L=x;for(let V=0;V<=i;V++){const j=V/i*u+c,X=Math.cos(j),q=Math.sin(j);N.x=R*q,N.y=_*B,N.z=R*X,f.push(N.x,N.y,N.z),m.push(0,B,0),D.x=X*.5+.5,D.y=q*.5*B+.5,g.push(D.x,D.y),x++}for(let V=0;V<i;V++){const H=P+V,j=L+V;E===!0?d.push(j,j+1,H):d.push(j+1,j,H),A+=3}h.addGroup(v,A,E===!0?1:2),v+=A}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new El(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Tl extends El{constructor(e=1,t=1,n=32,i=1,s=!1,o=0,c=Math.PI*2){super(0,e,t,n,i,s,o,c),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:c}}static fromJSON(e){return new Tl(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class is extends xt{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],o=[];c(i),h(n),d(),this.setAttribute("position",new qe(s,3)),this.setAttribute("normal",new qe(s.slice(),3)),this.setAttribute("uv",new qe(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function c(S){const b=new F,E=new F,P=new F;for(let D=0;D<t.length;D+=3)g(t[D+0],b),g(t[D+1],E),g(t[D+2],P),u(b,E,P,S)}function u(S,b,E,P){const D=P+1,N=[];for(let A=0;A<=D;A++){N[A]=[];const R=S.clone().lerp(E,A/D),B=b.clone().lerp(E,A/D),L=D-A;for(let V=0;V<=L;V++)V===0&&A===D?N[A][V]=R:N[A][V]=R.clone().lerp(B,V/L)}for(let A=0;A<D;A++)for(let R=0;R<2*(D-A)-1;R++){const B=Math.floor(R/2);R%2===0?(m(N[A][B+1]),m(N[A+1][B]),m(N[A][B])):(m(N[A][B+1]),m(N[A+1][B+1]),m(N[A+1][B]))}}function h(S){const b=new F;for(let E=0;E<s.length;E+=3)b.x=s[E+0],b.y=s[E+1],b.z=s[E+2],b.normalize().multiplyScalar(S),s[E+0]=b.x,s[E+1]=b.y,s[E+2]=b.z}function d(){const S=new F;for(let b=0;b<s.length;b+=3){S.x=s[b+0],S.y=s[b+1],S.z=s[b+2];const E=_(S)/2/Math.PI+.5,P=v(S)/Math.PI+.5;o.push(E,1-P)}x(),f()}function f(){for(let S=0;S<o.length;S+=6){const b=o[S+0],E=o[S+2],P=o[S+4],D=Math.max(b,E,P),N=Math.min(b,E,P);D>.9&&N<.1&&(b<.2&&(o[S+0]+=1),E<.2&&(o[S+2]+=1),P<.2&&(o[S+4]+=1))}}function m(S){s.push(S.x,S.y,S.z)}function g(S,b){const E=S*3;b.x=e[E+0],b.y=e[E+1],b.z=e[E+2]}function x(){const S=new F,b=new F,E=new F,P=new F,D=new ge,N=new ge,A=new ge;for(let R=0,B=0;R<s.length;R+=9,B+=6){S.set(s[R+0],s[R+1],s[R+2]),b.set(s[R+3],s[R+4],s[R+5]),E.set(s[R+6],s[R+7],s[R+8]),D.set(o[B+0],o[B+1]),N.set(o[B+2],o[B+3]),A.set(o[B+4],o[B+5]),P.copy(S).add(b).add(E).divideScalar(3);const L=_(P);M(D,B+0,S,L),M(N,B+2,b,L),M(A,B+4,E,L)}}function M(S,b,E,P){P<0&&S.x===1&&(o[b]=S.x-1),E.x===0&&E.z===0&&(o[b]=P/2/Math.PI+.5)}function _(S){return Math.atan2(S.z,-S.x)}function v(S){return Math.atan2(-S.y,Math.sqrt(S.x*S.x+S.z*S.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new is(e.vertices,e.indices,e.radius,e.detail)}}class Hh extends is{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Hh(e.radius,e.detail)}}const ru=new F,su=new F,Hf=new F,ou=new ei;class Ry extends xt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(Fs*t),o=e.getIndex(),c=e.getAttribute("position"),u=o?o.count:c.count,h=[0,0,0],d=["a","b","c"],f=new Array(3),m={},g=[];for(let x=0;x<u;x+=3){o?(h[0]=o.getX(x),h[1]=o.getX(x+1),h[2]=o.getX(x+2)):(h[0]=x,h[1]=x+1,h[2]=x+2);const{a:M,b:_,c:v}=ou;if(M.fromBufferAttribute(c,h[0]),_.fromBufferAttribute(c,h[1]),v.fromBufferAttribute(c,h[2]),ou.getNormal(Hf),f[0]=`${Math.round(M.x*i)},${Math.round(M.y*i)},${Math.round(M.z*i)}`,f[1]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,f[2]=`${Math.round(v.x*i)},${Math.round(v.y*i)},${Math.round(v.z*i)}`,!(f[0]===f[1]||f[1]===f[2]||f[2]===f[0]))for(let S=0;S<3;S++){const b=(S+1)%3,E=f[S],P=f[b],D=ou[d[S]],N=ou[d[b]],A=`${E}_${P}`,R=`${P}_${E}`;R in m&&m[R]?(Hf.dot(m[R].normal)<=s&&(g.push(D.x,D.y,D.z),g.push(N.x,N.y,N.z)),m[R]=null):A in m||(m[A]={index0:h[S],index1:h[b],normal:Hf.clone()})}}for(const x in m)if(m[x]){const{index0:M,index1:_}=m[x];ru.fromBufferAttribute(c,M),su.fromBufferAttribute(c,_),g.push(ru.x,ru.y,ru.z),g.push(su.x,su.y,su.z)}this.setAttribute("position",new qe(g,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Wi{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){ke("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let i=0;const s=n.length;let o;t?o=t:o=e*n[s-1];let c=0,u=s-1,h;for(;c<=u;)if(i=Math.floor(c+(u-c)/2),h=n[i]-o,h<0)c=i+1;else if(h>0)u=i-1;else{u=i;break}if(i=u,n[i]===o)return i/(s-1);const d=n[i],m=n[i+1]-d,g=(o-d)/m;return(i+g)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),c=this.getPoint(s),u=t||(o.isVector2?new ge:new F);return u.copy(c).sub(o).normalize(),u}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new F,i=[],s=[],o=[],c=new F,u=new yt;for(let g=0;g<=e;g++){const x=g/e;i[g]=this.getTangentAt(x,new F)}s[0]=new F,o[0]=new F;let h=Number.MAX_VALUE;const d=Math.abs(i[0].x),f=Math.abs(i[0].y),m=Math.abs(i[0].z);d<=h&&(h=d,n.set(1,0,0)),f<=h&&(h=f,n.set(0,1,0)),m<=h&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],c),o[0].crossVectors(i[0],s[0]);for(let g=1;g<=e;g++){if(s[g]=s[g-1].clone(),o[g]=o[g-1].clone(),c.crossVectors(i[g-1],i[g]),c.length()>Number.EPSILON){c.normalize();const x=Math.acos(gt(i[g-1].dot(i[g]),-1,1));s[g].applyMatrix4(u.makeRotationAxis(c,x))}o[g].crossVectors(i[g],s[g])}if(t===!0){let g=Math.acos(gt(s[0].dot(s[e]),-1,1));g/=e,i[0].dot(c.crossVectors(s[0],s[e]))>0&&(g=-g);for(let x=1;x<=e;x++)s[x].applyMatrix4(u.makeRotationAxis(i[x],g*x)),o[x].crossVectors(i[x],s[x])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Wh extends Wi{constructor(e=0,t=0,n=1,i=1,s=0,o=Math.PI*2,c=!1,u=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=c,this.aRotation=u}getPoint(e,t=new ge){const n=t,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const c=this.aStartAngle+e*s;let u=this.aX+this.xRadius*Math.cos(c),h=this.aY+this.yRadius*Math.sin(c);if(this.aRotation!==0){const d=Math.cos(this.aRotation),f=Math.sin(this.aRotation),m=u-this.aX,g=h-this.aY;u=m*d-g*f+this.aX,h=m*f+g*d+this.aY}return n.set(u,h)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class Iy extends Wh{constructor(e,t,n,i,s,o){super(e,t,n,n,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function gm(){let r=0,e=0,t=0,n=0;function i(s,o,c,u){r=s,e=c,t=-3*s+3*o-2*c-u,n=2*s-2*o+c+u}return{initCatmullRom:function(s,o,c,u,h){i(o,c,h*(c-s),h*(u-o))},initNonuniformCatmullRom:function(s,o,c,u,h,d,f){let m=(o-s)/h-(c-s)/(h+d)+(c-o)/d,g=(c-o)/d-(u-o)/(d+f)+(u-c)/f;m*=d,g*=d,i(o,c,m,g)},calc:function(s){const o=s*s,c=o*s;return r+e*s+t*o+n*c}}}const au=new F,Wf=new gm,jf=new gm,Xf=new gm;class Py extends Wi{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new F){const n=t,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let c=Math.floor(o),u=o-c;this.closed?c+=c>0?0:(Math.floor(Math.abs(c)/s)+1)*s:u===0&&c===s-1&&(c=s-2,u=1);let h,d;this.closed||c>0?h=i[(c-1)%s]:(au.subVectors(i[0],i[1]).add(i[0]),h=au);const f=i[c%s],m=i[(c+1)%s];if(this.closed||c+2<s?d=i[(c+2)%s]:(au.subVectors(i[s-1],i[s-2]).add(i[s-1]),d=au),this.curveType==="centripetal"||this.curveType==="chordal"){const g=this.curveType==="chordal"?.5:.25;let x=Math.pow(h.distanceToSquared(f),g),M=Math.pow(f.distanceToSquared(m),g),_=Math.pow(m.distanceToSquared(d),g);M<1e-4&&(M=1),x<1e-4&&(x=M),_<1e-4&&(_=M),Wf.initNonuniformCatmullRom(h.x,f.x,m.x,d.x,x,M,_),jf.initNonuniformCatmullRom(h.y,f.y,m.y,d.y,x,M,_),Xf.initNonuniformCatmullRom(h.z,f.z,m.z,d.z,x,M,_)}else this.curveType==="catmullrom"&&(Wf.initCatmullRom(h.x,f.x,m.x,d.x,this.tension),jf.initCatmullRom(h.y,f.y,m.y,d.y,this.tension),Xf.initCatmullRom(h.z,f.z,m.z,d.z,this.tension));return n.set(Wf.calc(u),jf.calc(u),Xf.calc(u)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new F().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function tx(r,e,t,n,i){const s=(n-e)*.5,o=(i-t)*.5,c=r*r,u=r*c;return(2*t-2*n+s+o)*u+(-3*t+3*n-2*s-o)*c+s*r+t}function Nb(r,e){const t=1-r;return t*t*e}function Ub(r,e){return 2*(1-r)*r*e}function Ob(r,e){return r*r*e}function il(r,e,t,n){return Nb(r,e)+Ub(r,t)+Ob(r,n)}function Fb(r,e){const t=1-r;return t*t*t*e}function Bb(r,e){const t=1-r;return 3*t*t*r*e}function kb(r,e){return 3*(1-r)*r*r*e}function zb(r,e){return r*r*r*e}function rl(r,e,t,n,i){return Fb(r,e)+Bb(r,t)+kb(r,n)+zb(r,i)}class xm extends Wi{constructor(e=new ge,t=new ge,n=new ge,i=new ge){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new ge){const n=t,i=this.v0,s=this.v1,o=this.v2,c=this.v3;return n.set(rl(e,i.x,s.x,o.x,c.x),rl(e,i.y,s.y,o.y,c.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Ly extends Wi{constructor(e=new F,t=new F,n=new F,i=new F){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new F){const n=t,i=this.v0,s=this.v1,o=this.v2,c=this.v3;return n.set(rl(e,i.x,s.x,o.x,c.x),rl(e,i.y,s.y,o.y,c.y),rl(e,i.z,s.z,o.z,c.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class vm extends Wi{constructor(e=new ge,t=new ge){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ge){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}
vendor: 13,952 bytes, line 1
1getTangent(e,t=new ge){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Dy extends Wi{constructor(e=new F,t=new F){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new F){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new F){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class ym extends Wi{constructor(e=new ge,t=new ge,n=new ge){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ge){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(il(e,i.x,s.x,o.x),il(e,i.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class _m extends Wi{constructor(e=new F,t=new F,n=new F){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new F){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(il(e,i.x,s.x,o.x),il(e,i.y,s.y,o.y),il(e,i.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Sm extends Wi{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ge){const n=t,i=this.points,s=(i.length-1)*e,o=Math.floor(s),c=s-o,u=i[o===0?o:o-1],h=i[o],d=i[o>i.length-2?i.length-1:o+1],f=i[o>i.length-3?i.length-1:o+2];return n.set(tx(c,u.x,h.x,d.x,f.x),tx(c,u.y,h.y,d.y,f.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new ge().fromArray(i))}return this}}var vh=Object.freeze({__proto__:null,ArcCurve:Iy,CatmullRomCurve3:Py,CubicBezierCurve:xm,CubicBezierCurve3:Ly,EllipseCurve:Wh,LineCurve:vm,LineCurve3:Dy,QuadraticBezierCurve:ym,QuadraticBezierCurve3:_m,SplineCurve:Sm});class Ny extends Wi{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new vh[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const o=i[s]-n,c=this.curves[s],u=c.getLength(),h=u===0?0:1-o/u;return c.getPointAt(h,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const o=s[i],c=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,u=o.getPoints(c);for(let h=0;h<u.length;h++){const d=u[h];n&&n.equals(d)||(t.push(d),n=d)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new vh[i.type]().fromJSON(i))}return this}}class yh extends Ny{constructor(e){super(),this.type="Path",this.currentPoint=new ge,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new vm(this.currentPoint.clone(),new ge(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new ym(this.currentPoint.clone(),new ge(e,t),new ge(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,o){const c=new xm(this.currentPoint.clone(),new ge(e,t),new ge(n,i),new ge(s,o));return this.curves.push(c),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Sm(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,o){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absarc(e+c,t+u,n,i,s,o),this}absarc(e,t,n,i,s,o){return this.absellipse(e,t,n,n,i,s,o),this}ellipse(e,t,n,i,s,o,c,u){const h=this.currentPoint.x,d=this.currentPoint.y;return this.absellipse(e+h,t+d,n,i,s,o,c,u),this}absellipse(e,t,n,i,s,o,c,u){const h=new Wh(e,t,n,i,s,o,c,u);if(this.curves.length>0){const f=h.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(h);const d=h.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Ar extends yh{constructor(e){super(e),this.uuid=fi(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new yh().fromJSON(i))}return this}}function Vb(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=Uy(r,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let c,u,h;if(n&&(s=Xb(r,e,s,t)),r.length>80*t){c=r[0],u=r[1];let d=c,f=u;for(let m=t;m<i;m+=t){const g=r[m],x=r[m+1];g<c&&(c=g),x<u&&(u=x),g>d&&(d=g),x>f&&(f=x)}h=Math.max(d-c,f-u),h=h!==0?32767/h:0}return ml(s,o,t,c,u,h,0),o}function Uy(r,e,t,n,i){let s;if(i===iw(r,e,t,n)>0)for(let o=e;o<t;o+=n)s=nx(o/n|0,r[o],r[o+1],s);else for(let o=t-n;o>=e;o-=n)s=nx(o/n|0,r[o],r[o+1],s);return s&&Qo(s,s.next)&&(xl(s),s=s.next),s}function Xs(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(Qo(t,t.next)||$t(t.prev,t,t.next)===0)){if(xl(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function ml(r,e,t,n,i,s,o){if(!r)return;!o&&s&&Kb(r,n,i,s);let c=r;for(;r.prev!==r.next;){const u=r.prev,h=r.next;if(s?Hb(r,n,i,s):Gb(r)){e.push(u.i,r.i,h.i),xl(r),r=h.next,c=h.next;continue}if(r=h,r===c){o?o===1?(r=Wb(Xs(r),e),ml(r,e,t,n,i,s,2)):o===2&&jb(r,e,t,n,i,s):ml(Xs(r),e,t,n,i,s,1);break}}}function Gb(r){const e=r.prev,t=r,n=r.next;if($t(e,t,n)>=0)return!1;const i=e.x,s=t.x,o=n.x,c=e.y,u=t.y,h=n.y,d=Math.min(i,s,o),f=Math.min(c,u,h),m=Math.max(i,s,o),g=Math.max(c,u,h);let x=n.next;for(;x!==e;){if(x.x>=d&&x.x<=m&&x.y>=f&&x.y<=g&&ja(i,c,s,u,o,h,x.x,x.y)&&$t(x.prev,x,x.next)>=0)return!1;x=x.next}return!0}function Hb(r,e,t,n){const i=r.prev,s=r,o=r.next;if($t(i,s,o)>=0)return!1;const c=i.x,u=s.x,h=o.x,d=i.y,f=s.y,m=o.y,g=Math.min(c,u,h),x=Math.min(d,f,m),M=Math.max(c,u,h),_=Math.max(d,f,m),v=Dp(g,x,e,t,n),S=Dp(M,_,e,t,n);let b=r.prevZ,E=r.nextZ;for(;b&&b.z>=v&&E&&E.z<=S;){if(b.x>=g&&b.x<=M&&b.y>=x&&b.y<=_&&b!==i&&b!==o&&ja(c,d,u,f,h,m,b.x,b.y)&&$t(b.prev,b,b.next)>=0||(b=b.prevZ,E.x>=g&&E.x<=M&&E.y>=x&&E.y<=_&&E!==i&&E!==o&&ja(c,d,u,f,h,m,E.x,E.y)&&$t(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;b&&b.z>=v;){if(b.x>=g&&b.x<=M&&b.y>=x&&b.y<=_&&b!==i&&b!==o&&ja(c,d,u,f,h,m,b.x,b.y)&&$t(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;E&&E.z<=S;){if(E.x>=g&&E.x<=M&&E.y>=x&&E.y<=_&&E!==i&&E!==o&&ja(c,d,u,f,h,m,E.x,E.y)&&$t(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function Wb(r,e){let t=r;do{const n=t.prev,i=t.next.next;!Qo(n,i)&&Fy(n,t,t.next,i)&&gl(n,i)&&gl(i,n)&&(e.push(n.i,t.i,i.i),xl(t),xl(t.next),t=r=i),t=t.next}while(t!==r);return Xs(t)}function jb(r,e,t,n,i,s){let o=r;do{let c=o.next.next;for(;c!==o.prev;){if(o.i!==c.i&&ew(o,c)){let u=By(o,c);o=Xs(o,o.next),u=Xs(u,u.next),ml(o,e,t,n,i,s,0),ml(u,e,t,n,i,s,0);return}c=c.next}o=o.next}while(o!==r)}function Xb(r,e,t,n){const i=[];for(let s=0,o=e.length;s<o;s++){const c=e[s]*n,u=s<o-1?e[s+1]*n:r.length,h=Uy(r,c,u,n,!1);h===h.next&&(h.steiner=!0),i.push($b(h))}i.sort(Yb);for(let s=0;s<i.length;s++)t=qb(i[s],t);return t}function Yb(r,e){let t=r.x-e.x;if(t===0&&(t=r.y-e.y,t===0)){const n=(r.next.y-r.y)/(r.next.x-r.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function qb(r,e){const t=Zb(r,e);if(!t)return e;const n=By(t,r);return Xs(n,n.next),Xs(t,t.next)}function Zb(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,o;if(Qo(r,t))return t;do{if(Qo(r,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const f=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s&&(s=f,o=t.x<t.next.x?t:t.next,f===n))return o}t=t.next}while(t!==e);if(!o)return null;const c=o,u=o.x,h=o.y;let d=1/0;t=o;do{if(n>=t.x&&t.x>=u&&n!==t.x&&Oy(i<h?n:s,i,u,h,i<h?s:n,i,t.x,t.y)){const f=Math.abs(i-t.y)/(n-t.x);gl(t,r)&&(f<d||f===d&&(t.x>o.x||t.x===o.x&&Jb(o,t)))&&(o=t,d=f)}t=t.next}while(t!==c);return o}function Jb(r,e){return $t(r.prev,r,e.prev)<0&&$t(e.next,r,r.next)<0}function Kb(r,e,t,n){let i=r;do i.z===0&&(i.z=Dp(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Qb(i)}function Qb(r){let e,t=1;do{let n=r,i;r=null;let s=null;for(e=0;n;){e++;let o=n,c=0;for(let h=0;h<t&&(c++,o=o.nextZ,!!o);h++);let u=t;for(;c>0||u>0&&o;)c!==0&&(u===0||!o||n.z<=o.z)?(i=n,n=n.nextZ,c--):(i=o,o=o.nextZ,u--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;n=o}s.nextZ=null,t*=2}while(e>1);return r}function Dp(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function $b(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Oy(r,e,t,n,i,s,o,c){return(i-o)*(e-c)>=(r-o)*(s-c)&&(r-o)*(n-c)>=(t-o)*(e-c)&&(t-o)*(s-c)>=(i-o)*(n-c)}function ja(r,e,t,n,i,s,o,c){return!(r===o&&e===c)&&Oy(r,e,t,n,i,s,o,c)}function ew(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!tw(r,e)&&(gl(r,e)&&gl(e,r)&&nw(r,e)&&($t(r.prev,r,e.prev)||$t(r,e.prev,e))||Qo(r,e)&&$t(r.prev,r,r.next)>0&&$t(e.prev,e,e.next)>0)}function $t(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Qo(r,e){return r.x===e.x&&r.y===e.y}function Fy(r,e,t,n){const i=cu($t(r,e,t)),s=cu($t(r,e,n)),o=cu($t(t,n,r)),c=cu($t(t,n,e));return!!(i!==s&&o!==c||i===0&&lu(r,t,e)||s===0&&lu(r,n,e)||o===0&&lu(t,r,n)||c===0&&lu(t,e,n))}function lu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function cu(r){return r>0?1:r<0?-1:0}function tw(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&Fy(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function gl(r,e){return $t(r.prev,r,r.next)<0?$t(r,e,r.next)>=0&&$t(r,r.prev,e)>=0:$t(r,e,r.prev)<0||$t(r,r.next,e)<0}function nw(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function By(r,e){const t=Np(r.i,r.x,r.y),n=Np(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function nx(r,e,t,n){const i=Np(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function xl(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Np(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function iw(r,e,t,n){let i=0;for(let s=e,o=t-n;s<t;s+=n)i+=(r[o]-r[s])*(r[s+1]+r[o+1]),o=s;return i}class rw{static triangulate(e,t,n=2){return Vb(e,t,n)}}class zi{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return zi.area(e)<0}
1static triangulateShape(e,t){const n=[],i=[],s=[];ix(e),rx(n,e);let o=e.length;t.forEach(ix);for(let u=0;u<t.length;u++)i.push(o),o+=t[u].length,rx(n,t[u]);const c=rw.triangulate(n,i);for(let u=0;u<c.length;u+=3)s.push(c.slice(u,u+3));return s}}function ix(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function rx(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class jh extends xt{constructor(e=new Ar([new ge(.5,.5),new ge(-.5,.5),new ge(-.5,-.5),new ge(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let c=0,u=e.length;c<u;c++){const h=e[c];o(h)}this.setAttribute("position",new qe(i,3)),this.setAttribute("uv",new qe(s,2)),this.computeVertexNormals();function o(c){const u=[],h=t.curveSegments!==void 0?t.curveSegments:12,d=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1;let m=t.bevelEnabled!==void 0?t.bevelEnabled:!0,g=t.bevelThickness!==void 0?t.bevelThickness:.2,x=t.bevelSize!==void 0?t.bevelSize:g-.1,M=t.bevelOffset!==void 0?t.bevelOffset:0,_=t.bevelSegments!==void 0?t.bevelSegments:3;const v=t.extrudePath,S=t.UVGenerator!==void 0?t.UVGenerator:sw;let b,E=!1,P,D,N,A;if(v){b=v.getSpacedPoints(d),E=!0,m=!1;const xe=v.isCatmullRomCurve3?v.closed:!1;P=v.computeFrenetFrames(d,xe),D=new F,N=new F,A=new F}m||(_=0,g=0,x=0,M=0);const R=c.extractPoints(h);let B=R.shape;const L=R.holes;if(!zi.isClockWise(B)){B=B.reverse();for(let xe=0,_e=L.length;xe<_e;xe++){const ye=L[xe];zi.isClockWise(ye)&&(L[xe]=ye.reverse())}}function H(xe){const ye=10000000000000001e-36;let Ie=xe[0];for(let k=1;k<=xe.length;k++){const tt=k%xe.length,Be=xe[tt],at=Be.x-Ie.x,Ce=Be.y-Ie.y,O=at*at+Ce*Ce,I=Math.max(Math.abs(Be.x),Math.abs(Be.y),Math.abs(Ie.x),Math.abs(Ie.y)),Z=ye*I*I;if(O<=Z){xe.splice(tt,1),k--;continue}Ie=Be}}H(B),L.forEach(H);const j=L.length,X=B;for(let xe=0;xe<j;xe++){const _e=L[xe];B=B.concat(_e)}function q(xe,_e,ye){return _e||ot("ExtrudeGeometry: vec does not exist"),xe.clone().addScaledVector(_e,ye)}const Y=B.length;function J(xe,_e,ye){let Ie,k,tt;const Be=xe.x-_e.x,at=xe.y-_e.y,Ce=ye.x-xe.x,O=ye.y-xe.y,I=Be*Be+at*at,Z=Be*O-at*Ce;if(Math.abs(Z)>Number.EPSILON){const le=Math.sqrt(I),me=Math.sqrt(Ce*Ce+O*O),de=_e.x-at/le,Qe=_e.y+Be/le,Ne=ye.x-O/me,it=ye.y+Ce/me,ht=((Ne-de)*O-(it-Qe)*Ce)/(Be*O-at*Ce);Ie=de+Be*ht-xe.x,k=Qe+at*ht-xe.y;const Me=Ie*Ie+k*k;if(Me<=2)return new ge(Ie,k);tt=Math.sqrt(Me/2)}else{let le=!1;Be>Number.EPSILON?Ce>Number.EPSILON&&(le=!0):Be<-Number.EPSILON?Ce<-Number.EPSILON&&(le=!0):Math.sign(at)===Math.sign(O)&&(le=!0),le?(Ie=-at,k=Be,tt=Math.sqrt(I)):(Ie=Be,k=at,tt=Math.sqrt(I/2))}return new ge(Ie/tt,k/tt)}const te=[];for(let xe=0,_e=X.length,ye=_e-1,Ie=xe+1;xe<_e;xe++,ye++,Ie++)ye===_e&&(ye=0),Ie===_e&&(Ie=0),te[xe]=J(X[xe],X[ye],X[Ie]);const oe=[];let ce,ve=te.concat();for(let xe=0,_e=j;xe<_e;xe++){const ye=L[xe];ce=[];for(let Ie=0,k=ye.length,tt=k-1,Be=Ie+1;Ie<k;Ie++,tt++,Be++)tt===k&&(tt=0),Be===k&&(Be=0),ce[Ie]=J(ye[Ie],ye[tt],ye[Be]);oe.push(ce),ve=ve.concat(ce)}let Ae;if(_===0)Ae=zi.triangulateShape(X,L);else{const xe=[],_e=[];for(let ye=0;ye<_;ye++){const Ie=ye/_,k=g*Math.cos(Ie*Math.PI/2),tt=x*Math.sin(Ie*Math.PI/2)+M;for(let Be=0,at=X.length;Be<at;Be++){const Ce=q(X[Be],te[Be],tt);rt(Ce.x,Ce.y,-k),Ie===0&&xe.push(Ce)}for(let Be=0,at=j;Be<at;Be++){const Ce=L[Be];ce=oe[Be];const O=[];for(let I=0,Z=Ce.length;I<Z;I++){const le=q(Ce[I],ce[I],tt);rt(le.x,le.y,-k),Ie===0&&O.push(le)}Ie===0&&_e.push(O)}}Ae=zi.triangulateShape(xe,_e)}const dt=Ae.length,vt=x+M;for(let xe=0;xe<Y;xe++){const _e=m?q(B[xe],ve[xe],vt):B[xe];E?(N.copy(P.normals[0]).multiplyScalar(_e.x),D.copy(P.binormals[0]).multiplyScalar(_e.y),A.copy(b[0]).add(N).add(D),rt(A.x,A.y,A.z)):rt(_e.x,_e.y,0)}for(let xe=1;xe<=d;xe++)for(let _e=0;_e<Y;_e++){const ye=m?q(B[_e],ve[_e],vt):B[_e];E?(N.copy(P.normals[xe]).multiplyScalar(ye.x),D.copy(P.binormals[xe]).multiplyScalar(ye.y),A.copy(b[xe]).add(N).add(D),rt(A.x,A.y,A.z)):rt(ye.x,ye.y,f/d*xe)}for(let xe=_-1;xe>=0;xe--){const _e=xe/_,ye=g*Math.cos(_e*Math.PI/2),Ie=x*Math.sin(_e*Math.PI/2)+M;for(let k=0,tt=X.length;k<tt;k++){const Be=q(X[k],te[k],Ie);rt(Be.x,Be.y,f+ye)}for(let k=0,tt=L.length;k<tt;k++){const Be=L[k];ce=oe[k];for(let at=0,Ce=Be.length;at<Ce;at++){const O=q(Be[at],ce[at],Ie);E?rt(O.x,O.y+b[d-1].y,b[d-1].x+ye):rt(O.x,O.y,f+ye)}}}he(),we();function he(){const xe=i.length/3;if(m){let _e=0,ye=Y*_e;for(let Ie=0;Ie<dt;Ie++){const k=Ae[Ie];He(k[2]+ye,k[1]+ye,k[0]+ye)}_e=d+_*2,ye=Y*_e;for(let Ie=0;Ie<dt;Ie++){const k=Ae[Ie];He(k[0]+ye,k[1]+ye,k[2]+ye)}}else{for(let _e=0;_e<dt;_e++){const ye=Ae[_e];He(ye[2],ye[1],ye[0])}for(let _e=0;_e<dt;_e++){const ye=Ae[_e];He(ye[0]+Y*d,ye[1]+Y*d,ye[2]+Y*d)}}n.addGroup(xe,i.length/3-xe,0)}function we(){const xe=i.length/3;let _e=0;Ee(X,_e),_e+=X.length;for(let ye=0,Ie=L.length;ye<Ie;ye++){const k=L[ye];Ee(k,_e),_e+=k.length}n.addGroup(xe,i.length/3-xe,1)}function Ee(xe,_e){let ye=xe.length;for(;--ye>=0;){const Ie=ye;let k=ye-1;k<0&&(k=xe.length-1);for(let tt=0,Be=d+_*2;tt<Be;tt++){const at=Y*tt,Ce=Y*(tt+1),O=_e+Ie+at,I=_e+k+at,Z=_e+k+Ce,le=_e+Ie+Ce;De(O,I,Z,le)}}}function rt(xe,_e,ye){u.push(xe),u.push(_e),u.push(ye)}function He(xe,_e,ye){_t(xe),_t(_e),_t(ye);const Ie=i.length/3,k=S.generateTopUV(n,i,Ie-3,Ie-2,Ie-1);Je(k[0]),Je(k[1]),Je(k[2])}function De(xe,_e,ye,Ie){_t(xe),_t(_e),_t(Ie),_t(_e),_t(ye),_t(Ie);const k=i.length/3,tt=S.generateSideWallUV(n,i,k-6,k-3,k-2,k-1);Je(tt[0]),Je(tt[1]),Je(tt[3]),Je(tt[1]),Je(tt[2]),Je(tt[3])}function _t(xe){i.push(u[xe*3+0]),i.push(u[xe*3+1]),i.push(u[xe*3+2])}function Je(xe){s.push(xe.x),s.push(xe.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return ow(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,o=e.shapes.length;s<o;s++){const c=t[e.shapes[s]];n.push(c)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new vh[i.type]().fromJSON(i)),new jh(n,e.options)}}const sw={generateTopUV:function(r,e,t,n,i){const s=e[t*3],o=e[t*3+1
vendor: 41,080 bytes, lines 1-5
1],c=e[n*3],u=e[n*3+1],h=e[i*3],d=e[i*3+1];return[new ge(s,o),new ge(c,u),new ge(h,d)]},generateSideWallUV:function(r,e,t,n,i,s){const o=e[t*3],c=e[t*3+1],u=e[t*3+2],h=e[n*3],d=e[n*3+1],f=e[n*3+2],m=e[i*3],g=e[i*3+1],x=e[i*3+2],M=e[s*3],_=e[s*3+1],v=e[s*3+2];return Math.abs(c-d)<Math.abs(o-h)?[new ge(o,1-u),new ge(h,1-f),new ge(m,1-x),new ge(M,1-v)]:[new ge(c,1-u),new ge(d,1-f),new ge(g,1-x),new ge(_,1-v)]}};function ow(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Xh extends is{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Xh(e.radius,e.detail)}}class Yh extends xt{constructor(e=[new ge(0,-.5),new ge(.5,0),new ge(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=gt(i,0,Math.PI*2);const s=[],o=[],c=[],u=[],h=[],d=1/t,f=new F,m=new ge,g=new F,x=new F,M=new F;let _=0,v=0;for(let S=0;S<=e.length-1;S++)switch(S){case 0:_=e[S+1].x-e[S].x,v=e[S+1].y-e[S].y,g.x=v*1,g.y=-_,g.z=v*0,M.copy(g),g.normalize(),u.push(g.x,g.y,g.z);break;case e.length-1:u.push(M.x,M.y,M.z);break;default:_=e[S+1].x-e[S].x,v=e[S+1].y-e[S].y,g.x=v*1,g.y=-_,g.z=v*0,x.copy(g),g.x+=M.x,g.y+=M.y,g.z+=M.z,g.normalize(),u.push(g.x,g.y,g.z),M.copy(x)}for(let S=0;S<=t;S++){const b=n+S*d*i,E=Math.sin(b),P=Math.cos(b);for(let D=0;D<=e.length-1;D++){f.x=e[D].x*E,f.y=e[D].y,f.z=e[D].x*P,o.push(f.x,f.y,f.z),m.x=S/t,m.y=D/(e.length-1),c.push(m.x,m.y);const N=u[3*D+0]*E,A=u[3*D+1],R=u[3*D+0]*P;h.push(N,A,R)}}for(let S=0;S<t;S++)for(let b=0;b<e.length-1;b++){const E=b+S*e.length,P=E,D=E+e.length,N=E+e.length+1,A=E+1;s.push(P,D,A),s.push(N,A,D)}this.setIndex(s),this.setAttribute("position",new qe(o,3)),this.setAttribute("uv",new qe(c,2)),this.setAttribute("normal",new qe(h,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Yh(e.points,e.segments,e.phiStart,e.phiLength)}}class Al extends is{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Al(e.radius,e.detail)}}class ia extends xt{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,o=t/2,c=Math.floor(n),u=Math.floor(i),h=c+1,d=u+1,f=e/c,m=t/u,g=[],x=[],M=[],_=[];for(let v=0;v<d;v++){const S=v*m-o;for(let b=0;b<h;b++){const E=b*f-s;x.push(E,-S,0),M.push(0,0,1),_.push(b/c),_.push(1-v/u)}}for(let v=0;v<u;v++)for(let S=0;S<c;S++){const b=S+h*v,E=S+h*(v+1),P=S+1+h*(v+1),D=S+1+h*v;g.push(b,E,D),g.push(E,P,D)}this.setIndex(g),this.setAttribute("position",new qe(x,3)),this.setAttribute("normal",new qe(M,3)),this.setAttribute("uv",new qe(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ia(e.width,e.height,e.widthSegments,e.heightSegments)}}class qh extends xt{constructor(e=.5,t=1,n=32,i=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const c=[],u=[],h=[],d=[];let f=e;const m=(t-e)/i,g=new F,x=new ge;for(let M=0;M<=i;M++){for(let _=0;_<=n;_++){const v=s+_/n*o;g.x=f*Math.cos(v),g.y=f*Math.sin(v),u.push(g.x,g.y,g.z),h.push(0,0,1),x.x=(g.x/t+1)/2,x.y=(g.y/t+1)/2,d.push(x.x,x.y)}f+=m}for(let M=0;M<i;M++){const _=M*(n+1);for(let v=0;v<n;v++){const S=v+_,b=S,E=S+n+1,P=S+n+2,D=S+1;c.push(b,E,D),c.push(E,P,D)}}this.setIndex(c),this.setAttribute("position",new qe(u,3)),this.setAttribute("normal",new qe(h,3)),this.setAttribute("uv",new qe(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qh(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class ra extends xt{constructor(e=new Ar([new ge(0,.5),new ge(-.5,-.5),new ge(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],o=[];let c=0,u=0;if(Array.isArray(e)===!1)h(e);else for(let d=0;d<e.length;d++)h(e[d]),this.addGroup(c,u,d),c+=u,u=0;this.setIndex(n),this.setAttribute("position",new qe(i,3)),this.setAttribute("normal",new qe(s,3)),this.setAttribute("uv",new qe(o,2));function h(d){const f=i.length/3,m=d.extractPoints(t);let g=m.shape;const x=m.holes;zi.isClockWise(g)===!1&&(g=g.reverse());for(let _=0,v=x.length;_<v;_++){const S=x[_];zi.isClockWise(S)===!0&&(x[_]=S.reverse())}const M=zi.triangulateShape(g,x);for(let _=0,v=x.length;_<v;_++){const S=x[_];g=g.concat(S)}for(let _=0,v=g.length;_<v;_++){const S=g[_];i.push(S.x,S.y,0),s.push(0,0,1),o.push(S.x,S.y)}for(let _=0,v=M.length;_<v;_++){const S=M[_],b=S[0]+f,E=S[1]+f,P=S[2]+f;n.push(b,E,P),u+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return aw(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const o=t[e.shapes[i]];n.push(o)}return new ra(n,e.curveSegments)}}function aw(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class Cl extends xt{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,o=0,c=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:o,thetaLength:c},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const u=Math.min(o+c,Math.PI);let h=0;const d=[],f=new F,m=new F,g=[],x=[],M=[],_=[];for(let v=0;v<=n;v++){const S=[],b=v/n;let E=0;v===0&&o===0?E=.5/t:v===n&&u===Math.PI&&(E=-.5/t);for(let P=0;P<=t;P++){const D=P/t;f.x=-e*Math.cos(i+D*s)*Math.sin(o+b*c),f.y=e*Math.cos(o+b*c),f.z=e*Math.sin(i+D*s)*Math.sin(o+b*c),x.push(f.x,f.y,f.z),m.copy(f).normalize(),M.push(m.x,m.y,m.z),_.push(D+E,1-b),S.push(h++)}d.push(S)}for(let v=0;v<n;v++)for(let S=0;S<t;S++){const b=d[v][S+1],E=d[v][S],P=d[v+1][S],D=d[v+1][S+1];(v!==0||o>0)&&g.push(b,E,D),(v!==n-1||u<Math.PI)&&g.push(E,P,D)}this.setIndex(g),this.setAttribute("position",new qe(x,3)),this.setAttribute("normal",new qe(M,3)),this.setAttribute("uv",new qe(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Cl(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Zh extends is{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Zh(e.radius,e.detail)}}class Jh extends xt{constructor(e=1,t=.4,n=12,i=48,s=Math.PI*2,o=0,c=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s,thetaStart:o,thetaLength:c},n=Math.floor(n),i=Math.floor(i);const u=[],h=[],d=[],f=[],m=new F,g=new F,x=new F;for(let M=0;M<=n;M++){const _=o+M/n*c;for(let v=0;v<=i;v++){const S=v/i*s;g.x=(e+t*Math.cos(_))*Math.cos(S),g.y=(e+t*Math.cos(_))*Math.sin(S),g.z=t*Math.sin(_),h.push(g.x,g.y,g.z),m.x=e*Math.cos(S),m.y=e*Math.sin(S),x.subVectors(g,m).normalize(),d.push(x.x,x.y,x.z),f.push(v/i),f.push(M/n)}}for(let M=1;M<=n;M++)for(let _=1;_<=i;_++){const v=(i+1)*M+_-1,S=(i+1)*(M-1)+_-1,b=(i+1)*(M-1)+_,E=(i+1)*M+_;u.push(v,S,E),u.push(S,b,E)}this.setIndex(u),this.setAttribute("position",new qe(h,3)),this.setAttribute("normal",new qe(d,3)),this.setAttribute("uv",new qe(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Jh(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Kh extends xt{constructor(e=1,t=.4,n=64,i=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:o},n=Math.floor(n),i=Math.floor(i);const c=[],u=[],h=[],d=[],f=new F,m=new F,g=new F,x=new F,M=new F,_=new F,v=new F;for(let b=0;b<=n;++b){const E=b/n*s*Math.PI*2;S(E,s,o,e,g),S(E+.01,s,o,e,x),_.subVectors(x,g),v.addVectors(x,g),M.crossVectors(_,v),v.crossVectors(M,_),M.normalize(),v.normalize();for(let P=0;P<=i;++P){const D=P/i*Math.PI*2,N=-t*Math.cos(D),A=t*Math.sin(D);f.x=g.x+(N*v.x+A*M.x),f.y=g.y+(N*v.y+A*M.y),f.z=g.z+(N*v.z+A*M.z),u.push(f.x,f.y,f.z),m.subVectors(f,g).normalize(),h.push(m.x,m.y,m.z),d.push(b/n),d.push(P/i)}}for(let b=1;b<=n;b++)for(let E=1;E<=i;E++){const P=(i+1)*(b-1)+(E-1),D=(i+1)*b+(E-1),N=(i+1)*b+E,A=(i+1)*(b-1)+E;c.push(P,D,A),c.push(D,N,A)}this.setIndex(c),this.setAttribute("position",new qe(u,3)),this.setAttribute("normal",new qe(h,3)),this.setAttribute("uv",new qe(d,2));function S(b,E,P,D,N){const A=Math.cos(b),R=Math.sin(b),B=P/E*b,L=Math.cos(B);N.x=D*(2+L)*.5*A,N.y=D*(2+L)*R*.5,N.z=D*Math.sin(B)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Kh(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Qh extends xt{constructor(e=new _m(new F(-1,-1,0),new F(-1,1,0),new F(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const c=new F,u=new F,h=new ge;let d=new F;const f=[],m=[],g=[],x=[];M(),this.setIndex(x),this.setAttribute("position",new qe(f,3)),this.setAttribute("normal",new qe(m,3)),this.setAttribute("uv",new qe(g,2));function M(){for(let b=0;b<t;b++)_(b);_(s===!1?t:0),S(),v()}function _(b){d=e.getPointAt(b/t,d);const E=o.normals[b],P=o.binormals[b];for(let D=0;D<=i;D++){const N=D/i*Math.PI*2,A=Math.sin(N),R=-Math.cos(N);u.x=R*E.x+A*P.x,u.y=R*E.y+A*P.y,u.z=R*E.z+A*P.z,u.normalize(),m.push(u.x,u.y,u.z),c.x=d.x+n*u.x,c.y=d.y+n*u.y,c.z=d.z+n*u.z,f.push(c.x,c.y,c.z)}}function v(){for(let b=1;b<=t;b++)for(let E=1;E<=i;E++){const P=(i+1)*(b-1)+(E-1),D=(i+1)*b+(E-1),N=(i+1)*b+E,A=(i+1)*(b-1)+E;x.push(P,D,A),x.push(D,N,A)}}function S(){for(let b=0;b<=t;b++)for(let E=0;E<=i;E++)h.x=b/t,h.y=E/i,g.push(h.x,h.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new Qh(new vh[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class ky extends xt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new F,s=new F;if(e.index!==null){const o=e.attributes.position,c=e.index;let u=e.groups;u.length===0&&(u=[{start:0,count:c.count,materialIndex:0}]);for(let h=0,d=u.length;h<d;++h){const f=u[h],m=f.start,g=f.count;for(let x=m,M=m+g;x<M;x+=3)for(let _=0;_<3;_++){const v=c.getX(x+_),S=c.getX(x+(_+1)%3);i.fromBufferAttribute(o,v),s.fromBufferAttribute(o,S),sx(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let c=0,u=o.count/3;c<u;c++)for(let h=0;h<3;h++){const d=3*c+h,f=3*c+(h+1)%3;i.fromBufferAttribute(o,d),s.fromBufferAttribute(o,f),sx(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new qe(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function sx(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var ox=Object.freeze({__proto__:null,BoxGeometry:Zs,CapsuleGeometry:Vh,CircleGeometry:Gh,ConeGeometry:Tl,CylinderGeometry:El,DodecahedronGeometry:Hh,EdgesGeometry:Ry,ExtrudeGeometry:jh,IcosahedronGeometry:Xh,LatheGeometry:Yh,OctahedronGeometry:Al,PlaneGeometry:ia,PolyhedronGeometry:is,RingGeometry:qh,ShapeGeometry:ra,SphereGeometry:Cl,TetrahedronGeometry:Zh,TorusGeometry:Jh,TorusKnotGeometry:Kh,TubeGeometry:Qh,WireframeGeometry:ky});class zy extends Bn{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ke(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}function $o(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(ke("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Gn(r){const e={};for(let t=0;t<r.length;t++){const n=$o(r[t]);for(const i in n)e[i]=n[i]}return e}function lw(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function Vy(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Dt.workingColorSpace}const Gy={clone:$o,merge:Gn};var cw=`void main() {
2	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3}`,uw=`void main() {
4	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
5}`;class Ii extends Bn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=cw,this.fragmentShader=uw,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=$o(e.uniforms),this.uniformsGroups=lw(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Mm extends Ii{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class bm extends Bn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ke(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 Ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ts,this.normalScale=new ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mi,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Hy extends bm{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ge(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return gt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ke(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ke(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ke(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Wy extends Bn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ke(16777215),this.specular=new Ke(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ts,this.normalScale=new ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mi,this.combine=Ml,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class jy extends Bn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ke(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ts,this.normalScale=new ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class Xy extends Bn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ts,this.normalScale=new ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Yy extends Bn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ke(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ts,this.normalScale=new ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mi,this.combine=Ml,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class wm extends Bn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=oy,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Em extends Bn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class qy extends Bn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ke(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ts,this.normalScale=new ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Zy extends Xn{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Us(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function Jy(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function Up(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){const c=t[s]*e;for(let u=0;u!==e;++u)i[o++]=r[c+u]}return i}function Tm(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push(...o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)}function hw(r,e,t,n,i=30){const s=r.clone();s.name=e;const o=[];for(let u=0;u<s.tracks.length;++u){const h=s.tracks[u],d=h.getValueSize(),f=[],m=[];for(let g=0;g<h.times.length;++g){const x=h.times[g]*i;if(!(x<t||x>=n)){f.push(h.times[g]);for(let M=0;M<d;++M)m.push(h.values[g*d+M])}}f.length!==0&&(h.times=Us(f,h.times.constructor),h.values=Us(m,h.values.constructor),o.push(h))}s.tracks=o;let c=1/0;for(let u=0;u<s.tracks.length;++u)c>s.tracks[u].times[0]&&(c=s.tracks[u].times[0]);for(let u=0;u<s.tracks.length;++u)s.tracks[u].shift(-1*c);return s.resetDuration(),s}function dw(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let o=0;o<i;++o){const c=t.tracks[o],u=c.ValueTypeName;if(u==="bool"||u==="string")continue;const h=r.tracks.find(function(v){return v.name===c.name&&v.ValueTypeName===u});if(h===void 0)continue;let d=0;const f=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=f/3);let m=0;const g=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(m=g/3);const x=c.times.length-1;let M;if(s<=c.times[0]){const v=d,S=f-d;M=c.values.slice(v,S)}else if(s>=c.times[x]){const v=x*f+d,S=v+f-d;M=c.values.slice(v,S)}else{const v=c.createInterpolant(),S=d,b=f-d;v.evaluate(s),M=v.resultBuffer.slice(S,b)}u==="quaternion"&&new wn().fromArray(M).normalize().conjugate().toArray(M);const _=h.times.length;for(let v=0;v<_;++v){const S=v*g+m;if(u==="quaternion")wn.multiplyQuaternionsFlat(h.values,S,M,0,h.values,S);else{const b=g-m*2;for(let E=0;E<b;++E)h.values[S+E]-=M[E]}}}return r.blendMode=om,r}class fw{static convertArray(e,t){return Us(e,t)}static isTypedArray(e){return py(e)}static getKeyframeOrder(e){return Jy(e)}static sortedArray(e,t,n){return Up(e,t,n)}static flattenJSON(e,t,n,i){Tm(e,t,n,i)}static subclip(e,t,n,i,s=30){return hw(e,t,n,i,s)}static makeClipAdditive(e,t=0,n=e,i=30){return dw(e,t,n,i)}}class sa{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let c=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===c)break;if(s=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=s)){const c=t[1];e<c&&(n=2,s=c);for(let u=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===u)break;if(i=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){const c=n+o>>>1;e<t[c]?o=c:n=c+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let o=0;o!==i;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Ky extends sa{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ds,endingEnd:Ds}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,o=e+1,c=i[s],u=i[o];if(c===void 0)switch(this.getSettings_().endingStart){case Ns:s=e,c=2*t-n;break;case cl:s=i.length-2,c=t+i[s]-i[s+1];break;default:s=e,c=n}if(u===void 0)switch(this.getSettings_().endingEnd){case Ns:o=e,u=2*n-t;break;case cl:o=1,u=n+i[1]-i[0];break;default:o=e-1,u=t}const h=(n-t)*.5,d=this.valueSize;this._weightPrev=h/(t-c),this._weightNext=h/(u-n),this._offsetPrev=s*d,this._offsetNext=o*d}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,d=this._offsetPrev,f=this._offsetNext,m=this._weightPrev,g=this._weightNext,x=(n-t)/(i-t),M=x*x,_=M*x,v=-m*_+2*m*M-m*x,S=(1+m)*_+(-1.5-2*m)*M+(-.5+m)*x+1,b=(-1-g)*_+(1.5+g)*M+.5*x,E=g*_-g*M;for(let P=0;P!==c;++P)s[P]=v*o[d+P]+S*o[h+P]+b*o[u+P]+E*o[f+P];return s}}class Am extends sa{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,d=(n-t)/(i-t),f=1-d;for(let m=0;m!==c;++m)s[m]=o[h+m]*f+o[u+m]*d;return s}}class Qy extends sa{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class $y extends sa{interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,d=this.settings||this.DefaultSettings_,f=d.inTangents,m=d.outTangents;if(!f||!m){const M=(n-t)/(i-t),_=1-M;for(let v=0;v!==c;++v)s[v]=o[h+v]*_+o[u+v]*M;return s}const g=c*2,x=e-1;for(let M=0;M!==c;++M){const _=o[h+M],v=o[u+M],S=x*g+M*2,b=m[S],E=m[S+1],P=e*g+M*2,D=f[P],N=f[P+1];let A=(n-t)/(i-t),R,B,L,V,H;for(let j=0;j<8;j++){R=A*A,B=R*A,L=1-A,V=L*L,H=V*L;const q=H*t+3*V*A*b+3*L*R*D+B*i-n;if(Math.abs(q)<1e-10)break;const Y=3*V*(b-t)+6*L*A*(D-b)+3*R*(i-D);if(Math.abs(Y)<1e-10)break;A=A-q/Y,A=Math.max(0,Math.min(1,A))}s[M]=H*_+3*V*A*E+3*L*R*N+B*v}return s}}class Pi{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Us(t,this.TimeBufferType),this.values=Us(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Us(e.times,Array),values:Us(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Qy(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Am(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Ky(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){const t=new $y(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.settings=this.settings),t}setInterpolation(e){let t;switch(e){case ll:t=this.InterpolantFactoryMethodDiscrete;break;case mh:t=this.InterpolantFactoryMethodLinear;break;case wu:t=this.InterpolantFactoryMethodSmooth;break;case Rp:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return ke("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ll;case this.InterpolantFactoryMethodLinear:return mh;case this.InterpolantFactoryMethodSmooth:return wu;case this.InterpolantFactoryMethodBezier:return Rp}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,o=i-1;for(;s!==i&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const c=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*c,o*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(ot("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(ot("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let c=0;c!==s;c++){const u=n[c];if(typeof u=="number"&&isNaN(u)){ot("KeyframeTrack: Time is not a valid number.",this,c,u),e=!1;break}if(o!==null&&o>u){ot("KeyframeTrack: Out of order keys.",this,c,u,o),e=!1;break}o=u}if(i!==void 0&&py(i))for(let c=0,u=i.length;c!==u;++c){const h=i[c];if(isNaN(h)){ot("KeyframeTrack: Value is not a valid number.",this,c,h),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===wu,s=e.length-1;let o=1;for(let c=1;c<s;++c){let u=!1;const h=e[c],d=e[c+1];if(h!==d&&(c!==1||h!==e[0]))if(i)u=!0;else{const f=c*n,m=f-n,g=f+n;for(let x=0;x!==n;++x){const M=t[f+x];if(M!==t[m+x]||M!==t[g+x]){u=!0;break}}}if(u){if(c!==o){e[o]=e[c];const f=c*n,m=o*n;for(let g=0;g!==n;++g)t[m+g]=t[f+g]}++o}}if(s>0){e[o]=e[s];for(let c=s*n,u=o*n,h=0;h!==n;++h)t[u+h]=t[c+h];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Pi.prototype.ValueTypeName="";Pi.prototype.TimeBufferType=Float32Array;Pi.prototype.ValueBufferType=Float32Array;Pi.prototype.DefaultInterpolation=mh;class Js extends Pi{constructor(e,t,n){super(e,t,n)}}Js.prototype.ValueTypeName="bool";Js.prototype.ValueBufferType=Array;Js.prototype.DefaultInterpolation=ll;Js.prototype.InterpolantFactoryMethodLinear=void 0;Js.prototype.InterpolantFactoryMethodSmooth=void 0;class Cm extends Pi{constructor(e,t,n,i){super(e,t,n,i)}}Cm.prototype.ValueTypeName="color";class vl extends Pi{constructor(e,t,n,i){super(e,t,n,i)}}vl.prototype.ValueTypeName="number";class e_ extends sa{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,c=this.valueSize,u=(n-t)/(i-t);let h=e*c;for(let d=h+c;h!==d;h+=4)wn.slerpFlat(s,0,o,h-c,o,h,u);return s}}class Rl extends Pi{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new e_(this.times,this.values,this.getValueSize(),e)}}Rl.prototype.ValueTypeName="quaternion";Rl.prototype.InterpolantFactoryMethodSmooth=void 0;class Ks extends Pi{constructor(e,t,n){super(e,t,n)}}Ks.prototype.ValueTypeName="string";Ks.prototype.ValueBufferType=Array;Ks.prototype.DefaultInterpolation=ll;Ks.prototype.InterpolantFactoryMethodLinear=void 0;Ks.prototype.InterpolantFactoryMethodSmooth=void 0;class yl extends Pi{constructor(e,t,n,i){super(e,t,n,i)}}yl.prototype.ValueTypeName="vector";class _l{constructor(e="",t=-1,n=[],i=Ih){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=fi(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,c=n.length;o!==c;++o)t.push(mw(n[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,o=n.length;s!==o;++s)t.push(Pi.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,o=[];for(let c=0;c<s;c++){let u=[],h=[];u.push((c+s-1)%s,c,(c+1)%s),h.push(0,1,0);const d=Jy(u);
vendor: 5,032 bytes, line 5
5u=Up(u,1,d),h=Up(h,1,d),!i&&u[0]===0&&(u.push(s),h.push(h[0])),o.push(new vl(".morphTargetInfluences["+t[c].name+"]",u,h).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let c=0,u=e.length;c<u;c++){const h=e[c],d=h.name.match(s);if(d&&d.length>1){const f=d[1];let m=i[f];m||(i[f]=m=[]),m.push(h)}}const o=[];for(const c in i)o.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return o}static parseAnimation(e,t){if(ke("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return ot("AnimationClip: No animation in JSONLoader data."),null;const n=function(f,m,g,x,M){if(g.length!==0){const _=[],v=[];Tm(g,_,v,x),_.length!==0&&M.push(new f(m,_,v))}},i=[],s=e.name||"default",o=e.fps||30,c=e.blendMode;let u=e.length||-1;const h=e.hierarchy||[];for(let f=0;f<h.length;f++){const m=h[f].keys;if(!(!m||m.length===0))if(m[0].morphTargets){const g={};let x;for(x=0;x<m.length;x++)if(m[x].morphTargets)for(let M=0;M<m[x].morphTargets.length;M++)g[m[x].morphTargets[M]]=-1;for(const M in g){const _=[],v=[];for(let S=0;S!==m[x].morphTargets.length;++S){const b=m[x];_.push(b.time),v.push(b.morphTarget===M?1:0)}i.push(new vl(".morphTargetInfluence["+M+"]",_,v))}u=g.length*o}else{const g=".bones["+t[f].name+"]";n(yl,g+".position",m,"pos",i),n(Rl,g+".quaternion",m,"rot",i),n(yl,g+".scale",m,"scl",i)}}return i.length===0?null:new this(s,u,i,c)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function pw(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return vl;case"vector":case"vector2":case"vector3":case"vector4":return yl;case"color":return Cm;case"quaternion":return Rl;case"bool":case"boolean":return Js;case"string":return Ks}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function mw(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=pw(r.type);if(r.times===void 0){const t=[],n=[];Tm(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const rr={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(ax(r)||(this.files[r]=e))},get:function(r){if(this.enabled!==!1&&!ax(r))return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};function ax(r){try{const e=r.slice(r.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class Rm{constructor(e,t,n){const i=this;let s=!1,o=0,c=0,u;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(d){c++,s===!1&&i.onStart!==void 0&&i.onStart(d,o,c),s=!0},this.itemEnd=function(d){o++,i.onProgress!==void 0&&i.onProgress(d,o,c),o===c&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(d){i.onError!==void 0&&i.onError(d)},this.resolveURL=function(d){return u?u(d):d},this.setURLModifier=function(d){return u=d,this},this.addHandler=function(d,f){return h.push(d,f),this},this.removeHandler=function(d){const f=h.indexOf(d);return f!==-1&&h.splice(f,2),this},this.getHandler=function(d){for(let f=0,m=h.length;f<m;f+=2){const g=h[f],x=h[f+1];if(g.global&&(g.lastIndex=0),g.test(d))return x}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const t_=new Rm;class ii{constructor(e){this.manager=e!==void 0?e:t_,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}ii.DEFAULT_MATERIAL_NAME="__DEFAULT";const Mr={};
5class gw extends Error{constructor(e,t){super(e),this.response=t}}class Rr extends ii{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=rr.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Mr[e]!==void 0){Mr[e].push({onLoad:t,onProgress:n,onError:i});return}Mr[e]=[],Mr[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),c=this.mimeType,u=this.responseType;fetch(o).then(h=>{if(h.status===200||h.status===0){if(h.status===0&&ke("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||h.body===void 0||h.body.getReader===void 0)return h;const d=Mr[e],f=h.body.getReader(),m=h.headers.get("X-File-Size")||h.headers.get("Content-Length"),g=m?parseInt(m):0,x=g!==0;let M=0;const _=new ReadableStream({start(v){S();function S(){f.read().then(({done:b,value:E})=>{if(b)v.close();else{M+=E.byteLength;const P=new ProgressEvent("progress",{lengthComputable:x,loaded:M,total:g});for(let D=0,N=d.length;D<N;D++){const A=d[D];A.onProgress&&A.onProgress(P)}v.enqueue(E),S()}},b=>{v.error(b)})}}});return new Response(_)}else throw new gw(`fetch for "${h.url}" responded with ${h.status}: ${h.statusText}`,h)}).then(h=>{switch(u){case"arraybuffer":return h.arrayBuffer();case"blob":return h.blob();case"document":return h.text().then(d=>new DOMParser().parseFromString(d,c));case"json":return h.json();default:if(c==="")return h.text();{const f=/charset="?([^;"\s]*)"?/i.exec(c),m=f&&f[1]?f[1].toLowerCase():void 0,g=new TextDecoder(m);return h.arrayBuffer().then(x=>g.decode(x))}}}).then(h=>{rr.add(`file:${e}`,h);const d=Mr[e];delete Mr[e];for(let f=0,m=d.length;f<m;f++){const g=d[f];g.onLoad&&g.onLoad(h)}}).catch(h=>{const d=Mr[e];if(d===void 0)throw this.manager.itemError(e),h;delete Mr[e];for(let f=0,m=d.length;f<m;f++){const g=d[f];g.onError&&g.onError(h)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class xw extends ii{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new Rr(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(c){try{t(s.parse(JSON.parse(c)))}catch(u){i?i(u):ot(u),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=_l.parse(e[n]);t.push(i)}return t}}class vw extends ii{constructor(e){super(e)}load(e,t,n,i){const s=this,o=[],c=new zh,u=new Rr(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(s.withCredentials);let h=0;function d(f){u.load(e[f],function(m){const g=s.parse(m,!0);o[f]={width:g.width,height:g.height,format:g.format,mipmaps:g.mipmaps},h+=1,h===6&&(g.mipmapCount===1&&(c.minFilter=Xt),c.image=o,c.format=g.format,c.needsUpdate=!0,t&&t(c))},n,i)}if(Array.isArray(e))for(let f=0,m=e.length;f<m;++f)d(f);else u.load(e,function(f){const m=s.parse(f,!0);if(m.isCubemap){const g=m.mipmaps.length/m.mipmapCount;for(let x=0;x<g;x++){o[x]={mipmaps:[]};for(let M=0;M<m.mipmapCount;M++)o[x].mipmaps.push(m.mipmaps[x*m.mipmapCount+M]),o[x].format=m.format,o[x].width=m.width,o[x].height=m.height}c.image=o}else c.image.width=m.width,c.image.height=m.height,c.mipmaps=m.mipmaps;m.mipmapCount===1&&(c.minFilter=Xt),c.format=m.format,c.needsUpdate=!0,t&&t(c)},n,i);return c}}const Po=new WeakMap;class Sl extends ii{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=rr.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let f=Po.get(o);f===void 0&&(f=[],Po.set(o,f)),f.push({onLoad:t,onError:i})}return o}const c=dl("img");function u(){d(),t&&t(this);const f=Po.get(this)||[];for(let m=0;m<f.length;m++){const g=f[m];g.onLoad&&g.onLoad(this)}Po.delete(this),s.manager.itemEnd(e)}function h(f){d(),i&&i(f),rr.remove(`image:${e}`);const m=Po.get(this)||[];for(let g=0;g<m.length;g++){const x=m[g];x.onError&&x.onError(f)}Po.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function d(){c.removeEventListener("load",u,!1),c.removeEventListener("error",h,!1)}return c.addEventListener("load",u,!1),c.addEventListener("error",h,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(c.crossOrigin=this.crossOrigin),rr.add(`image:${e}`,c),s.manager.itemStart(e),c.src=e,c}}class yw extends ii{constructor(e){super(e)}load(e,t,n,i){const s=new wl;
5s.colorSpace=$n;const o=new Sl(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let c=0;function u(h){o.load(e[h],function(d){s.images[h]=d,c++,c===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let h=0;h<e.length;++h)u(h);return s}}class _w extends ii{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new Vi,c=new Rr(this.manager);return c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setPath(this.path),c.setWithCredentials(s.withCredentials),c.load(e,function(u){let h;try{h=s.parse(u)}catch(d){if(i!==void 0)i(d);else{d(d);return}}h.image!==void 0?o.image=h.image:h.data!==void 0&&(o.image.width=h.width,o.image.height=h.height,o.image.data=h.data),o.wrapS=h.wrapS!==void 0?h.wrapS:ti,o.wrapT=h.wrapT!==void 0?h.wrapT:ti,o.magFilter=h.magFilter!==void 0?h.magFilter:Xt,o.minFilter=h.minFilter!==void 0?h.minFilter:Xt,o.anisotropy=h.anisotropy!==void 0?h.anisotropy:1,h.colorSpace!==void 0&&(o.colorSpace=h.colorSpace),h.flipY!==void 0&&(o.flipY=h.flipY),h.format!==void 0&&(o.format=h.format),h.type!==void 0&&(o.type=h.type),h.mipmaps!==void 0&&(o.mipmaps=h.mipmaps,o.minFilter=ir),h.mipmapCount===1&&(o.minFilter=Xt),h.generateMipmaps!==void 0&&(o.generateMipmaps=h.generateMipmaps),o.needsUpdate=!0,t&&t(o,h)},n,i),o}}class Sw extends ii{constructor(e){super(e)}load(e,t,n,i){const s=new rn,o=new Sl(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(c){s.image=c,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class rs extends Ot{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ke(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class n_ extends rs{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Ot.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ke(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const Yf=new yt,lx=new F,cx=new F;class Im{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ge(512,512),this.mapType=Hn,this.map=null,this.mapPass=null,this.matrix=new yt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new na,this._frameExtents=new ge(1,1),this._viewportCount=1,this._viewports=[new jt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;lx.setFromMatrixPosition(e.matrixWorld),t.position.copy(lx),cx.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(cx),t.updateMatrixWorld(),Yf.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Yf,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===Hs||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Yf)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const uu=new F,hu=new wn,tr=new F;class Il extends Ot{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new yt,this.projectionMatrix=new yt,this.projectionMatrixInverse=new yt,this.coordinateSystem=di,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(uu,hu,tr),tr.x===1&&tr.y===1&&tr.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(uu,hu,tr.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(uu,hu,tr),tr.x===1&&tr.y===1&&tr.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(uu,hu,tr.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const jr=new F,ux=new ge,hx=new ge;let Zt=class extends Il{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Jo*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Fs*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,982 bytes, line 5
5getEffectiveFOV(){return Jo*2*Math.atan(Math.tan(Fs*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){jr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(jr.x,jr.y).multiplyScalar(-e/jr.z),jr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(jr.x,jr.y).multiplyScalar(-e/jr.z)}getViewSize(e,t){return this.getViewBounds(e,ux,hx),t.subVectors(hx,ux)}setViewOffset(e,t,n,i,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Fs*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const u=o.fullWidth,h=o.fullHeight;s+=o.offsetX*i/u,t-=o.offsetY*n/h,i*=o.width/u,n*=o.height/h}const c=this.filmOffset;c!==0&&(s+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}};class Mw extends Im{constructor(){super(new Zt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=Jo*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class i_ extends rs{constructor(e,t,n=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ot.DEFAULT_UP),this.updateMatrix(),this.target=new Ot,this.distance=n,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new Mw}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class bw extends Im{constructor(){super(new Zt(90,1,.5,500)),this.isPointLightShadow=!0}}class r_ extends rs{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new bw}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}let Gi=class extends Il{constructor(e=-1,t=1,n=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,o=n+e,c=i+t,u=i-t;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=h*this.view.offsetX,o=s+h*this.view.width,c-=d*this.view.offsetY,u=c-d*this.view.height}
vendor: 18,909 bytes, line 5
5this.projectionMatrix.makeOrthographic(s,o,c,u,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}};class ww extends Im{constructor(){super(new Gi(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class s_ extends rs{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ot.DEFAULT_UP),this.updateMatrix(),this.target=new Ot,this.shadow=new ww}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class o_ extends rs{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class a_ extends rs{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class Pm{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new F)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}class l_ extends rs{constructor(e=new Pm,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class $h extends ii{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,o=new Rr(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(c){try{t(s.parse(JSON.parse(c)))}catch(u){i?i(u):ot(u),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&ke("MaterialLoader: Undefined texture",s),t[s]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new Ke().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(i.allowOverride=e.allowOverride),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=n(o.value);break;case"c":i.uniforms[s].value=new Ke().setHex(o.value);break;case"v2":i.uniforms[s].value=new ge().fromArray(o.value);break;case"v3":i.uniforms[s].value=new F().fromArray(o.value);break;case"v4":i.uniforms[s].value=new jt().fromArray(o.value);break;case"m3":i.uniforms[s].value=new bt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new yt().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new ge().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ge().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return $h.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:zy,SpriteMaterial:dm,RawShaderMaterial:Mm,ShaderMaterial:Ii,PointsMaterial:pm,MeshPhysicalMaterial:Hy,MeshStandardMaterial:bm,MeshPhongMaterial:Wy,MeshToonMaterial:jy,MeshNormalMaterial:Xy,MeshLambertMaterial:Yy,MeshDepthMaterial:wm,MeshDistanceMaterial:Em,MeshBasicMaterial:ns,MeshMatcapMaterial:qy,LineDashedMaterial:Zy,LineBasicMaterial:Xn,Material:Bn};return new t[e]}}class Op{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class c_ extends xt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class u_ extends ii{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new Rr(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(c){try{t(s.parse(JSON.parse(c)))}catch(u){i?i(u):ot(u),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(g,x){if(t[x]!==void 0)return t[x];const _=g.interleavedBuffers[x],v=s(g,_.buffer),S=Go(_.type,v),b=new Fh(S,_.stride);return b.uuid=_.uuid,t[x]=b,b}function s(g,x){if(n[x]!==void 0)return n[x];const _=g.arrayBuffers[x],v=new Uint32Array(_).buffer;return n[x]=v,v}const o=e.isInstancedBufferGeometry?new c_:new xt,c=e.data.index;if(c!==void 0){const g=Go(c.type,c.array);o.setIndex(new Ht(g,1))}const u=e.data.attributes;for(const g in u){const x=u[g];let M;if(x.isInterleavedBufferAttribute){const _=i(e.data,x.data);M=new Ws(_,x.itemSize,x.offset,x.normalized)}else{const _=Go(x.type,x.array),v=x.isInstancedBufferAttribute?Ko:Ht;M=new v(_,x.itemSize,x.normalized)}x.name!==void 0&&(M.name=x.name),x.usage!==void 0&&M.setUsage(x.usage),o.setAttribute(g,M)}const h=e.data.morphAttributes;if(h)for(const g in h){const x=h[g],M=[];for(let _=0,v=x.length;_<v;_++){const S=x[_];let b;if(S.isInterleavedBufferAttribute){const E=i(e.data,S.data);b=new Ws(E,S.itemSize,S.offset,S.normalized)}else{const E=Go(S.type,S.array);b=new Ht(E,S.itemSize,S.normalized)}S.name!==void 0&&(b.name=S.name),M.push(b)}o.morphAttributes[g]=M}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const f=e.data.groups||e.data.drawcalls||e.data.offsets;if(f!==void 0)for(let g=0,x=f.length;g!==x;++g){const M=f[g];o.addGroup(M.start,M.count,M.materialIndex)}const m=e.data.boundingSphere;return m!==void 0&&(o.boundingSphere=new En().fromJSON(m)),e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class Ew extends ii{constructor(e){super(e)}load(e,t,n,i){const s=this,o=this.path===""?Op.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const c=new Rr(this.manager);c.setPath(this.path),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(u){let h=null;try{h=JSON.parse(u)}catch(f){i!==void 0&&i(f),f("ObjectLoader: Can't parse "+e+".",f.message);return}const d=h.metadata;if(d===void 0||d.type===void 0||d.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),ot("ObjectLoader: Can't load "+e);return}s.parse(h,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?Op.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new Rr(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,t);let c;try{c=JSON.parse(o)}catch(h){throw new Error("ObjectLoader: Can't parse "+e+". "+h.message)}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(c)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(h)}),c=this.parseTextures(e.textures,o),u=this.parseMaterials(e.materials,c),h=this.parseObject(e.object,s,u,c,n),d=this.parseSkeletons(e.skeletons,h);if(this.bindSkeletons(h,d),this.bindLightTargets(h),t!==void 0){let f=!1;for(const m in o)if(o[m].data instanceof HTMLImageElement){f=!0;break}f===!1&&t(h)}return h}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),c=this.parseMaterials(e.materials,o),u=this.parseObject(e.object,i,c,o,t),h=this.parseSkeletons(e.skeletons,u);return this.bindSkeletons(u,h),this.bindLightTargets(u),u}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new Ar().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const c=new Bh().fromJSON(e[s],i);n[c.uuid]=c}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new u_;for(let s=0,o=e.length;s<o;s++){let c;const u=e[s];switch(u.type){case"BufferGeometry":case"InstancedBufferGeometry":c=i.parse(u);break;default:u.type in ox?c=ox[u.type].fromJSON(u,t):ke(`ObjectLoader: Unsupported geometry type "${u.type}"`)}c.uuid=u.uuid,u.name!==void 0&&(c.name=u.name),u.userData!==void 0&&(c.userData=u.userData),n[u.uuid]=c}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new $h;s.setTextures(t);for(let o=0,c=e.length;o<c;o++){const u=e[o];n[u.uuid]===void 0&&(n[u.uuid]=s.parse(u)),i[u.uuid]=n[u.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=_l.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function o(u){return n.manager.itemStart(u),s.load(u,function(){n.manager.itemEnd(u)},void 0,function(){n.manager.itemError(u),n.manager.itemEnd(u)})}function c(u){if(typeof u=="string"){const h=u,d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h)?h:n.resourcePath+h;return o(d)}else return u.data?{data:Go(u.type,u.data),width:u.width,height:u.height}:null}if(e!==void 0&&e.length>0){const u=new Rm(t);s=new Sl(u),s.setCrossOrigin(this.crossOrigin);for(let h=0,d=e.length;h<d;h++){const f=e[h],m=f.url;if(Array.isArray(m)){const g=[];for(let x=0,M=m.length;x<M;x++){const _=m[x],v=c(_);
5v!==null&&(v instanceof HTMLImageElement?g.push(v):g.push(new Vi(v.data,v.width,v.height)))}i[f.uuid]=new Jr(g)}else{const g=c(f.url);i[f.uuid]=new Jr(g)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function s(o){if(typeof o=="string"){const c=o,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:t.resourcePath+c;return await i.loadAsync(u)}else return o.data?{data:Go(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new Sl(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,c=e.length;o<c;o++){const u=e[o],h=u.url;if(Array.isArray(h)){const d=[];for(let f=0,m=h.length;f<m;f++){const g=h[f],x=await s(g);x!==null&&(x instanceof HTMLImageElement?d.push(x):d.push(new Vi(x.data,x.width,x.height)))}n[u.uuid]=new Jr(d)}else{const d=await s(u.url);n[u.uuid]=new Jr(d)}}}return n}parseTextures(e,t){function n(s,o){return typeof s=="number"?s:(ke("ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const i={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const c=e[s];c.image===void 0&&ke('ObjectLoader: No "image" specified for',c.uuid),t[c.image]===void 0&&ke("ObjectLoader: Undefined image",c.image);const u=t[c.image],h=u.data;let d;Array.isArray(h)?(d=new wl,h.length===6&&(d.needsUpdate=!0)):(h&&h.data?d=new Vi:d=new rn,h&&(d.needsUpdate=!0)),d.source=u,d.uuid=c.uuid,c.name!==void 0&&(d.name=c.name),c.mapping!==void 0&&(d.mapping=n(c.mapping,Tw)),c.channel!==void 0&&(d.channel=c.channel),c.offset!==void 0&&d.offset.fromArray(c.offset),c.repeat!==void 0&&d.repeat.fromArray(c.repeat),c.center!==void 0&&d.center.fromArray(c.center),c.rotation!==void 0&&(d.rotation=c.rotation),c.wrap!==void 0&&(d.wrapS=n(c.wrap[0],dx),d.wrapT=n(c.wrap[1],dx)),c.format!==void 0&&(d.format=c.format),c.internalFormat!==void 0&&(d.internalFormat=c.internalFormat),c.type!==void 0&&(d.type=c.type),c.colorSpace!==void 0&&(d.colorSpace
vendor: 3,679 bytes, line 5
5=c.colorSpace),c.minFilter!==void 0&&(d.minFilter=n(c.minFilter,fx)),c.magFilter!==void 0&&(d.magFilter=n(c.magFilter,fx)),c.anisotropy!==void 0&&(d.anisotropy=c.anisotropy),c.flipY!==void 0&&(d.flipY=c.flipY),c.generateMipmaps!==void 0&&(d.generateMipmaps=c.generateMipmaps),c.premultiplyAlpha!==void 0&&(d.premultiplyAlpha=c.premultiplyAlpha),c.unpackAlignment!==void 0&&(d.unpackAlignment=c.unpackAlignment),c.compareFunction!==void 0&&(d.compareFunction=c.compareFunction),c.userData!==void 0&&(d.userData=c.userData),i[c.uuid]=d}return i}parseObject(e,t,n,i,s){let o;function c(m){return t[m]===void 0&&ke("ObjectLoader: Undefined geometry",m),t[m]}function u(m){if(m!==void 0){if(Array.isArray(m)){const g=[];for(let x=0,M=m.length;x<M;x++){const _=m[x];n[_]===void 0&&ke("ObjectLoader: Undefined material",_),g.push(n[_])}return g}return n[m]===void 0&&ke("ObjectLoader: Undefined material",m),n[m]}}function h(m){return i[m]===void 0&&ke("ObjectLoader: Undefined texture",m),i[m]}let d,f;switch(e.type){case"Scene":o=new cm,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new Ke(e.background):o.background=h(e.background)),e.environment!==void 0&&(o.environment=h(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new Oh(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new Uh(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new Zt(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new Gi(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new o_(e.color,e.intensity);break;case"DirectionalLight":o=new s_(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new r_(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new a_(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new i_(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new n_(e.color,e.groundColor,e.intensity);break;case"LightProbe":const m=new Pm().fromArray(e.sh);o=new l_(m,e.intensity);break;case"SkinnedMesh":d=c(e.geometry),f=u(e.material),o=new My(d,f),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":d=c(e.geometry),f=u(e.material),o=new dn(d,f);break;case"InstancedMesh":d=c(e.geometry),f=u(e.material);const g=e.count,x=e.instanceMatrix,M=e.instanceColor;o=new by(d,f,g),o.instanceMatrix=new Ko(new Float32Array(x.array),16),M!==void 0&&(o.instanceColor=new Ko(new Float32Array(M.array),M.itemSize));break;case"BatchedMesh":d=c(e.geometry),f=u(e.material),o=new wy(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,f),o.geometry=d,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._geometryInfo=e.geometryInfo.map(_=>{let v=null,S=null;
5return _.boundingBox!==void 0&&(v=new Fn().fromJSON(_.boundingBox)),_.boundingSphere!==void 0&&(S=new En().fromJSON(_.boundingSphere)),{..._,boundingBox:v,boundingSphere:S}}),o._instanceInfo=e.instanceInfo,o._availableInstanceIds=e._availableInstanceIds,o._availableGeometryIds=e._availableGeometryIds,o._nextIndexStart=e.nextIndexStart,o._nextVertexStart=e.nextVertexStart,o._geometryCount=e.geometryCount,o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._matricesTexture=h(e.matricesTexture.uuid),o._indirectTexture=h(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=h(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(o.boundingSphere=new En().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(o.boundingBox=new Fn().fromJSON(e.boundingBox));break;case"LOD":o=new Sy;break;case"Line":o=new es(c(e.geometry),u(e.material));break;case"LineLoop":o=new Ey(c(e.geometry),u(e.material));break;case"LineSegments":o=new cr(c(e.geometry),u(e.material));break;case"PointCloud":case"Points":o=new Ty(c(e.geometry),u(e.material));break;case"Sprite":o=new _y(u(e.material));break;case"Group":o=new Ho;break;case"Bone":o=new fm;break;default:o=new Ot}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.pivot!==void 0&&(o.pivot=new F().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(o.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(o.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.static!==void 0&&(o.static=e.static),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let g=0;g<m.length;g++)o.add(this.parseObject(m[g],t,n,i,s))}if(e.animations!==void 0){const m=e.animations;for(let g=0;g<m.length;g++){const x=m[g];o.animations.push(s[x])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const m=e.levels;for(let g=0;g<m.length;g++){const x=m[g],M=o.getObjectByProperty("uuid",x.object);M!==void 0&&o.addLevel(M,x.distance,x.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=t[n.skeleton];i===void 0?ke("ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new Ot}})}}const Tw={UVMapping:bh,CubeReflectionMapping:or,CubeRefractionMapping:Qr,EquirectangularReflectionMapping:Za,EquirectangularRefractionMapping:Ja,CubeUVReflectionMapping:ta},dx={RepeatWrapping:ol,ClampToEdgeWrapping:ti,MirroredRepeatWrapping:al},fx={NearestFilter:an,NearestMipmapNearestFilter:$p,NearestMipmapLinearFilter:Vo,LinearFilter:Xt,LinearMipmapNearestFilter:Ka,LinearMipmapLinearFilter:ir},qf=new WeakMap;class Aw extends ii{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&ke("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&ke("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=rr.get(`image-bitmap:${e}`);
5if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(h=>{if(qf.has(o)===!0)i&&i(qf.get(o)),s.manager.itemError(e),s.manager.itemEnd(e);else return t&&t(h),s.manager.itemEnd(e),h});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader,c.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const u=fetch(e,c).then(function(h){return h.blob()}).then(function(h){return createImageBitmap(h,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(h){return rr.add(`image-bitmap:${e}`,h),t&&t(h),s.manager.itemEnd(e),h}).catch(function(h){i&&i(h),qf.set(u,h),rr.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});rr.add(`image-bitmap:${e}`,u),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let du;class Lm{static getContext(){return du===void 0&&(du=new(window.AudioContext||window.webkitAudioContext)),du}static setContext(e){du=e}}class Cw extends ii{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new Rr(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(u){try{const h=u.slice(0);Lm.getContext().decodeAudioData(h,function(f){t(f)}).catch(c)}catch(h){c(h)}},n,i);function c(u){i?i(u):ot(u),s.manager.itemError(e)}}}const px=new yt,mx=new yt,_s=new yt;class Rw{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Zt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Zt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,_s.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(Fs*t.fov*.5)/t.zoom;let c,u;mx.elements[12]=-i,px.elements[12]=i,c=-o*t.aspect+s,u=o*t.aspect+s,_s.elements[0]=2*t.near/(u-c),_s.elements[8]=(u+c)/(u-c),this.cameraL.projectionMatrix.copy(_s),c=-o*t.aspect-s,u=o*t.aspect-s,_s.elements[0]=2*t.near/(u-c),_s.elements[8]=(u+c)/(u-c),this.cameraR.projectionMatrix.copy(_s)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(mx),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(
5px)}}const Lo=-90,Do=1;class h_ extends Ot{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Zt(Lo,Do,e,t);i.layers=this.layers,this.add(i);const s=new Zt(Lo,Do,e,t);s.layers=this.layers,this.add(s);const o=new Zt(Lo,Do,e,t);o.layers=this.layers,this.add(o);const c=new Zt(Lo,Do,e,t);c.layers=this.layers,this.add(c);const u=new Zt(Lo,Do,e,t);u.layers=this.layers,this.add(u);const h=new Zt(Lo,Do,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,o,c,u]=t;for(const h of t)this.remove(h);if(e===di)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),u.up.set(0,1,0),u.lookAt(0,0,-1);else if(e===Hs)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),u.up.set(0,-1,0),u.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const h of t)this.add(h),h.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,c,u,h,d]=this.children,f=e.getRenderTarget(),m=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),x=e.xr.enabled;e.xr.enabled=!1;const M=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let _=!1;e.isWebGLRenderer===!0?_=e.state.buffers.depth.getReversed():_=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),_&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,i),_&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,2,i),_&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,3,i),_&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(n,4,i),_&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),n.texture.generateMipmaps=M,e.setRenderTarget(n,5,i),_&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),e.setRenderTarget(f,m,g),e.xr.enabled=x,n.texture.needsPMREMUpdate=!0}}class d_ extends Zt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class f_{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=Iw.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function Iw(){this._document.hidden===!1&&this.reset()}const Ss=new F,Zf=new wn,Pw=new F,Ms=new F,bs=new F;class Lw extends Ot{constructor(){super(),this.type="AudioListener",this.context=Lm.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new f_}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update(
vendor: 4,318 bytes, line 5
5);const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(Ss,Zf,Pw),Ms.set(0,0,-1).applyQuaternion(Zf),bs.set(0,1,0).applyQuaternion(Zf),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Ss.x,n),t.positionY.linearRampToValueAtTime(Ss.y,n),t.positionZ.linearRampToValueAtTime(Ss.z,n),t.forwardX.linearRampToValueAtTime(Ms.x,n),t.forwardY.linearRampToValueAtTime(Ms.y,n),t.forwardZ.linearRampToValueAtTime(Ms.z,n),t.upX.linearRampToValueAtTime(bs.x,n),t.upY.linearRampToValueAtTime(bs.y,n),t.upZ.linearRampToValueAtTime(bs.z,n)}else t.setPosition(Ss.x,Ss.y,Ss.z),t.setOrientation(Ms.x,Ms.y,Ms.z,bs.x,bs.y,bs.z)}}class p_ 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){ke("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}
vendor: 9,301 bytes, line 5
5getLoop(){return this.hasPlaybackControl===!1?(ke("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){ke("Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType!=="buffer"?(ke("Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const ws=new F,gx=new wn,Dw=new F,Es=new F;class Nw extends p_{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(ws,gx,Dw),Es.set(0,0,1).applyQuaternion(gx);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(ws.x,n),t.positionY.linearRampToValueAtTime(ws.y,n),t.positionZ.linearRampToValueAtTime(ws.z,n),t.orientationX.linearRampToValueAtTime(Es.x,n),t.orientationY.linearRampToValueAtTime(Es.y,n),t.orientationZ.linearRampToValueAtTime(Es.z,n)}else t.setPosition(ws.x,ws.y,ws.z),t.setOrientation(Es.x,Es.y,Es.z)}}class Uw{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class m_{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let c=0;c!==i;++c)n[s+c]=n[c];o=t}else{o+=t;const c=t/o;this._mixBufferRegion(n,s,0,c,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,c=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const u=t*this._origIndex;this._mixBufferRegion(n,i,u,1-s,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let u=t,h=t+t;u!==h;++u)if(n[u]!==n[u+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,o=i;s!==o;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let o=0;o!==s;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){wn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const o=this._workIndex*s;wn.multiplyQuaternionsFlat(e,o,e,t,e,n),wn.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,s){const o=1-i;for(let c=0;c!==s;++c){const u=t+c;e[u]=e[u]*o+e[n+c]*i}}_lerpAdditive(e,t,n,i,s){for(let o=0;o!==s;++o){const c=t+o;e[c]=e[c]+e[n+o]*i}}}const Dm="\\[\\]\\.:\\/",Ow=new RegExp("["+Dm+"]","g"),Nm="[^"+Dm+"]",Fw="[^"+Dm.replace("\\.","")+"]",Bw=/((?:WC+[\/:])*)/.source.replace("WC",Nm),kw=/(WCOD+)?/.source.replace("WCOD",Fw),zw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Nm),Vw=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Nm),Gw=new RegExp("^"+Bw+kw+zw+Vw+"$"),Hw=["material","materials","bones","map"];class Ww{constructor(e,t,n){const i=n||Ut.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Ut{constructor(e,t,n){this.path=t,this.parsedPath=n||Ut.parseTrackName(t),this.node=Ut.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ut.Composite(e,t,n):new Ut(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Ow,"")}static parseTrackName(e){const t=Gw.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);Hw.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let o=0;o<s.length;o++){const c=s[o];if(c.name===t||c.uuid===t)return c;const u=n(c.children);if(u)return u}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}
5_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=Ut.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){ke("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let h=t.objectIndex;switch(n){case"materials":if(!e.material){ot("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){ot("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){ot("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let d=0;d<e.length;d++)if(e[d].name===h){h=d;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){ot("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){ot("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){ot("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(h!==void 0){if(e[h]===void 0){ot("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[h]}}const o=e[i];if(o===void 0){const h=t.nodeName;ot("PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",e);return}let c=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?c=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(c=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){ot("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){ot("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])}u=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(u=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][c]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Ut.Composite=Ww;Ut.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Ut.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Ut.prototype.GetterByBindingType=[Ut.prototype._getValue_direct,Ut.prototype._getValue_array,Ut.prototype._getValue_arrayElement,Ut.prototype._getValue_toArray];Ut.prototype.SetterByBindingTypeAndVersioning=[[Ut.prototype._setValue_direct,Ut.prototype._setValue_direct_setNeedsUpdate,Ut.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ut.prototype._setValue_array,Ut.prototype._setValue_array_setNeedsUpdate,Ut.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ut.prototype._setValue_arrayElement,Ut.prototype._setValue_arrayElement_setNeedsUpdate,Ut.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ut.prototype._setValue_fromArray,Ut.prototype._setValue_fromArray_setNeedsUpdate,Ut.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class jw{constructor(){this.isAnimationObjectGroup=!0,this.uuid=fi(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length;let c,u=e.length,h=this.nCachedObjects_;for(let d=0,f=arguments.length;d!==f;++d){const m=arguments[d],g=m.uuid;let x=t[g];if(x===void 0){x=u++,t[g]=x,e.push(m);for(let M=0,_=o;M!==_;++M)s[M].push(new Ut(m,n[M],i[M]))}else if(x<h){c=e[x];const M=--h,_=e[M];t[_.uuid]=x,e[x]=_,t[g]=M,e[M]=m;for(let v=0,S=o;v!==S;++v){const b=s[v],E=b[M];let P=b[x];b[x]=E,P===void 0&&(P=new Ut(m,n[v],i[v])),b[M]=P}}else e[x]!==c&&ot("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastru
5cture when reloading scenes.")}this.nCachedObjects_=h}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let o=0,c=arguments.length;o!==c;++o){const u=arguments[o],h=u.uuid,d=t[h];if(d!==void 0&&d>=s){const f=s++,m=e[f];t[m.uuid]=d,e[d]=m,t[h]=f,e[f]=u;for(let g=0,x=i;g!==x;++g){const M=n[g],_=M[f],v=M[d];M[d]=_,M[f]=v}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,o=e.length;for(let c=0,u=arguments.length;c!==u;++c){const h=arguments[c],d=h.uuid,f=t[d];if(f!==void 0)if(delete t[d],f<s){const m=--s,g=e[m],x=--o,M=e[x];t[g.uuid]=f,e[f]=g,t[M.uuid]=m,e[m]=M,e.pop();for(let _=0,v=i;_!==v;++_){const S=n[_],b=S[m],E=S[x];S[f]=b,S[m]=E,S.pop()}}else{const m=--o,g=e[m];m>0&&(t[g.uuid]=f),e[f]=g,e.pop();for(let x=0,M=i;x!==M;++x){const _=n[x];_[f]=_[m],_.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,c=this._parsedPaths,u=this._objects,h=u.length,d=this.nCachedObjects_,f=new Array(h);i=s.length,n[e]=i,o.push(e),c.push(t),s.push(f);for(let m=d,g=u.length;m!==g;++m){const x=u[m];f[m]=new Ut(x,e,t)}return f}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,c=o.length-1,u=o[c],h=e[c];t[h]=n,o[n]=u,o.pop(),s[n]=s[c],s.pop(),i[n]=i[c],i.pop()}}}class g_{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,o=s.length,c=new Array(o),u={endingStart:Ds,endingEnd:Ds};for(let h=0;h!==o;++h){const d=s[h].createInterpolant(null);c[h]=d,d.settings=u}this._interpolantSettings=u,this._interpolants=c,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ry,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,s=e._clip.duration,o=s/i,c=i/s;e.warp(1,o,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,o=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const u=c.parameterPositions,h=c.sampleValues;return u[0]=s,u[1]=s+n,h[0]=e/o,h[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const u=(e-s)*n;u<0||n===0?t=0:(this._startTime=null,t=n*u)}t*=this._updateTimeScale(e);const o=this._updateTime(t),c=this._updateWeight(e);if(c>0){const u=this._interpolants,h=this._propertyBindings;switch(this.blendMode){case om:for(let d=0,f=u.length;d!==f;++d)u[d].evaluate(o),h[d].accumulateAdditive(c);break;case Ih:default:for(let d=0,f=u.length;d!==f;++d)u[d].evaluate(o),h[d].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const o=n===sy;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(n===iy){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,s+=Math.abs(c);const u=this.repetitions-s;if(u<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(u===1){const h=e<0;this._setEndings(h,!h,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}
vendor: 9,066 bytes, line 5
5_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Ns,i.endingEnd=Ns):(e?i.endingStart=this.zeroSlopeAtStart?Ns:Ds:i.endingStart=cl,t?i.endingEnd=this.zeroSlopeAtEnd?Ns:Ds:i.endingEnd=cl)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const c=o.parameterPositions,u=o.sampleValues;return c[0]=s,u[0]=t,c[1]=s+e,u[1]=n,this}}const Xw=new Float32Array(1);class Yw extends lr{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,c=e._interpolants,u=n.uuid,h=this._bindingsByRootAndName;let d=h[u];d===void 0&&(d={},h[u]=d);for(let f=0;f!==s;++f){const m=i[f],g=m.name;let x=d[g];if(x!==void 0)++x.referenceCount,o[f]=x;else{if(x=o[f],x!==void 0){x._cacheIndex===null&&(++x.referenceCount,this._addInactiveBinding(x,u,g));continue}const M=t&&t._propertyBindings[f].binding.parsedPath;x=new m_(Ut.create(n,g,M),m.ValueTypeName,m.getValueSize()),++x.referenceCount,this._addInactiveBinding(x,u,g),o[f]=x}c[f].resultBuffer=x.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const c=o.knownActions;e._byClipCacheIndex=c.length,c.push(e)}e._cacheIndex=i.length,i.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,c=o[s],u=c.knownActions,h=u[u.length-1],d=e._byClipCacheIndex;h._byClipCacheIndex=d,u[d]=h,u.pop(),e._byClipCacheIndex=null;const f=c.actionByRoot,m=(e._localRoot||this._root).uuid;delete f[m],u.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,o=this._bindingsByRootAndName,c=o[i],u=t[t.length-1],h=e._cacheIndex;u._cacheIndex=h,t[h]=u,t.pop(),delete c[s],Object.keys(c).length===0&&delete o[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Am(new Float32Array(2),new Float32Array(2),1,Xw),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let o=typeof e=="string"?_l.findByName(i,e):e;const c=o!==null?o.uuid:e,u=this._actionsByClip[c];let h=null;if(n===void 0&&(o!==null?n=o.blendMode:n=Ih),u!==void 0){const f=u.actionByRoot[s];if(f!==void 0&&f.blendMode===n)return f;h=u.knownActions[0],o===null&&(o=h._clip)}if(o===null)return null;const d=new g_(this,o,t,n);return this._bindAction(d,h),this._addInactiveAction(d,c,s),d}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?_l.findByName(n,e):e,o=s?s.uuid:e,c=this._actionsByClip[o];return c!==void 0&&c.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let h=0;h!==n;++h)t[h]._update(i,e,s,o);const c=this._bindings,u=this._nActiveBindings;for(let h=0;h!==u;++h)c[h].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const o=s.knownActions;for(let c=0,u=o.length;c!==u;++c){const h=o[c];this._deactivateAction(h);const d=h._cacheIndex,f=t[t.length-1];h._cacheIndex=null,h._byClipCacheIndex=null,f._cacheIndex=d,t[d]=f,t.pop(),this._removeInactiveBindingsForAction(h)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const c=n[o].actionByRoot,u=c[t];u!==void 0&&(this._deactivateAction(u),this._removeInactiveAction(u))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const o in s){const c=s[o];c.restoreOriginalState(),this._removeInactiveBinding(c)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class qw extends lm{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new Nh(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Um{constructor(e){this.value=e}clone(){return new Um(this.value.clone===void 0?this.value:this.value.clone())}}let Zw=0;class Jw extends lr{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:Zw++}),this.name="",this.usage=hl,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const s=Array.isArray(t[n])?t[n]:[t[n]];for(let o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class Kw extends Fh{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class Qw{constructor(e,t,n,i,s,o=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,this.normalized=o,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const xx=new yt;class x_{constructor(e,t,n=0,i=1/0){this.ray=new qs(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Bs,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):ot("Raycaster: 
5Unsupported camera type: "+t.type)}setFromXRController(e){return xx.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(xx),this}intersectObject(e,t=!0,n=[]){return Fp(e,this,n,t),n.sort(vx),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)Fp(e[i],this,n,t);return n.sort(vx),n}}function vx(r,e){return r.distance-e.distance}function Fp(r,e,t,n){let i=!0;if(r.layers.test(e.layers)&&r.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const s=r.children;for(let o=0,c=s.length;o<c;o++)Fp(s[o],e,t,!0)}}class v_{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,ke("THREE.Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}class Bp{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=gt(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(gt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class $w{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class Om{constructor(e,t,n,i){Om.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=i,this}}const yx=new ge;class eE{constructor(e=new ge(1/0,1/0),t=new ge(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=yx.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,yx).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const _x=new F,fu=new F,No=new F,Uo=new F,Jf=new F,tE=new F,nE=new F;class iE{constructor(e=new F,t=new F){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){_x.subVectors(e,this.start),fu.subVectors(this.end,this.start);const n=fu.dot(fu);let s=fu.dot(_x)/n;return t&&(s=gt(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}
5distanceSqToLine3(e,t=tE,n=nE){const i=10000000000000001e-32;let s,o;const c=this.start,u=e.start,h=this.end,d=e.end;No.subVectors(h,c),Uo.subVectors(d,u),Jf.subVectors(c,u);const f=No.dot(No),m=Uo.dot(Uo),g=Uo.dot(Jf);if(f<=i&&m<=i)return t.copy(c),n.copy(u),t.sub(n),t.dot(t);if(f<=i)s=0,o=g/m,o=gt(o,0,1);else{const x=No.dot(Jf);if(m<=i)o=0,s=gt(-x/f,0,1);else{const M=No.dot(Uo),_=f*m-M*M;_!==0?s=gt((M*g-x*m)/_,0,1):s=0,o=(M*s+g)/m,o<0?(o=0,s=gt(-x/f,0,1)):o>1&&(o=1,s=gt((M-x)/f,0,1))}}return t.copy(c).addScaledVector(No,s),n.copy(u).addScaledVector(Uo,o),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Sx=new F;class rE extends Ot{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new xt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,c=1,u=32;o<u;o++,c++){const h=o/u*Math.PI*2,d=c/u*Math.PI*2;i.push(Math.cos(h),Math.sin(h),1,Math.cos(d),Math.sin(d),1)}n.setAttribute("position",new qe(i,3));const s=new Xn({fog:!1,toneMapped:!1});this.cone=new cr(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Sx.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Sx),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Xr=new F,pu=new yt,Kf=new yt;class sE extends cr{constructor(e){const t=y_(e),n=new xt,i=[],s=[];for(let h=0;h<t.length;h++){const d=t[h];d.parent&&d.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(0,0,0),s.push(0,0,0))}n.setAttribute("position",new qe(i,3)),n.setAttribute("color",new qe(s,3));const o=new Xn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,o),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const c=new Ke(255),u=new Ke(65280);this.setColors(c,u)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Kf.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const c=t[s];c.parent&&c.parent.isBone&&(pu.multiplyMatrices(Kf,c.matrixWorld),Xr.setFromMatrixPosition(pu),i.setXYZ(o,Xr.x,Xr.y,Xr.z),pu.multiplyMatrices(Kf,c.parent.matrixWorld),Xr.setFromMatrixPosition(pu),i.setXYZ(o+1,Xr.x,Xr.y,Xr.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const i=this.geometry.getAttribute("color");for(let s=0;s<i.count;s+=2)i.setXYZ(s,e.r,e.g,e.b),i.setXYZ(s+1,t.r,t.g,t.b);return i.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function y_(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push(...y_(r.children[t]));return e}class oE extends dn{constructor(e,t,n){const i=new Cl(t,4,2),s=new ns({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const aE=new F,Mx=new Ke,bx=new Ke;class lE extends Ot{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Al(t);i.rotateY(Math.PI*.5),this.material=new ns({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),o=new Float32Array(s.count*3);i.setAttribute("color",new Ht(o,3)),this.add(new dn(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Mx.copy(this.light.color),bx.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?Mx:bx;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(aE.setFromMatrixPosition(this.light.matrixWorld).negate())}}class cE extends cr{constructor(e=10,t=10,n=4473924,i=8947848){n=new Ke(n),i=new Ke(i);const s=t/2,o=e/t,c=e/2,u=[],h=[];for(let m=0,g=0,x=-c;m<=t;m++,x+=o){u.push(-c,0,x,c,0,x),u.push(x,0,-c,x,0,c);const M=m===s?n:i;M.toArray(h,g),g+=3,M.toArray(h,g),g+=3,M.toArray(h,g),g+=3,M.toArray(h,g),g+=3}const d=new xt;d.setAttribute("position",new qe(u,3)),d.setAttribute("color",new qe(h,3));const f=new Xn({vertexColors:!0,toneMapped:!1});super(d,f),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class uE extends cr{constructor(e=10,t=16,n=8,i=64,s=4473924,o=8947848){s=new Ke(s),o=new Ke(o);const c=[],u=[];
vendor: 4,236 bytes, line 5
5if(t>1)for(let f=0;f<t;f++){const m=f/t*(Math.PI*2),g=Math.sin(m)*e,x=Math.cos(m)*e;c.push(0,0,0),c.push(g,0,x);const M=f&1?s:o;u.push(M.r,M.g,M.b),u.push(M.r,M.g,M.b)}for(let f=0;f<n;f++){const m=f&1?s:o,g=e-e/n*f;for(let x=0;x<i;x++){let M=x/i*(Math.PI*2),_=Math.sin(M)*g,v=Math.cos(M)*g;c.push(_,0,v),u.push(m.r,m.g,m.b),M=(x+1)/i*(Math.PI*2),_=Math.sin(M)*g,v=Math.cos(M)*g,c.push(_,0,v),u.push(m.r,m.g,m.b)}}const h=new xt;h.setAttribute("position",new qe(c,3)),h.setAttribute("color",new qe(u,3));const d=new Xn({vertexColors:!0,toneMapped:!1});super(h,d),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const wx=new F,mu=new F,Ex=new F;class hE extends Ot{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let i=new xt;i.setAttribute("position",new qe([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new Xn({fog:!1,toneMapped:!1});this.lightPlane=new es(i,s),this.add(this.lightPlane),i=new xt,i.setAttribute("position",new qe([0,0,0,0,0,1],3)),this.targetLine=new es(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),wx.setFromMatrixPosition(this.light.matrixWorld),mu.setFromMatrixPosition(this.light.target.matrixWorld),Ex.subVectors(mu,wx),this.lightPlane.lookAt(mu),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(mu),this.targetLine.scale.z=Ex.length()}}const gu=new F,nn=new Il;class dE extends cr{constructor(e){const t=new xt,n=new Xn({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],o={};c("n1","n2"),c("n2","n4"),c("n4","n3"),c("n3","n1"),c("f1","f2"),c("f2","f4"),c("f4","f3"),c("f3","f1"),c("n1","f1"),c("n2","f2"),c("n3","f3"),c("n4","f4"),c("p","n1"),c("p","n2"),c("p","n3"),c("p","n4"),c("u1","u2"),c("u2","u3"),c("u3","u1"),c("c","t"),c("p","c"),c("cn1","cn2"),c("cn3","cn4"),c("cf1","cf2"),c("cf3","cf4");function c(x,M){u(x),u(M)}function u(x){i.push(0,0,0),s.push(0,0,0),o[x]===void 0&&(o[x]=[]),o[x].push(i.length/3-1)}t.setAttribute("position",new qe(i,3)),t.setAttribute("color",new qe(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const h=new Ke(16755200),d=new Ke(16711680),f=new Ke(43775),m=new Ke(16777215),g=new Ke(3355443);this.setColors(h,d,f,m,g)}setColors(e,t,n,i,s){const c=this.geometry.getAttribute("color");return c.setXYZ(0,e.r,e.g,e.b),c.setXYZ(1,e.r,e.g,e.b),c.setXYZ(2,e.r,e.g,e.b),c.setXYZ(3,e.r,e.g,e.b),c.setXYZ(4,e.r,e.g,e.b),c.setXYZ(5,e.r,e.g,e.b),c.setXYZ(6,e.r,e.g,e.b),c.setXYZ(7,e.r,e.g,e.b),c.setXYZ(8,e.r,e.g,e.b),c.setXYZ(9,e.r,e.g,e.b),c.setXYZ(10,e.r,e.g,e.b),c.setXYZ(11,e.r,e.g,e.b),c.setXYZ(12,e.r,e.g,e.b),c.setXYZ(13,e.r,e.g,e.b),c.setXYZ(14,e.r,e.g,e.b),c.setXYZ(15,e.r,e.g,e.b),c.setXYZ(16,e.r,e.g,e.b),c.setXYZ(17,e.r,e.g,e.b),c.setXYZ(18,e.r,e.g,e.b),c.setXYZ(19,e.r,e.g,e.b),c.setXYZ(20,e.r,e.g,e.b),c.setXYZ(21,e.r,e.g,e.b),c.setXYZ(22,e.r,e.g,e.b),c.setXYZ(23,e.r,e.g,e.b),c.setXYZ(24,t.r,t.g,t.b),c.setXYZ(25,t.r,t.g,t.b),c.setXYZ(26,t.r,t.g,t.b),c.setXYZ(27,t.r,t.g,t.b),c.setXYZ(28,t.r,t.g,t.b),c.setXYZ(29,t.r,t.g,t.b),c.setXYZ(30,t.r,t.g,t.b),c.setXYZ(31,t.r,t.g,t.b),c.setXYZ(32,n.r,n.g,n.b),c.setXYZ(33,n.r,n.g,n.b),c.setXYZ(34,n.r,n.g,n.b),c.setXYZ(35,n.r,n.g,n.b),c.setXYZ(36,n.r,n.g,n.b),c.setXYZ(37,n.r,n.g,n.b),c.setXYZ(38,i.r,i.g,i.b),c.setXYZ(39,i.r,i.g,i.b),c.setXYZ(40,s.r,s.g,s.b),c.setXYZ(41,s.r,s.g,s.b),c.setXYZ(42,s.r,s.g,s.b),c.setXYZ(43,s.r,s.g,s.b),c.setXYZ(44,s.r,s.g,s.b),c.setXYZ(45,s.r,s.g,s.b),c.setXYZ(46,s.r,s.g,s.b),c.setXYZ(47,s.r,s.g,s.b),c.setXYZ(48,s.r,s.g,s.b),c.setXYZ(49,s.r,s.g,s.b),c.needsUpdate=!0,this}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;let s,o;
5if(nn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,o=0;else if(this.camera.coordinateSystem===di)s=-1,o=1;else if(this.camera.coordinateSystem===Hs)s=0,o=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);on("c",t,e,nn,0,0,s),on("t",t,e,nn,0,0,o),on("n1",t,e,nn,-n,-i,s),on("n2",t,e,nn,n,-i,s),on("n3",t,e,nn,-n,i,s),on("n4",t,e,nn,n,i,s),on("f1",t,e,nn,-n,-i,o),on("f2",t,e,nn,n,-i,o),on("f3",t,e,nn,-n,i,o),on("f4",t,e,nn,n,i,o),on("u1",t,e,nn,n*.7,i*1.1,s),on("u2",t,e,nn,-n*.7,i*1.1,s),on("u3",t,e,nn,0,i*2,s),on("cf1",t,e,nn,-n,0,o),on("cf2",t,e,nn,n,0,o),on("cf3",t,e,nn,0,-i,o),on("cf4",t,e,nn,0,i,o),on("cn1",t,e,nn,-n,0,s),on("cn2",t,e,nn,n,0,s),on("cn3",t,e,nn,0,-i,s),on("cn4",t,e,nn,0,i,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function on(r,e,t,n,i,s,o){gu.set(i,s,o).unproject(n);const c=e[r];if(c!==void 0){const u=t.getAttribute("position");for(let h=0,d=c.length;h<d;h++)u.setXYZ(c[h],gu.x,gu.y,gu.z)}}const xu=new Fn;class fE extends cr{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),s=new xt;s.setIndex(new Ht(n,1)),s.setAttribute("position",new Ht(i,3)),super(s,new Xn({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&xu.setFromObject(this.object),xu.isEmpty())return;const e=xu.min,t=xu.max,n=this.geometry.attributes.position,i=n.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class pE extends cr{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new xt;s.setIndex(new Ht(n,1)),s.setAttribute("position",new qe(i,3)),super(s,new Xn({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class mE extends es{constructor(e,t=1,n=16776960){const i=n,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new xt;o.setAttribute("position",new qe(s,3)),o.computeBoundingSphere(),super(o,new Xn({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const c=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],u=new xt;u.setAttribute("position",new qe(c,3)),u.computeBoundingSphere(),this.add(new dn(u,new ns({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const Tx=new F;let vu,Qf;class gE extends Ot{constructor(e=new F(0,0,1),t=new F(0,0,0),n=1,i=16776960,s=n*.2,o=s*.2){super(),this.type="ArrowHelper",vu===void 0&&(vu=new xt,vu.setAttribute("position",new qe([0,0,0,0,1,0],3)),Qf=new Tl(.5,1,5,1),Qf.translate(0,-.5,0)),this.position.copy(t),this.line=new es(vu,new Xn({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new dn(Qf,new ns({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Tx.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Tx,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class xE extends cr{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new xt;i.setAttribute("position",new qe(t,3)),i.setAttribute("color",new qe(n,3));const s=new Xn({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}
5setColors(e,t,n){const i=new Ke,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class vE{constructor(){this.type="ShapePath",this.color=new Ke,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new yh,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,o){return this.currentPath.bezierCurveTo(e,t,n,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(v){const S=[];for(let b=0,E=v.length;b<E;b++){const P=v[b],D=new Ar;D.curves=P.curves,S.push(D)}return S}function n(v,S){const b=S.length;let E=!1;for(let P=b-1,D=0;D<b;P=D++){let N=S[P],A=S[D],R=A.x-N.x,B=A.y-N.y;if(Math.abs(B)>Number.EPSILON){if(B<0&&(N=S[D],R=-R,A=S[P],B=-B),v.y<N.y||v.y>A.y)continue;if(v.y===N.y){if(v.x===N.x)return!0}else{const L=B*(v.x-N.x)-R*(v.y-N.y);if(L===0)return!0;if(L<0)continue;E=!E}}else{if(v.y!==N.y)continue;if(A.x<=v.x&&v.x<=N.x||N.x<=v.x&&v.x<=A.x)return!0}}return E}const i=zi.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,c,u;const h=[];if(s.length===1)return c=s[0],u=new Ar,u.curves=c.curves,h.push(u),h;let d=!i(s[0].getPoints());d=e?!d:d;const f=[],m=[];let g=[],x=0,M;m[x]=void 0,g[x]=[];for(let v=0,S=s.length;v<S;v++)c=s[v],M=c.getPoints(),o=i(M),o=e?!o:o,o?(!d&&m[x]&&x++,m[x]={s:new Ar,p:M},m[x].s.curves=c.curves,d&&x++,g[x]=[]):g[x].push({h:c,p:M[0]});if(!m[0])return t(s);if(m.length>1){let v=!1,S=0;for(let b=0,E=m.length;b<E;b++)f[b]=[];for(let b=0,E=m.length;b<E;b++){const P=g[b];for(let D=0;D<P.length;D++){const N=P[D];let A=!0;for(let R=0;R<m.length;R++)n(N.p,m[R].p)&&(b!==R&&S++,A?(A=!1,f[R].push(N)):v=!0);A&&f[b].push(N)}}S>0&&v===!1&&(g=f)}let _;for(let v=0,S=m.length;v<S;v++){u=m[v].s,h.push(u),_=g[v];for(let b=0,E=_.length;b<E;b++)u.holes.push(_[b].h)}return h}}class yE extends lr{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){ke("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function _E(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function SE(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function ME(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function kp(r,e,t,n){const i=bE(n);switch(t){case rm:return r*e;case Ah:return r*e/i.components*i.byteLength;case bl:return r*e/i.components*i.byteLength;case Vs:return r*e*2/i.components*i.byteLength;case Ch:return r*e*2/i.components*i.byteLength;case sm:return r*e*3/i.components*i.byteLength;case On:return r*e*4/i.components*i.byteLength;case Rh:return r*e*4/i.components*i.byteLength;case Qa:case $a:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case el:case tl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Bu:case zu:return Math.max(r,16)*Math.max(e,8)/4;case Fu:case ku:return Math.max(r,8)*Math.max(e,8)/2;case Vu:case Gu:case Wu:case ju:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Hu:case Xu:case Yu:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case qu:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Zu:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Ju:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Ku:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Qu:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case $u:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case eh:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case th:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case nh:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case ih:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case rh:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case sh:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case oh:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case ah:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case lh:case ch:case uh:return Math.ceil(r/4)*Math.ceil(e/4)*16;case hh:case dh:return Math.ceil(r/4)*Math.ceil(e/4)*8;case fh:case ph:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function bE(r){switch(r){case Hn:case em:return{byteLength:1,components:1};case qo:case tm:case Hi:return{byteLength:2,components:1};case Eh:case Th:return{byteLength:2,components:4};case Ri:case wh:case Un:return{byteLength:4,components:1};case nm:case im:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class wE{static contain(e,t){return _E(e,t)}static cover(e,t){return SE(e,t)}static fill(e){return ME(e)}static getByteLength(e,t,n,i){return kp(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Sh}}));typeof window<"u"&&(window.__THREE__?ke("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Sh
vendor: 4,492 bytes, lines 5-64
5);function __(){let r=null,e=!1,t=null,n=null;function i(s,o){t(s,o),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function EE(r){const e=new WeakMap;function t(c,u){const h=c.array,d=c.usage,f=h.byteLength,m=r.createBuffer();r.bindBuffer(u,m),r.bufferData(u,h,d),c.onUploadCallback();let g;if(h instanceof Float32Array)g=r.FLOAT;else if(typeof Float16Array<"u"&&h instanceof Float16Array)g=r.HALF_FLOAT;else if(h instanceof Uint16Array)c.isFloat16BufferAttribute?g=r.HALF_FLOAT:g=r.UNSIGNED_SHORT;else if(h instanceof Int16Array)g=r.SHORT;else if(h instanceof Uint32Array)g=r.UNSIGNED_INT;else if(h instanceof Int32Array)g=r.INT;else if(h instanceof Int8Array)g=r.BYTE;else if(h instanceof Uint8Array)g=r.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)g=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:m,type:g,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version,size:f}}function n(c,u,h){const d=u.array,f=u.updateRanges;if(r.bindBuffer(h,c),f.length===0)r.bufferSubData(h,0,d);else{f.sort((g,x)=>g.start-x.start);let m=0;for(let g=1;g<f.length;g++){const x=f[m],M=f[g];M.start<=x.start+x.count+1?x.count=Math.max(x.count,M.start+M.count-x.start):(++m,f[m]=M)}f.length=m+1;for(let g=0,x=f.length;g<x;g++){const M=f[g];r.bufferSubData(h,M.start*d.BYTES_PER_ELEMENT,d,M.start,M.count)}u.clearUpdateRanges()}u.onUploadCallback()}function i(c){return c.isInterleavedBufferAttribute&&(c=c.data),e.get(c)}function s(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=e.get(c);u&&(r.deleteBuffer(u.buffer),e.delete(c))}function o(c,u){if(c.isInterleavedBufferAttribute&&(c=c.data),c.isGLBufferAttribute){const d=e.get(c);(!d||d.version<c.version)&&e.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}const h=e.get(c);if(h===void 0)e.set(c,t(c,u));else if(h.version<c.version){if(h.size!==c.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(h.buffer,c,u),h.version=c.version}}return{get:i,remove:s,update:o}}var TE=`#ifdef USE_ALPHAHASH
6	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
7#endif`,AE=`#ifdef USE_ALPHAHASH
8	const float ALPHA_HASH_SCALE = 0.05;
9	float hash2D( vec2 value ) {
10		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
11	}
12	float hash3D( vec3 value ) {
13		return hash2D( vec2( hash2D( value.xy ), value.z ) );
14	}
15	float getAlphaHashThreshold( vec3 position ) {
16		float maxDeriv = max(
17			length( dFdx( position.xyz ) ),
18			length( dFdy( position.xyz ) )
19		);
20		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
21		vec2 pixScales = vec2(
22			exp2( floor( log2( pixScale ) ) ),
23			exp2( ceil( log2( pixScale ) ) )
24		);
25		vec2 alpha = vec2(
26			hash3D( floor( pixScales.x * position.xyz ) ),
27			hash3D( floor( pixScales.y * position.xyz ) )
28		);
29		float lerpFactor = fract( log2( pixScale ) );
30		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
31		float a = min( lerpFactor, 1.0 - lerpFactor );
32		vec3 cases = vec3(
33			x * x / ( 2.0 * a * ( 1.0 - a ) ),
34			( x - 0.5 * a ) / ( 1.0 - a ),
35			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
36		);
37		float threshold = ( x < ( 1.0 - a ) )
38			? ( ( x < a ) ? cases.x : cases.y )
39			: cases.z;
40		return clamp( threshold , 1.0e-6, 1.0 );
41	}
42#endif`,CE=`#ifdef USE_ALPHAMAP
43	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
44#endif`,RE=`#ifdef USE_ALPHAMAP
45	uniform sampler2D alphaMap;
46#endif`,IE=`#ifdef USE_ALPHATEST
47	#ifdef ALPHA_TO_COVERAGE
48	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
49	if ( diffuseColor.a == 0.0 ) discard;
50	#else
51	if ( diffuseColor.a < alphaTest ) discard;
52	#endif
53#endif`,PE=`#ifdef USE_ALPHATEST
54	uniform float alphaTest;
55#endif`,LE=`#ifdef USE_AOMAP
56	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
57	reflectedLight.indirectDiffuse *= ambientOcclusion;
58	#if defined( USE_CLEARCOAT ) 
59		clearcoatSpecularIndirect *= ambientOcclusion;
60	#endif
61	#if defined( USE_SHEEN ) 
62		sheenSpecularIndirect *= ambientOcclusion;
63	#endif
64	#if defined( USE_ENVMAP ) && defined( STANDARD )
65		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
66		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
67	#endif
68#endif`,DE=`#ifdef USE_AOMAP
69	uniform sampler2D aoMap;
70	uniform float aoMapIntensity;
71#endif`,NE=`#ifdef USE_BATCHING
72	#if ! defined( GL_ANGLE_multi_draw )
73	#define gl_DrawID _gl_DrawID
74	uniform int _gl_DrawID;
75	#endif
76	uniform highp sampler2D batchingTexture;
77	uniform highp usampler2D batchingIdTexture;
78	mat4 getBatchingMatrix( const in float i ) {
79		int size = textureSize( batchingTexture, 0 ).x;
80		int j = int( i ) * 4;
81		int x = j % size;
82		int y = j / size;
83		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
84		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
85		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
86		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
87		return mat4( v1, v2, v3, v4 );
88	}
89	float getIndirectIndex( const in int i ) {
90		int size = textureSize( batchingIdTexture, 0 ).x;
91		int x = i % size;
92		int y = i / size;
93		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
94	}
95#endif
96#ifdef USE_BATCHING_COLOR
97	uniform sampler2D batchingColorTexture;
98	vec4 getBatchingColor( const in float i ) {
99		int size = textureSize( batchingColorTexture, 0 ).x;
100		int j = int( i );
101		int x = j % size;
102		int y = j / size;
103		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
104	}
105#endif`,UE=`#ifdef USE_BATCHING
106	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
107#endif`,OE=`vec3 transformed = vec3( position );
108#ifdef USE_ALPHAHASH
109	vPosition = vec3( position );
110#endif`,FE=`vec3 objectNormal = vec3( normal );
111#ifdef USE_TANGENT
112	vec3 objectTangent = vec3( tangent.xyz );
113#endif`,BE=`float G_BlinnPhong_Implicit( ) {
114	return 0.25;
115}
116float D_BlinnPhong( const in float shininess, const in float dotNH ) {
117	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
118}
119vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
120	vec3 halfDir = normalize( lightDir + viewDir );
121	float dotNH = saturate( dot( normal, halfDir ) );
122	float dotVH = saturate( dot( viewDir, halfDir ) );
123	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
124	float G = G_BlinnPhong_Implicit( );
125	float D = D_BlinnPhong( shininess, dotNH );
126	return F * ( G * D );
127} // validated`,kE=`#ifdef USE_IRIDESCENCE
128	const mat3 XYZ_TO_REC709 = mat3(
129		 3.2404542, -0.9692660,  0.0556434,
130		-1.5371385,  1.8760108, -0.2040259,
131		-0.4985314,  0.0415560,  1.0572252
132	);
133	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
134		vec3 sqrtF0 = sqrt( fresnel0 );
135		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
136	}
137	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
138		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
139	}
140	float IorToFresnel0( float transmittedIor, float incidentIor ) {
141		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
142	}
143	vec3 evalSensitivity( float OPD, vec3 shift ) {
144		float phase = 2.0 * PI * OPD * 1.0e-9;
145		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
146		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
147		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
148		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
149		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
150		xyz /= 1.0685e-7;
151		vec3 rgb = XYZ_TO_REC709 * xyz;
152		return rgb;
153	}
154	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
155		vec3 I;
156		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
157		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
158		float cosTheta2Sq = 1.0 - sinTheta2Sq;
159		if ( cosTheta2Sq < 0.0 ) {
160			return vec3( 1.0 );
161		}
162		float cosTheta2 = sqrt( cosTheta2Sq );
163		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
164		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
165		float T121 = 1.0 - R12;
166		float phi12 = 0.0;
167		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
168		float phi21 = PI - phi12;
169		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
170		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
171		vec3 phi23 = vec3( 0.0 );
172		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
173		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
174		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
175		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
176		vec3 phi = vec3( phi21 ) + phi23;
177		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
178		vec3 r123 = sqrt( R123 );
179		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
180		vec3 C0 = R12 + Rs;
181		I = C0;
182		vec3 Cm = Rs - T121;
183		for ( int m = 1; m <= 2; ++ m ) {
184			Cm *= r123;
185			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
186			I += Cm * Sm;
187		}
188		return max( I, vec3( 0.0 ) );
189	}
190#endif`,zE=`#ifdef USE_BUMPMAP
191	uniform sampler2D bumpMap;
192	uniform float bumpScale;
193	vec2 dHdxy_fwd() {
194		vec2 dSTdx = dFdx( vBumpMapUv );
195		vec2 dSTdy = dFdy( vBumpMapUv );
196		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
197		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
198		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
199		return vec2( dBx, dBy );
200	}
201	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
202		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
203		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
204		vec3 vN = surf_norm;
205		vec3 R1 = cross( vSigmaY, vN );
206		vec3 R2 = cross( vN, vSigmaX );
207		float fDet = dot( vSigmaX, R1 ) * faceDirection;
208		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
209		return normalize( abs( fDet ) * surf_norm - vGrad );
210	}
211#endif`,VE=`#if NUM_CLIPPING_PLANES > 0
212	vec4 plane;
213	#ifdef ALPHA_TO_COVERAGE
214		float distanceToPlane, distanceGradient;
215		float clipOpacity = 1.0;
216		#pragma unroll_loop_start
217		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
218			plane = clippingPlanes[ i ];
219			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
220			distanceGradient = fwidth( distanceToPlane ) / 2.0;
221			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
222			if ( clipOpacity == 0.0 ) discard;
223		}
224		#pragma unroll_loop_end
225		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
226			float unionClipOpacity = 1.0;
227			#pragma unroll_loop_start
228			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
229				plane = clippingPlanes[ i ];
230				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
231				distanceGradient = fwidth( distanceToPlane ) / 2.0;
232				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
233			}
234			#pragma unroll_loop_end
235			clipOpacity *= 1.0 - unionClipOpacity;
236		#endif
237		diffuseColor.a *= clipOpacity;
238		if ( diffuseColor.a == 0.0 ) discard;
239	#else
240		#pragma unroll_loop_start
241		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
242			plane = clippingPlanes[ i ];
243			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
244		}
245		#pragma unroll_loop_end
246		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
247			bool clipped = true;
248			#pragma unroll_loop_start
249			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
250				plane = clippingPlanes[ i ];
251				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
252			}
253			#pragma unroll_loop_end
254			if ( clipped ) discard;
255		#endif
256	#endif
257#endif`,GE=`#if NUM_CLIPPING_PLANES > 0
258	varying vec3 vClipPosition;
259	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
260#endif`,HE=`#if NUM_CLIPPING_PLANES > 0
261	varying vec3 vClipPosition;
262#endif`,WE=`#if NUM_CLIPPING_PLANES > 0
263	vClipPosition = - mvPosition.xyz;
264#endif`,jE=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
265	diffuseColor *= vColor;
266#endif`,XE=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
267	varying vec4 vColor;
268#endif`,YE=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
269	varying vec4 vColor;
270#endif`,qE=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
271	vColor = vec4( 1.0 );
272#endif
273#ifdef USE_COLOR_ALPHA
274	vColor *= color;
275#elif defined( USE_COLOR )
276	vColor.rgb *= color;
277#endif
278#ifdef USE_INSTANCING_COLOR
279	vColor.rgb *= instanceColor.rgb;
280#endif
281#ifdef USE_BATCHING_COLOR
282	vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
283#endif`,ZE=`#define PI 3.141592653589793
284#define PI2 6.283185307179586
285#define PI_HALF 1.5707963267948966
286#define RECIPROCAL_PI 0.3183098861837907
287#define RECIPROCAL_PI2 0.15915494309189535
288#define EPSILON 1e-6
289#ifndef saturate
290#define saturate( a ) clamp( a, 0.0, 1.0 )
291#endif
292#define whiteComplement( a ) ( 1.0 - saturate( a ) )
293float pow2( const in float x ) { return x*x; }
294vec3 pow2( const in vec3 x ) { return x*x; }
295float pow3( const in float x ) { return x*x*x; }
296float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
297float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
298float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
299highp float rand( const in vec2 uv ) {
300	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
301	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
302	return fract( sin( sn ) * c );
303}
304#ifdef HIGH_PRECISION
305	float precisionSafeLength( vec3 v ) { return length( v ); }
306#else
307	float precisionSafeLength( vec3 v ) {
308		float maxComponent = max3( abs( v ) );
309		return length( v / maxComponent ) * maxComponent;
310	}
311#endif
312struct IncidentLight {
313	vec3 color;
314	vec3 direction;
315	bool visible;
316};
317struct ReflectedLight {
318	vec3 directDiffuse;
319	vec3 directSpecular;
320	vec3 indirectDiffuse;
321	vec3 indirectSpecular;
322};
323#ifdef USE_ALPHAHASH
324	varying vec3 vPosition;
325#endif
326vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
327	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
328}
329vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
330	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
331}
332bool isPerspectiveMatrix( mat4 m ) {
333	return m[ 2 ][ 3 ] == - 1.0;
334}
335vec2 equirectUv( in vec3 dir ) {
336	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
337	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
338	return vec2( u, v );
339}
340vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
341	return RECIPROCAL_PI * diffuseColor;
342}
343vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
344	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
345	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
346}
347float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
348	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
349	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
350} // validated`,JE=`#ifdef ENVMAP_TYPE_CUBE_UV
351	#define cubeUV_minMipLevel 4.0
352	#define cubeUV_minTileSize 16.0
353	float getFace( vec3 direction ) {
354		vec3 absDirection = abs( direction );
355		float face = - 1.0;
356		if ( absDirection.x > absDirection.z ) {
357			if ( absDirection.x > absDirection.y )
358				face = direction.x > 0.0 ? 0.0 : 3.0;
359			else
360				face = direction.y > 0.0 ? 1.0 : 4.0;
361		} else {
362			if ( absDirection.z > absDirection.y )
363				face = direction.z > 0.0 ? 2.0 : 5.0;
364			else
365				face = direction.y > 0.0 ? 1.0 : 4.0;
366		}
367		return face;
368	}
369	vec2 getUV( vec3 direction, float face ) {
370		vec2 uv;
371		if ( face == 0.0 ) {
372			uv = vec2( direction.z, direction.y ) / abs( direction.x );
373		} else if ( face == 1.0 ) {
374			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
375		} else if ( face == 2.0 ) {
376			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
377		} else if ( face == 3.0 ) {
378			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
379		} else if ( face == 4.0 ) {
380			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
381		} else {
382			uv = vec2( direction.x, direction.y ) / abs( direction.z );
383		}
384		return 0.5 * ( uv + 1.0 );
385	}
386	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
387		float face = getFace( direction );
388		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
389		mipInt = max( mipInt, cubeUV_minMipLevel );
390		float faceSize = exp2( mipInt );
391		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
392		if ( face > 2.0 ) {
393			uv.y += faceSize;
394			face -= 3.0;
395		}
396		uv.x += face * faceSize;
397		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
398		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
399		uv.x *= CUBEUV_TEXEL_WIDTH;
400		uv.y *= CUBEUV_TEXEL_HEIGHT;
401		#ifdef texture2DGradEXT
402			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
403		#else
404			return texture2D( envMap, uv ).rgb;
405		#endif
406	}
407	#define cubeUV_r0 1.0
408	#define cubeUV_m0 - 2.0
409	#define cubeUV_r1 0.8
410	#define cubeUV_m1 - 1.0
411	#define cubeUV_r4 0.4
412	#define cubeUV_m4 2.0
413	#define cubeUV_r5 0.305
414	#define cubeUV_m5 3.0
415	#define cubeUV_r6 0.21
416	#define cubeUV_m6 4.0
417	float roughnessToMip( float roughness ) {
418		float mip = 0.0;
419		if ( roughness >= cubeUV_r1 ) {
420			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
421		} else if ( roughness >= cubeUV_r4 ) {
422			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
423		} else if ( roughness >= cubeUV_r5 ) {
424			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
425		} else if ( roughness >= cubeUV_r6 ) {
426			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
427		} else {
428			mip = - 2.0 * log2( 1.16 * roughness );		}
429		return mip;
430	}
431	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
432		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
433		float mipF = fract( mip );
434		float mipInt = floor( mip );
435		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
436		if ( mipF == 0.0 ) {
437			return vec4( color0, 1.0 );
438		} else {
439			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
440			return vec4( mix( color0, color1, mipF ), 1.0 );
441		}
442	}
443#endif`,KE=`vec3 transformedNormal = objectNormal;
444#ifdef USE_TANGENT
445	vec3 transformedTangent = objectTangent;
446#endif
447#ifdef USE_BATCHING
448	mat3 bm = mat3( batchingMatrix );
449	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
450	transformedNormal = bm * transformedNormal;
451	#ifdef USE_TANGENT
452		transformedTangent = bm * transformedTangent;
453	#endif
454#endif
455#ifdef USE_INSTANCING
456	mat3 im = mat3( instanceMatrix );
457	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
458	transformedNormal = im * transformedNormal;
459	#ifdef USE_TANGENT
460		transformedTangent = im * transformedTangent;
461	#endif
462#endif
463transformedNormal = normalMatrix * transformedNormal;
464#ifdef FLIP_SIDED
465	transformedNormal = - transformedNormal;
466#endif
467#ifdef USE_TANGENT
468	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
469	#ifdef FLIP_SIDED
470		transformedTangent = - transformedTangent;
471	#endif
472#endif`,QE=`#ifdef USE_DISPLACEMENTMAP
473	uniform sampler2D displacementMap;
474	uniform float displacementScale;
475	uniform float displacementBias;
476#endif`,$E=`#ifdef USE_DISPLACEMENTMAP
477	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
477placementBias );
478#endif`,eT=`#ifdef USE_EMISSIVEMAP
479	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
480	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
481		emissiveColor = sRGBTransferEOTF( emissiveColor );
482	#endif
483	totalEmissiveRadiance *= emissiveColor.rgb;
484#endif`,tT=`#ifdef USE_EMISSIVEMAP
485	uniform sampler2D emissiveMap;
486#endif`,nT="gl_FragColor = linearToOutputTexel( gl_FragColor );",iT=`vec4 LinearTransferOETF( in vec4 value ) {
487	return value;
488}
489vec4 sRGBTransferEOTF( in vec4 value ) {
490	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
491}
492vec4 sRGBTransferOETF( in vec4 value ) {
493	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
494}`,rT=`#ifdef USE_ENVMAP
495	#ifdef ENV_WORLDPOS
496		vec3 cameraToFrag;
497		if ( isOrthographic ) {
498			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
499		} else {
500			cameraToFrag = normalize( vWorldPosition - cameraPosition );
501		}
502		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
503		#ifdef ENVMAP_MODE_REFLECTION
504			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
505		#else
506			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
507		#endif
508	#else
509		vec3 reflectVec = vReflect;
510	#endif
511	#ifdef ENVMAP_TYPE_CUBE
512		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
513		#ifdef ENVMAP_BLENDING_MULTIPLY
514			outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
515		#elif defined( ENVMAP_BLENDING_MIX )
516			outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
517		#elif defined( ENVMAP_BLENDING_ADD )
518			outgoingLight += envColor.xyz * specularStrength * reflectivity;
519		#endif
520	#endif
521#endif`,sT=`#ifdef USE_ENVMAP
522	uniform float envMapIntensity;
523	uniform float flipEnvMap;
524	uniform mat3 envMapRotation;
525	#ifdef ENVMAP_TYPE_CUBE
526		uniform samplerCube envMap;
527	#else
528		uniform sampler2D envMap;
529	#endif
530#endif`,oT=`#ifdef USE_ENVMAP
531	uniform float reflectivity;
532	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
533		#define ENV_WORLDPOS
534	#endif
535	#ifdef ENV_WORLDPOS
536		varying vec3 vWorldPosition;
537		uniform float refractionRatio;
538	#else
539		varying vec3 vReflect;
540	#endif
541#endif`,aT=`#ifdef USE_ENVMAP
542	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
543		#define ENV_WORLDPOS
544	#endif
545	#ifdef ENV_WORLDPOS
546		
547		varying vec3 vWorldPosition;
548	#else
549		varying vec3 vReflect;
550		uniform float refractionRatio;
551	#endif
552#endif`,lT=`#ifdef USE_ENVMAP
553	#ifdef ENV_WORLDPOS
554		vWorldPosition = worldPosition.xyz;
555	#else
556		vec3 cameraToVertex;
557		if ( isOrthographic ) {
558			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
559		} else {
560			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
561		}
562		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
563		#ifdef ENVMAP_MODE_REFLECTION
564			vReflect = reflect( cameraToVertex, worldNormal );
565		#else
566			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
567		#endif
568	#endif
569#endif`,cT=`#ifdef USE_FOG
570	vFogDepth = - mvPosition.z;
571#endif`,uT=`#ifdef USE_FOG
572	varying float vFogDepth;
573#endif`,hT=`#ifdef USE_FOG
574	#ifdef FOG_EXP2
575		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
576	#else
577		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
578	#endif
579	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
580#endif`,dT=`#ifdef USE_FOG
581	uniform vec3 fogColor;
582	varying float vFogDepth;
583	#ifdef FOG_EXP2
584		uniform float fogDensity;
585	#else
586		uniform float fogNear;
587		uniform float fogFar;
588	#endif
589#endif`,fT=`#ifdef USE_GRADIENTMAP
590	uniform sampler2D gradientMap;
591#endif
592vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
593	float dotNL = dot( normal, lightDirection );
594	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
595	#ifdef USE_GRADIENTMAP
596		return vec3( texture2D( gradientMap, coord ).r );
597	#else
598		vec2 fw = fwidth( coord ) * 0.5;
599		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
600	#endif
601}`,pT=`#ifdef USE_LIGHTMAP
602	uniform sampler2D lightMap;
603	uniform float lightMapIntensity;
604#endif`,mT=`LambertMaterial material;
605material.diffuseColor = diffuseColor.rgb;
606material.specularStrength = specularStrength;`,gT=`varying vec3 vViewPosition;
607struct LambertMaterial {
608	vec3 diffuseColor;
609	float specularStrength;
610};
611void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
612	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
613	vec3 irradiance = dotNL * directLight.color;
614	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
615}
616void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
617	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
618}
619#define RE_Direct				RE_Direct_Lambert
620#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,xT=`uniform bool receiveShadow;
621uniform vec3 ambientLightColor;
622#if defined( USE_LIGHT_PROBES )
623	uniform vec3 lightProbe[ 9 ];
624#endif
625vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
626	float x = normal.x, y = normal.y, z = normal.z;
627	vec3 result = shCoefficients[ 0 ] * 0.886227;
628	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
629	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
630	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
631	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
632	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
633	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
634	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
635	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
636	return result;
637}
638vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
639	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
640	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
641	return irradiance;
642}
643vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
644	vec3 irradiance = ambientLightColor;
645	return irradiance;
646}
647float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
648	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
649	if ( cutoffDistance > 0.0 ) {
650		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
651	}
652	return distanceFalloff;
653}
654float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
655	return smoothstep( coneCosine, penumbraCosine, angleCosine );
656}
657#if NUM_DIR_LIGHTS > 0
658	struct DirectionalLight {
659		vec3 direction;
660		vec3 color;
661	};
662	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
663	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
664		light.color = directionalLight.color;
665		light.direction = directionalLight.direction;
666		light.visible = true;
667	}
668#endif
669#if NUM_POINT_LIGHTS > 0
670	struct PointLight {
671		vec3 position;
672		vec3 color;
673		float distance;
674		float decay;
675	};
676	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
677	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
678		vec3 lVector = pointLight.position - geometryPosition;
679		light.direction = normalize( lVector );
680		float lightDistance = length( lVector );
681		light.color = pointLight.color;
682		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
683		light.visible = ( light.color != vec3( 0.0 ) );
684	}
685#endif
686#if NUM_SPOT_LIGHTS > 0
687	struct SpotLight {
688		vec3 position;
689		vec3 direction;
690		vec3 color;
691		float distance;
692		float decay;
693		float coneCos;
694		float penumbraCos;
695	};
696	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
697	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
698		vec3 lVector = spotLight.position - geometryPosition;
699		light.direction = normalize( lVector );
700		float angleCos = dot( light.direction, spotLight.direction );
701		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
702		if ( spotAttenuation > 0.0 ) {
703			float lightDistance = length( lVector );
704			light.color = spotLight.color * spotAttenuation;
705			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
706			light.visible = ( light.color != vec3( 0.0 ) );
707		} else {
708			light.color = vec3( 0.0 );
709			light.visible = false;
710		}
711	}
712#endif
713#if NUM_RECT_AREA_LIGHTS > 0
714	struct RectAreaLight {
715		vec3 color;
716		vec3 position;
717		vec3 halfWidth;
718		vec3 halfHeight;
719	};
720	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
721	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
722#endif
723#if NUM_HEMI_LIGHTS > 0
724	struct HemisphereLight {
725		vec3 direction;
726		vec3 skyColor;
727		vec3 groundColor;
728	};
729	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
730	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
731		float dotNL = dot( normal, hemiLight.direction );
732		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
733		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
734		return irradiance;
735	}
736#endif`,vT=`#ifdef USE_ENVMAP
737	vec3 getIBLIrradiance( const in vec3 normal ) {
738		#ifdef ENVMAP_TYPE_CUBE_UV
739			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
740			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
741			return PI * envMapColor.rgb * envMapIntensity;
742		#else
743			return vec3( 0.0 );
744		#endif
745	}
746	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
747		#ifdef ENVMAP_TYPE_CUBE_UV
748			vec3 reflectVec = reflect( - viewDir, normal );
749			reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
750			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
751			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
752			return envMapColor.rgb * envMapIntensity;
753		#else
754			return vec3( 0.0 );
755		#endif
756	}
757	#ifdef USE_ANISOTROPY
758		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
759			#ifdef ENVMAP_TYPE_CUBE_UV
760				vec3 bentNormal = cross( bitangent, viewDir );
761				bentNormal = normalize( cross( bentNormal, bitangent ) );
762				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
763				return getIBLRadiance( viewDir, bentNormal, roughness );
764			#else
765				return vec3( 0.0 );
766			#endif
767		}
768	#endif
769#endif`,yT=`ToonMaterial material;
770material.diffuseColor = diffuseColor.rgb;`,_T=`varying vec3 vViewPosition;
771struct ToonMaterial {
772	vec3 diffuseColor;
773};
774void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
775	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
776	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
777}
778void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
779	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
780}
781#define RE_Direct				RE_Direct_Toon
782#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,ST=`BlinnPhongMaterial material;
783material.diffuseColor = diffuseColor.rgb;
784material.specularColor = specular;
785material.specularShininess = shininess;
786material.specularStrength = specularStrength;`,MT=`varying vec3 vViewPosition;
787struct BlinnPhongMaterial {
788	vec3 diffuseColor;
789	vec3 specularColor;
790	float specularShininess;
791	float specularStrength;
792};
793void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
794	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
795	vec3 irradiance = dotNL * directLight.color;
796	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
797	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
798}
799void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
800	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
801}
802#define RE_Direct				RE_Direct_BlinnPhong
803#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,bT=`PhysicalMaterial material;
804material.diffuseColor = diffuseColor.rgb;
805material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
806material.metalness = metalnessFactor;
807vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
808float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
809material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
810material.roughness = min( material.roughness, 1.0 );
811#ifdef IOR
812	material.ior = ior;
813	#ifdef USE_SPECULAR
814		float specularIntensityFactor = specularIntensity;
815		vec3 specularColorFactor = specularColor;
816		#ifdef USE_SPECULAR_COLORMAP
817			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
818		#endif
819		#ifdef USE_SPECULAR_INTENSITYMAP
820			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
821		#endif
822		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
823	#else
824		float specularIntensityFactor = 1.0;
825		vec3 specularColorFactor = vec3( 1.0 );
826		material.specularF90 = 1.0;
827	#endif
828	material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
829	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
830#else
831	material.specularColor = vec3( 0.04 );
832	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
833	material.specularF90 = 1.0;
834#endif
835#ifdef USE_CLEARCOAT
836	material.clearcoat = clearcoat;
837	material.clearcoatRoughness = clearcoatRoughness;
838	material.clearcoatF0 = vec3( 0.04 );
839	material.clearcoatF90 = 1.0;
840	#ifdef USE_CLEARCOATMAP
841		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
842	#endif
843	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
844		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
845	#endif
846	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
847	material.clearcoatRoughness += geometryRoughness;
848	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
849#endif
850#ifdef USE_DISPERSION
851	material.dispersion = dispersion;
852#endif
853#ifdef USE_IRIDESCENCE
854	material.iridescence = iridescence;
855	material.iridescenceIOR = iridescenceIOR;
856	#ifdef USE_IRIDESCENCEMAP
857		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
858	#endif
859	#ifdef USE_IRIDESCENCE_THICKNESSMAP
860		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
861	#else
862		material.iridescenceThickness = iridescenceThicknessMaximum;
863	#endif
864#endif
865#ifdef USE_SHEEN
866	material.sheenColor = sheenColor;
867	#ifdef USE_SHEEN_COLORMAP
868		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
869	#endif
870	material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
871	#ifdef USE_SHEEN_ROUGHNESSMAP
872		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
873	#endif
874#endif
875#ifdef USE_ANISOTROPY
876	#ifdef USE_ANISOTROPYMAP
877		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
878		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
879		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
880	#else
881		vec2 anisotropyV = anisotropyVector;
882	#endif
883	material.anisotropy = length( anisotropyV );
884	if( material.anisotropy == 0.0 ) {
885		anisotropyV = vec2( 1.0, 0.0 );
886	} else {
887		anisotropyV /= material.anisotropy;
888		material.anisotropy = saturate( material.anisotropy );
889	}
890	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
891	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
892	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
893#endif`,wT
vendor: 9,654 bytes, lines 893-1124
893=`uniform sampler2D dfgLUT;
894struct PhysicalMaterial {
895	vec3 diffuseColor;
896	vec3 diffuseContribution;
897	vec3 specularColor;
898	vec3 specularColorBlended;
899	float roughness;
900	float metalness;
901	float specularF90;
902	float dispersion;
903	#ifdef USE_CLEARCOAT
904		float clearcoat;
905		float clearcoatRoughness;
906		vec3 clearcoatF0;
907		float clearcoatF90;
908	#endif
909	#ifdef USE_IRIDESCENCE
910		float iridescence;
911		float iridescenceIOR;
912		float iridescenceThickness;
913		vec3 iridescenceFresnel;
914		vec3 iridescenceF0;
915		vec3 iridescenceFresnelDielectric;
916		vec3 iridescenceFresnelMetallic;
917	#endif
918	#ifdef USE_SHEEN
919		vec3 sheenColor;
920		float sheenRoughness;
921	#endif
922	#ifdef IOR
923		float ior;
924	#endif
925	#ifdef USE_TRANSMISSION
926		float transmission;
927		float transmissionAlpha;
928		float thickness;
929		float attenuationDistance;
930		vec3 attenuationColor;
931	#endif
932	#ifdef USE_ANISOTROPY
933		float anisotropy;
934		float alphaT;
935		vec3 anisotropyT;
936		vec3 anisotropyB;
937	#endif
938};
939vec3 clearcoatSpecularDirect = vec3( 0.0 );
940vec3 clearcoatSpecularIndirect = vec3( 0.0 );
941vec3 sheenSpecularDirect = vec3( 0.0 );
942vec3 sheenSpecularIndirect = vec3(0.0 );
943vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
944    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
945    float x2 = x * x;
946    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
947    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
948}
949float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
950	float a2 = pow2( alpha );
951	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
952	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
953	return 0.5 / max( gv + gl, EPSILON );
954}
955float D_GGX( const in float alpha, const in float dotNH ) {
956	float a2 = pow2( alpha );
957	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
958	return RECIPROCAL_PI * a2 / pow2( denom );
959}
960#ifdef USE_ANISOTROPY
961	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
962		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
963		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
964		float v = 0.5 / ( gv + gl );
965		return v;
966	}
967	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
968		float a2 = alphaT * alphaB;
969		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
970		highp float v2 = dot( v, v );
971		float w2 = a2 / v2;
972		return RECIPROCAL_PI * a2 * pow2 ( w2 );
973	}
974#endif
975#ifdef USE_CLEARCOAT
976	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
977		vec3 f0 = material.clearcoatF0;
978		float f90 = material.clearcoatF90;
979		float roughness = material.clearcoatRoughness;
980		float alpha = pow2( roughness );
981		vec3 halfDir = normalize( lightDir + viewDir );
982		float dotNL = saturate( dot( normal, lightDir ) );
983		float dotNV = saturate( dot( normal, viewDir ) );
984		float dotNH = saturate( dot( normal, halfDir ) );
985		float dotVH = saturate( dot( viewDir, halfDir ) );
986		vec3 F = F_Schlick( f0, f90, dotVH );
987		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
988		float D = D_GGX( alpha, dotNH );
989		return F * ( V * D );
990	}
991#endif
992vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
993	vec3 f0 = material.specularColorBlended;
994	float f90 = material.specularF90;
995	float roughness = material.roughness;
996	float alpha = pow2( roughness );
997	vec3 halfDir = normalize( lightDir + viewDir );
998	float dotNL = saturate( dot( normal, lightDir ) );
999	float dotNV = saturate( dot( normal, viewDir ) );
1000	float dotNH = saturate( dot( normal, halfDir ) );
1001	float dotVH = saturate( dot( viewDir, halfDir ) );
1002	vec3 F = F_Schlick( f0, f90, dotVH );
1003	#ifdef USE_IRIDESCENCE
1004		F = mix( F, material.iridescenceFresnel, material.iridescence );
1005	#endif
1006	#ifdef USE_ANISOTROPY
1007		float dotTL = dot( material.anisotropyT, lightDir );
1008		float dotTV = dot( material.anisotropyT, viewDir );
1009		float dotTH = dot( material.anisotropyT, halfDir );
1010		float dotBL = dot( material.anisotropyB, lightDir );
1011		float dotBV = dot( material.anisotropyB, viewDir );
1012		float dotBH = dot( material.anisotropyB, halfDir );
1013		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1014		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1015	#else
1016		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1017		float D = D_GGX( alpha, dotNH );
1018	#endif
1019	return F * ( V * D );
1020}
1021vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1022	const float LUT_SIZE = 64.0;
1023	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1024	const float LUT_BIAS = 0.5 / LUT_SIZE;
1025	float dotNV = saturate( dot( N, V ) );
1026	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1027	uv = uv * LUT_SCALE + LUT_BIAS;
1028	return uv;
1029}
1030float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1031	float l = length( f );
1032	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1033}
1034vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1035	float x = dot( v1, v2 );
1036	float y = abs( x );
1037	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1038	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1039	float v = a / b;
1040	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1041	return cross( v1, v2 ) * theta_sintheta;
1042}
1043vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1044	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1045	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1046	vec3 lightNormal = cross( v1, v2 );
1047	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1048	vec3 T1, T2;
1049	T1 = normalize( V - N * dot( V, N ) );
1050	T2 = - cross( N, T1 );
1051	mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
1052	vec3 coords[ 4 ];
1053	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1054	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1055	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1056	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1057	coords[ 0 ] = normalize( coords[ 0 ] );
1058	coords[ 1 ] = normalize( coords[ 1 ] );
1059	coords[ 2 ] = normalize( coords[ 2 ] );
1060	coords[ 3 ] = normalize( coords[ 3 ] );
1061	vec3 vectorFormFactor = vec3( 0.0 );
1062	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1063	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1064	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1065	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1066	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1067	return vec3( result );
1068}
1069#if defined( USE_SHEEN )
1070float D_Charlie( float roughness, float dotNH ) {
1071	float alpha = pow2( roughness );
1072	float invAlpha = 1.0 / alpha;
1073	float cos2h = dotNH * dotNH;
1074	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1075	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1076}
1077float V_Neubelt( float dotNV, float dotNL ) {
1078	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1079}
1080vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1081	vec3 halfDir = normalize( lightDir + viewDir );
1082	float dotNL = saturate( dot( normal, lightDir ) );
1083	float dotNV = saturate( dot( normal, viewDir ) );
1084	float dotNH = saturate( dot( normal, halfDir ) );
1085	float D = D_Charlie( sheenRoughness, dotNH );
1086	float V = V_Neubelt( dotNV, dotNL );
1087	return sheenColor * ( D * V );
1088}
1089#endif
1090float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1091	float dotNV = saturate( dot( normal, viewDir ) );
1092	float r2 = roughness * roughness;
1093	float rInv = 1.0 / ( roughness + 0.1 );
1094	float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
1095	float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
1096	float DG = exp( a * dotNV + b );
1097	return saturate( DG );
1098}
1099vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1100	float dotNV = saturate( dot( normal, viewDir ) );
1101	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1102	return specularColor * fab.x + specularF90 * fab.y;
1103}
1104#ifdef USE_IRIDESCENCE
1105void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
1106#else
1107void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
1108#endif
1109	float dotNV = saturate( dot( normal, viewDir ) );
1110	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1111	#ifdef USE_IRIDESCENCE
1112		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1113	#else
1114		vec3 Fr = specularColor;
1115	#endif
1116	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1117	float Ess = fab.x + fab.y;
1118	float Ems = 1.0 - Ess;
1119	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1120	singleScatter += FssEss;
1121	multiScatter += Fms * Ems;
1122}
1123vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1124	vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
vendor: 8,354 bytes, lines 1125-1254
1125	float dotNL = saturate( dot( normal, lightDir ) );
1126	float dotNV = saturate( dot( normal, viewDir ) );
1127	vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
1128	vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
1129	vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
1130	vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
1131	float Ess_V = dfgV.x + dfgV.y;
1132	float Ess_L = dfgL.x + dfgL.y;
1133	float Ems_V = 1.0 - Ess_V;
1134	float Ems_L = 1.0 - Ess_L;
1135	vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
1136	vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
1137	float compensationFactor = Ems_V * Ems_L;
1138	vec3 multiScatter = Fms * compensationFactor;
1139	return singleScatter + multiScatter;
1140}
1141#if NUM_RECT_AREA_LIGHTS > 0
1142	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1143		vec3 normal = geometryNormal;
1144		vec3 viewDir = geometryViewDir;
1145		vec3 position = geometryPosition;
1146		vec3 lightPos = rectAreaLight.position;
1147		vec3 halfWidth = rectAreaLight.halfWidth;
1148		vec3 halfHeight = rectAreaLight.halfHeight;
1149		vec3 lightColor = rectAreaLight.color;
1150		float roughness = material.roughness;
1151		vec3 rectCoords[ 4 ];
1152		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1153		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1154		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1155		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1156		vec4 t1 = texture2D( ltc_1, uv );
1157		vec4 t2 = texture2D( ltc_2, uv );
1158		mat3 mInv = mat3(
1159			vec3( t1.x, 0, t1.y ),
1160			vec3(    0, 1,    0 ),
1161			vec3( t1.z, 0, t1.w )
1162		);
1163		vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
1164		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1165		reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1166		#ifdef USE_CLEARCOAT
1167			vec3 Ncc = geometryClearcoatNormal;
1168			vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
1169			vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
1170			vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
1171			mat3 mInvClearcoat = mat3(
1172				vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
1173				vec3(             0, 1,             0 ),
1174				vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
1175			);
1176			vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
1177			clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
1178		#endif
1179	}
1180#endif
1181void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1182	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1183	vec3 irradiance = dotNL * directLight.color;
1184	#ifdef USE_CLEARCOAT
1185		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1186		vec3 ccIrradiance = dotNLcc * directLight.color;
1187		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1188	#endif
1189	#ifdef USE_SHEEN
1190 
1191 		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1192 
1193 		float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1194 		float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
1195 
1196 		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
1197 
1198 		irradiance *= sheenEnergyComp;
1199 
1200 	#endif
1201	reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
1202	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
1203}
1204void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1205	vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
1206	#ifdef USE_SHEEN
1207		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1208		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1209		diffuse *= sheenEnergyComp;
1210	#endif
1211	reflectedLight.indirectDiffuse += diffuse;
1212}
1213void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
1214	#ifdef USE_CLEARCOAT
1215		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1216	#endif
1217	#ifdef USE_SHEEN
1218		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
1219 	#endif
1220	vec3 singleScatteringDielectric = vec3( 0.0 );
1221	vec3 multiScatteringDielectric = vec3( 0.0 );
1222	vec3 singleScatteringMetallic = vec3( 0.0 );
1223	vec3 multiScatteringMetallic = vec3( 0.0 );
1224	#ifdef USE_IRIDESCENCE
1225		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1226		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1227	#else
1228		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1229		computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1230	#endif
1231	vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
1232	vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
1233	vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
1234	vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
1235	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1236	vec3 indirectSpecular = radiance * singleScattering;
1237	indirectSpecular += multiScattering * cosineWeightedIrradiance;
1238	vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
1239	#ifdef USE_SHEEN
1240		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1241		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1242		indirectSpecular *= sheenEnergyComp;
1243		indirectDiffuse *= sheenEnergyComp;
1244	#endif
1245	reflectedLight.indirectSpecular += indirectSpecular;
1246	reflectedLight.indirectDiffuse += indirectDiffuse;
1247}
1248#define RE_Direct				RE_Direct_Physical
1249#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1250#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1251#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1252float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1253	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1254}`,
1254ET=`
1255vec3 geometryPosition = - vViewPosition;
1256vec3 geometryNormal = normal;
1257vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1258vec3 geometryClearcoatNormal = vec3( 0.0 );
1259#ifdef USE_CLEARCOAT
1260	geometryClearcoatNormal = clearcoatNormal;
1261#endif
1262#ifdef USE_IRIDESCENCE
1263	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1264	if ( material.iridescenceThickness == 0.0 ) {
1265		material.iridescence = 0.0;
1266	} else {
1267		material.iridescence = saturate( material.iridescence );
1268	}
1269	if ( material.iridescence > 0.0 ) {
1270		material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1271		material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
1272		material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
1273		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1274	}
1275#endif
1276IncidentLight directLight;
1277#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1278	PointLight pointLight;
1279	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1280	PointLightShadow pointLightShadow;
1281	#endif
1282	#pragma unroll_loop_start
1283	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1284		pointLight = pointLights[ i ];
1285		getPointLightInfo( pointLight, geometryPosition, directLight );
1286		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
1287		pointLightShadow = pointLightShadows[ i ];
1288		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1289		#endif
1290		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1291	}
1292	#pragma unroll_loop_end
1293#endif
1294#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1295	SpotLight spotLight;
1296	vec4 spotColor;
1297	vec3 spotLightCoord;
1298	bool inSpotLightMap;
1299	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1300	SpotLightShadow spotLightShadow;
1301	#endif
1302	#pragma unroll_loop_start
1303	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1304		spotLight = spotLights[ i ];
1305		getSpotLightInfo( spotLight, geometryPosition, directLight );
1306		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1307		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1308		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1309		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1310		#else
1311		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1312		#endif
1313		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1314			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1315			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1316			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1317			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1318		#endif
1319		#undef SPOT_LIGHT_MAP_INDEX
1320		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1321		spotLightShadow = spotLightShadows[ i ];
1322		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1323		#endif
1324		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1325	}
1326	#pragma unroll_loop_end
1327#endif
1328#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1329	DirectionalLight directionalLight;
1330	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1331	DirectionalLightShadow directionalLightShadow;
1332	#endif
1333	#pragma unroll_loop_start
1334	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1335		directionalLight = directionalLights[ i ];
1336		getDirectionalLightInfo( directionalLight, directLight );
1337		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1338		directionalLightShadow = directionalLightShadows[ i ];
1339		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1340		#endif
1341		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1342	}
1343	#pragma unroll_loop_end
1344#endif
1345#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1346	RectAreaLight rectAreaLight;
1347	#pragma unroll_loop_start
1348	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1349		rectAreaLight = rectAreaLights[ i ];
1350		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1351	}
1352	#pragma unroll_loop_end
1353#endif
1354#if defined( RE_IndirectDiffuse )
1355	vec3 iblIrradiance = vec3( 0.0 );
1356	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1357	#if defined( USE_LIGHT_PROBES )
1358		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1359	#endif
1360	#if ( NUM_HEMI_LIGHTS > 0 )
1361		#pragma unroll_loop_start
1362		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1363			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1364		}
1365		#pragma unroll_loop_end
1366	#endif
1367#endif
1368#if defined( RE_IndirectSpecular )
1369	vec3 radiance = vec3( 0.0 );
1370	vec3 clearcoatRadiance = vec3( 0.0 );
1371#endif`,TT=`#if defined( RE_IndirectDiffuse )
1372	#ifdef USE_LIGHTMAP
1373		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1374		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1375		irradiance += lightMapIrradiance;
1376	#endif
1377	#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
1378		#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
1379			iblIrradiance += getIBLIrradiance( geometryNormal );
1380		#endif
1381	#endif
1382#endif
1383#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1384	#ifdef USE_ANISOTROPY
1385		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1386	#else
1387		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1388	#endif
1389	#ifdef USE_CLEARCOAT
1390		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1391	#endif
1392#endif`,AT=`#if defined( RE_IndirectDiffuse )
1393	#if defined( LAMBERT ) || defined( PHONG )
1394		irradiance += iblIrradiance;
1395	#endif
1396	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1397#endif
1398#if defined( RE_IndirectSpecular )
1399	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1400#endif`,CT=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1401	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1402#endif`,RT=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1403	uniform float logDepthBufFC;
1404	varying float vFragDepth;
1405	varying float vIsPerspective;
1406#endif`,IT=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1407	varying float vFragDepth;
1408	varying float vIsPerspective;
1409#endif`,PT=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1410	vFragDepth = 1.0 + gl_Position.w;
1411	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1412#endif`,LT=`#ifdef USE_MAP
1413	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1414	#ifdef DECODE_VIDEO_TEXTURE
1415		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1416	#endif
1417	diffuseColor *= sampledDiffuseColor;
1418#endif`,DT=`#ifdef USE_MAP
1419	uniform sampler2D map;
1420#endif`,NT=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1421	#if defined( USE_POINTS_UV )
1422		vec2 uv = vUv;
1423	#else
1424		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1425	#endif
1426#endif
1427#ifdef USE_MAP
1428	diffuseColor *= texture2D( map, uv );
1429#endif
1430#ifdef USE_ALPHAMAP
1431	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1432#endif`,UT=`#if defined( USE_POINTS_UV )
1433	varying vec2 vUv;
1434#else
1435	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1436		uniform mat3 uvTransform;
1437	#endif
1438#endif
1439#ifdef USE_MAP
1440	uniform sampler2D map;
1441#endif
1442#ifdef USE_ALPHAMAP
1443	uniform sampler2D alphaMap;
1444#endif`,OT=`float metalnessFactor = metalness;
1445#ifdef USE_METALNESSMAP
1446	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1447	metalnessFactor *= texelMetalness.b;
1448#endif`,FT=`#ifdef USE_METALNESSMAP
1449	uniform sampler2D metalnessMap;
1450#endif`,BT=`#ifdef USE_INSTANCING_MORPH
1451	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1452	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1453	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1454		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1455	}
1456#endif`,kT=`#if defined( USE_MORPHCOLORS )
1457	vColor *= morphTargetBaseInfluence;
1458	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1459		#if defined( USE_COLOR_ALPHA )
1460			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1461		#elif defined( USE_COLOR )
1462			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1463		#endif
1464	}
1465#endif`,zT=`#ifdef USE_MORPHNORMALS
1466	objectNormal *= morphTargetBaseInfluence;
1467	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1468		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1469	}
1470#endif`,VT=`#ifdef USE_MORPHTARGETS
1471	#ifndef USE_INSTANCING_MORPH
1472		uniform float morphTargetBaseInfluence;
1473		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1474	#endif
1475	uniform sampler2DArray morphTargetsTexture;
1476	uniform ivec2 morphTargetsTextureSize;
1477	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1478		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1479		int y = texelIndex / morphTargetsTextureSize.x;
1480		int x = texelIndex - y * morphTargetsTextureSize.x;
1481		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1482		return texelFetch( morphTargetsTexture, morphUV, 0 );
1483	}
1484#endif`,GT=`#ifdef USE_MORPHTARGETS
1485	transformed *= morphTargetBaseInfluence;
1486	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1487		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1488	}
1489#endif`,HT=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1490#ifdef FLAT_SHADED
1491	vec3 fdx = dFdx( vViewPosition );
1492	vec3 fdy = dFdy( vViewPosition );
1493	vec3 normal = normalize( cross( fdx, fdy ) );
1494#else
1495	vec3 normal = normalize( vNormal );
1496	#ifdef DOUBLE_SIDED
1497		normal *= faceDirection;
1498	#endif
1499#endif
1500#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1501	#ifdef USE_TANGENT
1502		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1503	#else
1504		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1505		#if defined( USE_NORMALMAP )
1506			vNormalMapUv
1507		#elif defined( USE_CLEARCOAT_NORMALMAP )
1508			vClearcoatNormalMapUv
1509		#else
1510			vUv
1511		#endif
1512		);
1513	#endif
1514	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1515		tbn[0] *= faceDirection;
1516		tbn[1] *= faceDirection;
1517	#endif
1518#endif
1519#ifdef USE_CLEARCOAT_NORMALMAP
1520	#ifdef USE_TANGENT
1521		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1522	#else
1523		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1524	#endif
1525	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1526		tbn2[0] *= faceDirection;
1527		tbn2[1] *= faceDirection;
1528	#endif
1529#endif
1530vec3 nonPerturbedNormal = normal;`,WT=`#ifdef USE_NORMALMAP_OBJECTSPACE
1531	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1532	#ifdef FLIP_SIDED
1533		normal = - normal;
1534	#endif
1535	#ifdef DOUBLE_SIDED
1536		normal = normal * faceDirection;
1537	#endif
1538	normal = normalize( normalMatrix * normal );
1539#elif defined( USE_NORMALMAP_TANGENTSPACE )
1540	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1541	mapN.xy *= normalScale;
1542	normal = normalize( tbn * mapN );
1543#elif defined( USE_BUMPMAP )
1544	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1545#endif`,jT=`#ifndef FLAT_SHADED
1546	varying vec3 vNormal;
1547	#ifdef USE_TANGENT
1548		varying vec3 vTangent;
1549		varying vec3 vBitangent;
1550	#endif
1551#endif`,XT=`#ifndef FLAT_SHADED
1552	varying vec3 vNormal;
1553	#ifdef USE_TANGENT
1554		varying vec3 vTangent;
1555		varying vec3 vBitangent;
1556	#endif
1557#endif`,YT=`#ifndef FLAT_SHADED
1558	vNormal = normalize( transformedNormal );
1559	#ifdef USE_TANGENT
1560		vTangent = normalize( transformedTangent );
1561		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1562	#endif
1563#endif`,qT=`#ifdef USE_NORMALMAP
1564	uniform sampler2D normalMap;
1565	uniform vec2 normalScale;
1566#endif
1567#ifdef USE_NORMALMAP_OBJECTSPACE
1568	uniform mat3 normalMatrix;
1569#endif
1570#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1571	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1572		vec3 q0 = dFdx( eye_pos.xyz );
1573		vec3 q1 = dFdy( eye_pos.xyz );
1574		vec2 st0 = dFdx( uv.st );
1575		vec2 st1 = dFdy( uv.st );
1576		vec3 N = surf_norm;
1577		vec3 q1perp = cross( q1, N );
1578		vec3 q0perp = cross( N, q0 );
1579		vec3 T = q1perp * st0.x + q0perp * st1.x;
1580		vec3 B = q1perp * st0.y + q0perp * st1.y;
1581		float det = max( dot( T, T ), dot( B, B ) );
1582		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1583		return mat3( T * scale, B * scale, N );
1584	}
1585#endif`,ZT=`#ifdef USE_CLEARCOAT
1586	vec3 clearcoatNormal = nonPerturbedNormal;
1587#endif`,JT=`#ifdef USE_CLEARCOAT_NORMALMAP
1588	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1589	clearcoatMapN.xy *= clearcoatNormalScale;
1590	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1591#endif`,KT=`#ifdef USE_CLEARCOATMAP
1592	uniform sampler2D clearcoatMap;
1593#endif
1594#ifdef USE_CLEARCOAT_NORMALMAP
1595	uniform sampler2D clearcoatNormalMap;
1596	uniform vec2 clearcoatNormalScale;
1597#endif
1598#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1599	uniform sampler2D clearcoatRoughnessMap;
1600#endif`,QT=`#ifdef USE_IRIDESCENCEMAP
1601	uniform sampler2D iridescenceMap;
1602#endif
1603#ifdef USE_IRIDESCENCE_THICKNESSMAP
1604	uniform sampler2D iridescenceThicknessMap;
1605#endif`,$T=`#ifdef OPAQUE
1606diffuseColor.a = 1.0;
1607#endif
1608#ifdef USE_TRANSMISSION
1609diffuseColor.a *= material.transmissionAlpha;
1610#endif
1611gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,eA=`vec3 packNormalToRGB( const in vec3 normal ) {
1612	return normalize( normal ) * 0.5 + 0.5;
1613}
1614vec3 unpackRGBToNormal( const in vec3 rgb ) {
1615	return 2.0 * rgb.xyz - 1.0;
1616}
1617const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1618const float Inv255 = 1. / 255.;
1619const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1620const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1621const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1622const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1623vec4 packDepthToRGBA( const in float v ) {
1624	if( v <= 0.0 )
1625		return vec4( 0., 0., 0., 0. );
1626	if( v >= 1.0 )
1627		return vec4( 1., 1., 1., 1. );
1628	float vuf;
1629	float af = modf( v * PackFactors.a, vuf );
1630	float bf = modf( vuf * ShiftRight8, vuf );
1631	float gf = modf( vuf * ShiftRight8, vuf );
1632	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1633}
1634vec3 packDepthToRGB( const in float v ) {
1635	if( v <= 0.0 )
1636		return vec3( 0., 0., 0. );
1637	if( v >= 1.0 )
1638		return vec3( 1., 1., 1. );
1639	float vuf;
1640	float bf = modf( v * PackFactors.b, vuf );
1641	float gf = modf( vuf * ShiftRight8, vuf );
1642	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1643}
1644vec2 packDepthToRG( const in float v ) {
1645	if( v <= 0.0 )
1646		return vec2( 0., 0. );
1647	if( v >= 1.0 )
1648		return vec2( 1., 1. );
1649	float vuf;
1650	float gf = modf( v * 256., vuf );
1651	return vec2( vuf * Inv255, gf );
1652}
1653float unpackRGBAToDepth( const in vec4 v ) {
1654	return dot( v, UnpackFactors4 );
1655}
1656float unpackRGBToDepth( const in vec3 v ) {
1657	return dot( v, UnpackFactors3 );
1658}
1659float unpackRGToDepth( const in vec2 v ) {
1660	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1661}
1662vec4 pack2HalfToRGBA( const in vec2 v ) {
1663	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1664	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1665}
1666vec2 unpackRGBATo2Half( const in vec4 v ) {
1667	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1668}
1669float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1670	return ( viewZ + near ) / ( near - far );
1671}
1672float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1673	#ifdef USE_REVERSED_DEPTH_BUFFER
1674	
1675		return depth * ( far - near ) - far;
1676	#else
1677		return depth * ( near - far ) - near;
1678	#endif
1679}
1680float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1681	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1682}
1683float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1684	
1685	#ifdef USE_REVERSED_DEPTH_BUFFER
1686		return ( near * far ) / ( ( near - far ) * depth - near );
1687	#else
1688		return ( near * far ) / ( ( far - near ) * depth - far );
1689	#endif
1690}`,tA=`#ifdef PREMULTIPLIED_ALPHA
1691	gl_FragColor.rgb *= gl_FragColor.a;
1692#endif`,nA=`vec4 mvPosition = vec4( transformed, 1.0 );
1693#ifdef USE_BATCHING
1694	mvPosition = batchingMatrix * mvPosition;
1695#endif
1696#ifdef USE_INSTANCING
1697	mvPosition = instanceMatrix * mvPosition;
1698#endif
1699mvPosition = modelViewMatrix * mvPosition;
1700gl_Position = projectionMatrix * mvPosition;`,iA=`#ifdef DITHERING
1701	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1702#endif`,rA=`#ifdef DITHERING
1703	vec3 dithering( vec3 color ) {
1704		float grid_position = rand( gl_FragCoord.xy );
1705		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1706		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1707		return color + dither_shift_RGB;
1708	}
1709#endif`,sA=`float roughnessFactor = roughness;
1710#ifdef USE_ROUGHNESSMAP
1711	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1712	roughnessFactor *= texelRoughness.g;
1713#endif`,oA=`#ifdef USE_ROUGHNESSMAP
1714	uniform sampler2D roughnessMap;
1715#endif`,aA=`#if NUM_SPOT_LIGHT_COORDS > 0
1716	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1717#endif
1718#if NUM_SPOT_LIGHT_MAPS > 0
1719	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1720#endif
1721#ifdef USE_SHADOWMAP
1722	#if NUM_DIR_LIGHT_SHADOWS > 0
1723		#if defined( SHADOWMAP_TYPE_PCF )
1724			uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1725		#else
1726			uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1727		#endif
1728		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1729		struct DirectionalLightShadow {
1730			float shadowIntensity;
1731			float shadowBias;
1732			float shadowNormalBias;
1733			float shadowRadius;
1734			vec2 shadowMapSize;
1735		};
1736		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1737	#endif
1738	#if NUM_SPOT_LIGHT_SHADOWS > 0
1739		#if defined( SHADOWMAP_TYPE_PCF )
1740			uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1741		#else
1742			uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1743		#endif
1744		struct SpotLightShadow {
1745			float shadowIntensity;
1746			float shadowBias;
1747			float shadowNormalBias;
1748			float shadowRadius;
1749			vec2 shadowMapSize;
1750		};
1751		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1752	#endif
1753	#if NUM_POINT_LIGHT_SHADOWS > 0
1754		#if defined( SHADOWMAP_TYPE_PCF )
1755			uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1756		#elif defined( SHADOWMAP_TYPE_BASIC )
1757			uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1758		#endif
1759		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1760		struct PointLightShadow {
1761			float shadowIntensity;
1762			float shadowBias;
1763			float shadowNormalBias;
1764			float shadowRadius;
1765			vec2 shadowMapSize;
1766			float shadowCameraNear;
1767			float shadowCameraFar;
1768		};
1769		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1770	#endif
1771	#if defined( SHADOWMAP_TYPE_PCF )
1772		float interleavedGradientNoise( vec2 position ) {
1773			return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
1774		}
1775		vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
1776			const float goldenAngle = 2.399963229728653;
1777			float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
1778			float theta = float( sampleIndex ) * goldenAngle + phi;
1779			return vec2( cos( theta ), sin( theta ) ) * r;
1780		}
1781	#endif
1782	#if defined( SHADOWMAP_TYPE_PCF )
1783		float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1784			float shadow = 1.0;
1785			shadowCoord.xyz /= shadowCoord.w;
1786			shadowCoord.z += shadowBias;
1787			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1788			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1789			if ( frustumTest ) {
1790				vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1791				float radius = shadowRadius * texelSize.x;
1792				float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1793				shadow = (
1794					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
1795					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
1796					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
1797					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
1798					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
1799				) * 0.2;
1800			}
1801			return mix( 1.0, shadow, shadowIntensity );
1802		}
1803	#elif defined( SHADOWMAP_TYPE_VSM )
1804		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1805			float shadow = 1.0;
1806			shadowCoord.xyz /= shadowCoord.w;
1807			#ifdef USE_REVERSED_DEPTH_BUFFER
1808				shadowCoord.z -= shadowBias;
1809			#else
1810				shadowCoord.z += shadowBias;
1811			#endif
1812			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1813			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1814			if ( frustumTest ) {
1815				vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
1816				float mean = distribution.x;
1817				float variance = distribution.y * distribution.y;
1818				#ifdef USE_REVERSED_DEPTH_BUFFER
1819					float hard_shadow = step( mean, shadowCoord.z );
1820				#else
1821					float hard_shadow = step( shadowCoord.z, mean );
1822				#endif
1823				
1824				if ( hard_shadow == 1.0 ) {
1825					shadow = 1.0;
1826				} else {
1827					variance = max( variance, 0.0000001 );
1828					float d = shadowCoord.z - mean;
1829					float p_max = variance / ( variance + d * d );
1830					p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
1831					shadow = max( hard_shadow, p_max );
1832				}
1833			}
1834			return mix( 1.0, shadow, shadowIntensity );
1835		}
1836	#else
1837		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1838			float shadow = 1.0;
1839			shadowCoord.xyz /= shadowCoord.w;
1840			#ifdef USE_REVERSED_DEPTH_BUFFER
1841				shadowCoord.z -= shadowBias;
1842			#else
1843				shadowCoord.z += shadowBias;
1844			#endif
1845			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1846			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1847			if ( frustumTest ) {
1848				float depth = texture2D( shadowMap, shadowCoord.xy ).r;
1849				#ifdef USE_REVERSED_DEPTH_BUFFER
1850					shadow = step( depth, shadowCoord.z );
1851				#else
1852					shadow = step( shadowCoord.z, depth );
1853				#endif
1854			}
1855			return mix( 1.0, shadow, shadowIntensity );
1856		}
1857	#endif
1858	#if NUM_POINT_LIGHT_SHADOWS > 0
1859	#if defined( SHADOWMAP_TYPE_PCF )
1860	float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1861		float shadow = 1.0;
1862		vec3 lightToPosition = shadowCoord.xyz;
1863		vec3 bd3D = normalize( lightToPosition );
1864		vec3 absVec = abs( lightToPosition );
1865		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1866		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1867			#ifdef USE_REVERSED_DEPTH_BUFFER
1868				float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1869				dp -= shadowBias;
1870			#else
1871				float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1872				dp += shadowBias;
1873			#endif
1874			float texelSize = shadowRadius / shadowMapSize.x;
1875			vec3 absDir = abs( bd3D );
1876			vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
1877			tangent = normalize( cross( bd3D, tangent ) );
1878			vec3 bitangent = cross( bd3D, tangent );
1879			float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1880			vec2 sample0 = vogelDiskSample( 0, 5, phi );
1881			vec2 sample1 = vogelDiskSample( 1, 5, phi );
1882			vec2 sample2 = vogelDiskSample( 2, 5, phi );
1883			vec2 sample3 = vogelDiskSample( 3, 5, phi );
1884			vec2 sample4 = vogelDiskSample( 4, 5, phi );
1885			shadow = (
1886				texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
1887				texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
1888				texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
1889				texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
1890				texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
1891			) * 0.2;
1892		}
1893		return mix( 1.0, shadow, shadowIntensity );
1894	}
1895	#elif defined( SHADOWMAP_TYPE_BASIC )
1896	float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1897		float shadow = 1.0;
1898		vec3 lightToPosition = shadowCoord.xyz;
1899		vec3 absVec = abs( lightToPosition );
1900		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1901		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1902			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1903			dp += shadowBias;
1904			vec3 bd3D = normalize( lightToPosition );
1905			float depth = textureCube( shadowMap, bd3D ).r;
1906			#ifdef USE_REVERSED_DEPTH_BUFFER
1907				depth = 1.0 - depth;
1908			#endif
1909			shadow = step( dp, depth );
1910		}
1911		return mix( 1.0, shadow, shadowIntensity );
1912	}
1913	#endif
1914	#endif
1915#endif`,lA=`#if NUM_SPOT_LIGHT_COORDS > 0
1916	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1917	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1918#endif
1919#ifdef USE_SHADOWMAP
1920	#if NUM_DIR_LIGHT_SHADOWS > 0
1921		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1922		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1923		struct DirectionalLightShadow {
1924			float shadowIntensity;
1925			float shadowBias;
1926			float shadowNormalBias;
1927			float shadowRadius;
1928			vec2 shadowMapSize;
1929		};
1930		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1931	#endif
1932	#if NUM_SPOT_LIGHT_SHADOWS > 0
1933		struct SpotLightShadow {
1934			float shadowIntensity;
1935			float shadowBias;
1936			float shadowNormalBias;
1937			float shadowRadius;
1938			vec2 shadowMapSize;
1939		};
1940		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1941	#endif
1942	#if NUM_POINT_LIGHT_SHADOWS > 0
1943		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1944		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1945		struct PointLightShadow {
1946			float shadowIntensity;
1947			float shadowBias;
1948			float shadowNormalBias;
1949			float shadowRadius;
1950			vec2 shadowMapSize;
1951			float shadowCameraNear;
1952			float shadowCameraFar;
1953		};
1954		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1955	#endif
1956#endif`,cA=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1957	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1958	vec4 shadowWorldPosition;
1959#endif
1960#if defined( USE_SHADOWMAP )
1961	#if NUM_DIR_LIGHT_SHADOWS > 0
1962		#pragma unroll_loop_start
1963		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1964			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1965			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1966		}
1967		#pragma unroll_loop_end
1968	#endif
1969	#if NUM_POINT_LIGHT_SHADOWS > 0
1970		#pragma unroll_loop_start
1971		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1972			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1973			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1974		}
1975		#pragma unroll_loop_end
1976	#endif
1977#endif
1978#if NUM_SPOT_LIGHT_COORDS > 0
1979	#pragma unroll_loop_start
1980	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
1981		shadowWorldPosition = worldPosition;
1982		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1983			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
1984		#endif
1985		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1986	}
1987	#pragma unroll_loop_end
1988#endif`,uA=`float getShadowMask() {
1989	float shadow = 1.0;
1990	#ifdef USE_SHADOWMAP
1991	#if NUM_DIR_LIGHT_SHADOWS > 0
1992	DirectionalLightShadow directionalLight;
1993	#pragma unroll_loop_start
1994	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1995		directionalLight = directionalLightShadows[ i ];
1996		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1997	}
1998	#pragma unroll_loop_end
1999	#endif
2000	#if NUM_SPOT_LIGHT_SHADOWS > 0
2001	SpotLightShadow spotLight;
2002	#pragma unroll_loop_start
2003	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
2004		spotLight = spotLightShadows[ i ];
2005		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2006	}
2007	#pragma unroll_loop_end
2008	#endif
2009	#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
2010	PointLightShadow pointLight;
2011	#pragma unroll_loop_start
2012	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2013		pointLight = pointLightShadows[ i ];
2014		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
2015	}
2016	#pragma unroll_loop_end
2017	#endif
2018	#endif
2019	return shadow;
2020}`,hA=`#ifdef USE_SKINNING
2021	mat4 boneMatX = getBoneMatrix( skinIndex.x );
2022	mat4 boneMatY = getBoneMatrix( skinIndex.y );
2023	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2024	mat4 boneMatW = getBoneMatrix( skinIndex.w );
2025#endif`,dA=`#ifdef USE_SKINNING
2026	uniform mat4 bindMatrix;
2027	uniform mat4 bindMatrixInverse;
2028	uniform highp sampler2D boneTexture;
2029	mat4 getBoneMatrix( const in float i ) {
2030		int size = textureSize( boneTexture, 0 ).x;
2031		int j = int( i ) * 4;
2032		int x = j % size;
2033		int y = j / size;
2034		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2035		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2036		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2037		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2038		return mat4( v1, v2, v3, v4 );
2039	}
2040#endif`,fA=`#ifdef USE_SKINNING
2041	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2042	vec4 skinned = vec4( 0.0 );
2043	skinned += boneMatX * skinVertex * skinWeight.x;
2044	skinned += boneMatY * skinVertex * skinWeight.y;
2045	skinned += boneMatZ * skinVertex * skinWeight.z;
2046	skinned += boneMatW * skinVertex * skinWeight.w;
2047	transformed = ( bindMatrixInverse * skinned ).xyz;
2048#endif`,pA=`#ifdef USE_SKINNING
2049	mat4 skinMatrix = mat4( 0.0 );
2050	skinMatrix += skinWeight.x * boneMatX;
2051	skinMatrix += skinWeight.y * boneMatY;
2052	skinMatrix += skinWeight.z * boneMatZ;
2053	skinMatrix += skinWeight.w * boneMatW;
2054	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2055	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2056	#ifdef USE_TANGENT
2057		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2058	#endif
2059#endif`,mA=`float specularStrength;
2060#ifdef USE_SPECULARMAP
2061	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2062	specularStrength = texelSpecular.r;
2063#else
2064	specularStrength = 1.0;
2065#endif`,gA=`#ifdef USE_SPECULARMAP
2066	uniform sampler2D specularMap;
2067#endif`,xA=`#if defined( TONE_MAPPING )
2068	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2069#endif`,vA=`#ifndef saturate
2070#define saturate( a ) clamp( a, 0.0, 1.0 )
2071#endif
2072uniform float toneMappingExposure;
2073vec3 LinearToneMapping( vec3 color ) {
2074	return saturate( toneMappingExposure * color );
2075}
2076vec3 ReinhardToneMapping( vec3 color ) {
2077	color *= toneMappingExposure;
2078	return saturate( color / ( vec3( 1.0 ) + color ) );
2079}
2080vec3 CineonToneMapping( vec3 color ) {
2081	color *= toneMappingExposure;
2082	color = max( vec3( 0.0 ), color - 0.004 );
2083	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2084}
2085vec3 RRTAndODTFit( vec3 v ) {
2086	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2087	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2088	return a / b;
2089}
2090vec3 ACESFilmicToneMapping( vec3 color ) {
2091	const mat3 ACESInputMat = mat3(
2092		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2093		vec3( 0.04823, 0.01566, 0.83777 )
2094	);
2095	const mat3 ACESOutputMat = mat3(
2096		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2097		vec3( -0.07367, -0.00605,  1.07602 )
2098	);
2099	color *= toneMappingExposure / 0.6;
2100	color = ACESInputMat * color;
2101	color = RRTAndODTFit( color );
2102	color = ACESOutputMat * color;
2103	return saturate( color );
2104}
2105const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2106	vec3( 1.6605, - 0.1246, - 0.0182 ),
2107	vec3( - 0.5876, 1.1329, - 0.1006 ),
2108	vec3( - 0.0728, - 0.0083, 1.1187 )
2109);
2110const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2111	vec3( 0.6274, 0.0691, 0.0164 ),
2112	vec3( 0.3293, 0.9195, 0.0880 ),
2113	vec3( 0.0433, 0.0113, 0.8956 )
2114);
2115vec3 agxDefaultContrastApprox( vec3 x ) {
2116	vec3 x2 = x * x;
2117	vec3 x4 = x2 * x2;
2118	return + 15.5 * x4 * x2
2119		- 40.14 * x4 * x
2120		+ 31.96 * x4
2121		- 6.868 * x2 * x
2122		+ 0.4298 * x2
2123		+ 0.1191 * x
2124		- 0.00232;
2125}
2126vec3 AgXToneMapping( vec3 color ) {
2127	const mat3 AgXInsetMatrix = mat3(
2128		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2129		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2130		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2131	);
2132	const mat3 AgXOutsetMatrix = mat3(
2133		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2134		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2135		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2136	);
2137	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2138	color *= toneMappingExposure;
2139	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2140	color = AgXInsetMatrix * color;
2141	color = max( color, 1e-10 );	color = log2( color );
2142	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2143	color = clamp( color, 0.0, 1.0 );
2144	color = agxDefaultContrastApprox( color );
2145	color = AgXOutsetMatrix * color;
2146	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2147	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2148	color = clamp( color, 0.0, 1.0 );
2149	return color;
2150}
2151vec3 NeutralToneMapping( vec3 color ) {
2152	const float StartCompression = 0.8 - 0.04;
2153	const float Desaturation = 0.15;
2154	color *= toneMappingExposure;
2155	float x = min( color.r, min( color.g, color.b ) );
2156	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2157	color -= offset;
2158	float peak = max( color.r, max( color.g, color.b ) );
2159	if ( peak < StartCompression ) return color;
2160	float d = 1. - StartCompression;
2161	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2162	color *= newPeak / peak;
2163	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2164	return mix( color, vec3( newPeak ), g );
2165}
2166vec3 CustomToneMapping( vec3 color ) { return color; }`,yA=`#ifdef USE_TRANSMISSION
2167	material.transmission = transmission;
2168	material.transmissionAlpha = 1.0;
2169	material.thickness = thickness;
2170	material.attenuationDistance = attenuationDistance;
2171	material.attenuationColor = attenuationColor;
2172	#ifdef USE_TRANSMISSIONMAP
2173		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2174	#endif
2175	#ifdef USE_THICKNESSMAP
2176		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2177	#endif
2178	vec3 pos = vWorldPosition;
2179	vec3 v = normalize( cameraPosition - pos );
2180	vec3 n = inverseTransformDirection( normal, viewMatrix );
2181	vec4 transmitted = getIBLVolumeRefraction(
2182		n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
2183		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2184		material.attenuationColor, material.attenuationDistance );
2185	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2186	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2187#endif`,_A=`#ifdef USE_TRANSMISSION
2188	uniform float transmission;
2189	uniform float thickness;
2190	uniform float attenuationDistance;
2191	uniform vec3 attenuationColor;
2192	#ifdef USE_TRANSMISSIONMAP
2193		uniform sampler2D transmissionMap;
2194	#endif
2195	#ifdef USE_THICKNESSMAP
2196		uniform sampler2D thicknessMap;
2197	#endif
2198	uniform vec2 transmissionSamplerSize;
2199	uniform sampler2D transmissionSamplerMap;
2200	uniform mat4 modelMatrix;
2201	uniform mat4 projectionMatrix;
2202	varying vec3 vWorldPosition;
2203	float w0( float a ) {
2204		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2205	}
2206	float w1( float a ) {
2207		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2208	}
2209	float w2( float a ){
2210		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2211	}
2212	float w3( float a ) {
2213		return ( 1.0 / 6.0 ) * ( a * a * a );
2214	}
2215	float g0( float a ) {
2216		return w0( a ) + w1( a );
2217	}
2218	float g1( float a ) {
2219		return w2( a ) + w3( a );
2220	}
2221	float h0( float a ) {
2222		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2223	}
2224	float h1( float a ) {
2225		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2226	}
2227	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2228		uv = uv * texelSize.zw + 0.5;
2229		vec2 iuv = floor( uv );
2230		vec2 fuv = fract( uv );
2231		float g0x = g0( fuv.x );
2232		float g1x = g1( fuv.x );
2233		float h0x = h0( fuv.x );
2234		float h1x = h1( fuv.x );
2235		float h0y = h0( fuv.y );
2236		float h1y = h1( fuv.y );
2237		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2238		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2239		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2240		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2241		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2242			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2243	}
2244	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2245		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2246		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2247		vec2 fLodSizeInv = 1.0 / fLodSize;
2248		vec2 cLodSizeInv = 1.0 / cLodSize;
2249		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2250		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2251		return mix( fSample, cSample, fract( lod ) );
2252	}
2253	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2254		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2255		vec3 modelScale;
2256		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2257		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2258		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2259		return normalize( refractionVector ) * thickness * modelScale;
2260	}
2261	float applyIorToRoughness( const in float roughness, const in float ior ) {
2262		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2263	}
2264	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2265		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2266		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2267	}
2268	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2269		if ( isinf( attenuationDistance ) ) {
2270			return vec3( 1.0 );
2271		} else {
2272			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2273			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2274		}
2275	}
2276	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2277		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2278		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2279		const in vec3 attenuationColor, const in float attenuationDistance ) {
2280		vec4 transmittedLight;
2281		vec3 transmittance;
2282		#ifdef USE_DISPERSION
2283			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2284			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2285			for ( int i = 0; i < 3; i ++ ) {
2286				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2287				vec3 refractedRayExit = position + transmissionRay;
2288				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2289				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2290				refractionCoords += 1.0;
2291				refractionCoords /= 2.0;
2292				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2293				transmittedLight[ i ] = transmissionSample[ i ];
2294				transmittedLight.a += transmissionSample.a;
2295				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2296			}
2297			transmittedLight.a /= 3.0;
2298		#else
2299			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2300			vec3 refractedRayExit = position + transmissionRay;
2301			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2302			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2303			refractionCoords += 1.0;
2304			refractionCoords /= 2.0;
2305			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2306			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2307		#endif
2308		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2309		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2310		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2311		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2312	}
2313#endif`,SA=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2314	varying vec2 vUv;
2315#endif
2316#ifdef USE_MAP
2317	varying vec2 vMapUv;
2318#endif
2319#ifdef USE_ALPHAMAP
2320	varying vec2 vAlphaMapUv;
2321#endif
2322#ifdef USE_LIGHTMAP
2323	varying vec2 vLightMapUv;
2324#endif
2325#ifdef USE_AOMAP
2326	varying vec2 vAoMapUv;
2327#endif
2328#ifdef USE_BUMPMAP
2329	varying vec2 vBumpMapUv;
2330#endif
2331#ifdef USE_NORMALMAP
2332	varying vec2 vNormalMapUv;
2333#endif
2334#ifdef USE_EMISSIVEMAP
2335	varying vec2 vEmissiveMapUv;
2336#endif
2337#ifdef USE_METALNESSMAP
2338	varying vec2 vMetalnessMapUv;
2339#endif
2340#ifdef USE_ROUGHNESSMAP
2341	varying vec2 vRoughnessMapUv;
2342#endif
2343#ifdef USE_ANISOTROPYMAP
2344	varying vec2 vAnisotropyMapUv;
2345#endif
2346#ifdef USE_CLEARCOATMAP
2347	varying vec2 vClearcoatMapUv;
2348#endif
2349#ifdef USE_CLEARCOAT_NORMALMAP
2350	varying vec2 vClearcoatNormalMapUv;
2351#endif
2352#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2353	varying vec2 vClearcoatRoughnessMapUv;
2354#endif
2355#ifdef USE_IRIDESCENCEMAP
2356	varying vec2 vIridescenceMapUv;
2357#endif
2358#ifdef USE_IRIDESCENCE_THICKNESSMAP
2359	varying vec2 vIridescenceThicknessMapUv;
2360#endif
2361#ifdef USE_SHEEN_COLORMAP
2362	varying vec2 vSheenColorMapUv;
2363#endif
2364#ifdef USE_SHEEN_ROUGHNESSMAP
2365	varying vec2 vSheenRoughnessMapUv;
2366#endif
2367#ifdef USE_SPECULARMAP
2368	varying vec2 vSpecularMapUv;
2369#endif
2370#ifdef USE_SPECULAR_COLORMAP
2371	varying vec2 vSpecularColorMapUv;
2372#endif
2373#ifdef USE_SPECULAR_INTENSITYMAP
2374	varying vec2 vSpecularIntensityMapUv;
2375#endif
2376#ifdef USE_TRANSMISSIONMAP
2377	uniform mat3 transmissionMapTransform;
2378	varying vec2 vTransmissionMapUv;
2379#endif
2380#ifdef USE_THICKNESSMAP
2381	uniform mat3 thicknessMapTransform;
2382	varying vec2 vThicknessMapUv;
2383#endif`,MA=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2384	varying vec2 vUv;
2385#endif
2386#ifdef USE_MAP
2387	uniform mat3 mapTransform;
2388	varying vec2 vMapUv;
2389#endif
2390#ifdef USE_ALPHAMAP
2391	uniform mat3 alphaMapTransform;
2392	varying vec2 vAlphaMapUv;
2393#endif
2394#ifdef USE_LIGHTMAP
2395	uniform mat3 lightMapTransform;
2396	varying vec2 vLightMapUv;
2397#endif
2398#ifdef USE_AOMAP
2399	uniform mat3 aoMapTransform;
2400	varying vec2 vAoMapUv;
2401#endif
2402#ifdef USE_BUMPMAP
2403	uniform mat3 bumpMapTransform;
2404	varying vec2 vBumpMapUv;
2405#endif
2406#ifdef USE_NORMALMAP
2407	uniform mat3 normalMapTransform;
2408	varying vec2 vNormalMapUv;
2409#endif
2410#ifdef USE_DISPLACEMENTMAP
2411	uniform mat3 displacementMapTransform;
2412	varying vec2 vDisplacementMapUv;
2413#endif
2414#ifdef USE_EMISSIVEMAP
2415	uniform mat3 emissiveMapTransform;
2416	varying vec2 vEmissiveMapUv;
2417#endif
2418#ifdef USE_METALNESSMAP
2419	uniform mat3 metalnessMapTransform;
2420	varying vec2 vMetalnessMapUv;
2421#endif
2422#ifdef USE_ROUGHNESSMAP
2423	uniform mat3 roughnessMapTransform;
2424	varying vec2 vRoughnessMapUv;
2425#endif
2426#ifdef USE_ANISOTROPYMAP
2427	uniform mat3 anisotropyMapTransform;
2428	varying vec2 vAnisotropyMapUv;
2429#endif
2430#ifdef USE_CLEARCOATMAP
2431	uniform mat3 clearcoatMapTransform;
2432	varying vec2 vClearcoatMapUv;
2433#endif
2434#ifdef USE_CLEARCOAT_NORMALMAP
2435	uniform mat3 clearcoatNormalMapTransform;
2436	varying vec2 vClearcoatNormalMapUv;
2437#endif
2438#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2439	uniform mat3 clearcoatRoughnessMapTransform;
2440	varying vec2 vClearcoatRoughnessMapUv;
2441#endif
2442#ifdef USE_SHEEN_COLORMAP
2443	uniform mat3 sheenColorMapTransform;
2444	varying vec2 vSheenColorMapUv;
2445#endif
2446#ifdef USE_SHEEN_ROUGHNESSMAP
2447	uniform mat3 sheenRoughnessMapTransform;
2448	varying vec2 vSheenRoughnessMapUv;
2449#endif
2450#ifdef USE_IRIDESCENCEMAP
2451	uniform mat3 iridescenceMapTransform;
2452	varying vec2 vIridescenceMapUv;
2453#endif
2454#ifdef USE_IRIDESCENCE_THICKNESSMAP
2455	uniform mat3 iridescenceThicknessMapTransform;
2456	varying vec2 vIridescenceThicknessMapUv;
2457#endif
2458#ifdef USE_SPECULARMAP
2459	uniform mat3 specularMapTransform;
2460	varying vec2 vSpecularMapUv;
2461#endif
2462#ifdef USE_SPECULAR_COLORMAP
2463	uniform mat3 specularColorMapTransform;
2464	varying vec2 vSpecularColorMapUv;
2465#endif
2466#ifdef USE_SPECULAR_INTENSITYMAP
2467	uniform mat3 specularIntensityMapTransform;
2468	varying vec2 vSpecularIntensityMapUv;
2469#endif
2470#ifdef USE_TRANSMISSIONMAP
2471	uniform mat3 transmissionMapTransform;
2472	varying vec2 vTransmissionMapUv;
2473#endif
2474#ifdef USE_THICKNESSMAP
2475	uniform mat3 thicknessMapTransform;
2476	varying vec2 vThicknessMapUv;
2477#endif`,bA=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2478	vUv = vec3( uv, 1 ).xy;
2479#endif
2480#ifdef USE_MAP
2481	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2482#endif
2483#ifdef USE_ALPHAMAP
2484	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2485#endif
2486#ifdef USE_LIGHTMAP
2487	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2488#endif
2489#ifdef USE_AOMAP
2490	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2491#endif
2492#ifdef USE_BUMPMAP
2493	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2494#endif
2495#ifdef USE_NORMALMAP
2496	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2497#endif
2498#ifdef USE_DISPLACEMENTMAP
2499	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2500#endif
2501#ifdef USE_EMISSIVEMAP
2502	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2503#endif
2504#ifdef USE_METALNESSMAP
2505	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2506#endif
2507#ifdef USE_ROUGHNESSMAP
2508	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2509#endif
2510#ifdef USE_ANISOTROPYMAP
2511	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2512#endif
2513#ifdef USE_CLEARCOATMAP
2514	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2515#endif
2516#ifdef USE_CLEARCOAT_NORMALMAP
2517	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2518#endif
2519#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2520	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2521#endif
2522#ifdef USE_IRIDESCENCEMAP
2523	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2524#endif
2525#ifdef USE_IRIDESCENCE_THICKNESSMAP
2526	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2527#endif
2528#ifdef USE_SHEEN_COLORMAP
2529	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2530#endif
2531#ifdef USE_SHEEN_ROUGHNESSMAP
2532	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2533#endif
2534#ifdef USE_SPECULARMAP
2535	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2536#endif
2537#ifdef USE_SPECULAR_COLORMAP
2538	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2539#endif
2540#ifdef USE_SPECULAR_INTENSITYMAP
2541	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2542#endif
2543#ifdef USE_TRANSMISSIONMAP
2544	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2545#endif
2546#ifdef USE_THICKNESSMAP
2547	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2548#endif`,wA=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2549	vec4 worldPosition = vec4( transformed, 1.0 );
2550	#ifdef USE_BATCHING
2551		worldPosition = batchingMatrix * worldPosition;
2552	#endif
2553	#ifdef USE_INSTANCING
2554		worldPosition = instanceMatrix * worldPosition;
2555	#endif
2556	worldPosition = modelMatrix * worldPosition;
2557#endif`;const EA=`varying vec2 vUv;
2558uniform mat3 uvTransform;
2559void main() {
2560	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2561	gl_Position = vec4( position.xy, 1.0, 1.0 );
2562}`,TA=`uniform sampler2D t2D;
2563uniform float backgroundIntensity;
2564varying vec2 vUv;
2565void main() {
2566	vec4 texColor = texture2D( t2D, vUv );
2567	#ifdef DECODE_VIDEO_TEXTURE
2568		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
2569	#endif
2570	texColor.rgb *= backgroundIntensity;
2571	gl_FragColor = texColor;
2572	#include <tonemapping_fragment>
2573	#include <colorspace_fragment>
2574}`,AA=`varying vec3 vWorldDirection;
2575#include <common>
2576void main() {
2577	vWorldDirection = transformDirection( position, modelMatrix );
2578	#include <begin_vertex>
2579	#include <project_vertex>
2580	gl_Position.z = gl_Position.w;
2581}`,CA=`#ifdef ENVMAP_TYPE_CUBE
2582	uniform samplerCube envMap;
2583#elif defined( ENVMAP_TYPE_CUBE_UV )
2584	uniform sampler2D envMap;
2585#endif
2586uniform float flipEnvMap;
2587uniform float backgroundBlurriness;
2588uniform float backgroundIntensity;
2589uniform mat3 backgroundRotation;
2590varying vec3 vWorldDirection;
2591#include <cube_uv_reflection_fragment>
2592void main() {
2593	#ifdef ENVMAP_TYPE_CUBE
2594		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
2595	#elif defined( ENVMAP_TYPE_CUBE_UV )
2596		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2597	#else
2598		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2599	#endif
2600	texColor.rgb *= backgroundIntensity;
2601	gl_FragColor = texColor;
2602	#include <tonemapping_fragment>
2603	#include <colorspace_fragment>
2604}`,RA=`varying vec3 vWorldDirection;
2605#include <common>
2606void main() {
2607	vWorldDirection = transformDirection( position, modelMatrix );
2608	#include <begin_vertex>
2609	#include <project_vertex>
2610	gl_Position.z = gl_Position.w;
2611}`,IA=`uniform samplerCube tCube;
2612uniform float tFlip;
2613uniform float opacity;
2614varying vec3 vWorldDirection;
2615void main() {
2616	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2617	gl_FragColor = texColor;
2618	gl_FragColor.a *= opacity;
2619	#include <tonemapping_fragment>
2620	#include <colorspace_fragment>
2621}`,PA=`#include <common>
2622#include <batching_pars_vertex>
2623#include <uv_pars_vertex>
2624#include <displacementmap_pars_vertex>
2625#include <morphtarget_pars_vertex>
2626#include <skinning_pars_vertex>
2627#include <logdepthbuf_pars_vertex>
2628#include <clipping_planes_pars_vertex>
2629varying vec2 vHighPrecisionZW;
2630void main() {
2631	#include <uv_vertex>
2632	#include <batching_vertex>
2633	#include <skinbase_vertex>
2634	#include <morphinstance_vertex>
2635	#ifdef USE_DISPLACEMENTMAP
2636		#include <beginnormal_vertex>
2637		#include <morphnormal_vertex>
2638		#include <skinnormal_vertex>
2639	#endif
2640	#include <begin_vertex>
2641	#include <morphtarget_vertex>
2642	#include <skinning_vertex>
2643	#include <displacementmap_vertex>
2644	#include <project_vertex>
2645	#include <logdepthbuf_vertex>
2646	#include <clipping_planes_vertex>
2647	vHighPrecisionZW = gl_Position.zw;
2648}`,LA=`#if DEPTH_PACKING == 3200
2649	uniform float opacity;
2650#endif
2651#include <common>
2652#include <packing>
2653#include <uv_pars_fragment>
2654#include <map_pars_fragment>
2655#include <alphamap_pars_fragment>
2656#include <alphatest_pars_fragment>
2657#include <alphahash_pars_fragment>
2658#include <logdepthbuf_pars_fragment>
2659#include <clipping_planes_pars_fragment>
2660varying vec2 vHighPrecisionZW;
2661void main() {
2662	vec4 diffuseColor = vec4( 1.0 );
2663	#include <clipping_planes_fragment>
2664	#if DEPTH_PACKING == 3200
2665		diffuseColor.a = opacity;
2666	#endif
2667	#include <map_fragment>
2668	#include <alphamap_fragment>
2669	#include <alphatest_fragment>
2670	#include <alphahash_fragment>
2671	#include <logdepthbuf_fragment>
2672	#ifdef USE_REVERSED_DEPTH_BUFFER
2673		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
2674	#else
2675		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
2676	#endif
2677	#if DEPTH_PACKING == 3200
2678		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2679	#elif DEPTH_PACKING == 3201
2680		gl_FragColor = packDepthToRGBA( fragCoordZ );
2681	#elif DEPTH_PACKING == 3202
2682		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2683	#elif DEPTH_PACKING == 3203
2684		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2685	#endif
2686}`,DA=`#define DISTANCE
2687varying vec3 vWorldPosition;
2688#include <common>
2689#include <batching_pars_vertex>
2690#include <uv_pars_vertex>
2691#include <displacementmap_pars_vertex>
2692#include <morphtarget_pars_vertex>
2693#include <skinning_pars_vertex>
2694#include <clipping_planes_pars_vertex>
2695void main() {
2696	#include <uv_vertex>
2697	#include <batching_vertex>
2698	#include <skinbase_vertex>
2699	#include <morphinstance_vertex>
2700	#ifdef USE_DISPLACEMENTMAP
2701		#include <beginnormal_vertex>
2702		#include <morphnormal_vertex>
2703		#include <skinnormal_vertex>
2704	#endif
2705	#include <begin_vertex>
2706	#include <morphtarget_vertex>
2707	#include <skinning_vertex>
2708	#include <displacementmap_vertex>
2709	#include <project_vertex>
2710	#include <worldpos_vertex>
2711	#include <clipping_planes_vertex>
2712	vWorldPosition = worldPosition.xyz;
2713}`,NA=`#define DISTANCE
2714uniform vec3 referencePosition;
2715uniform float nearDistance;
2716uniform float farDistance;
2717varying vec3 vWorldPosition;
2718#include <common>
2719#include <uv_pars_fragment>
2720#include <map_pars_fragment>
2721#include <alphamap_pars_fragment>
2722#include <alphatest_pars_fragment>
2723#include <alphahash_pars_fragment>
2724#include <clipping_planes_pars_fragment>
2725void main () {
2726	vec4 diffuseColor = vec4( 1.0 );
2727	#include <clipping_planes_fragment>
2728	#include <map_fragment>
2729	#include <alphamap_fragment>
2730	#include <alphatest_fragment>
2731	#include <alphahash_fragment>
2732	float dist = length( vWorldPosition - referencePosition );
2733	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2734	dist = saturate( dist );
2735	gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2736}`,UA=`varying vec3 vWorldDirection;
2737#include <common>
2738void main() {
2739	vWorldDirection = transformDirection( position, modelMatrix );
2740	#include <begin_vertex>
2741	#include <project_vertex>
2742}`,OA=`uniform sampler2D tEquirect;
2743varying vec3 vWorldDirection;
2744#include <common>
2745void main() {
2746	vec3 direction = normalize( vWorldDirection );
2747	vec2 sampleUV = equirectUv( direction );
2748	gl_FragColor = texture2D( tEquirect, sampleUV );
2749	#include <tonemapping_fragment>
2750	#include <colorspace_fragment>
2751}`,FA=`uniform float scale;
2752attribute float lineDistance;
2753varying float vLineDistance;
2754#include <common>
2755#include <uv_pars_vertex>
2756#include <color_pars_vertex>
2757#include <fog_pars_vertex>
2758#include <morphtarget_pars_vertex>
2759#include <logdepthbuf_pars_vertex>
2760#include <clipping_planes_pars_vertex>
2761void main() {
2762	vLineDistance = scale * lineDistance;
2763	#include <uv_vertex>
2764	#include <color_vertex>
2765	#include <morphinstance_vertex>
2766	#include <morphcolor_vertex>
2767	#include <begin_vertex>
2768	#include <morphtarget_vertex>
2769	#include <project_vertex>
2770	#include <logdepthbuf_vertex>
2771	#include <clipping_planes_vertex>
2772	#include <fog_vertex>
2773}`,BA=`uniform vec3 diffuse;
2774uniform float opacity;
2775uniform float dashSize;
2776uniform float totalSize;
2777varying float vLineDistance;
2778#include <common>
2779#include <color_pars_fragment>
2780#include <uv_pars_fragment>
2781#include <map_pars_fragment>
2782#include <fog_pars_fragment>
2783#include <logdepthbuf_pars_fragment>
2784#include <clipping_planes_pars_fragment>
2785void main() {
2786	vec4 diffuseColor = vec4( diffuse, opacity );
2787	#include <clipping_planes_fragment>
2788	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2789		discard;
2790	}
2791	vec3 outgoingLight = vec3( 0.0 );
2792	#include <logdepthbuf_fragment>
2793	#include <map_fragment>
2794	#include <color_fragment>
2795	outgoingLight = diffuseColor.rgb;
2796	#include <opaque_fragment>
2797	#include <tonemapping_fragment>
2798	#include <colorspace_fragment>
2799	#include <fog_fragment>
2800	#include <premultiplied_alpha_fragment>
2801}`,kA=`#include <common>
2802#include <batching_pars_vertex>
2803#include <uv_pars_vertex>
2804#include <envmap_pars_vertex>
2805#include <color_pars_vertex>
2806#include <fog_pars_vertex>
2807#include <morphtarget_pars_vertex>
2808#include <skinning_pars_vertex>
2809#include <logdepthbuf_pars_vertex>
2810#include <clipping_planes_pars_vertex>
2811void main() {
2812	#include <uv_vertex>
2813	#include <color_vertex>
2814	#include <morphinstance_vertex>
2815	#include <morphcolor_vertex>
2816	#include <batching_vertex>
2817	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2818		#include <beginnormal_vertex>
2819		#include <morphnormal_vertex>
2820		#include <skinbase_vertex>
2821		#include <skinnormal_vertex>
2822		#include <defaultnormal_vertex>
2823	#endif
2824	#include <begin_vertex>
2825	#include <morphtarget_vertex>
2826	#include <skinning_vertex>
2827	#include <project_vertex>
2828	#include <logdepthbuf_vertex>
2829	#include <clipping_planes_vertex>
2830	#include <worldpos_vertex>
2831	#include <envmap_vertex>
2832	#include <fog_vertex>
2833}`,zA=`uniform vec3 diffuse;
2834uniform float opacity;
2835#ifndef FLAT_SHADED
2836	varying vec3 vNormal;
2837#endif
2838#include <common>
2839#include <dithering_pars_fragment>
2840#include <color_pars_fragment>
2841#include <uv_pars_fragment>
2842#include <map_pars_fragment>
2843#include <alphamap_pars_fragment>
2844#include <alphatest_pars_fragment>
2845#include <alphahash_pars_fragment>
2846#include <aomap_pars_fragment>
2847#include <lightmap_pars_fragment>
2848#include <envmap_common_pars_fragment>
2849#include <envmap_pars_fragment>
2850#include <fog_pars_fragment>
2851#include <specularmap_pars_fragment>
2852#include <logdepthbuf_pars_fragment>
2853#include <clipping_planes_pars_fragment>
2854void main() {
2855	vec4 diffuseColor = vec4( diffuse, opacity );
2856	#include <clipping_planes_fragment>
2857	#include <logdepthbuf_fragment>
2858	#include <map_fragment>
2859	#include <color_fragment>
2860	#include <alphamap_fragment>
2861	#include <alphatest_fragment>
2862	#include <alphahash_fragment>
2863	#include <specularmap_fragment>
2864	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2865	#ifdef USE_LIGHTMAP
2866		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2867		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2868	#else
2869		reflectedLight.indirectDiffuse += vec3( 1.0 );
2870	#endif
2871	#include <aomap_fragment>
2872	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2873	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2874	#include <envmap_fragment>
2875	#include <opaque_fragment>
2876	#include <tonemapping_fragment>
2877	#include <colorspace_fragment>
2878	#include <fog_fragment>
2879	#include <premultiplied_alpha_fragment>
2880	#include <dithering_fragment>
2881}`,VA=`#define LAMBERT
2882varying vec3 vViewPosition;
2883#include <common>
2884#include <batching_pars_vertex>
2885#include <uv_pars_vertex>
2886#include <displacementmap_pars_vertex>
2887#include <envmap_pars_vertex>
2888#include <color_pars_vertex>
2889#include <fog_pars_vertex>
2890#include <normal_pars_vertex>
2891#include <morphtarget_pars_vertex>
2892#include <skinning_pars_vertex>
2893#include <shadowmap_pars_vertex>
2894#include <logdepthbuf_pars_vertex>
2895#include <clipping_planes_pars_vertex>
2896void main() {
2897	#include <uv_vertex>
2898	#include <color_vertex>
2899	#include <morphinstance_vertex>
2900	#include <morphcolor_vertex>
2901	#include <batching_vertex>
2902	#include <beginnormal_vertex>
2903	#include <morphnormal_vertex>
2904	#include <skinbase_vertex>
2905	#include <skinnormal_vertex>
2906	#include <defaultnormal_vertex>
2907	#include <normal_vertex>
2908	#include <begin_vertex>
2909	#include <morphtarget_vertex>
2910	#include <skinning_vertex>
2911	#include <displacementmap_vertex>
2912	#include <project_vertex>
2913	#include <logdepthbuf_vertex>
2914	#include <clipping_planes_vertex>
2915	vViewPosition = - mvPosition.xyz;
2916	#include <worldpos_vertex>
2917	#include <envmap_vertex>
2918	#include <shadowmap_vertex>
2919	#include <fog_vertex>
2920}`,GA=`#define LAMBERT
2921uniform vec3 diffuse;
2922uniform vec3 emissive;
2923uniform float opacity;
2924#include <common>
2925#include <dithering_pars_fragment>
2926#include <color_pars_fragment>
2927#include <uv_pars_fragment>
2928#include <map_pars_fragment>
2929#include <alphamap_pars_fragment>
2930#include <alphatest_pars_fragment>
2931#include <alphahash_pars_fragment>
2932#include <aomap_pars_fragment>
2933#include <lightmap_pars_fragment>
2934#include <emissivemap_pars_fragment>
2935#include <cube_uv_reflection_fragment>
2936#include <envmap_common_pars_fragment>
2937#include <envmap_pars_fragment>
2938#include <envmap_physical_pars_fragment>
2939#include <fog_pars_fragment>
2940#include <bsdfs>
2941#include <lights_pars_begin>
2942#include <normal_pars_fragment>
2943#include <lights_lambert_pars_fragment>
2944#include <shadowmap_pars_fragment>
2945#include <bumpmap_pars_fragment>
2946#include <normalmap_pars_fragment>
2947#include <specularmap_pars_fragment>
2948#include <logdepthbuf_pars_fragment>
2949#include <clipping_planes_pars_fragment>
2950void main() {
2951	vec4 diffuseColor = vec4( diffuse, opacity );
2952	#include <clipping_planes_fragment>
2953	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2954	vec3 totalEmissiveRadiance = emissive;
2955	#include <logdepthbuf_fragment>
2956	#include <map_fragment>
2957	#include <color_fragment>
2958	#include <alphamap_fragment>
2959	#include <alphatest_fragment>
2960	#include <alphahash_fragment>
2961	#include <specularmap_fragment>
2962	#include <normal_fragment_begin>
2963	#include <normal_fragment_maps>
2964	#include <emissivemap_fragment>
2965	#include <lights_lambert_fragment>
2966	#include <lights_fragment_begin>
2967	#include <lights_fragment_maps>
2968	#include <lights_fragment_end>
2969	#include <aomap_fragment>
2970	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2971	#include <envmap_fragment>
2972	#include <opaque_fragment>
2973	#include <tonemapping_fragment>
2974	#include <colorspace_fragment>
2975	#include <fog_fragment>
2976	#include <premultiplied_alpha_fragment>
2977	#include <dithering_fragment>
2978}`,HA=`#define MATCAP
2979varying vec3 vViewPosition;
2980#include <common>
2981#include <batching_pars_vertex>
2982#include <uv_pars_vertex>
2983#include <color_pars_vertex>
2984#include <displacementmap_pars_vertex>
2985#include <fog_pars_vertex>
2986#include <normal_pars_vertex>
2987#include <morphtarget_pars_vertex>
2988#include <skinning_pars_vertex>
2989#include <logdepthbuf_pars_vertex>
2990#include <clipping_planes_pars_vertex>
2991void main() {
2992	#include <uv_vertex>
2993	#include <color_vertex>
2994	#include <morphinstance_vertex>
2995	#include <morphcolor_vertex>
2996	#include <batching_vertex>
2997	#include <beginnormal_vertex>
2998	#include <morphnormal_vertex>
2999	#include <skinbase_vertex>
3000	#include <skinnormal_vertex>
3001	#include <defaultnormal_vertex>
3002	#include <normal_vertex>
3003	#include <begin_vertex>
3004	#include <morphtarget_vertex>
3005	#include <skinning_vertex>
3006	#include <displacementmap_vertex>
3007	#include <project_vertex>
3008	#include <logdepthbuf_vertex>
3009	#include <clipping_planes_vertex>
3010	#include <fog_vertex>
3011	vViewPosition = - mvPosition.xyz;
3012}`,WA=`#define MATCAP
3013uniform vec3 diffuse;
3014uniform float opacity;
3015uniform sampler2D matcap;
3016varying vec3 vViewPosition;
3017#include <common>
3018#include <dithering_pars_fragment>
3019#include <color_pars_fragment>
3020#include <uv_pars_fragment>
3021#include <map_pars_fragment>
3022#include <alphamap_pars_fragment>
3023#include <alphatest_pars_fragment>
3024#include <alphahash_pars_fragment>
3025#include <fog_pars_fragment>
3026#include <normal_pars_fragm
3026ent>
3027#include <bumpmap_pars_fragment>
3028#include <normalmap_pars_fragment>
3029#include <logdepthbuf_pars_fragment>
3030#include <clipping_planes_pars_fragment>
3031void main() {
3032	vec4 diffuseColor = vec4( diffuse, opacity );
3033	#include <clipping_planes_fragment>
3034	#include <logdepthbuf_fragment>
3035	#include <map_fragment>
3036	#include <color_fragment>
3037	#include <alphamap_fragment>
3038	#include <alphatest_fragment>
3039	#include <alphahash_fragment>
3040	#include <normal_fragment_begin>
3041	#include <normal_fragment_maps>
3042	vec3 viewDir = normalize( vViewPosition );
3043	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3044	vec3 y = cross( viewDir, x );
3045	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3046	#ifdef USE_MATCAP
3047		vec4 matcapColor = texture2D( matcap, uv );
3048	#else
3049		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3050	#endif
3051	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3052	#include <opaque_fragment>
3053	#include <tonemapping_fragment>
3054	#include <colorspace_fragment>
3055	#include <fog_fragment>
3056	#include <premultiplied_alpha_fragment>
3057	#include <dithering_fragment>
3058}`,jA=`#define NORMAL
3059#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3060	varying vec3 vViewPosition;
3061#endif
3062#include <common>
3063#include <batching_pars_vertex>
3064#include <uv_pars_vertex>
3065#include <displacementmap_pars_vertex>
3066#include <normal_pars_vertex>
3067#include <morphtarget_pars_vertex>
3068#include <skinning_pars_vertex>
3069#include <logdepthbuf_pars_vertex>
3070#include <clipping_planes_pars_vertex>
3071void main() {
3072	#include <uv_vertex>
3073	#include <batching_vertex>
3074	#include <beginnormal_vertex>
3075	#include <morphinstance_vertex>
3076	#include <morphnormal_vertex>
3077	#include <skinbase_vertex>
3078	#include <skinnormal_vertex>
3079	#include <defaultnormal_vertex>
3080	#include <normal_vertex>
3081	#include <begin_vertex>
3082	#include <morphtarget_vertex>
3083	#include <skinning_vertex>
3084	#include <displacementmap_vertex>
3085	#include <project_vertex>
3086	#include <logdepthbuf_vertex>
3087	#include <clipping_planes_vertex>
3088#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3089	vViewPosition = - mvPosition.xyz;
3090#endif
3091}`,XA=`#define NORMAL
3092uniform float opacity;
3093#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3094	varying vec3 vViewPosition;
3095#endif
3096#include <uv_pars_fragment>
3097#include <normal_pars_fragment>
3098#include <bumpmap_pars_fragment>
3099#include <normalmap_pars_fragment>
3100#include <logdepthbuf_pars_fragment>
3101#include <clipping_planes_pars_fragment>
3102void main() {
3103	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3104	#include <clipping_planes_fragment>
3105	#include <logdepthbuf_fragment>
3106	#include <normal_fragment_begin>
3107	#include <normal_fragment_maps>
3108	gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
3109	#ifdef OPAQUE
3110		gl_FragColor.a = 1.0;
3111	#endif
3112}`,YA=`#define PHONG
3113varying vec3 vViewPosition;
3114#include <common>
3115#include <batching_pars_vertex>
3116#include <uv_pars_vertex>
3117#include <displacementmap_pars_vertex>
3118#include <envmap_pars_vertex>
3119#include <color_pars_vertex>
3120#include <fog_pars_vertex>
3121#include <normal_pars_vertex>
3122#include <morphtarget_pars_vertex>
3123#include <skinning_pars_vertex>
3124#include <shadowmap_pars_vertex>
3125#include <logdepthbuf_pars_vertex>
3126#include <clipping_planes_pars_vertex>
3127void main() {
3128	#include <uv_vertex>
3129	#include <color_vertex>
3130	#include <morphcolor_vertex>
3131	#include <batching_vertex>
3132	#include <beginnormal_vertex>
3133	#include <morphinstance_vertex>
3134	#include <morphnormal_vertex>
3135	#include <skinbase_vertex>
3136	#include <skinnormal_vertex>
3137	#include <defaultnormal_vertex>
3138	#include <normal_vertex>
3139	#include <begin_vertex>
3140	#include <morphtarget_vertex>
3141	#include <skinning_vertex>
3142	#include <displacementmap_vertex>
3143	#include <project_vertex>
3144	#include <logdepthbuf_vertex>
3145	#include <clipping_planes_vertex>
3146	vViewPosition = - mvPosition.xyz;
3147	#include <worldpos_vertex>
3148	#include <envmap_vertex>
3149	#include <shadowmap_vertex>
3150	#include <fog_vertex>
3151}`,qA=`#define PHONG
3152uniform vec3 diffuse;
3153uniform vec3 emissive;
3154uniform vec3 specular;
3155uniform float shininess;
3156uniform float opacity;
3157#include <common>
3158#include <dithering_pars_fragment>
3159#include <color_pars_fragment>
3160#include <uv_pars_fragment>
3161#include <map_pars_fragment>
3162#include <alphamap_pars_fragment>
3163#include <alphatest_pars_fragment>
3164#include <alphahash_pars_fragment>
3165#include <aomap_pars_fragment>
3166#include <lightmap_pars_fragment>
3167#include <emissivemap_pars_fragment>
3168#include <cube_uv_reflection_fragment>
3169#include <envmap_common_pars_fragment>
3170#include <envmap_pars_fragment>
3171#include <envmap_physical_pars_fragment>
3172#include <fog_pars_fragment>
3173#include <bsdfs>
3174#include <lights_pars_begin>
3175#include <normal_pars_fragment>
3176#include <lights_phong_pars_fragment>
3177#include <shadowmap_pars_fragment>
3178#include <bumpmap_pars_fragment>
3179#include <normalmap_pars_fragment>
3180#include <specularmap_pars_fragment>
3181#include <logdepthbuf_pars_fragment>
3182#include <clipping_planes_pars_fragment>
3183void main() {
3184	vec4 diffuseColor = vec4( diffuse, opacity );
3185	#include <clipping_planes_fragment>
3186	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3187	vec3 totalEmissiveRadiance = emissive;
3188	#include <logdepthbuf_fragment>
3189	#include <map_fragment>
3190	#include <color_fragment>
3191	#include <alphamap_fragment>
3192	#include <alphatest_fragment>
3193	#include <alphahash_fragment>
3194	#include <specularmap_fragment>
3195	#include <normal_fragment_begin>
3196	#include <normal_fragment_maps>
3197	#include <emissivemap_fragment>
3198	#include <lights_phong_fragment>
3199	#include <lights_fragment_begin>
3200	#include <lights_fragment_maps>
3201	#include <lights_fragment_end>
3202	#include <aomap_fragment>
3203	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3204	#include <envmap_fragment>
3205	#include <opaque_fragment>
3206	#include <tonemapping_fragment>
3207	#include <colorspace_fragment>
3208	#include <fog_fragment>
3209	#include <premultiplied_alpha_fragment>
3210	#include <dithering_fragment>
3211}`,ZA=`#define STANDARD
3212varying vec3 vViewPosition;
3213#ifdef USE_TRANSMISSION
3214	varying vec3 vWorldPosition;
3215#endif
3216#include <common>
3217#include <batching_pars_vertex>
3218#include <uv_pars_vertex>
3219#include <displacementmap_pars_vertex>
3220#include <color_pars_vertex>
3221#include <fog_pars_vertex>
3222#include <normal_pars_vertex>
3223#include <morphtarget_pars_vertex>
3224#include <skinning_pars_vertex>
3225#include <shadowmap_pars_vertex>
3226#include <logdepthbuf_pars_vertex>
3227#include <clipping_planes_pars_vertex>
3228void main() {
3229	#include <uv_vertex>
3230	#include <color_vertex>
3231	#include <morphinstance_vertex>
3232	#include <morphcolor_vertex>
3233	#include <batching_vertex>
3234	#include <beginnormal_vertex>
3235	#include <morphnormal_vertex>
3236	#include <skinbase_vertex>
3237	#include <skinnormal_vertex>
3238	#include <defaultnormal_vertex>
3239	#include <normal_vertex>
3240	#include <begin_vertex>
3241	#include <morphtarget_vertex>
3242	#include <skinning_vertex>
3243	#include <displacementmap_vertex>
3244	#include <project_vertex>
3245	#include <logdepthbuf_vertex>
3246	#include <clipping_planes_vertex>
3247	vViewPosition = - mvPosition.xyz;
3248	#include <worldpos_vertex>
3249	#include <shadowmap_vertex>
3250	#include <fog_vertex>
3251#ifdef USE_TRANSMISSION
3252	vWorldPosition = worldPosition.xyz;
3253#endif
3254}`,JA=`#define STANDARD
3255#ifdef PHYSICAL
3256	#define IOR
3257	#define USE_SPECULAR
3258#endif
3259uniform vec3 diffuse;
3260uniform vec3 emissive;
3261uniform float roughness;
3262uniform float metalness;
3263uniform float opacity;
3264#ifdef IOR
3265	uniform float ior;
3266#endif
3267#ifdef USE_SPECULAR
3268	uniform float specularIntensity;
3269	uniform vec3 specularColor;
3270	#ifdef USE_SPECULAR_COLORMAP
3271		uniform sampler2D specularColorMap;
3272	#endif
3273	#ifdef USE_SPECULAR_INTENSITYMAP
3274		uniform sampler2D specularIntensityMap;
3275	#endif
3276#endif
3277#ifdef USE_CLEARCOAT
3278	uniform float clearcoat;
3279	uniform float clearcoatRoughness;
3280#endif
3281#ifdef USE_DISPERSION
3282	uniform float dispersion;
3283#endif
3284#ifdef USE_IRIDESCENCE
3285	uniform float iridescence;
3286	uniform float iridescenceIOR;
3287	uniform float iridescenceThicknessMinimum;
3288	uniform float iridescenceThicknessMaximum;
3289#endif
3290#ifdef USE_SHEEN
3291	uniform vec3 sheenColor;
3292	uniform float sheenRoughness;
3293	#ifdef USE_SHEEN_COLORMAP
3294		uniform sampler2D sheenColorMap;
3295	#endif
3296	#ifdef USE_SHEEN_ROUGHNESSMAP
3297		uniform sampler2D sheenRoughnessMap;
3298	#endif
3299#endif
3300#ifdef USE_ANISOTROPY
3301	uniform vec2 anisotropyVector;
3302	#ifdef USE_ANISOTROPYMAP
3303		uniform sampler2D anisotropyMap;
3304	#endif
3305#endif
3306varying vec3 vViewPosition;
3307#include <common>
3308#include <dithering_pars_fragment>
3309#include <color_pars_fragment>
3310#include <uv_pars_fragment>
3311#include <map_pars_fragment>
3312#include <alphamap_pars_fragment>
3313#include <alphatest_pars_fragment>
3314#include <alphahash_pars_fragment>
3315#include <aomap_pars_fragment>
3316#include <lightmap_pars_fragment>
3317#include <emissivemap_pars_fragment>
3318#include <iridescence_fragment>
3319#include <cube_uv_reflection_fragment>
3320#include <envmap_common_pars_fragment>
3321#include <envmap_physical_pars_fragment>
3322#include <fog_pars_fragment>
3323#include <lights_pars_begin>
3324#include <normal_pars_fragment>
3325#include <lights_physical_pars_fragment>
3326#include <transmission_pars_fragment>
3327#include <shadowmap_pars_fragment>
3328#include <bumpmap_pars_fragment>
3329#include <normalmap_pars_fragment>
3330#include <clearcoat_pars_fragment>
3331#include <iridescence_pars_fragment>
3332#include <roughnessmap_pars_fragment>
3333#include <metalnessmap_pars_fragment>
3334#include <logdepthbuf_pars_fragment>
3335#include <clipping_planes_pars_fragment>
3336void main() {
3337	vec4 diffuseColor = vec4( diffuse, opacity );
3338	#include <clipping_planes_fragment>
3339	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3340	vec3 totalEmissiveRadiance = emissive;
3341	#include <logdepthbuf_fragment>
3342	#include <map_fragment>
3343	#include <color_fragment>
3344	#include <alphamap_fragment>
3345	#include <alphatest_fragment>
3346	#include <alphahash_fragment>
3347	#include <roughnessmap_fragment>
3348	#include <metalnessmap_fragment>
3349	#include <normal_fragment_begin>
3350	#include <normal_fragment_maps>
3351	#include <clearcoat_normal_fragment_begin>
3352	#include <clearcoat_normal_fragment_maps>
3353	#include <emissivemap_fragment>
3354	#include <lights_physical_fragment>
3355	#include <lights_fragment_begin>
3356	#include <lights_fragment_maps>
3357	#include <lights_fragment_end>
3358	#include <aomap_fragment>
3359	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3360	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3361	#include <transmission_fragment>
3362	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3363	#ifdef USE_SHEEN
3364 
3365		outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
3366 
3367 	#endif
3368	#ifdef USE_CLEARCOAT
3369		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3370		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3371		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3372	#endif
3373	#include <opaque_fragment>
3374	#include <tonemapping_fragment>
3375	#include <colorspace_fragment>
3376	#include <fog_fragment>
3377	#include <premultiplied_alpha_fragment>
3378	#include <dithering_fragment>
3379}`,KA=`#define TOON
3380varying vec3 vViewPosition;
3381#include <common>
3382#include <batching_pars_vertex>
3383#include <uv_pars_vertex>
3384#include <displacementmap_pars_vertex>
3385#include <color_pars_vertex>
3386#include <fog_pars_vertex>
3387#include <normal_pars_vertex>
3388#include <morphtarget_pars_vertex>
3389#include <skinning_pars_vertex>
3390#include <shadowmap_pars_vertex>
3391#include <logdepthbuf_pars_vertex>
3392#include <clipping_planes_pars_vertex>
3393void main() {
3394	#include <uv_vertex>
3395	#include <color_vertex>
3396	#include <morphinstance_vertex>
3397	#include <morphcolor_vertex>
3398	#include <batching_vertex>
3399	#include <beginnormal_vertex>
3400	#include <morphnormal_vertex>
3401	#include <skinbase_vertex>
3402	#include <skinnormal_vertex>
3403	#include <defaultnormal_vertex>
3404	#include <normal_vertex>
3405	#include <begin_vertex>
3406	#include <morphtarget_vertex>
3407	#include <skinning_vertex>
3408	#include <displacementmap_vertex>
3409	#include <project_vertex>
3410	#include <logdepthbuf_vertex>
3411	#include <clipping_planes_vertex>
3412	vViewPosition = - mvPosition.xyz;
3413	#include <worldpos_vertex>
3414	#include <shadowmap_vertex>
3415	#include <fog_vertex>
3416}`,QA=`#define TOON
3417uniform vec3 diffuse;
3418uniform vec3 emissive;
3419uniform float opacity;
3420#include <common>
3421#include <dithering_pars_fragment>
3422#include <color_pars_fragment>
3423#include <uv_pars_fragment>
3424#include <map_pars_fragment>
3425#include <alphamap_pars_fragment>
3426#include <alphatest_pars_fragment>
3427#include <alphahash_pars_fragment>
3428#include <aomap_pars_fragment>
3429#include <lightmap_pars_fragment>
3430#include <emissivemap_pars_fragment>
3431#include <gradientmap_pars_fragment>
3432#include <fog_pars_fragment>
3433#include <bsdfs>
3434#include <lights_pars_begin>
3435#include <normal_pars_fragment>
3436#include <lights_toon_pars_fragment>
3437#include <shadowmap_pars_fragment>
3438#include <bumpmap_pars_fragment>
3439#include <normalmap_pars_fragment>
3440#include <logdepthbuf_pars_fragment>
3441#include <clipping_planes_pars_fragment>
3442void main() {
3443	vec4 diffuseColor = vec4( diffuse, opacity );
3444	#include <clipping_planes_fragment>
3445	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3446	vec3 totalEmissiveRadiance = emissive;
3447	#include <logdepthbuf_fragment>
3448	#include <map_fragment>
3449	#include <color_fragment>
3450	#include <alphamap_fragment>
3451	#include <alphatest_fragment>
3452	#include <alphahash_fragment>
3453	#include <normal_fragment_begin>
3454	#include <normal_fragment_maps>
3455	#include <emissivemap_fragment>
3456	#include <lights_toon_fragment>
3457	#include <lights_fragment_begin>
3458	#include <lights_fragment_maps>
3459	#include <lights_fragment_end>
3460	#include <aomap_fragment>
3461	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3462	#include <opaque_fragment>
3463	#include <tonemapping_fragment>
3464	#include <colorspace_fragment>
3465	#include <fog_fragment>
3466	#include <premultiplied_alpha_fragment>
3467	#include <dithering_fragment>
3468}`,$A=`uniform float size;
3469uniform float scale;
3470#include <common>
3471#include <color_pars_vertex>
3472#include <fog_pars_vertex>
3473#include <morphtarget_pars_vertex>
3474#include <logdepthbuf_pars_vertex>
3475#include <clipping_planes_pars_vertex>
3476#ifdef USE_POINTS_UV
3477	varying vec2 vUv;
3478	uniform mat3 uvTransform;
3479#endif
3480void main() {
3481	#ifdef USE_POINTS_UV
3482		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3483	#endif
3484	#include <color_vertex>
3485	#include <morphinstance_vertex>
3486	#include <morphcolor_vertex>
3487	#include <begin_vertex>
3488	#include <morphtarget_vertex>
3489	#include <project_vertex>
3490	gl_PointSize = size;
3491	#ifdef USE_SIZEATTENUATION
3492		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3493		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3494	#endif
3495	#include <logdepthbuf_vertex>
3496	#include <clipping_planes_vertex>
3497	#include <worldpos_vertex>
3498	#include <fog_vertex>
3499}`,eC=`uniform vec3 diffuse;
3500uniform float opacity;
3501#include <common>
3502#include <color_pars_fragment>
3503#include <map_particle_pars_fragment>
3504#include <alphatest_pars_fragment>
3505#include <alphahash_pars_fragment>
3506#include <fog_pars_fragment>
3507#include <logdepthbuf_pars_fragment>
3508#include <clipping_planes_pars_fragment>
3509void main() {
3510	vec4 diffuseColor = vec4( diffuse, opacity );
3511	#include <clipping_planes_fragment>
3512	vec3 outgoingLight = vec3( 0.0 );
3513	#include <logdepthbuf_fragment>
3514	#include <map_particle_fragment>
3515	#include <color_fragment>
3516	#include <alphatest_fragment>
3517	#include <alphahash_fragment>
3518	outgoingLight = diffuseColor.rgb;
3519	#include <opaque_fragment>
3520	#include <tonemapping_fragment>
3521	#include <colorspace_fragment>
3522	#include <fog_fragment>
3523	#include <premultiplied_alpha_fragment>
3524}`,tC=`#include <common>
3525#include <batching_pars_vertex>
3526#include <fog_pars_vertex>
3527#include <morphtarget_pars_vertex>
3528#include <skinning_pars_vertex>
3529#include <logdepthbuf_pars_vertex>
3530#include <shadowmap_pars_vertex>
3531void main() {
3532	#include <batching_vertex>
3533	#include <beginnormal_vertex>
3534	#include <morphinstance_vertex>
3535	#include <morphnormal_vertex>
3536	#include <skinbase_vertex>
3537	#include <skinnormal_vertex>
3538	#include <defaultnormal_vertex>
3539	#include <begin_vertex>
3540	#include <morphtarget_vertex>
3541	#include <skinning_vertex>
3542	#include <project_vertex>
3543	#include <logdepthbuf_vertex>
3544	#include <worldpos_vertex>
3545	#include <shadowmap_vertex>
3546	#include <fog_vertex>
3547}`,nC=`uniform vec3 color;
3548uniform float opacity;
3549#include <common>
3550#include <fog_pars_fragment>
3551#include <bsdfs>
3552#include <lights_pars_begin>
3553#include <logdepthbuf_pars_fragment>
3554#include <shadowmap_pars_fragment>
3555#include <shadowmask_pars_fragment>
3556void main() {
3557	#include <logdepthbuf_fragment>
3558	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3559	#include <tonemapping_fragment>
3560	#include <colorspace_fragment>
3561	#include <fog_fragment>
3562	#include <premultiplied_alpha_fragment>
3563}`,iC=`uniform float rotation;
3564uniform vec2 center;
3565#include <common>
3566#include <uv_pars_vertex>
3567#include <fog_pars_vertex>
3568#include <logdepthbuf_pars_vertex>
3569#include <clipping_planes_pars_vertex>
3570void main() {
3571	#include <uv_vertex>
3572	vec4 mvPosition = modelViewMatrix[ 3 ];
3573	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3574	#ifndef USE_SIZEATTENUATION
3575		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3576		if ( isPerspective ) scale *= - mvPosition.z;
3577	#endif
3578	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3579	vec2 rotatedPosition;
3580	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3581	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3582	mvPosition.xy += rotatedPosition;
3583	gl_Position = projectionMatrix * mvPosition;
3584	#include <logdepthbuf_vertex>
3585	#include <clipping_planes_vertex>
3586	#include <fog_vertex>
3587}`,rC=`uniform vec3 diffuse;
3588uniform float opacity;
3589#include <common>
3590#include <uv_pars_fragment>
3591#include <map_pars_fragment>
3592#include <alphamap_pars_fragment>
3593#include <alphatest_pars_fragment>
3594#include <alphahash_pars_fragment>
3595#include <fog_pars_fragment>
3596#include <logdepthbuf_pars_fragment>
3597#include <clipping_planes_pars_fragment>
3598void main() {
3599	vec4 diffuseColor = vec4( diffuse, opacity );
3600	#include <clipping_planes_fragment>
3601	vec3 outgoingLight = vec3( 0.0 );
3602	#include <logdepthbuf_fragment>
3603	#include <map_fragment>
3604	#include <alphamap_fragment>
3605	#include <alphatest_fragment>
3606	#include <alphahash_fragment>
3607	outgoingLight = diffuseColor.rgb;
3608	#include <opaque_fragment>
3609	#include <tonemapping_fragment>
3610	#include <colorspace_fragment>
3611	#include <fog_fragment>
3612}`,Et={alphahash_fragment:TE,alphahash_pars_fragment:AE,alphamap_fragment:CE,alphamap_pars_fragment:RE,alphatest_fragment:IE,alphatest_pars_fragment:PE,aomap_fragment:LE,aomap_pars_fragment:DE,batching_pars_vertex:NE,batching_vertex:UE,begin_vertex:OE,beginnormal_vertex:FE,bsdfs:BE,iridescence_fragment:kE,bumpmap_pars_fragment:zE,clipping_planes_fragment:VE,clipping_planes_pars_fragment:GE,clipping_planes_pars_vertex:HE,clipping_planes_vertex:WE,color_fragment:jE,color_pars_fragment:XE,color_pars_vertex:YE,color_vertex:qE,common:ZE,cube_uv_reflection_fragment:JE,defaultnormal_vertex:KE,displacementmap_pars_vertex:QE,displacementmap_vertex:$E,emissivemap_fragment:eT,emissivemap_pars_fragment:tT,colorspace_fragment:nT,colorspace_pars_fragment:iT,envmap_fragment:rT,envmap_common_pars_fragment:sT,envmap_pars_fragment:oT,envmap_pars_vertex:aT,envmap_physical_pars_fragment:vT,envmap_vertex:lT,fog_vertex:cT,fog_pars_vertex:uT,fog_fragment:hT,fog_pars_fragment:dT,gradientmap_pars_fragment:fT,lightmap_pars_fragment:pT,lights_lambert_fragment:mT,lights_lambert_pars_fragment:gT,lights_pars_begin:xT,lights_toon_fragment:yT,lights_toon_pars_fragment:_T,lights_phong_fragment:ST,lights_phong_pars_fragment:MT,lights_physical_fragment:bT,lights_physical_pars_fragment:wT,lights_fragment_begin:ET,lights_fragment_maps:TT,lights_fragment_end:AT,logdepthbuf_fragment:CT,logdepthbuf_pars_fragment:RT,logdepthbuf_pars_vertex:IT,logdepthbuf_vertex:PT,map_fragment:LT,map_pars_fragment:DT,map_particle_fragment:NT,map_particle_pars_fragment:UT,metalnessmap_fragment:OT,metalnessmap_pars_fragment:FT,morphinstance_vertex:BT,morphcolor_vertex:kT,morphnormal_vertex:zT,morphtarget_pars_vertex:VT,morphtarget_vertex:GT,normal_fragment_begin:HT,normal_fragment_maps:WT,normal_pars_fragment:jT,normal_pars_vertex:XT,normal_vertex:YT,normalmap_pars_fragment:qT,clearcoat_normal_fragment_begin:ZT,clearcoat_normal_fragment_maps:JT,clearcoat_pars_fragment:KT,iridescence_pars_fragment:QT,opaque_fragment:$T,packing:eA,premultiplied_alpha_fragment:tA,project_vertex:nA,dithering_fragment:iA,dithering_pars_fragment:rA,roughnessmap_fragment:sA,roughnessmap_pars_fragment:oA,shadowmap_pars_fragment:aA,shadowmap_pars_vertex:lA,shadowmap_vertex:cA,shadowmask_pars_fragment:uA,skinbase_vertex:hA,skinning_pars_vertex:dA,skinning_vertex:fA,skinnormal_vertex:pA,specularmap_fragment:mA,specularmap_pars_fragment:gA,tonemapping_fragment:xA,tonemapping_pars_fragment:vA,transmission_fragment:yA,transmission_pars_fragment:_A,uv_pars_fragment:SA,uv_pars_vertex:MA,uv_vertex:bA,worldpos_vertex:wA,background_vert:EA,background_frag:TA,backgroundCube_vert:AA,backgroundCube_frag:CA,cube_vert:RA,cube_frag:IA,depth_vert:PA,depth_frag:LA,distance_vert:DA,distance_frag:NA,equirect_vert:UA,equirect_frag:OA,linedashed_vert:FA,linedashed_frag:BA,meshbasic_vert:kA,meshbasic_frag:zA,meshlambert_vert:VA,meshlambert_frag:GA,meshmatcap_vert:HA,meshmatcap_frag:WA,meshnormal_vert:jA,meshnormal_frag:XA,meshphong_vert:YA,meshphong_frag:qA,meshphysical_vert:ZA,meshphysical_frag:JA,meshtoon_vert:KA,meshtoon_frag:QA,points_vert:$A,points_frag:eC,shadow_vert:tC,shadow_frag:nC,sprite_vert:iC,sprite_frag:rC},Ge={common:{diffuse:{value:new Ke(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new bt},alphaMap:{value:null},alphaMapTransform:{value:new bt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new bt}},envmap:{envMap:{value:null},envMapRotation:{value:new bt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new bt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new bt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new bt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new bt},normalScale:{value:new ge(1,1)}}
vendor: 7,064 bytes, line 3612
3612,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new bt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new bt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new bt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new bt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ke(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ke(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new bt},alphaTest:{value:0},uvTransform:{value:new bt}},sprite:{diffuse:{value:new Ke(16777215)},opacity:{value:1},center:{value:new ge(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new bt},alphaMap:{value:null},alphaMapTransform:{value:new bt},alphaTest:{value:0}}},ki={basic:{uniforms:Gn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.fog]),vertexShader:Et.meshbasic_vert,fragmentShader:Et.meshbasic_frag},lambert:{uniforms:Gn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Ke(0)},envMapIntensity:{value:1}}]),vertexShader:Et.meshlambert_vert,fragmentShader:Et.meshlambert_frag},phong:{uniforms:Gn([Ge.common,Ge.specularmap,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,Ge.lights,{emissive:{value:new Ke(0)},specular:{value:new Ke(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Et.meshphong_vert,fragmentShader:Et.meshphong_frag},standard:{uniforms:Gn([Ge.common,Ge.envmap,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.roughnessmap,Ge.metalnessmap,Ge.fog,Ge.lights,{emissive:{value:new Ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Et.meshphysical_vert,fragmentShader:Et.meshphysical_frag},toon:{uniforms:Gn([Ge.common,Ge.aomap,Ge.lightmap,Ge.emissivemap,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.gradientmap,Ge.fog,Ge.lights,{emissive:{value:new Ke(0)}}]),vertexShader:Et.meshtoon_vert,fragmentShader:Et.meshtoon_frag},matcap:{uniforms:Gn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,Ge.fog,{matcap:{value:null}}]),vertexShader:Et.meshmatcap_vert,fragmentShader:Et.meshmatcap_frag},points:{uniforms:Gn([Ge.points,Ge.fog]),vertexShader:Et.points_vert,fragmentShader:Et.points_frag},dashed:{uniforms:Gn([Ge.common,Ge.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Et.linedashed_vert,fragmentShader:Et.linedashed_frag},depth:{uniforms:Gn([Ge.common,Ge.displacementmap]),vertexShader:Et.depth_vert,fragmentShader:Et.depth_frag},normal:{uniforms:Gn([Ge.common,Ge.bumpmap,Ge.normalmap,Ge.displacementmap,{opacity:{value:1}}]),vertexShader:Et.meshnormal_vert,fragmentShader:Et.meshnormal_frag},sprite:{uniforms:Gn([Ge.sprite,Ge.fog]),vertexShader:Et.sprite_vert,fragmentShader:Et.sprite_frag},background:{uniforms:{uvTransform:{value:new bt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Et.background_vert,fragmentShader:Et.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new bt}},vertexShader:Et.backgroundCube_vert,fragmentShader:Et.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Et.cube_vert,fragmentShader:Et.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Et.equirect_vert,fragmentShader:Et.equirect_frag},distance:{uniforms:Gn([Ge.common,Ge.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Et.distance_vert,fragmentShader:Et.distance_frag},shadow:{uniforms:Gn([Ge.lights,Ge.fog,{color:{value:new Ke(0)},opacity:{value:1}}]),vertexShader:Et.shadow_vert,fragmentShader:Et.shadow_frag}};ki.physical={uniforms:Gn([ki.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new bt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new bt},clearcoatNormalScale:{value:new ge(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new bt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new bt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new bt},sheen:{value:0},sheenColor:{value:new Ke(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new bt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new bt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new bt},transmissionSamplerSize:{value:new ge},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new bt},attenuationDistance:{value:0},attenuationColor:{value:new Ke(0)},specularColor:{value:new Ke(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new bt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new bt},anisotropyVector:{value:new ge},anisotropyMap:{value:null},anisotropyMapTransform:{value:new bt}}]),vertexShader:Et.meshphysical_vert,fragmentShader:Et.meshphysical_frag};const yu={r:0,b:0,g:0},Ts=new mi,sC=new yt;function oC(r,e,t,n,i,s){const o=new Ke(0);let c=i===!0?0:1,u,h,d=null,f=0,m=null;function g(S){let b=S.isScene===!0?S.background:null;if(b&&b.isTexture){const E=S.backgroundBlurriness>0;b=e.get(b,E)}return b}function x(S){let b=!1;const E=g(S);E===null?_(o,c):E&&E.isColor&&(_(E,1),b=!0);const P=r.xr.getEnvironmentBlendMode();
vendor: 14,923 bytes, line 3612
3612P==="additive"?t.buffers.color.setClear(0,0,0,1,s):P==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(r.autoClear||b)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function M(S,b){const E=g(b);E&&(E.isCubeTexture||E.mapping===ta)?(h===void 0&&(h=new dn(new Zs(1,1,1),new Ii({name:"BackgroundCubeMaterial",uniforms:$o(ki.backgroundCube.uniforms),vertexShader:ki.backgroundCube.vertexShader,fragmentShader:ki.backgroundCube.fragmentShader,side:jn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(P,D,N){this.matrixWorld.copyPosition(N.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(h)),Ts.copy(b.backgroundRotation),Ts.x*=-1,Ts.y*=-1,Ts.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(Ts.y*=-1,Ts.z*=-1),h.material.uniforms.envMap.value=E,h.material.uniforms.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=b.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(sC.makeRotationFromEuler(Ts)),h.material.toneMapped=Dt.getTransfer(E.colorSpace)!==Vt,(d!==E||f!==E.version||m!==r.toneMapping)&&(h.material.needsUpdate=!0,d=E,f=E.version,m=r.toneMapping),h.layers.enableAll(),S.unshift(h,h.geometry,h.material,0,0,null)):E&&E.isTexture&&(u===void 0&&(u=new dn(new ia(2,2),new Ii({name:"BackgroundMaterial",uniforms:$o(ki.background.uniforms),vertexShader:ki.background.vertexShader,fragmentShader:ki.background.fragmentShader,side:Cr,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(u)),u.material.uniforms.t2D.value=E,u.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,u.material.toneMapped=Dt.getTransfer(E.colorSpace)!==Vt,E.matrixAutoUpdate===!0&&E.updateMatrix(),u.material.uniforms.uvTransform.value.copy(E.matrix),(d!==E||f!==E.version||m!==r.toneMapping)&&(u.material.needsUpdate=!0,d=E,f=E.version,m=r.toneMapping),u.layers.enableAll(),S.unshift(u,u.geometry,u.material,0,0,null))}function _(S,b){S.getRGB(yu,Vy(r)),t.buffers.color.setClear(yu.r,yu.g,yu.b,b,s)}function v(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0)}return{getClearColor:function(){return o},setClearColor:function(S,b=1){o.set(S),c=b,_(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(S){c=S,_(o,c)},render:x,addToRenderList:M,dispose:v}}function aC(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=m(null);let s=i,o=!1;function c(L,V,H,j,X){let q=!1;const Y=f(L,j,H,V);s!==Y&&(s=Y,h(s.object)),q=g(L,j,H,X),q&&x(L,j,H,X),X!==null&&e.update(X,r.ELEMENT_ARRAY_BUFFER),(q||o)&&(o=!1,E(L,V,H,j),X!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(X).buffer))}function u(){return r.createVertexArray()}function h(L){return r.bindVertexArray(L)}function d(L){return r.deleteVertexArray(L)}function f(L,V,H,j){const X=j.wireframe===!0;let q=n[V.id];q===void 0&&(q={},n[V.id]=q);const Y=L.isInstancedMesh===!0?L.id:0;let J=q[Y];J===void 0&&(J={},q[Y]=J);let te=J[H.id];te===void 0&&(te={},J[H.id]=te);let oe=te[X];return oe===void 0&&(oe=m(u()),te[X]=oe),oe}function m(L){const V=[],H=[],j=[];for(let X=0;X<t;X++)V[X]=0,H[X]=0,j[X]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:V,enabledAttributes:H,attributeDivisors:j,object:L,attributes:{},index:null}}function g(L,V,H,j){const X=s.attributes,q=V.attributes;let Y=0;const J=H.getAttributes();for(const te in J)if(J[te].location>=0){const ce=X[te];let ve=q[te];if(ve===void 0&&(te==="instanceMatrix"&&L.instanceMatrix&&(ve=L.instanceMatrix),te==="instanceColor"&&L.instanceColor&&(ve=L.instanceColor)),ce===void 0||ce.attribute!==ve||ve&&ce.data!==ve.data)return!0;Y++}return s.attributesNum!==Y||s.index!==j}function x(L,V,H,j){const X={},q=V.attributes;let Y=0;const J=H.getAttributes();for(const te in J)if(J[te].location>=0){let ce=q[te];ce===void 0&&(te==="instanceMatrix"&&L.instanceMatrix&&(ce=L.instanceMatrix),te==="instanceColor"&&L.instanceColor&&(ce=L.instanceColor));const ve={};ve.attribute=ce,ce&&ce.data&&(ve.data=ce.data),X[te]=ve,Y++}s.attributes=X,s.attributesNum=Y,s.index=j}function M(){const L=s.newAttributes;for(let V=0,H=L.length;V<H;V++)L[V]=0}function _(L){v(L,0)}function v(L,V){const H=s.newAttributes,j=s.enabledAttributes,X=s.attributeDivisors;H[L]=1,j[L]===0&&(r.enableVertexAttribArray(L),j[L]=1),X[L]!==V&&(r.vertexAttribDivisor(L,V),X[L]=V)}function S(){const L=s.newAttributes,V=s.enabledAttributes;for(let H=0,j=V.length;H<j;H++)V[H]!==L[H]&&(r.disableVertexAttribArray(H),V[H]=0)}function b(L,V,H,j,X,q,Y){Y===!0?r.vertexAttribIPointer(L,V,H,X,q):r.vertexAttribPointer(L,V,H,j,X,q)}function E(L,V,H,j){M();const X=j.attributes,q=H.getAttributes(),Y=V.defaultAttributeValues;for(const J in q){const te=q[J];if(te.location>=0){let oe=X[J];if(oe===void 0&&(J==="instanceMatrix"&&L.instanceMatrix&&(oe=L.instanceMatrix),J==="instanceColor"&&L.instanceColor&&(oe=L.instanceColor)),oe!==void 0){const ce=oe.normalized,ve=oe.itemSize,Ae=e.get(oe);if(Ae===void 0)continue;const dt=Ae.buffer,vt=Ae.type,he=Ae.bytesPerElement,we=vt===r.INT||vt===r.UNSIGNED_INT||oe.gpuType===wh;if(oe.isInterleavedBufferAttribute){const Ee=oe.data,rt=Ee.stride,He=oe.offset;if(Ee.isInstancedInterleavedBuffer){for(let De=0;De<te.locationSize;De++)v(te.location+De,Ee.meshPerAttribute);L.isInstancedMesh!==!0&&j._maxInstanceCount===void 0&&(j._maxInstanceCount=Ee.meshPerAttribute*Ee.count)}else for(let De=0;De<te.locationSize;De++)_(te.location+De);r.bindBuffer(r.ARRAY_BUFFER,dt);for(let De=0;De<te.locationSize;De++)b(te.location+De,ve/te.locationSize,vt,ce,rt*he,(He+ve/te.locationSize*De)*he,we)}else{if(oe.isInstancedBufferAttribute){for(let Ee=0;Ee<te.locationSize;Ee++)v(te.location+Ee,oe.meshPerAttribute);L.isInstancedMesh!==!0&&j._maxInstanceCount===void 0&&(j._maxInstanceCount=oe.meshPerAttribute*oe.count)}else for(let Ee=0;Ee<te.locationSize;Ee++)_(te.location+Ee);r.bindBuffer(r.ARRAY_BUFFER,dt);for(let Ee=0;Ee<te.locationSize;Ee++)b(te.location+Ee,ve/te.locationSize,vt,ce,ve*he,ve/te.locationSize*Ee*he,we)}}else if(Y!==void 0){const ce=Y[J];if(ce!==void 0)switch(ce.length){case 2:r.vertexAttrib2fv(te.location,ce);break;case 3:r.vertexAttrib3fv(te.location,ce);break;case 4:r.vertexAttrib4fv(te.location,ce);break;default:r.vertexAttrib1fv(te.location,ce)}}}}S()}function P(){R();for(const L in n){const V=n[L];for(const H in V){const j=V[H];for(const X in j){const q=j[X];for(const Y in q)d(q[Y].object),delete q[Y];delete j[X]}}delete n[L]}}function D(L){if(n[L.id]===void 0)return;const V=n[L.id];for(const H in V){const j=V[H];for(const X in j){const q=j[X];for(const Y in q)d(q[Y].object),delete q[Y];delete j[X]}}delete n[L.id]}function N(L){for(const V in n){const H=n[V];for(const j in H){const X=H[j];if(X[L.id]===void 0)continue;const q=X[L.id];for(const Y in q)d(q[Y].object),delete q[Y];delete X[L.id]}}}function A(L){for(const V in n){const H=n[V],j=L.isInstancedMesh===!0?L.id:0,X=H[j];if(X!==void 0){for(const q in X){const Y=X[q];for(const J in Y)d(Y[J].object),delete Y[J];delete X[q]}delete H[j],Object.keys(H).length===0&&delete n[V]}}}function R(){B(),o=!0,s!==i&&(s=i,h(s.object))}function B(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:c,reset:R,resetDefaultState:B,dispose:P,releaseStatesOfGeometry:D,releaseStatesOfObject:A,releaseStatesOfProgram:N,initAttributes:M,enableAttribute:_,disableUnusedAttributes:S}}function lC(r,e,t){let n;function i(h){n=h}function s(h,d){r.drawArrays(n,h,d),t.update(d,n,1)}function o(h,d,f){f!==0&&(r.drawArraysInstanced(n,h,d,f),t.update(d,n,f))}function c(h,d,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,h,0,d,0,f);let g=0;for(let x=0;x<f;x++)g+=d[x];t.update(g,n,1)}function u(h,d,f,m){if(f===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let x=0;x<h.length;x++)o(h[x],d[x],m[x]);else{g.multiDrawArraysInstancedWEBGL(n,h,0,d,0,m,0,f);let x=0;for(let M=0;M<f;M++)x+=d[M]*m[M];t.update(x,n,1)}}this.setMode=i,this.render=s,this.renderInstances=o,this.renderMultiDraw=c,this.renderMultiDrawInstances=u}function cC(r,e,t,n){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const N=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(N.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(N){return!(N!==On&&n.convert(N)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function c(N){const A=N===Hi&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(N!==Hn&&n.convert(N)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&N!==Un&&!A)}function u(N){if(N==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";N="mediump"}return N==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=t.precision!==void 0?t.precision:"highp";const d=u(h);d!==h&&(ke("WebGLRenderer:",h,"not supported, using",d,"instead."),h=d);const f=t.logarithmicDepthBuffer===!0,m=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),g=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),x=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),M=r.getParameter(r.MAX_TEXTURE_SIZE),_=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),v=r.getParameter(r.MAX_VERTEX_ATTRIBS),S=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),b=r.getParameter(r.MAX_VARYING_VECTORS),E=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),P=r.getParameter(r.MAX_SAMPLES),D=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:u,textureFormatReadable:o,textureTypeReadable:c,precision:h,logarithmicDepthBuffer:f,reversedDepthBuffer:m,maxTextures:g,maxVertexTextures:x,maxTextureSize:M,maxCubemapSize:_,maxAttributes:v,maxVertexUniforms:S,maxVaryings:b,maxFragmentUniforms:E,maxSamples:P,samples:D}}function uC(r){const e=this;let t=null,n=0,i=!1,s=!1;const o=new Bi,c=new bt,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(f,m){const g=f.length!==0||m||n!==0||i;return i=m,n=f.length,g},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,m){t=d(f,m,0)},this.setState=function(f,m,g){const x=f.clippingPlanes,M=f.clipIntersection,_=f.clipShadows,v=r.get(f);if(!i||x===null||x.length===0||s&&!_)s?d(null):h();else{const S=s?0:n,b=S*4;let E=v.clippingState||null;u.value=E,E=d(x,m,b,g);for(let P=0;P!==b;++P)E[P]=t[P];v.clippingState=E,this.numIntersection=M?this.numPlanes:0,this.numPlanes+=S}};function h(){u.value!==t&&(u.value=t,u.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function d(f,m,g,x){const M=f!==null?f.length:0;let _=null;if(M!==0){if(_=u.value,x!==!0||_===null){const v=g+M*4,S=m.matrixWorldInverse;c.getNormalMatrix(S),(_===null||_.length<v)&&(_=new Float32Array(v));for(let b=0,E=g;b!==M;++b,E+=4)o.copy(f[b]).applyMatrix4(S,c),o.normal.toArray(_,E),_[E+3]=o.constant}u.value=_,u.needsUpdate=!0}return e.numPlanes=M,e.numIntersection=0,_}}const Kr=4,Ax=[.125,.215,.35,.446,.526,.582],Ps=20,hC=256,ka=new Gi,Cx=new Ke;let $f=null,ep=0,tp=0,np=!1;const dC=new F;class zp{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,s={}){const{size:o=256,position:c=dC}=s;$f=this._renderer.getRenderTarget(),ep=this._renderer.getActiveCubeFace(),tp=this._renderer.getActiveMipmapLevel(),np=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const u=this._allocateTargets();return u.depthBuffer=!0,this._sceneToCubeUV(e,n,i,u,c),t>0&&this._blur(u,0,0,t),this._applyPMREM(u),this._cleanup(u),u}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Px(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Ix(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget($f,ep,tp),this._renderer.xr.enabled=np,e.scissorTest=!1,Oo(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===or||e.mapping===Qr?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),$f=this._renderer.getRenderTarget(),ep=this._renderer.getActiveCubeFace(),tp=this._renderer.getActiveMipmapLevel(),np=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Xt,minFilter:Xt,generateMipmaps:!1,type:Hi,format:On,colorSpace:Gs,depthBuffer:!1},i=Rx(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Rx(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=fC(s)),this._blurMaterial=mC(s,e,t),this._ggxMaterial=pC(s,e,t)}return i}_compileMaterial(e){const t=new dn(new xt,e);this._renderer.compile(t,ka)}_sceneToCubeUV(e,t,n,i,s){const u=new Zt(90,1,t,n),h=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],f=this._renderer,m=f.autoClear,g=f.toneMapping;f.getClearColor(Cx),f.toneMapping=Ci,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(i),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new dn(new Zs,new ns({name:"PMREM.Backgroun
3612d",side:jn,depthWrite:!1,depthTest:!1})));const M=this._backgroundBox,_=M.material;let v=!1;const S=e.background;S?S.isColor&&(_.color.copy(S),e.background=null,v=!0):(_.color.copy(Cx),v=!0);for(let b=0;b<6;b++){const E=b%3;E===0?(u.up.set(0,h[b],0),u.position.set(s.x,s.y,s.z),u.lookAt(s.x+d[b],s.y,s.z)):E===1?(u.up.set(0,0,h[b]),u.position.set(s.x,s.y,s.z),u.lookAt(s.x,s.y+d[b],s.z)):(u.up.set(0,h[b],0),u.position.set(s.x,s.y,s.z),u.lookAt(s.x,s.y,s.z+d[b]));const P=this._cubeSize;Oo(i,E*P,b>2?P:0,P,P),f.setRenderTarget(i),v&&f.render(M,u),f.render(e,u)}f.toneMapping=g,f.autoClear=m,e.background=S}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===or||e.mapping===Qr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Px()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Ix());const s=i?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;const c=s.uniforms;c.envMap.value=e;const u=this._cubeSize;Oo(t,0,0,3*u,2*u),n.setRenderTarget(t),n.render(o,ka)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let s=1;s<i;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const i=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,c=this._lodMeshes[n];c.material=o;const u=o.uniforms,h=n/(this._lodMeshes.length-1),d=t/(this._lodMeshes.length-1),f=Math.sqrt(h*h-d*d),m=0+h*1.25,g=f*m,{_lodMax:x}=this,M=this._sizeLods[n],_=3*M*(n>x-Kr?n-x+Kr:0),v=4*(this._cubeSize-M);u.envMap.value=e.texture,u.roughness.value=g,u.mipInt.value=x-t,Oo(s,_,v,3*M,2*M),i.setRenderTarget(s),i.render(c,ka),u.envMap.value=s.texture,u.roughness.value=0,u.mipInt.value=x-n,Oo(e,_,v,3*M,2*M),i.setRenderTarget(e),i.render(c,ka)}_blur(e,t,n,i,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,i,"latitudinal",s),this._halfBlur(o,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,o,c){const u=this._renderer,h=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&ot("blur direction must be either latitudinal or longitudinal!");const d=3,f=this._lodMeshes[i];f.material=h;const m=h.uniforms,g=this._sizeLods[n]-1,x=isFinite(s)?Math.PI/(2*g):2*Math.PI/(2*Ps-1),M=s/x,_=isFinite(s)?1+Math.floor(d*M):Ps;_>Ps&&ke(`sigmaRadians, ${s}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${Ps}`);const v=[];let S=0;for(let N=0;N<Ps;++N){const A=N/M,R=Math.exp(-A*A/2);v.push(R),N===0?S+=R:N<_&&(S+=2*R)}for(let N=0;N<v.length;N++)v[N]=v[N]/S;m.envMap.value=e.texture,m.samples.value=_,m.weights.value=v,m.latitudinal.value=o==="latitudinal",c&&(m.poleAxis.value=c);const{_lodMax:b}=this;m.dTheta.value=x,m.mipInt.value=b-n;const E=this._sizeLods[i],P=3*E*(i>b-Kr?i-b+Kr:0),D=4*(this._cubeSize-E);Oo(t,P,D,3*E,2*E),u.setRenderTarget(t),u.render(f,ka)}}function fC(r){const e=[],t=[],n=[];let i=r;const s=r-Kr+1+Ax.length;for(let o=0;o<s;o++){const c=Math.pow(2,i);e.push(c);let u=1/c;o>r-Kr?u=Ax[o-r+Kr-1]:o===0&&(u=0),t.push(u);const h=1/(c-2),d=-h,f=1+h,m=[d,d,f,d,f,f,d,d,f,f,d,f],g=6,x=6,M=3,_=2,v=1,S=new Float32Array(M*x*g),b=new Float32Array(_*x*g),E=new Float32Array(v*x*g);for(let D=0;D<g;D++){const N=D%3*2/3-1,A=D>2?0:-1,R=[N,A,0,N+2/3,A,0,N+2/3,A+1,0,N,A,0,N+2/3,A+1,0,N,A+1,0];S.set(R,M*x*D),b.set(m,_*x*D);const B=[D,D,D,D,D,D];E.set(B,v*x*D)}const P=new xt;P.setAttribute("position",new Ht(S,M)),P.setAttribute("uv",new Ht(b,_)),P.setAttribute("faceIndex",new Ht(E,v)),n.push(new dn(P,null)),i>Kr&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function Rx(r,e,t){const n=new ni(r,e,t);return n.texture.mapping=ta,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Oo(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function pC(r,e,t){return new Ii({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:hC,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:ed(),fragmentShader:`
3613
3614			precision highp float;
3615			precision highp int;
3616
3617			varying vec3 vOutputDirection;
3618
3619			uniform sampler2D envMap;
3620			uniform float roughness;
3621			uniform float mipInt;
3622
3623			#define ENVMAP_TYPE_CUBE_UV
3624			#include <cube_uv_reflection_fragment>
3625
3626			#define PI 3.14159265359
3627
3628			// Van der Corput radical inverse
3629			float radicalInverse_VdC(uint bits) {
3630				bits = (bits << 16u) | (bits >> 16u);
3631				bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
3632				bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
3633				bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
3634				bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
3635				return float(bits) * 2.3283064365386963e-10; // / 0x100000000
3636			}
3637
3638			// Hammersley sequence
3639			vec2 hammersley(uint i, uint N) {
3640				return vec2(float(i) / float(N), radicalInverse_VdC(i));
3641			}
3642
3643			// GGX VNDF importance sampling (Eric Heitz 2018)
3644			// "Sampling the GGX Distribution of Visible Normals"
3645			// https://jcgt.org/published/0007/04/01/
3646			vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
3647				float alpha = roughness * roughness;
3648
3649				// Section 4.1: Orthonormal basis
3650				vec3 T1 = vec3(1.0, 0.0, 0.0);
3651				vec3 T2 = cross(V, T1);
3652
3653				// Section 4.2: Parameterization of projected area
3654				float r = sqrt(Xi.x);
3655				float phi = 2.0 * PI * Xi.y;
3656				float t1 = r * cos(phi);
3657				float t2 = r * sin(phi);
3658				float s = 0.5 * (1.0 + V.z);
3659				t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
3660
3661				// Section 4.3: Reprojection onto hemisphere
3662				vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
3663
3664				// Section 3.4: Transform back to ellipsoid configuration
3665				return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
3666			}
3667
3668			void main() {
3669				vec3 N = normalize(vOutputDirection);
3670				vec3 V = N; // Assume view direction equals normal for pre-filtering
3671
3672				vec3 prefilteredColor = vec3(0.0);
3673				float totalWeight = 0.0;
3674
3675				// For very low roughness, just sample the environment directly
3676				if (roughness < 0.001) {
3677					gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
3678					return;
3679				}
3680
3681				// Tangent space basis for VNDF sampling
3682				vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
3683				vec3 tangent = normalize(cross(up, N));
3684				vec3 bitangent = cross(N, tangent);
3685
3686				for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
3687					vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
3688
3689					// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
3690					vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
3691
3692					// Transform H back to world space
3693					vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
3694					vec3 L = normalize(2.0 * dot(V, H) * H - V);
3695
3696					float NdotL = max(dot(N, L), 0.0);
3697
3698					if(NdotL > 0.0) {
3699						// Sample environment at fixed mip level
3700						// VNDF importance sampling handles the distribution filtering
3701						vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
3702
3703						// Weight by NdotL for the split-sum approximation
3704						// VNDF PDF naturally accounts for the visible microfacet distribution
3705						prefilteredColor += sampleColor * NdotL;
3706						totalWeight += NdotL;
3707					}
3708				}
3709
3710				if (totalWeight > 0.0) {
3711					prefilteredColor = prefilteredColor / totalWeight;
3712				}
3713
3714				gl_FragColor = vec4(prefilteredColor, 1.0);
3715			}
3716		`,blending:sr,depthTest:!1,depthWrite:!1})}function mC(r,e,t){const n=new Float32Array(Ps),i=new F(0,1,0);return new Ii({name:"SphericalGaussianBlur",defines:{n:Ps,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:ed(),fragmentShader:`
3717
3718			precision mediump float;
3719			precision mediump int;
3720
3721			varying vec3 vOutputDirection;
3722
3723			uniform sampler2D envMap;
3724			uniform int samples;
3725			uniform float weights[ n ];
3726			uniform bool latitudinal;
3727			uniform float dTheta;
3728			uniform float mipInt;
3729			uniform vec3 poleAxis;
3730
3731			#define ENVMAP_TYPE_CUBE_UV
3732			#include <cube_uv_reflection_fragment>
3733
3734			vec3 getSample( float theta, vec3 axis ) {
3735
3736				float cosTheta = cos( theta );
3737				// Rodrigues' axis-angle rotation
3738				vec3 sampleDirection = vOutputDirection * cosTheta
3739					+ cross( axis, vOutputDirection ) * sin( theta )
3740					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3741
3742				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3743
3744			}
3745
3746			void main() {
3747
3748				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3749
3750				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3751
3752					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3753
3754				}
3755
3756				axis = normalize( axis );
3757
3758				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3759				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3760
3761				for ( int i = 1; i < n; i++ ) {
3762
3763					if ( i >= samples ) {
3764
3765						break;
3766
3767					}
3768
3769					float theta = dTheta * float( i );
3770					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3771					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3772
3773				}
3774
3775			}
3776		`,blending:sr,depthTest:!1,depthWrite:!1})}function Ix(){return new Ii({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ed(),fragmentShader:`
3777
3778			precision mediump float;
3779			precision mediump int;
3780
3781			varying vec3 vOutputDirection;
3782
3783			uniform sampler2D envMap;
3784
3785			#include <common>
3786
3787			void main() {
3788
3789				vec3 outputDirection = normalize( vOutputDirection );
3790				vec2 uv = equirectUv( outputDirection );
3791
3792				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3793
3794			}
3795		`,blending:sr,depthTest:!1,depthWrite:!1})}function Px(){return new Ii({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ed(),fragmentShader:`
3796
3797			precision mediump float;
3798			precision mediump int;
3799
3800			uniform float flipEnvMap;
3801
3802			varying vec3 vOutputDirection;
3803
3804			uniform samplerCube envMap;
3805
3806			void main() {
3807
3808				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3809
3810			}
3811		`,blending:sr,depthTest:!1,depthWrite:!1})}function ed(){return`
3812
3813		precision mediump float;
3814		precision mediump int;
3815
3816		attribute float faceIndex;
3817
3818		varying vec3 vOutputDirection;
3819
3820		// RH coordinate system; PMREM face-indexing convention
3821		vec3 getDirection( vec2 uv, float face ) {
3822
3823			uv = 2.0 * uv - 1.0;
3824
3825			vec3 direction = vec3( uv, 1.0 );
3826
3827			if ( face == 0.0 ) {
3828
3829				direction = direction.zyx; // ( 1, v, u ) pos x
3830
3831			} else if ( face == 1.0 ) {
3832
3833				direction = direction.xzy;
3834				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3835
3836			} else if ( face == 2.0 ) {
3837
3838				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3839
3840			} else if ( face == 3.0 ) {
3841
3842				direction = direction.zyx;
3843				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3844
3845			} else if ( face == 4.0 ) {
3846
3847				direction = direction.xzy;
3848				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3849
3850			} else if ( face == 5.0 ) {
3851
3852				direction.z *= -1.0; // ( u, v, -1 ) neg z
3853
3854			}
3855
3856			return direction;
3857
3858		}
3859
3860		void main() {
3861
3862			vOutputDirection = getDirection( uv, faceIndex );
3863			gl_Position = vec4( position, 1.0 );
3864
3865		}
3866	`}class Fm extends ni{constructor(e=1,t={}
vendor: 8,442 bytes, lines 3866-3901
3866){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new wl(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
3867
3868				varying vec3 vWorldDirection;
3869
3870				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
3871
3872					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
3873
3874				}
3875
3876				void main() {
3877
3878					vWorldDirection = transformDirection( position, modelMatrix );
3879
3880					#include <begin_vertex>
3881					#include <project_vertex>
3882
3883				}
3884			`,fragmentShader:`
3885
3886				uniform sampler2D tEquirect;
3887
3888				varying vec3 vWorldDirection;
3889
3890				#include <common>
3891
3892				void main() {
3893
3894					vec3 direction = normalize( vWorldDirection );
3895
3896					vec2 sampleUV = equirectUv( direction );
3897
3898					gl_FragColor = texture2D( tEquirect, sampleUV );
3899
3900				}
3901			`},i=new Zs(5,5,5),s=new Ii({name:"CubemapFromEquirect",uniforms:$o(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:jn,blending:sr});s.uniforms.tEquirect.value=t;const o=new dn(i,s),c=t.minFilter;return t.minFilter===ir&&(t.minFilter=Xt),new h_(1,10,this).update(e,o),t.minFilter=c,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(s)}}function gC(r){let e=new WeakMap,t=new WeakMap,n=null;function i(m,g=!1){return m==null?null:g?o(m):s(m)}function s(m){if(m&&m.isTexture){const g=m.mapping;if(g===Za||g===Ja)if(e.has(m)){const x=e.get(m).texture;return c(x,m.mapping)}else{const x=m.image;if(x&&x.height>0){const M=new Fm(x.height);return M.fromEquirectangularTexture(r,m),e.set(m,M),m.addEventListener("dispose",h),c(M.texture,m.mapping)}else return null}}return m}function o(m){if(m&&m.isTexture){const g=m.mapping,x=g===Za||g===Ja,M=g===or||g===Qr;if(x||M){let _=t.get(m);const v=_!==void 0?_.texture.pmremVersion:0;if(m.isRenderTargetTexture&&m.pmremVersion!==v)return n===null&&(n=new zp(r)),_=x?n.fromEquirectangular(m,_):n.fromCubemap(m,_),_.texture.pmremVersion=m.pmremVersion,t.set(m,_),_.texture;if(_!==void 0)return _.texture;{const S=m.image;return x&&S&&S.height>0||M&&S&&u(S)?(n===null&&(n=new zp(r)),_=x?n.fromEquirectangular(m):n.fromCubemap(m),_.texture.pmremVersion=m.pmremVersion,t.set(m,_),m.addEventListener("dispose",d),_.texture):null}}}return m}function c(m,g){return g===Za?m.mapping=or:g===Ja&&(m.mapping=Qr),m}function u(m){let g=0;const x=6;for(let M=0;M<x;M++)m[M]!==void 0&&g++;return g===x}function h(m){const g=m.target;g.removeEventListener("dispose",h);const x=e.get(g);x!==void 0&&(e.delete(g),x.dispose())}function d(m){const g=m.target;g.removeEventListener("dispose",d);const x=t.get(g);x!==void 0&&(t.delete(g),x.dispose())}function f(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:f}}function xC(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&pl("WebGLRenderer: "+n+" extension not supported."),i}}}function vC(r,e,t,n){const i={},s=new WeakMap;function o(f){const m=f.target;m.index!==null&&e.remove(m.index);for(const x in m.attributes)e.remove(m.attributes[x]);m.removeEventListener("dispose",o),delete i[m.id];const g=s.get(m);g&&(e.remove(g),s.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(f,m){return i[m.id]===!0||(m.addEventListener("dispose",o),i[m.id]=!0,t.memory.geometries++),m}function u(f){const m=f.attributes;for(const g in m)e.update(m[g],r.ARRAY_BUFFER)}function h(f){const m=[],g=f.index,x=f.attributes.position;let M=0;if(x===void 0)return;if(g!==null){const S=g.array;M=g.version;for(let b=0,E=S.length;b<E;b+=3){const P=S[b+0],D=S[b+1],N=S[b+2];m.push(P,D,D,N,N,P)}}else{const S=x.array;M=x.version;for(let b=0,E=S.length/3-1;b<E;b+=3){const P=b+0,D=b+1,N=b+2;m.push(P,D,D,N,N,P)}}const _=new(x.count>=65535?hm:um)(m,1);_.version=M;const v=s.get(f);v&&e.remove(v),s.set(f,_)}function d(f){const m=s.get(f);if(m){const g=f.index;g!==null&&m.version<g.version&&h(f)}else h(f);return s.get(f)}return{get:c,update:u,getWireframeAttribute:d}}function yC(r,e,t){let n;function i(m){n=m}let s,o;function c(m){s=m.type,o=m.bytesPerElement}function u(m,g){r.drawElements(n,g,s,m*o),t.update(g,n,1)}function h(m,g,x){x!==0&&(r.drawElementsInstanced(n,g,s,m*o,x),t.update(g,n,x))}function d(m,g,x){if(x===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,g,0,s,m,0,x);let _=0;for(let v=0;v<x;v++)_+=g[v];t.update(_,n,1)}function f(m,g,x,M){if(x===0)return;const _=e.get("WEBGL_multi_draw");if(_===null)for(let v=0;v<m.length;v++)h(m[v]/o,g[v],M[v]);else{_.multiDrawElementsInstancedWEBGL(n,g,0,s,m,0,M,0,x);let v=0;for(let S=0;S<x;S++)v+=g[S]*M[S];t.update(v,n,1)}}this.setMode=i,this.setIndex=c,this.render=u,this.renderInstances=h,this.renderMultiDraw=d,this.renderMultiDrawInstances=f}function _C(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,c){switch(t.calls++,o){case r.TRIANGLES:t.triangles+=c*(s/3);break;case r.LINES:t.lines+=c*(s/2);break;case r.LINE_STRIP:t.lines+=c*(s-1);break;case r.LINE_LOOP:t.lines+=c*s;break;case r.POINTS:t.points+=c*s;break;default:ot("WebGLInfo: Unknown draw mode:",o);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function SC(r,e,t){const n=new WeakMap,i=new jt;function s(o,c,u){const h=o.morphTargetInfluences,d=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,f=d!==void 0?d.length:0;let m=n.get(c);if(m===void 0||m.count!==f){let R=function(){N.dispose(),n.delete(c),c.removeEventListener("dispose",R)};m!==void 0&&m.texture.dispose();const g=c.morphAttributes.position!==void 0,x=c.morphAttributes.normal!==void 0,M=c.morphAttributes.color!==void 0,_=c.morphAttributes.position||[],v=c.morphAttributes.normal||[],S=c.morphAttributes.color||[];let b=0;g===!0&&(b=1),x===!0&&(b=2),M===!0&&(b=3);let E=c.attributes.position.count*b,P=1;E>e.maxTextureSize&&(P=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const D=new Float32Array(E*P*4*f),N=new Dh(D,E,P,f);N.type=Un,N.needsUpdate=!0;const A=b*4;for(let B=0;B<f;B++){const L=_[B],V=v[B],H=S[B],j=E*P*4*B;for(let X=0;X<L.count;X++){const q=X*A;g===!0&&(i.fromBufferAttribute(L,X),D[j+q+0]=i.x,D[j+q+1]=i.y,D[j+q+2]=i.z,D[j+q+3]=0),x===!0&&(i.fromBufferAttribute(V,X),D[j+q+4]=i.x,D[j+q+5]=i.y,D[j+q+6]=i.z,D[j+q+7]=0),M===!0&&(i.fromBufferAttribute(H,X),D[j+q+8]=i.x,D[j+q+9]=i.y,D[j+q+10]=i.z,D[j+q+11]=H.itemSize===4?i.w:1)}}m={count:f,texture:N,size:new ge(E,P)},n.set(c,m),c.addEventListener("dispose",R)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)u.getUniforms().setValue(r,"morphTexture",o.morphTexture,t);else{let g=0;for(let M=0;M<h.length;M++)g+=h[M];const x=c.morphTargetsRelative?1:1-g;u.getUniforms().setValue(r,"morphTargetBaseInfluence",x),u.getUniforms().setValue(r,"morphTargetInfluences",h)}u.getUniforms().setValue(r,"morphTargetsTexture",m.texture,t),u.getUniforms().setValue(r,"morphTargetsTextureSize",m.size)}return{update:s}}function MC(r,e,t,n,i){let s=new WeakMap;function o(h){const d=i.render.frame,f=h.geometry,m=e.get(h,f);if(s.get(m)!==d&&(e.update(m),s.set(m,d)),h.isInstancedMesh&&(h.hasEventListener("dispose",u)===!1&&h.addEventListener("dispose",u),s.get(h)!==d&&(t.update(h.instanceMatrix,r.ARRAY_BUFFER),h.instanceColor!==null&&t.update(h.instanceColor,r.ARRAY_BUFFER),s.set(h,d))),h.isSkinnedMesh){const g=h.skeleton;s.get(g)!==d&&(g.update(),s.set(g,d))}return m}function c(){s=new WeakMap}function u(h){const d=h.target;d.removeEventListener("dispose",u),n.releaseStatesOfObject(d),t.remove(d.instanceMatrix),d.instanceColor!==null&&t.remove(d.instanceColor)}return{update:o,dispose:c}}const bC={[Yp]:"LINEAR_TONE_MAPPING",[qp]:"REINHARD_TONE_MAPPING",[Zp]:"
3901CINEON_TONE_MAPPING",[Mh]:"ACES_FILMIC_TONE_MAPPING",[Kp]:"AGX_TONE_MAPPING",[Qp]:"NEUTRAL_TONE_MAPPING",[Jp]:"CUSTOM_TONE_MAPPING"};function wC(r,e,t,n,i){const s=new ni(e,t,{type:r,depthBuffer:n,stencilBuffer:i}),o=new ni(e,t,{type:Hi,depthBuffer:!1,stencilBuffer:!1}),c=new xt;c.setAttribute("position",new qe([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new qe([0,2,0,0,2,0],2));const u=new Mm({uniforms:{tDiffuse:{value:null}},vertexShader:`
3902			precision highp float;
3903
3904			uniform mat4 modelViewMatrix;
3905			uniform mat4 projectionMatrix;
3906
3907			attribute vec3 position;
3908			attribute vec2 uv;
3909
3910			varying vec2 vUv;
3911
3912			void main() {
3913				vUv = uv;
3914				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3915			}`,fragmentShader:`
3916			precision highp float;
3917
3918			uniform sampler2D tDiffuse;
3919
3920			varying vec2 vUv;
3921
3922			#include <tonemapping_pars_fragment>
3923			#include <colorspace_pars_fragment>
3924
3925			void main() {
3926				gl_FragColor = texture2D( tDiffuse, vUv );
3927
3928				#ifdef LINEAR_TONE_MAPPING
3929					gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
3930				#elif defined( REINHARD_TONE_MAPPING )
3931					gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
3932				#elif defined( CINEON_TONE_MAPPING )
3933					gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
3934				#elif defined( ACES_FILMIC_TONE_MAPPING )
3935					gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
3936				#elif defined( AGX_TONE_MAPPING )
3937					gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
3938				#elif defined( NEUTRAL_TONE_MAPPING )
3939					gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
3940				#elif defined( CUSTOM_TONE_MAPPING )
3941					gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
3942				#endif
3943
3944				#ifdef SRGB_TRANSFER
3945					gl_FragColor = sRGBTransferOETF( gl_FragColor );
3946				#endif
3947			}`,depthTest:!1,depthWrite:!1}),h=new dn(c,u),d=new Gi(-1,1,1,-1,0,1);let f=null,m=null,g=!1,x,M=null,_=[],v=!1;this.setSize=function(S,b){s.setSize(S,b),o.setSize(S,b);for(let E=0;E<_.length;E++){const P=_[E];P.setSize&&P.setSize(S,b)}},this.setEffects=function(S){_=S,v=_.length>0&&_[0].isRenderPass===!0;const b=s.width,E=s.height;for(let P=0;P<_.length;P++){const D=_[P];D.setSize&&D.setSize(b,E)}},this.begin=function(S,b){if(g||S.toneMapping===Ci&&_.length===0)return!1;if(M=b,b!==null){const E=b.width,P=b.height;(s.width!==E||s.height!==P)&&this.setSize(E,P)}return v===!1&&S.setRenderTarget(s),x=S.toneMapping,S.toneMapping=Ci,!0},this.hasRenderPass=function(){return v},this.end=function(S,b){S.toneMapping=x,g=!0;let E=s,P=o;for(let D=0;D<_.length;D++){const N=_[D];if(N.enabled!==!1&&(N.render(S,P,E,b),N.needsSwap!==!1)){const A=E;E=P,P=A}}if(f!==S.outputColorSpace||m!==S.toneMapping){f=S.outputColorSpace,m=S.toneMapping,u.defines={},Dt.getTransfer(f)===Vt&&(u.defines.SRGB_TRANSFER="");const D=bC[m];D&&(u.defines[D]=""),u.needsUpdate=!0}u.uniforms.tDiffuse.value=E.texture,S.setRenderTarget(M),S.render(h,d),M=null,g=!1},this.isCompositing=function(){return g},this.dispose=function(){s.dispose(),o.dispose(),c.dispose(),u.dispose()}}const S_=new rn,Vp=new js(1,1),M_=new Dh,b_=new Nh,w_=new wl,Lx=[],Dx=[],Nx=new Float32Array(16),Ux=new Float32Array(9),Ox=new Float32Array(4);function oa(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=Lx[i];if(s===void 0&&(s=new Float32Array(i),Lx[i]=s),e!==0){n.toArray(s,0);for(let o=1,c=0;o!==e;++o)c+=t,r[o].toArray(s,c)}return s}function mn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function gn(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function td(r,e){let t=Dx[e];t===void 0&&(t=new Int32Array(e),Dx[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function EC(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function TC(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(mn(t,e))return;r.uniform2fv(this.addr,e),gn(t,e)}}function AC(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(mn(t,e))return;r.uniform3fv(this.addr,e),gn(t,e)}}function CC(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(mn(t,e))return;r.uniform4fv(this.addr,e),gn(t,e)}}function RC(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(mn(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),gn(t,e)}else{if(mn(t,n))return;Ox.set(n),r.uniformMatrix2fv(this.addr,!1,Ox),gn(t,n)}}function IC(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(mn(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),gn(t,e)}else{if(mn(t,n))return;Ux.set(n),r.uniformMatrix3fv(this.addr,!1,Ux),gn(t,n)}}function PC(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(mn(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),gn(t,e)}else{if(mn(t,n))return;Nx.set(n),r.uniformMatrix4fv(this.addr,!1,Nx),gn(t,n)}}function LC(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function DC(r,e){const t=this.cache;
vendor: 12,240 bytes, lines 3947-3982
3947if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(mn(t,e))return;r.uniform2iv(this.addr,e),gn(t,e)}}function NC(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(mn(t,e))return;r.uniform3iv(this.addr,e),gn(t,e)}}function UC(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(mn(t,e))return;r.uniform4iv(this.addr,e),gn(t,e)}}function OC(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function FC(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(mn(t,e))return;r.uniform2uiv(this.addr,e),gn(t,e)}}function BC(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(mn(t,e))return;r.uniform3uiv(this.addr,e),gn(t,e)}}function kC(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(mn(t,e))return;r.uniform4uiv(this.addr,e),gn(t,e)}}function zC(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);let s;this.type===r.SAMPLER_2D_SHADOW?(Vp.compareFunction=t.isReversedDepthBuffer()?Lh:Ph,s=Vp):s=S_,t.setTexture2D(e||s,i)}function VC(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||b_,i)}function GC(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||w_,i)}function HC(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||M_,i)}function WC(r){switch(r){case 5126:return EC;case 35664:return TC;case 35665:return AC;case 35666:return CC;case 35674:return RC;case 35675:return IC;case 35676:return PC;case 5124:case 35670:return LC;case 35667:case 35671:return DC;case 35668:case 35672:return NC;case 35669:case 35673:return UC;case 5125:return OC;case 36294:return FC;case 36295:return BC;case 36296:return kC;case 35678:case 36198:case 36298:case 36306:case 35682:return zC;case 35679:case 36299:case 36307:return VC;case 35680:case 36300:case 36308:case 36293:return GC;case 36289:case 36303:case 36311:case 36292:return HC}}function jC(r,e){r.uniform1fv(this.addr,e)}function XC(r,e){const t=oa(e,this.size,2);r.uniform2fv(this.addr,t)}function YC(r,e){const t=oa(e,this.size,3);r.uniform3fv(this.addr,t)}function qC(r,e){const t=oa(e,this.size,4);r.uniform4fv(this.addr,t)}function ZC(r,e){const t=oa(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function JC(r,e){const t=oa(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function KC(r,e){const t=oa(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function QC(r,e){r.uniform1iv(this.addr,e)}function $C(r,e){r.uniform2iv(this.addr,e)}function e2(r,e){r.uniform3iv(this.addr,e)}function t2(r,e){r.uniform4iv(this.addr,e)}function n2(r,e){r.uniform1uiv(this.addr,e)}function i2(r,e){r.uniform2uiv(this.addr,e)}function r2(r,e){r.uniform3uiv(this.addr,e)}function s2(r,e){r.uniform4uiv(this.addr,e)}function o2(r,e,t){const n=this.cache,i=e.length,s=td(t,i);mn(n,s)||(r.uniform1iv(this.addr,s),gn(n,s));let o;this.type===r.SAMPLER_2D_SHADOW?o=Vp:o=S_;for(let c=0;c!==i;++c)t.setTexture2D(e[c]||o,s[c])}function a2(r,e,t){const n=this.cache,i=e.length,s=td(t,i);mn(n,s)||(r.uniform1iv(this.addr,s),gn(n,s));for(let o=0;o!==i;++o)t.setTexture3D(e[o]||b_,s[o])}function l2(r,e,t){const n=this.cache,i=e.length,s=td(t,i);mn(n,s)||(r.uniform1iv(this.addr,s),gn(n,s));for(let o=0;o!==i;++o)t.setTextureCube(e[o]||w_,s[o])}function c2(r,e,t){const n=this.cache,i=e.length,s=td(t,i);mn(n,s)||(r.uniform1iv(this.addr,s),gn(n,s));for(let o=0;o!==i;++o)t.setTexture2DArray(e[o]||M_,s[o])}function u2(r){switch(r){case 5126:return jC;case 35664:return XC;case 35665:return YC;case 35666:return qC;case 35674:return ZC;case 35675:return JC;case 35676:return KC;case 5124:case 35670:return QC;case 35667:case 35671:return $C;case 35668:case 35672:return e2;case 35669:case 35673:return t2;case 5125:return n2;case 36294:return i2;case 36295:return r2;case 36296:return s2;case 35678:case 36198:case 36298:case 36306:case 35682:return o2;case 35679:case 36299:case 36307:return a2;case 35680:case 36300:case 36308:case 36293:return l2;case 36289:case 36303:case 36311:case 36292:return c2}}class h2{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=WC(t.type)}}class d2{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=u2(t.type)}}class f2{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,o=i.length;s!==o;++s){const c=i[s];c.setValue(e,t[c.id],n)}}}const ip=/(\w+)(\])?(\[|\.)?/g;function Fx(r,e){r.seq.push(e),r.map[e.id]=e}function p2(r,e,t){const n=r.name,i=n.length;for(ip.lastIndex=0;;){const s=ip.exec(n),o=ip.lastIndex;let c=s[1];const u=s[2]==="]",h=s[3];if(u&&(c=c|0),h===void 0||h==="["&&o+2===i){Fx(t,h===void 0?new h2(c,r,e):new d2(c,r,e));break}else{let f=t.map[c];f===void 0&&(f=new f2(c),Fx(t,f)),t=f}}}class Tu{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let o=0;o<n;++o){const c=e.getActiveUniform(t,o),u=e.getUniformLocation(t,c.name);p2(c,u,this)}const i=[],s=[];for(const o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(o):s.push(o);i.length>0&&(this.seq=i.concat(s))}setValue(e,t,n,i){const s=this.map[t];s!==void 0&&s.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,o=t.length;s!==o;++s){const c=t[s],u=n[c.id];u.needsUpdate!==!1&&c.setValue(e,u.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const o=e[i];o.id in t&&n.push(o)}return n}}function Bx(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const m2=37297;let g2=0;function x2(r,e){const t=r.split(`
3948`),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=i;o<s;o++){const c=o+1;n.push(`${c===e?">":" "} ${c}: ${t[o]}`)}return n.join(`
3949`)}const kx=new bt;function v2(r){Dt._getMatrix(kx,Dt.workingColorSpace,r);const e=`mat3( ${kx.elements.map(t=>t.toFixed(4))} )`;switch(Dt.getTransfer(r)){case ul:return[e,"LinearTransferOETF"];case Vt:return[e,"sRGBTransferOETF"];default:return ke("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function zx(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),s=(r.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";const o=/ERROR: 0:(\d+)/.exec(s);if(o){const c=parseInt(o[1]);return t.toUpperCase()+`
3950
3951`+s+`
3952
3953`+x2(r.getShaderSource(e),c)}else return s}function y2(r,e){const t=v2(e);return[`vec4 ${r}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
3954`)}const _2={[Yp]:"Linear",[qp]:"Reinhard",[Zp]:"Cineon",[Mh]:"ACESFilmic",[Kp]:"AgX",[Qp]:"Neutral",[Jp]:"Custom"};function S2(r,e){const t=_2[e];return t===void 0?(ke("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const _u=new F;function M2(){Dt.getLuminanceCoefficients(_u);const r=_u.x.toFixed(4),e=_u.y.toFixed(4),t=_u.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${r}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
3955`)}function b2(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Xa).join(`
3956`)}function w2(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
3957`)}function E2(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),o=s.name;let c=1;s.type===r.FLOAT_MAT2&&(c=2),s.type===r.FLOAT_MAT3&&(c=3),s.type===r.FLOAT_MAT4&&(c=4),t[o]={type:s.type,location:r.getAttribLocation(e,o),locationSize:c}}return t}function Xa(r){return r!==""}function Vx(r,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Gx(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const T2=/^[ \t]*#include +<([\w\d./]+)>/gm;function Gp(r){return r.replace(T2,C2)}const A2=new Map;function C2(r,e){let t=Et[e];if(t===void 0){const n=A2.get(e);if(n!==void 0)t=Et[n],ke('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Gp(t)}const R2=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Hx(r){return r.replace(R2,I2)}function I2(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function Wx(r){let e=`precision ${r.precision} float;
3958	precision ${r.precision} int;
3959	precision ${r.precision} sampler2D;
3960	precision ${r.precision} samplerCube;
3961	precision ${r.precision} sampler3D;
3962	precision ${r.precision} sampler2DArray;
3963	precision ${r.precision} sampler2DShadow;
3964	precision ${r.precision} samplerCubeShadow;
3965	precision ${r.precision} sampler2DArrayShadow;
3966	precision ${r.precision} isampler2D;
3967	precision ${r.precision} isampler3D;
3968	precision ${r.precision} isamplerCube;
3969	precision ${r.precision} isampler2DArray;
3970	precision ${r.precision} usampler2D;
3971	precision ${r.precision} usampler3D;
3972	precision ${r.precision} usamplerCube;
3973	precision ${r.precision} usampler2DArray;
3974	`;return r.precision==="highp"?e+=`
3975#define HIGH_PRECISION`:r.precision==="mediump"?e+=`
3976#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
3977#define LOW_PRECISION`),e}const P2={[jo]:"SHADOWMAP_TYPE_PCF",[Ls]:"SHADOWMAP_TYPE_VSM"};function L2(r){return P2[r.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const D2={[or]:"ENVMAP_TYPE_CUBE",[Qr]:"ENVMAP_TYPE_CUBE",[ta]:"ENVMAP_TYPE_CUBE_UV"};function N2(r){return r.envMap===!1?"ENVMAP_TYPE_CUBE":D2[r.envMapMode]||"ENVMAP_TYPE_CUBE"}const U2={[Qr]:"ENVMAP_MODE_REFRACTION"};function O2(r){return r.envMap===!1?"ENVMAP_MODE_REFLECTION":U2[r.envMapMode]||"ENVMAP_MODE_REFLECTION"}const F2={[Ml]:"ENVMAP_BLENDING_MULTIPLY",[ey]:"ENVMAP_BLENDING_MIX",[ty]:"ENVMAP_BLENDING_ADD"};function B2(r){return r.envMap===!1?"ENVMAP_BLENDING_NONE":F2[r.combine]||"ENVMAP_BLENDING_NONE"}function k2(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function z2(r,e,t,n){const i=r.getContext(),s=t.defines;let o=t.vertexShader,c=t.fragmentShader;const u=L2(t),h=N2(t),d=O2(t),f=B2(t),m=k2(t),g=b2(t),x=w2(s),M=i.createProgram();let _,v,S=t.glslVersion?"#version "+t.glslVersion+`
3978`:"";t.isRawShaderMaterial?(_=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x].filter(Xa).join(`
3979`),_.length>0&&(_+=`
3980`),v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x].filter(Xa).join(`
3981`),v.length>0&&(v+=`
3982`)):(_=[Wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x,t.extensionCl
vendor: 6,474 bytes, lines 3982-3984
3982ipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
3983`].filter(Xa).join(`
3984`),v=[Wx(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,x,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.envMap?"#define "+d:"",t.envMap?"#define "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
3984IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ci?"#define TONE_MAPPING":"",t.toneMapping!==Ci?Et.tonemapping_pars_fragment:"",t.toneMapping!==Ci?S2("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Et.colorspace_pars_fragment,y2("linearToOutputTexel",t.outputColorSpace),M2(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3985`].filter(Xa).join(`
3986`)),o=Gp(o),o=Vx(o,t),o=Gx(o,t),c=Gp(c),c=Vx(c,t),c=Gx(c,t),o=Hx(o),c=Hx(c),t.isRawShaderMaterial!==!0&&(S=`#version 300 es
3987`,_=[g,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3988`)+`
3989`+_,v=["#define varying in",t.glslVersion===Pp?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Pp?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
3990`)+`
3991`+v);const b=S+_+o,E=S+v+c,P=Bx(i,i.VERTEX_SHADER,b),D=Bx(i,i.FRAGMENT_SHADER,E);i.attachShader(M,P),i.attachShader(M,D),t.index0AttributeName!==void 0?i.bindAttribLocation(M,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(M,0,"position"),i.linkProgram(M);function N(L){if(r.debug.checkShaderErrors){const V=i.getProgramInfoLog(M)||"",H=i.getShaderInfoLog(P)||"",j=i.getShaderInfoLog(D)||"",X=V.trim(),q=H.trim(),Y=j.trim();let J=!0,te=!0;if(i.getProgramParameter(M,i.LINK_STATUS)===!1)if(J=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,M,P,D);else{const oe=zx(i,P,"vertex"),ce=zx(i,D,"fragment");ot("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(M,i.VALIDATE_STATUS)+`
3992
3993Material Name: `+L.name+`
3994Material Type: `+L.type+`
3995
3996Program Info Log: `+X+`
3997`+oe+`
3998`+ce)}else X!==""?ke("WebGLProgram: Program Info Log:",X):(q===""||Y==="")&&(te=!1);te&&(L.diagnostics={runnable:J,programLog:X,vertexShader:{log:q,prefix:_},fragmentShader:{log:Y,prefix:v}})}i.deleteShader(P),i.deleteShader(D),A=new Tu(i,M),R=E2(i,M)}let A;this.getUniforms=function(){return A===void 0&&N(this),A};let R;this.getAttributes=function(){return R===void 0&&N(this),R};let B=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return B===!1&&(B=i.getProgramParameter(
vendor: 17,281 bytes, line 3998
3998M,m2)),B},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(M),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=g2++,this.cacheKey=e,this.usedTimes=1,this.program=M,this.vertexShader=P,this.fragmentShader=D,this}let V2=0;class G2{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new H2(e),t.set(e,n)),n}}class H2{constructor(e){this.id=V2++,this.code=e,this.usedTimes=0}}function W2(r,e,t,n,i,s){const o=new Bs,c=new G2,u=new Set,h=[],d=new Map,f=n.logarithmicDepthBuffer;let m=n.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function x(A){return u.add(A),A===0?"uv":`uv${A}`}function M(A,R,B,L,V){const H=L.fog,j=V.geometry,X=A.isMeshStandardMaterial||A.isMeshLambertMaterial||A.isMeshPhongMaterial?L.environment:null,q=A.isMeshStandardMaterial||A.isMeshLambertMaterial&&!A.envMap||A.isMeshPhongMaterial&&!A.envMap,Y=e.get(A.envMap||X,q),J=Y&&Y.mapping===ta?Y.image.height:null,te=g[A.type];A.precision!==null&&(m=n.getMaxPrecision(A.precision),m!==A.precision&&ke("WebGLProgram.getParameters:",A.precision,"not supported, using",m,"instead."));const oe=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,ce=oe!==void 0?oe.length:0;let ve=0;j.morphAttributes.position!==void 0&&(ve=1),j.morphAttributes.normal!==void 0&&(ve=2),j.morphAttributes.color!==void 0&&(ve=3);let Ae,dt,vt,he;if(te){const Ct=ki[te];Ae=Ct.vertexShader,dt=Ct.fragmentShader}else Ae=A.vertexShader,dt=A.fragmentShader,c.update(A),vt=c.getVertexShaderID(A),he=c.getFragmentShaderID(A);const we=r.getRenderTarget(),Ee=r.state.buffers.depth.getReversed(),rt=V.isInstancedMesh===!0,He=V.isBatchedMesh===!0,De=!!A.map,_t=!!A.matcap,Je=!!Y,xe=!!A.aoMap,_e=!!A.lightMap,ye=!!A.bumpMap,Ie=!!A.normalMap,k=!!A.displacementMap,tt=!!A.emissiveMap,Be=!!A.metalnessMap,at=!!A.roughnessMap,Ce=A.anisotropy>0,O=A.clearcoat>0,I=A.dispersion>0,Z=A.iridescence>0,le=A.sheen>0,me=A.transmission>0,de=Ce&&!!A.anisotropyMap,Qe=O&&!!A.clearcoatMap,Ne=O&&!!A.clearcoatNormalMap,it=O&&!!A.clearcoatRoughnessMap,ht=Z&&!!A.iridescenceMap,Me=Z&&!!A.iridescenceThicknessMap,Re=le&&!!A.sheenColorMap,$e=le&&!!A.sheenRoughnessMap,G=!!A.specularMap,se=!!A.specularColorMap,Pe=!!A.specularIntensityMap,W=me&&!!A.transmissionMap,Se=me&&!!A.thicknessMap,be=!!A.gradientMap,Ve=!!A.alphaMap,Te=A.alphaTest>0,fe=!!A.alphaHash,We=!!A.extensions;let ct=Ci;A.toneMapped&&(we===null||we.isXRRenderTarget===!0)&&(ct=r.toneMapping);const Pt={shaderID:te,shaderType:A.type,shaderName:A.name,vertexShader:Ae,fragmentShader:dt,defines:A.defines,customVertexShaderID:vt,customFragmentShaderID:he,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:m,batching:He,batchingColor:He&&V._colorsTexture!==null,instancing:rt,instancingColor:rt&&V.instanceColor!==null,instancingMorph:rt&&V.morphTexture!==null,outputColorSpace:we===null?r.outputColorSpace:we.isXRRenderTarget===!0?we.texture.colorSpace:Gs,alphaToCoverage:!!A.alphaToCoverage,map:De,matcap:_t,envMap:Je,envMapMode:Je&&Y.mapping,envMapCubeUVHeight:J,aoMap:xe,lightMap:_e,bumpMap:ye,normalMap:Ie,displacementMap:k,emissiveMap:tt,normalMapObjectSpace:Ie&&A.normalMapType===ay,normalMapTangentSpace:Ie&&A.normalMapType===ts,metalnessMap:Be,roughnessMap:at,anisotropy:Ce,anisotropyMap:de,clearcoat:O,clearcoatMap:Qe,clearcoatNormalMap:Ne,clearcoatRoughnessMap:it,dispersion:I,iridescence:Z,iridescenceMap:ht,iridescenceThicknessMap:Me,sheen:le,sheenColorMap:Re,sheenRoughnessMap:$e,specularMap:G,specularColorMap:se,specularIntensityMap:Pe,transmission:me,transmissionMap:W,thicknessMap:Se,gradientMap:be,opaque:A.transparent===!1&&A.blending===Os&&A.alphaToCoverage===!1,alphaMap:Ve,alphaTest:Te,alphaHash:fe,combine:A.combine,mapUv:De&&x(A.map.channel),aoMapUv:xe&&x(A.aoMap.channel),lightMapUv:_e&&x(A.lightMap.channel),bumpMapUv:ye&&x(A.bumpMap.channel),normalMapUv:Ie&&x(A.normalMap.channel),displacementMapUv:k&&x(A.displacementMap.channel),emissiveMapUv:tt&&x(A.emissiveMap.channel),metalnessMapUv:Be&&x(A.metalnessMap.channel),roughnessMapUv:at&&x(A.roughnessMap.channel),anisotropyMapUv:de&&x(A.anisotropyMap.channel),clearcoatMapUv:Qe&&x(A.clearcoatMap.channel),clearcoatNormalMapUv:Ne&&x(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:it&&x(A.clearcoatRoughnessMap.channel),iridescenceMapUv:ht&&x(A.iridescenceMap.channel),iridescenceThicknessMapUv:Me&&x(A.iridescenceThicknessMap.channel),sheenColorMapUv:Re&&x(A.sheenColorMap.channel),sheenRoughnessMapUv:$e&&x(A.sheenRoughnessMap.channel),specularMapUv:G&&x(A.specularMap.channel),specularColorMapUv:se&&x(A.specularColorMap.channel),specularIntensityMapUv:Pe&&x(A.specularIntensityMap.channel),transmissionMapUv:W&&x(A.transmissionMap.channel),thicknessMapUv:Se&&x(A.thicknessMap.channel),alphaMapUv:Ve&&x(A.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(Ie||Ce),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:V.isPoints===!0&&!!j.attributes.uv&&(De||Ve),fog:!!H,useFog:A.fog===!0,fogExp2:!!H&&H.isFogExp2,flatShading:A.wireframe===!1&&(A.flatShading===!0||j.attributes.normal===void 0&&Ie===!1&&(A.isMeshLambertMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isMeshPhysicalMaterial)),sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:Ee,skinning:V.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:ce,morphTextureStride:ve,numDirLights:R.directional.length,numPointLights:R.point.length,numSpotLights:R.spot.length,numSpotLightMaps:R.spotLightMap.length,numRectAreaLights:R.rectArea.length,numHemiLights:R.hemi.length,numDirLightShadows:R.directionalShadowMap.length,numPointLightShadows:R.pointShadowMap.length,numSpotLightShadows:R.spotShadowMap.length,numSpotLightShadowsWithMaps:R.numSpotLightShadowsWithMaps,numLightProbes:R.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:A.dithering,shadowMapEnabled:r.shadowMap.enabled&&B.length>0,shadowMapType:r.shadowMap.type,toneMapping:ct,decodeVideoTexture:De&&A.map.isVideoTexture===!0&&Dt.getTransfer(A.map.colorSpace)===Vt,decodeVideoTextureEmissive:tt&&A.emissiveMap.isVideoTexture===!0&&Dt.getTransfer(A.emissiveMap.colorSpace)===Vt,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===hn,flipSided:A.side===jn,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:We&&A.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(We&&A.extensions.multiDraw===!0||He)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return Pt.vertexUv1s=u.has(1),Pt.vertexUv2s=u.has(2),Pt.vertexUv3s=u.has(3),u.clear(),Pt}function _(A){const R=[];if(A.shaderID?R.push(A.shaderID):(R.push(A.customVertexShaderID),R.push(A.customFragmentShaderID)),A.defines!==void 0)for(const B in A.defines)R.push(B),R.push(A.defines[B]);return A.isRawShaderMaterial===!1&&(v(R,A),S(R,A),R.push(r.outputColorSpace)),R.push(A.customProgramCacheKey),R.join()}function v(A,R){A.push(R.precision),A.push(R.outputColorSpace),A.push(R.envMapMode),A.push(R.envMapCubeUVHeight),A.push(R.mapUv),A.push(R.alphaMapUv),A.push(R.lightMapUv),A.push(R.aoMapUv),A.push(R.bumpMapUv),A.push(R.normalMapUv),A.push(R.displacementMapUv),A.push(R.emissiveMapUv),A.push(R.metalnessMapUv),A.push(R.roughnessMapUv),A.push(R.anisotropyMapUv),A.push(R.clearcoatMapUv),A.push(R.clearcoatNormalMapUv),A.push(R.clearcoatRoughnessMapUv),A.push(R.iridescenceMapUv),A.push(R.iridescenceThicknessMapUv),A.push(R.sheenColorMapUv),A.push(R.sheenRoughnessMapUv),A.push(R.specularMapUv),A.push(R.specularColorMapUv),A.push(R.specularIntensityMapUv),A.push(R.transmissionMapUv),A.push(R.thicknessMapUv),A.push(R.combine),A.push(R.fogExp2),A.push(R.sizeAttenuation),A.push(R.morphTargetsCount),A.push(R.morphAttributeCount),A.push(R.numDirLights),A.push(R.numPointLights),A.push(R.numSpotLights),A.push(R.numSpotLightMaps),A.push(R.numHemiLights),A.push(R.numRectAreaLights),A.push(R.numDirLightShadows),A.push(R.numPointLightShadows),A.push(R.numSpotLightShadows),A.push(R.numSpotLightShadowsWithMaps),A.push(R.numLightProbes),A.push(R.shadowMapType),A.push(R.toneMapping),A.push(R.numClippingPlanes),A.push(R.numClipIntersection),A.push(R.depthPacking)}function S(A,R){o.disableAll(),R.instancing&&o.enable(0),R.instancingColor&&o.enable(1),R.instancingMorph&&o.enable(2),R.matcap&&o.enable(3),R.envMap&&o.enable(4),R.normalMapObjectSpace&&o.enable(5),R.normalMapTangentSpace&&o.enable(6),R.clearcoat&&o.enable(7),R.iridescence&&o.enable(8),R.alphaTest&&o.enable(9),R.vertexColors&&o.enable(10),R.vertexAlphas&&o.enable(11),R.vertexUv1s&&o.enable(12),R.vertexUv2s&&o.enable(13),R.vertexUv3s&&o.enable(14),R.vertexTangents&&o.enable(15),R.anisotropy&&o.enable(16),R.alphaHash&&o.enable(17),R.batching&&o.enable(18),R.dispersion&&o.enable(19),R.batchingColor&&o.enable(20),R.gradientMap&&o.enable(21),A.push(o.mask),o.disableAll(),R.fog&&o.enable(0),R.useFog&&o.enable(1),R.flatShading&&o.enable(2),R.logarithmicDepthBuffer&&o.enable(3),R.reversedDepthBuffer&&o.enable(4),R.skinning&&o.enable(5),R.morphTargets&&o.enable(6),R.morphNormals&&o.enable(7),R.morphColors&&o.enable(8),R.premultipliedAlpha&&o.enable(9),R.shadowMapEnabled&&o.enable(10),R.doubleSided&&o.enable(11),R.flipSided&&o.enable(12),R.useDepthPacking&&o.enable(13),R.dithering&&o.enable(14),R.transmission&&o.enable(15),R.sheen&&o.enable(16),R.opaque&&o.enable(17),R.pointsUvs&&o.enable(18),R.decodeVideoTexture&&o.enable(19),R.decodeVideoTextureEmissive&&o.enable(20),R.alphaToCoverage&&o.enable(21),A.push(o.mask)}function b(A){const R=g[A.type];let B;if(R){const L=ki[R];B=Gy.clone(L.uniforms)}else B=A.uniforms;return B}function E(A,R){let B=d.get(R);return B!==void 0?++B.usedTimes:(B=new z2(r,R,A,i),h.push(B),d.set(R,B)),B}function P(A){if(--A.usedTimes===0){const R=h.indexOf(A);h[R]=h[h.length-1],h.pop(),d.delete(A.cacheKey),A.destroy()}}function D(A){c.remove(A)}function N(){c.dispose()}return{getParameters:M,getProgramCacheKey:_,getUniforms:b,acquireProgram:E,releaseProgram:P,releaseShaderCache:D,programs:h,dispose:N}}function j2(){let r=new WeakMap;function e(o){return r.has(o)}function t(o){let c=r.get(o);return c===void 0&&(c={},r.set(o,c)),c}function n(o){r.delete(o)}function i(o,c,u){r.get(o)[c]=u}function s(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:s}}function X2(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function jx(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function Xx(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function o(m){let g=0;return m.isInstancedMesh&&(g+=2),m.isSkinnedMesh&&(g+=1),g}function c(m,g,x,M,_,v){let S=r[e];return S===void 0?(S={id:m.id,object:m,geometry:g,material:x,materialVariant:o(m),groupOrder:M,renderOrder:m.renderOrder,z:_,group:v},r[e]=S):(S.id=m.id,S.object=m,S.geometry=g,S.material=x,S.materialVariant=o(m),S.groupOrder=M,S.renderOrder=m.renderOrder,S.z=_,S.group=v),e++,S}function u(m,g,x,M,_,v){const S=c(m,g,x,M,_,v);x.transmission>0?n.push(S):x.transparent===!0?i.push(S):t.push(S)}function h(m,g,x,M,_,v){const S=c(m,g,x,M,_,v);x.transmission>0?n.unshift(S):x.transparent===!0?i.unshift(S):t.unshift(S)}function d(m,g){t.length>1&&t.sort(m||X2),n.length>1&&n.sort(g||jx),i.length>1&&i.sort(g||jx)}function f(){for(let m=e,g=r.length;m<g;m++){const x=r[m];if(x.id===null)break;x.id=null,x.object=null,x.geometry=null,x.material=null,x.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:u,unshift:h,finish:f,sort:d}}function Y2(){let r=new WeakMap;function e(n,i){const s=r.get(n);let o;return s===void 0?(o=new Xx,r.set(n,[o])):i>=s.length?(o=new Xx,s.push(o)):o=s[i],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function q2(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new Ke};break;case"SpotLight":t={position:new F,direction:new F,color:new Ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Ke,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Ke,groundColor:new Ke};break;case"RectAreaLight":t={color:new Ke,position:new F,halfWidth:new F,halfHeight:new F};break}return r[e.id]=t,t}}}function Z2(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ge};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ge};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ge,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let J2=0;function K2(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function Q2(r){const e=new q2,t=Z2(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let h=0;h<9;h++)n.probe.push(new F);const i=new F,s=new yt,o=new yt;function c(h){let d=0,f=0,m=0;for(let R=0;R<9;R++)n.probe[R].set(0,0,0);let g=0,x=0,M=0,_=0,v=0,S=0,b=0,E=0,P=0,D=0,N=0;h.sort(K2);for(let R=0,B=h.length;R<B;R++){const L=h[R],V=L.color,H=L.intensity,j=L.distance;let X=null;if(L.shadow&&L.shadow.map&&(L.shadow.map.texture.format===Vs?X=L.shadow.map.texture:X=L.shadow.map.depthTexture||L.shadow.map.texture),L.isAmbientLight)d+=V.r*H,f+=V.g*H,m+=V.b*H;else if(L.isLightProbe){for(let q=0;q<9;q++)n.probe[q].addScaledVector(L.sh.coefficients[q],H);N++}else if(L.isDirectionalLight){const q=e.get(L);if(q.color.copy(L.color).multiplyScalar(L.intensity),L.castShadow){const Y=L.shadow,J=t.get(L);J.shadowIntensity=Y.intensity,J.shadowBias=Y.bias,J.shadowNormalBias=Y.normalBias,J.shadowRadius=Y.radius,J.shadowMapSize=Y.mapSize,n.directionalShadow[g]=J,n.directionalShadowMap[g]=X,n.directionalShadowMatrix[g]=L.shadow.matrix,S++}n.directional[g]=q,g++}else if(L.isSpotLight){const q=e.get(L);q.position.setFromMatrixPosition(L.matrixWorld),q.color.copy(V).multiplyScalar(H),q.distance=j,q.coneCos=Math.cos(L.angle),q.penumbraCos=Math.cos(L.angle*(1-L.penumbra)),q.decay=L.decay,n.spot[M]=q;const Y=L.shadow;if(L.map&&(n.spotLightMap[P]=L.map,P++,Y.updateMatrices(L),L.castShadow&&D++),n.spotLightMatrix[M]=Y.matrix,L.castShadow){const J=t.get(L);J.shadowIntensity=Y.intensity,J.shadowBias=Y.bias,J.shadowNormalBias=Y.normalBias,J.shadowRadius=Y.radius,J.shadowMapSize=Y.mapSize,n.spotShadow[M]=J,n.spotShadowMap[M]=X,E++}M++}else if(L.isRectAreaLight){const q=e.get(L);q.color.copy(V).multiplyScalar(H),q.halfWidth.set(L.width*.5,0,0),q.halfHeight.set(0,L.height*.5,0),n.rectArea[_]=q,_++}else if(L.isPointLight){const q=e.get(L);if(q.color.copy(L.color).multiplyScalar(L.intensity),q.distance=L.distance,q.decay=L.decay,L.castShadow){const Y=L.shadow,J=t.get(L);J.shadowIntensity=Y.intensity,J.shadowBias=Y.bias,J.shadowNormalBias=Y.normalBias,J.shadowRadius=Y.radiu
vendor: 2,448 bytes, line 3998
3998s,J.shadowMapSize=Y.mapSize,J.shadowCameraNear=Y.camera.near,J.shadowCameraFar=Y.camera.far,n.pointShadow[x]=J,n.pointShadowMap[x]=X,n.pointShadowMatrix[x]=L.shadow.matrix,b++}n.point[x]=q,x++}else if(L.isHemisphereLight){const q=e.get(L);q.skyColor.copy(L.color).multiplyScalar(H),q.groundColor.copy(L.groundColor).multiplyScalar(H),n.hemi[v]=q,v++}}_>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ge.LTC_FLOAT_1,n.rectAreaLTC2=Ge.LTC_FLOAT_2):(n.rectAreaLTC1=Ge.LTC_HALF_1,n.rectAreaLTC2=Ge.LTC_HALF_2)),n.ambient[0]=d,n.ambient[1]=f,n.ambient[2]=m;const A=n.hash;(A.directionalLength!==g||A.pointLength!==x||A.spotLength!==M||A.rectAreaLength!==_||A.hemiLength!==v||A.numDirectionalShadows!==S||A.numPointShadows!==b||A.numSpotShadows!==E||A.numSpotMaps!==P||A.numLightProbes!==N)&&(n.directional.length=g,n.spot.length=M,n.rectArea.length=_,n.point.length=x,n.hemi.length=v,n.directionalShadow.length=S,n.directionalShadowMap.length=S,n.pointShadow.length=b,n.pointShadowMap.length=b,n.spotShadow.length=E,n.spotShadowMap.length=E,n.directionalShadowMatrix.length=S,n.pointShadowMatrix.length=b,n.spotLightMatrix.length=E+P-D,n.spotLightMap.length=P,n.numSpotLightShadowsWithMaps=D,n.numLightProbes=N,A.directionalLength=g,A.pointLength=x,A.spotLength=M,A.rectAreaLength=_,A.hemiLength=v,A.numDirectionalShadows=S,A.numPointShadows=b,A.numSpotShadows=E,A.numSpotMaps=P,A.numLightProbes=N,n.version=J2++)}function u(h,d){let f=0,m=0,g=0,x=0,M=0;const _=d.matrixWorldInverse;for(let v=0,S=h.length;v<S;v++){const b=h[v];if(b.isDirectionalLight){const E=n.directional[f];E.direction.setFromMatrixPosition(b.matrixWorld),i.setFromMatrixPosition(b.target.matrixWorld),E.direction.sub(i),E.direction.transformDirection(_),f++}else if(b.isSpotLight){const E=n.spot[g];E.position.setFromMatrixPosition(b.matrixWorld),E.position.applyMatrix4(_),E.direction.setFromMatrixPosition(b.matrixWorld),i.setFromMatrixPosition(b.target.matrixWorld),E.direction.sub(i),E.direction.transformDirection(_),g++}else if(b.isRectAreaLight){const E=n.rectArea[x];E.position.setFromMatrixPosition(b.matrixWorld),E.position.applyMatrix4(_),o.identity(),s.copy(b.matrixWorld),s.premultiply(_),o.extractRotation(s),E.halfWidth.set(b.width*.5,0,0),E.halfHeight.set(0,b.height*.5,0),E.halfWidth.applyMatrix4(o),E.halfHeight.applyMatrix4(o),x++}else if(b.isPointLight){const E=n.point[m];E.position.setFromMatrixPosition(b.matrixWorld),E.position.applyMatrix4(_),m
vendor: 4,770 bytes, lines 3998-4025
3998++}else if(b.isHemisphereLight){const E=n.hemi[M];E.direction.setFromMatrixPosition(b.matrixWorld),E.direction.transformDirection(_),M++}}}return{setup:c,setupView:u,state:n}}function Yx(r){const e=new Q2(r),t=[],n=[];function i(d){h.camera=d,t.length=0,n.length=0}function s(d){t.push(d)}function o(d){n.push(d)}function c(){e.setup(t)}function u(d){e.setupView(t,d)}const h={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:h,setupLights:c,setupLightsView:u,pushLight:s,pushShadow:o}}function $2(r){let e=new WeakMap;function t(i,s=0){const o=e.get(i);let c;return o===void 0?(c=new Yx(r),e.set(i,[c])):s>=o.length?(c=new Yx(r),o.push(c)):c=o[s],c}function n(){e=new WeakMap}return{get:t,dispose:n}}const eR=`void main() {
3999	gl_Position = vec4( position, 1.0 );
4000}`,tR=`uniform sampler2D shadow_pass;
4001uniform vec2 resolution;
4002uniform float radius;
4003void main() {
4004	const float samples = float( VSM_SAMPLES );
4005	float mean = 0.0;
4006	float squared_mean = 0.0;
4007	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
4008	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
4009	for ( float i = 0.0; i < samples; i ++ ) {
4010		float uvOffset = uvStart + i * uvStride;
4011		#ifdef HORIZONTAL_PASS
4012			vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
4013			mean += distribution.x;
4014			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
4015		#else
4016			float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
4017			mean += depth;
4018			squared_mean += depth * depth;
4019		#endif
4020	}
4021	mean = mean / samples;
4022	squared_mean = squared_mean / samples;
4023	float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4024	gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4025}`,nR=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],iR=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],qx=new yt,za=new F,rp=new F;function rR(r,e,t){let n=new na;const i=new ge,s=new ge,o=new jt,c=new wm,u=new Em,h={},d=t.maxTextureSize,f={[Cr]:jn,[jn]:Cr,[hn]:hn},m=new Ii({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ge},radius:{value:4}},vertexShader:eR,fragmentShader:tR}),g=m.clone();g.defines.HORIZONTAL_PASS=1;const x=new xt;x.setAttribute("position",new Ht(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const M=new dn(x,m),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=jo;let v=this.type;this.render=function(D,N,A){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||D.length===0)return;this.type===qa&&(ke("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=jo);const R=r.getRenderTarget(),B=r.getActiveCubeFace(),L=r.getActiveMipmapLevel(),V=r.state;V.setBlending(sr),V.buffers.depth.getReversed()===!0?V.buffers.color.setClear(0,0,0,0):V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);const H=v!==this.type;H&&N.traverse(function(j){j.material&&(Array.isArray(j.material)?j.material.forEach(X=>X.needsUpdate=!0):j.material.needsUpdate=!0)});for(let j=0,X=D.length;j<X;j++){const q=D[j],Y=q.shadow;if(Y===void 0){ke("WebGLShadowMap:",q,"has no shadow.");continue}if(Y.autoUpdate===!1&&Y.needsUpdate===!1)continue;i.copy(Y.mapSize);const J=Y.getFrameExtents();i.multiply(J),s.copy(Y.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(s.x=Math.floor(d/J.x),i.x=s.x*J.x,Y.mapSize.x=s.x),i.y>d&&(s.y=Math.floor(d/J.y),i.y=s.y*J.y,Y.mapSize.y=s.y));const te=r.state.buffers.depth.getReversed();if(Y.camera._reversedDepth=te,Y.map===null||H===!0){if(Y.map!==null&&(Y.map.depthTexture!==null&&(Y.map.depthTexture.dispose(),Y.map.depthTexture=null),Y.map.dispose()),this.type===Ls){if(q.isPointLight){ke("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}Y.map=new ni(i.x,i.y,{format:Vs,type:Hi,minFilter:Xt,magFilter:Xt,generateMipmaps:!1}),Y.map.texture.name=q.name+".shadowMap",Y.map.depthTexture=new js(i.x,i.y,Un),Y.map.depthTexture.name=q.name+".shadowMapDepth",Y.map.depthTexture.format=ar,Y.map.depthTexture.compareFunction=null,Y.map.depthTexture.minFilter=an,Y.map.depthTexture.magFilter=an}else q.isPointLight?(Y.map=new Fm(i.x),Y.map.depthTexture=new Cy(i.x,Ri)):(Y.map=new ni(i.x,i.y),Y.map.depthTexture=new js(i.x,i.y,Ri)),Y.map.depthTexture.name=q.name+".shadowMap",Y.map.depthTexture.format=ar,this.type===jo?(Y.map.depthTexture.compareFunction=te?Lh:Ph,Y.map.depthTexture.minFilter=Xt,Y.map.depthTexture.magFilter=Xt):(Y.map.depthTexture.compareFunction=null,Y.map.depthTexture.minFilter=an,Y.map.depthTexture.magFilter=an);Y.camera.updateProjectionMatrix()}
vendor: 103,124 bytes, lines 4025-4049
4025const oe=Y.map.isWebGLCubeRenderTarget?6:1;for(let ce=0;ce<oe;ce++){if(Y.map.isWebGLCubeRenderTarget)r.setRenderTarget(Y.map,ce),r.clear();else{ce===0&&(r.setRenderTarget(Y.map),r.clear());const ve=Y.getViewport(ce);o.set(s.x*ve.x,s.y*ve.y,s.x*ve.z,s.y*ve.w),V.viewport(o)}if(q.isPointLight){const ve=Y.camera,Ae=Y.matrix,dt=q.distance||ve.far;dt!==ve.far&&(ve.far=dt,ve.updateProjectionMatrix()),za.setFromMatrixPosition(q.matrixWorld),ve.position.copy(za),rp.copy(ve.position),rp.add(nR[ce]),ve.up.copy(iR[ce]),ve.lookAt(rp),ve.updateMatrixWorld(),Ae.makeTranslation(-za.x,-za.y,-za.z),qx.multiplyMatrices(ve.projectionMatrix,ve.matrixWorldInverse),Y._frustum.setFromProjectionMatrix(qx,ve.coordinateSystem,ve.reversedDepth)}else Y.updateMatrices(q);n=Y.getFrustum(),E(N,A,Y.camera,q,this.type)}Y.isPointLightShadow!==!0&&this.type===Ls&&S(Y,A),Y.needsUpdate=!1}v=this.type,_.needsUpdate=!1,r.setRenderTarget(R,B,L)};function S(D,N){const A=e.update(M);m.defines.VSM_SAMPLES!==D.blurSamples&&(m.defines.VSM_SAMPLES=D.blurSamples,g.defines.VSM_SAMPLES=D.blurSamples,m.needsUpdate=!0,g.needsUpdate=!0),D.mapPass===null&&(D.mapPass=new ni(i.x,i.y,{format:Vs,type:Hi})),m.uniforms.shadow_pass.value=D.map.depthTexture,m.uniforms.resolution.value=D.mapSize,m.uniforms.radius.value=D.radius,r.setRenderTarget(D.mapPass),r.clear(),r.renderBufferDirect(N,null,A,m,M,null),g.uniforms.shadow_pass.value=D.mapPass.texture,g.uniforms.resolution.value=D.mapSize,g.uniforms.radius.value=D.radius,r.setRenderTarget(D.map),r.clear(),r.renderBufferDirect(N,null,A,g,M,null)}function b(D,N,A,R){let B=null;const L=A.isPointLight===!0?D.customDistanceMaterial:D.customDepthMaterial;if(L!==void 0)B=L;else if(B=A.isPointLight===!0?u:c,r.localClippingEnabled&&N.clipShadows===!0&&Array.isArray(N.clippingPlanes)&&N.clippingPlanes.length!==0||N.displacementMap&&N.displacementScale!==0||N.alphaMap&&N.alphaTest>0||N.map&&N.alphaTest>0||N.alphaToCoverage===!0){const V=B.uuid,H=N.uuid;let j=h[V];j===void 0&&(j={},h[V]=j);let X=j[H];X===void 0&&(X=B.clone(),j[H]=X,N.addEventListener("dispose",P)),B=X}if(B.visible=N.visible,B.wireframe=N.wireframe,R===Ls?B.side=N.shadowSide!==null?N.shadowSide:N.side:B.side=N.shadowSide!==null?N.shadowSide:f[N.side],B.alphaMap=N.alphaMap,B.alphaTest=N.alphaToCoverage===!0?.5:N.alphaTest,B.map=N.map,B.clipShadows=N.clipShadows,B.clippingPlanes=N.clippingPlanes,B.clipIntersection=N.clipIntersection,B.displacementMap=N.displacementMap,B.displacementScale=N.displacementScale,B.displacementBias=N.displacementBias,B.wireframeLinewidth=N.wireframeLinewidth,B.linewidth=N.linewidth,A.isPointLight===!0&&B.isMeshDistanceMaterial===!0){const V=r.properties.get(B);V.light=A}return B}function E(D,N,A,R,B){if(D.visible===!1)return;if(D.layers.test(N.layers)&&(D.isMesh||D.isLine||D.isPoints)&&(D.castShadow||D.receiveShadow&&B===Ls)&&(!D.frustumCulled||n.intersectsObject(D))){D.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,D.matrixWorld);const H=e.update(D),j=D.material;if(Array.isArray(j)){const X=H.groups;for(let q=0,Y=X.length;q<Y;q++){const J=X[q],te=j[J.materialIndex];if(te&&te.visible){const oe=b(D,te,R,B);D.onBeforeShadow(r,D,N,A,H,oe,J),r.renderBufferDirect(A,null,H,oe,D,J),D.onAfterShadow(r,D,N,A,H,oe,J)}}}else if(j.visible){const X=b(D,j,R,B);D.onBeforeShadow(r,D,N,A,H,X,null),r.renderBufferDirect(A,null,H,X,D,null),D.onAfterShadow(r,D,N,A,H,X,null)}}const V=D.children;for(let H=0,j=V.length;H<j;H++)E(V[H],N,A,R,B)}function P(D){D.target.removeEventListener("dispose",P);for(const A in h){const R=h[A],B=D.target.uuid;B in R&&(R[B].dispose(),delete R[B])}}}function sR(r,e){function t(){let W=!1;const Se=new jt;let be=null;const Ve=new jt(0,0,0,0);return{setMask:function(Te){be!==Te&&!W&&(r.colorMask(Te,Te,Te,Te),be=Te)},setLocked:function(Te){W=Te},setClear:function(Te,fe,We,ct,Pt){Pt===!0&&(Te*=ct,fe*=ct,We*=ct),Se.set(Te,fe,We,ct),Ve.equals(Se)===!1&&(r.clearColor(Te,fe,We,ct),Ve.copy(Se))},reset:function(){W=!1,be=null,Ve.set(-1,0,0,0)}}}function n(){let W=!1,Se=!1,be=null,Ve=null,Te=null;return{setReversed:function(fe){if(Se!==fe){const We=e.get("EXT_clip_control");fe?We.clipControlEXT(We.LOWER_LEFT_EXT,We.ZERO_TO_ONE_EXT):We.clipControlEXT(We.LOWER_LEFT_EXT,We.NEGATIVE_ONE_TO_ONE_EXT),Se=fe;const ct=Te;Te=null,this.setClear(ct)}},getReversed:function(){return Se},setTest:function(fe){fe?we(r.DEPTH_TEST):Ee(r.DEPTH_TEST)},setMask:function(fe){be!==fe&&!W&&(r.depthMask(fe),be=fe)},setFunc:function(fe){if(Se&&(fe=A1[fe]),Ve!==fe){switch(fe){case Iu:r.depthFunc(r.NEVER);break;case Pu:r.depthFunc(r.ALWAYS);break;case Lu:r.depthFunc(r.LESS);break;case zs:r.depthFunc(r.LEQUAL);break;case Du:r.depthFunc(r.EQUAL);break;case Nu:r.depthFunc(r.GEQUAL);break;case Uu:r.depthFunc(r.GREATER);break;case Ou:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}Ve=fe}},setLocked:function(fe){W=fe},setClear:function(fe){Te!==fe&&(Te=fe,Se&&(fe=1-fe),r.clearDepth(fe))},reset:function(){W=!1,be=null,Ve=null,Te=null,Se=!1}}}function i(){let W=!1,Se=null,be=null,Ve=null,Te=null,fe=null,We=null,ct=null,Pt=null;return{setTest:function(Ct){W||(Ct?we(r.STENCIL_TEST):Ee(r.STENCIL_TEST))},setMask:function(Ct){Se!==Ct&&!W&&(r.stencilMask(Ct),Se=Ct)},setFunc:function(Ct,xn,Tn){(be!==Ct||Ve!==xn||Te!==Tn)&&(r.stencilFunc(Ct,xn,Tn),be=Ct,Ve=xn,Te=Tn)},setOp:function(Ct,xn,Tn){(fe!==Ct||We!==xn||ct!==Tn)&&(r.stencilOp(Ct,xn,Tn),fe=Ct,We=xn,ct=Tn)},setLocked:function(Ct){W=Ct},setClear:function(Ct){Pt!==Ct&&(r.clearStencil(Ct),Pt=Ct)},reset:function(){W=!1,Se=null,be=null,Ve=null,Te=null,fe=null,We=null,ct=null,Pt=null}}}const s=new t,o=new n,c=new i,u=new WeakMap,h=new WeakMap;let d={},f={},m=new WeakMap,g=[],x=null,M=!1,_=null,v=null,S=null,b=null,E=null,P=null,D=null,N=new Ke(0,0,0),A=0,R=!1,B=null,L=null,V=null,H=null,j=null;const X=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let q=!1,Y=0;const J=r.getParameter(r.VERSION);J.indexOf("WebGL")!==-1?(Y=parseFloat(/^WebGL (\d)/.exec(J)[1]),q=Y>=1):J.indexOf("OpenGL ES")!==-1&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(J)[1]),q=Y>=2);let te=null,oe={};const ce=r.getParameter(r.SCISSOR_BOX),ve=r.getParameter(r.VIEWPORT),Ae=new jt().fromArray(ce),dt=new jt().fromArray(ve);function vt(W,Se,be,Ve){const Te=new Uint8Array(4),fe=r.createTexture();r.bindTexture(W,fe),r.texParameteri(W,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(W,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let We=0;We<be;We++)W===r.TEXTURE_3D||W===r.TEXTURE_2D_ARRAY?r.texImage3D(Se,0,r.RGBA,1,1,Ve,0,r.RGBA,r.UNSIGNED_BYTE,Te):r.texImage2D(Se+We,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,Te);return fe}const he={};he[r.TEXTURE_2D]=vt(r.TEXTURE_2D,r.TEXTURE_2D,1),he[r.TEXTURE_CUBE_MAP]=vt(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),he[r.TEXTURE_2D_ARRAY]=vt(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),he[r.TEXTURE_3D]=vt(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),c.setClear(0),we(r.DEPTH_TEST),o.setFunc(zs),ye(!1),Ie(wp),we(r.CULL_FACE),xe(sr);function we(W){d[W]!==!0&&(r.enable(W),d[W]=!0)}function Ee(W){d[W]!==!1&&(r.disable(W),d[W]=!1)}function rt(W,Se){return f[W]!==Se?(r.bindFramebuffer(W,Se),f[W]=Se,W===r.DRAW_FRAMEBUFFER&&(f[r.FRAMEBUFFER]=Se),W===r.FRAMEBUFFER&&(f[r.DRAW_FRAMEBUFFER]=Se),!0):!1}function He(W,Se){let be=g,Ve=!1;if(W){be=m.get(Se),be===void 0&&(be=[],m.set(Se,be));const Te=W.textures;if(be.length!==Te.length||be[0]!==r.COLOR_ATTACHMENT0){for(let fe=0,We=Te.length;fe<We;fe++)be[fe]=r.COLOR_ATTACHMENT0+fe;be.length=Te.length,Ve=!0}}else be[0]!==r.BACK&&(be[0]=r.BACK,Ve=!0);Ve&&r.drawBuffers(be)}function De(W){return x!==W?(r.useProgram(W),x=W,!0):!1}const _t={[qr]:r.FUNC_ADD,[Fv]:r.FUNC_SUBTRACT,[Bv]:r.FUNC_REVERSE_SUBTRACT};_t[kv]=r.MIN,_t[zv]=r.MAX;const Je={[Vv]:r.ZERO,[Gv]:r.ONE,[Hv]:r.SRC_COLOR,[Cu]:r.SRC_ALPHA,[Zv]:r.SRC_ALPHA_SATURATE,[Yv]:r.DST_COLOR,[jv]:r.DST_ALPHA,[Wv]:r.ONE_MINUS_SRC_COLOR,[Ru]:r.ONE_MINUS_SRC_ALPHA,[qv]:r.ONE_MINUS_DST_COLOR,[Xv]:r.ONE_MINUS_DST_ALPHA,[Jv]:r.CONSTANT_COLOR,[Kv]:r.ONE_MINUS_CONSTANT_COLOR,[Qv]:r.CONSTANT_ALPHA,[$v]:r.ONE_MINUS_CONSTANT_ALPHA};function xe(W,Se,be,Ve,Te,fe,We,ct,Pt,Ct){if(W===sr){M===!0&&(Ee(r.BLEND),M=!1);return}if(M===!1&&(we(r.BLEND),M=!0),W!==Ov){if(W!==_||Ct!==R){if((v!==qr||E!==qr)&&(r.blendEquation(r.FUNC_ADD),v=qr,E=qr),Ct)switch(W){case Os:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Ep:r.blendFunc(r.ONE,r.ONE);break;case Tp:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Ap:r.blendFuncSeparate(r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE);break;default:ot("WebGLState: Invalid blending: ",W);break}else switch(W){case Os:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Ep:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case Tp:ot("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Ap:ot("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ot("WebGLState: Invalid blending: ",W);break}S=null,b=null,P=null,D=null,N.set(0,0,0),A=0,_=W,R=Ct}return}Te=Te||Se,fe=fe||be,We=We||Ve,(Se!==v||Te!==E)&&(r.blendEquationSeparate(_t[Se],_t[Te]),v=Se,E=Te),(be!==S||Ve!==b||fe!==P||We!==D)&&(r.blendFuncSeparate(Je[be],Je[Ve],Je[fe],Je[We]),S=be,b=Ve,P=fe,D=We),(ct.equals(N)===!1||Pt!==A)&&(r.blendColor(ct.r,ct.g,ct.b,Pt),N.copy(ct),A=Pt),_=W,R=!1}function _e(W,Se){W.side===hn?Ee(r.CULL_FACE):we(r.CULL_FACE);let be=W.side===jn;Se&&(be=!be),ye(be),W.blending===Os&&W.transparent===!1?xe(sr):xe(W.blending,W.blendEquation,W.blendSrc,W.blendDst,W.blendEquationAlpha,W.blendSrcAlpha,W.blendDstAlpha,W.blendColor,W.blendAlpha,W.premultipliedAlpha),o.setFunc(W.depthFunc),o.setTest(W.depthTest),o.setMask(W.depthWrite),s.setMask(W.colorWrite);const Ve=W.stencilWrite;c.setTest(Ve),Ve&&(c.setMask(W.stencilWriteMask),c.setFunc(W.stencilFunc,W.stencilRef,W.stencilFuncMask),c.setOp(W.stencilFail,W.stencilZFail,W.stencilZPass)),tt(W.polygonOffset,W.polygonOffsetFactor,W.polygonOffsetUnits),W.alphaToCoverage===!0?we(r.SAMPLE_ALPHA_TO_COVERAGE):Ee(r.SAMPLE_ALPHA_TO_COVERAGE)}function ye(W){B!==W&&(W?r.frontFace(r.CW):r.frontFace(r.CCW),B=W)}function Ie(W){W!==Dv?(we(r.CULL_FACE),W!==L&&(W===wp?r.cullFace(r.BACK):W===Nv?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Ee(r.CULL_FACE),L=W}function k(W){W!==V&&(q&&r.lineWidth(W),V=W)}function tt(W,Se,be){W?(we(r.POLYGON_OFFSET_FILL),(H!==Se||j!==be)&&(H=Se,j=be,o.getReversed()&&(Se=-Se),r.polygonOffset(Se,be))):Ee(r.POLYGON_OFFSET_FILL)}function Be(W){W?we(r.SCISSOR_TEST):Ee(r.SCISSOR_TEST)}function at(W){W===void 0&&(W=r.TEXTURE0+X-1),te!==W&&(r.activeTexture(W),te=W)}function Ce(W,Se,be){be===void 0&&(te===null?be=r.TEXTURE0+X-1:be=te);let Ve=oe[be];Ve===void 0&&(Ve={type:void 0,texture:void 0},oe[be]=Ve),(Ve.type!==W||Ve.texture!==Se)&&(te!==be&&(r.activeTexture(be),te=be),r.bindTexture(W,Se||he[W]),Ve.type=W,Ve.texture=Se)}function O(){const W=oe[te];W!==void 0&&W.type!==void 0&&(r.bindTexture(W.type,null),W.type=void 0,W.texture=void 0)}function I(){try{r.compressedTexImage2D(...arguments)}catch(W){ot("WebGLState:",W)}}function Z(){try{r.compressedTexImage3D(...arguments)}catch(W){ot("WebGLState:",W)}}function le(){try{r.texSubImage2D(...arguments)}catch(W){ot("WebGLState:",W)}}function me(){try{r.texSubImage3D(...arguments)}catch(W){ot("WebGLState:",W)}}function de(){try{r.compressedTexSubImage2D(...arguments)}catch(W){ot("WebGLState:",W)}}function Qe(){try{r.compressedTexSubImage3D(...arguments)}catch(W){ot("WebGLState:",W)}}function Ne(){try{r.texStorage2D(...arguments)}catch(W){ot("WebGLState:",W)}}function it(){try{r.texStorage3D(...arguments)}catch(W){ot("WebGLState:",W)}}function ht(){try{r.texImage2D(...arguments)}catch(W){ot("WebGLState:",W)}}function Me(){try{r.texImage3D(...arguments)}catch(W){ot("WebGLState:",W)}}function Re(W){Ae.equals(W)===!1&&(r.scissor(W.x,W.y,W.z,W.w),Ae.copy(W))}function $e(W){dt.equals(W)===!1&&(r.viewport(W.x,W.y,W.z,W.w),dt.copy(W))}function G(W,Se){let be=h.get(Se);be===void 0&&(be=new WeakMap,h.set(Se,be));let Ve=be.get(W);Ve===void 0&&(Ve=r.getUniformBlockIndex(Se,W.name),be.set(W,Ve))}function se(W,Se){const Ve=h.get(Se).get(W);u.get(Se)!==Ve&&(r.uniformBlockBinding(Se,Ve,W.__bindingPointIndex),u.set(Se,Ve))}function Pe(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),o.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),d={},te=null,oe={},f={},m=new WeakMap,g=[],x=null,M=!1,_=null,v=null,S=null,b=null,E=null,P=null,D=null,N=new Ke(0,0,0),A=0,R=!1,B=null,L=null,V=null,H=null,j=null,Ae.set(0,0,r.canvas.width,r.canvas.height),dt.set(0,0,r.canvas.width,r.canvas.height),s.reset(),o.reset(),c.reset()}return{buffers:{color:s,depth:o,stencil:c},enable:we,disable:Ee,bindFramebuffer:rt,drawBuffers:He,useProgram:De,setBlending:xe,setMaterial:_e,setFlipSided:ye,setCullFace:Ie,setLineWidth:k,setPolygonOffset:tt,setScissorTest:Be,activeTexture:at,bindTexture:Ce,unbindTexture:O,compressedTexImage2D:I,compressedTexImage3D:Z,texImage2D:ht,texImage3D:Me,updateUBOMapping:G,uniformBlockBinding:se,texStorage2D:Ne,texStorage3D:it,texSubImage2D:le,texSubImage3D:me,compressedTexSubImage2D:de,compressedTexSubImage3D:Qe,scissor:Re,viewport:$e,reset:Pe}}function oR(r,e,t,n,i,s,o){const c=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,u=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new ge,d=new WeakMap;let f;const m=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(O,I){return g?new OffscreenCanvas(O,I):dl("canvas")}function M(O,I,Z){let le=1;const me=Ce(O);if((me.width>Z||me.height>Z)&&(le=Z/Math.max(me.width,me.height)),le<1)if(typeof HTMLImageElement<"u"&&O instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&O instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&O instanceof ImageBitmap||typeof VideoFrame<"u"&&O instanceof VideoFrame){const de=Math.floor(le*me.width),Qe=Math.floor(le*me.height);f===void 0&&(f=x(de,Qe));const Ne=I?x(de,Qe):f;return Ne.width=de,Ne.height=Qe,Ne.getContext("2d").drawImage(O,0,0,de,Qe),ke("WebGLRenderer: Texture has been resized from ("+me.width+"x"+me.height+") to ("+de+"x"+Qe+")."),Ne}else return"data"in O&&ke("WebGLRenderer: Image in DataTexture is too big ("+me.width+"x"+me.height+")."),O;return O}function _(O){return O.generateMipmaps}function v(O){r.generateMipmap(O)}function S(O){return O.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:O.isWebGL3DRenderTarget?r.TEXTURE_3D:O.isWebGLArrayRenderTarget||O.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function b(O,I,Z,le,me=!1){if(O!==null){if(r[O]!==void 0)return r[O];ke("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+O+"'")}let de=I;if(I===r.RED&&(Z===r.FLOAT&&(de=r.R32F),Z===r.HALF_FLOAT&&(de=r.R16F),Z===r.UNSIGNED_BYTE&&(de=r.R8)),I===r.RED_INTEGER&&(Z===r.UNSIGNED_BYTE&&(de=r.R8UI),Z===r.UNSIGNED_SHORT&&(de=r.R16UI),Z===r.UNSIGNED_INT&&(de=r.R32UI),Z===r.BYTE&&(de=r.R8I),Z===r.SHORT&&(de=r.R16I),Z===r.INT&&(de=r.R32I)),I===r.RG&&(Z===r.FLOAT&&(de=r.RG32F),Z===r.HALF_FLOAT&&(de=r.RG16F),Z===r.UNSIGNED_BYTE&&(de=r.RG8)),I===r.RG_INTEGER&&(Z===r.UNSIGNED_BYTE&&(de=r.RG8UI),Z===r.UNSIGNED_SHORT&&(de=r.RG16UI),Z===r.UNSIGNED_INT&&(de=r.RG32UI),Z===r.BYTE&&(de=r.RG8I),Z===r.SHORT&&(de=r.RG16I),Z===r.INT&&(de=r.RG32I)),I===r.RGB_INTEGER&&(Z===r.UNSIGNED_BYTE&&(de=r.RGB8UI),Z===r.UNSIGNED_SHORT&&(de=r.RGB16UI),Z===r.UNSIGNED_INT&&(de=r.RGB32UI),Z===r.BYTE&&(de=r.RGB8I),Z===r.SHORT&&(de=r.RGB16I),Z===r.INT&&(de=r.RGB32I)),I===r.RGBA_INTEGER&&(Z===r.UNSIGNED_BYTE&&(de=r.RGBA8UI),Z===r.UNSIGNED_SHORT&&(de=r.RGBA16UI),Z===r.UNSIGNED_INT&&(de=r.RGBA32UI),Z===r.BYTE&&(de=r.RGBA8I),Z===r.SHORT&&(de=r.RGBA16I),Z===r.INT&&(de=r.RGBA32I)),I===r.RGB&&(Z===r.UNSIGNED_INT_5_9_9_9_REV&&(de=r.RGB9_E5),Z===r.UNSIGNED_INT_10F_11F_11F_REV&&(de=r.R11F_G11F_B10F)),I===r.RGBA){const Qe=me?ul:Dt.getTransfer(le);Z===r.FLOAT&&(de=r.RGBA32F),Z===r.HALF_FLOAT&&(de=r.RGBA16F),Z===r.UNSIGNED_BYTE&&(de=Qe===Vt?r.SRGB8_ALPHA8:r.RGBA8),Z===r.UNSIGNED_SHORT_4_4_4_4&&(de=r.RGBA4),Z===r.UNSIGNED_SHORT_5_5_5_1&&(de=r.RGB5_A1)}return(de===r.R16F||de===r.R32F||de===r.RG16F||de===r.RG32F||de===r.RGBA16F||de===r.RGBA32F)&&e.get("EXT_color_buffer_float"),de}function E(O,I){let Z;return O?I===null||I===Ri||I===Zo?Z=r.DEPTH24_STENCIL8:I===Un?Z=r.DEPTH32F_STENCIL8:I===qo&&(Z=r.DEPTH24_STENCIL8,ke("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):I===null||I===Ri||I===Zo?Z=r.DEPTH_COMPONENT24:I===Un?Z=r.DEPTH_COMPONENT32F:I===qo&&(Z=r.DEPTH_COMPONENT16),Z}function P(O,I){return _(O)===!0||O.isFramebufferTexture&&O.minFilter!==an&&O.minFilter!==Xt?Math.log2(Math.max(I.width,I.height))+1:O.mipmaps!==void 0&&O.mipmaps.length>0?O.mipmaps.length:O.isCompressedTexture&&Array.isArray(O.image)?I.mipmaps.length:1}function D(O){const I=O.target;I.removeEventListener("dispose",D),A(I),I.isVideoTexture&&d.delete(I)}function N(O){const I=O.target;I.removeEventListener("dispose",N),B(I)}function A(O){const I=n.get(O);if(I.__webglInit===void 0)return;const Z=O.source,le=m.get(Z);if(le){const me=le[I.__cacheKey];me.usedTimes--,me.usedTimes===0&&R(O),Object.keys(le).length===0&&m.delete(Z)}n.remove(O)}function R(O){const I=n.get(O);r.deleteTexture(I.__webglTexture);const Z=O.source,le=m.get(Z);delete le[I.__cacheKey],o.memory.textures--}function B(O){const I=n.get(O);if(O.depthTexture&&(O.depthTexture.dispose(),n.remove(O.depthTexture)),O.isWebGLCubeRenderTarget)for(let le=0;le<6;le++){if(Array.isArray(I.__webglFramebuffer[le]))for(let me=0;me<I.__webglFramebuffer[le].length;me++)r.deleteFramebuffer(I.__webglFramebuffer[le][me]);else r.deleteFramebuffer(I.__webglFramebuffer[le]);I.__webglDepthbuffer&&r.deleteRenderbuffer(I.__webglDepthbuffer[le])}else{if(Array.isArray(I.__webglFramebuffer))for(let le=0;le<I.__webglFramebuffer.length;le++)r.deleteFramebuffer(I.__webglFramebuffer[le]);else r.deleteFramebuffer(I.__webglFramebuffer);if(I.__webglDepthbuffer&&r.deleteRenderbuffer(I.__webglDepthbuffer),I.__webglMultisampledFramebuffer&&r.deleteFramebuffer(I.__webglMultisampledFramebuffer),I.__webglColorRenderbuffer)for(let le=0;le<I.__webglColorRenderbuffer.length;le++)I.__webglColorRenderbuffer[le]&&r.deleteRenderbuffer(I.__webglColorRenderbuffer[le]);I.__webglDepthRenderbuffer&&r.deleteRenderbuffer(I.__webglDepthRenderbuffer)}const Z=O.textures;for(let le=0,me=Z.length;le<me;le++){const de=n.get(Z[le]);de.__webglTexture&&(r.deleteTexture(de.__webglTexture),o.memory.textures--),n.remove(Z[le])}n.remove(O)}let L=0;function V(){L=0}function H(){const O=L;return O>=i.maxTextures&&ke("WebGLTextures: Trying to use "+O+" texture units while this GPU supports only "+i.maxTextures),L+=1,O}function j(O){const I=[];return I.push(O.wrapS),I.push(O.wrapT),I.push(O.wrapR||0),I.push(O.magFilter),I.push(O.minFilter),I.push(O.anisotropy),I.push(O.internalFormat),I.push(O.format),I.push(O.type),I.push(O.generateMipmaps),I.push(O.premultiplyAlpha),I.push(O.flipY),I.push(O.unpackAlignment),I.push(O.colorSpace),I.join()}function X(O,I){const Z=n.get(O);if(O.isVideoTexture&&Be(O),O.isRenderTargetTexture===!1&&O.isExternalTexture!==!0&&O.version>0&&Z.__version!==O.version){const le=O.image;if(le===null)ke("WebGLRenderer: Texture marked for update but no image data found.");else if(le.complete===!1)ke("WebGLRenderer: Texture marked for update but image is incomplete");else{he(Z,O,I);return}}else O.isExternalTexture&&(Z.__webglTexture=O.sourceTexture?O.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,Z.__webglTexture,r.TEXTURE0+I)}function q(O,I){const Z=n.get(O);if(O.isRenderTargetTexture===!1&&O.version>0&&Z.__version!==O.version){he(Z,O,I);return}else O.isExternalTexture&&(Z.__webglTexture=O.sourceTexture?O.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,Z.__webglTexture,r.TEXTURE0+I)}function Y(O,I){const Z=n.get(O);if(O.isRenderTargetTexture===!1&&O.version>0&&Z.__version!==O.version){he(Z,O,I);return}t.bindTexture(r.TEXTURE_3D,Z.__webglTexture,r.TEXTURE0+I)}function J(O,I){const Z=n.get(O);if(O.isCubeDepthTexture!==!0&&O.version>0&&Z.__version!==O.version){we(Z,O,I);return}t.bindTexture(r.TEXTURE_CUBE_MAP,Z.__webglTexture,r.TEXTURE0+I)}const te={[ol]:r.REPEAT,[ti]:r.CLAMP_TO_EDGE,[al]:r.MIRRORED_REPEAT},oe={[an]:r.NEAREST,[$p]:r.NEAREST_MIPMAP_NEAREST,[Vo]:r.NEAREST_MIPMAP_LINEAR,[Xt]:r.LINEAR,[Ka]:r.LINEAR_MIPMAP_NEAREST,[ir]:r.LINEAR_MIPMAP_LINEAR},ce={[ly]:r.NEVER,[fy]:r.ALWAYS,[cy]:r.LESS,[Ph]:r.LEQUAL,[uy]:r.EQUAL,[Lh]:r.GEQUAL,[hy]:r.GREATER,[dy]:r.NOTEQUAL};function ve(O,I){if(I.type===Un&&e.has("OES_texture_float_linear")===!1&&(I.magFilter===Xt||I.magFilter===Ka||I.magFilter===Vo||I.magFilter===ir||I.minFilter===Xt||I.minFilter===Ka||I.minFilter===Vo||I.minFilter===ir)&&ke("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(O,r.TEXTURE_WRAP_S,te[I.wrapS]),r.texParameteri(O,r.TEXTURE_WRAP_T,te[I.wrapT]),(O===r.TEXTURE_3D||O===r.TEXTURE_2D_ARRAY)&&r.texParameteri(O,r.TEXTURE_WRAP_R,te[I.wrapR]),r.texParameteri(O,r.TEXTURE_MAG_FILTER,oe[I.magFilter]),r.texParameteri(O,r.TEXTURE_MIN_FILTER,oe[I.minFilter]),I.compareFunction&&(r.texParameteri(O,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(O,r.TEXTURE_COMPARE_FUNC,ce[I.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(I.magFilter===an||I.minFilter!==Vo&&I.minFilter!==ir||I.type===Un&&e.has("OES_texture_float_linear")===!1)return;if(I.anisotropy>1||n.get(I).__currentAnisotropy){const Z=e.get("EXT_texture_filter_anisotropic");r.texParameterf(O,Z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(I.anisotropy,i.getMaxAnisotropy())),n.get(I).__currentAnisotropy=I.anisotropy}}}function Ae(O,I){let Z=!1;O.__webglInit===void 0&&(O.__webglInit=!0,I.addEventListener("dispose",D));const le=I.source;let me=m.get(le);me===void 0&&(me={},m.set(le,me));const de=j(I);if(de!==O.__cacheKey){me[de]===void 0&&(me[de]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,Z=!0),me[de].usedTimes++;const Qe=me[O.__cacheKey];Qe!==void 0&&(me[O.__cacheKey].usedTimes--,Qe.usedTimes===0&&R(I)),O.__cacheKey=de,O.__webglTexture=me[de].texture}return Z}function dt(O,I,Z){return Math.floor(Math.floor(O/Z)/I)}function vt(O,I,Z,le){const de=O.updateRanges;if(de.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,I.width,I.height,Z,le,I.data);else{de.sort((Me,Re)=>Me.start-Re.start);let Qe=0;for(let Me=1;Me<de.length;Me++){const Re=de[Qe],$e=de[Me],G=Re.start+Re.count,se=dt($e.start,I.width,4),Pe=dt(Re.start,I.width,4);$e.start<=G+1&&se===Pe&&dt($e.start+$e.count-1,I.width,4)===se?Re.count=Math.max(Re.count,$e.start+$e.count-Re.start):(++Qe,de[Qe]=$e)}de.length=Qe+1;const Ne=r.getParameter(r.UNPACK_ROW_LENGTH),it=r.getParameter(r.UNPACK_SKIP_PIXELS),ht=r.getParameter(r.UNPACK_SKIP_ROWS);r.pixelStorei(r.UNPACK_ROW_LENGTH,I.width);for(let Me=0,Re=de.length;Me<Re;Me++){const $e=de[Me],G=Math.floor($e.start/4),se=Math.ceil($e.count/4),Pe=G%I.width,W=Math.floor(G/I.width),Se=se,be=1;r.pixelStorei(r.UNPACK_SKIP_PIXELS,Pe),r.pixelStorei(r.UNPACK_SKIP_ROWS,W),t.texSubImage2D(r.TEXTURE_2D,0,Pe,W,Se,be,Z,le,I.data)}O.clearUpdateRanges(),r.pixelStorei(r.UNPACK_ROW_LENGTH,Ne),r.pixelStorei(r.UNPACK_SKIP_PIXELS,it),r.pixelStorei(r.UNPACK_SKIP_ROWS,ht)}}function he(O,I,Z){let le=r.TEXTURE_2D;(I.isDataArrayTexture||I.isCompressedArrayTexture)&&(le=r.TEXTURE_2D_ARRAY),I.isData3DTexture&&(le=r.TEXTURE_3D);const me=Ae(O,I),de=I.source;t.bindTexture(le,O.__webglTexture,r.TEXTURE0+Z);const Qe=n.get(de);if(de.version!==Qe.__version||me===!0){t.activeTexture(r.TEXTURE0+Z);const Ne=Dt.getPrimaries(Dt.workingColorSpace),it=I.colorSpace===br?null:Dt.getPrimaries(I.colorSpace),ht=I.colorSpace===br||Ne===it?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,I.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,I.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,ht);let Me=M(I.image,!1,i.maxTextureSize);Me=at(I,Me);const Re=s.convert(I.format,I.colorSpace),$e=s.convert(I.type);let G=b(I.internalFormat,Re,$e,I.colorSpace,I.isVideoTexture);ve(le,I);let se;const Pe=I.mipmaps,W=I.isVideoTexture!==!0,Se=Qe.__version===void 0||me===!0,be=de.dataReady,Ve=P(I,Me);if(I.isDepthTexture)G=E(I.format===Zr,I.type),Se&&(W?t.texStorage2D(r.TEXTURE_2D,1,G,Me.width,Me.height):t.texImage2D(r.TEXTURE_2D,0,G,Me.width,Me.height,0,Re,$e,null));else if(I.isDataTexture)if(Pe.length>0){W&&Se&&t.texStorage2D(r.TEXTURE_2D,Ve,G,Pe[0].width,Pe[0].height);for(let Te=0,fe=Pe.length;Te<fe;Te++)se=Pe[Te],W?be&&t.texSubImage2D(r.TEXTURE_2D,Te,0,0,se.width,se.height,Re,$e,se.data):t.texImage2D(r.TEXTURE_2D,Te,G,se.width,se.height,0,Re,$e,se.data);I.generateMipmaps=!1}else W?(Se&&t.texStorage2D(r.TEXTURE_2D,Ve,G,Me.width,Me.height),be&&vt(I,Me,Re,$e)):t.texImage2D(r.TEXTURE_2D,0,G,Me.width,Me.height,0,Re,$e,Me.data);else if(I.isCompressedTexture)if(I.isCompressedArrayTexture){W&&Se&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Ve,G,Pe[0].width,Pe[0].height,Me.depth);for(let Te=0,fe=Pe.length;Te<fe;Te++)if(se=Pe[Te],I.format!==On)if(Re!==null)if(W){if(be)if(I.layerUpdates.size>0){const We=kp(se.width,se.height,I.format,I.type);for(const ct of I.layerUpdates){const Pt=se.data.subarray(ct*We/se.data.BYTES_PER_ELEMENT,(ct+1)*We/se.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Te,0,0,ct,se.width,se.height,1,Re,Pt)}I.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Te,0,0,0,se.width,se.height,Me.depth,Re,se.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Te,G,se.width,se.height,Me.depth,0,se.data,0,0);else ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else W?be&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,Te,0,0,0,se.width,se.height,Me.depth,Re,$e,se.data):t.texImage3D(r.TEXTURE_2D_ARRAY,Te,G,se.width,se.height,Me.depth,0,Re,$e,se.data)}else{W&&Se&&t.texStorage2D(r.TEXTURE_2D,Ve,G,Pe[0].width,Pe[0].height);for(let Te=0,fe=Pe.length;Te<fe;Te++)se=Pe[Te],I.format!==On?Re!==null?W?be&&t.compressedTexSubImage2D(r.TEXTURE_2D,Te,0,0,se.width,se.height,Re,se.data):t.compressedTexImage2D(r.TEXTURE_2D,Te,G,se.width,se.height,0,se.data):ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):W?be&&t.texSubImage2D(r.TEXTURE_2D,Te,0,0,se.width,se.height,Re,$e,se.data):t.texImage2D(r.TEXTURE_2D,Te,G,se.width,se.height,0,Re,$e,se.data)}else if(I.isDataArrayTexture)if(W){if(Se&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Ve,G,Me.width,Me.height,Me.depth),be)if(I.layerUpdates.size>0){const Te=kp(Me.width,Me.height,I.format,I.type);for(const fe of I.layerUpdates){const We=Me.data.subarray(fe*Te/Me.data.BYTES_PER_ELEMENT,(fe+1)*Te/Me.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,fe,Me.width,Me.height,1,Re,$e,We)}I.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,Me.width,Me.height,Me.depth,Re,$e,Me.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,G,Me.width,Me.height,Me.depth,0,Re,$e,Me.data);else if(I.isData3DTexture)W?(Se&&t.texStorage3D(r.TEXTURE_3D,Ve,G,Me.width,Me.height,Me.depth),be&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,Me.width,Me.height,Me.depth,Re,$e,Me.data)):t.texImage3D(r.TEXTURE_3D,0,G,Me.width,Me.height,Me.depth,0,Re,$e,Me.data);else if(I.isFramebufferTexture){if(Se)if(W)t.texStorage2D(r.TEXTURE_2D,Ve,G,Me.width,Me.height);else{let Te=Me.width,fe=Me.height;for(let We=0;We<Ve;We++)t.texImage2D(r.TEXTURE_2D,We,G,Te,fe,0,Re,$e,null),Te>>=1,fe>>=1}}else if(Pe.length>0){if(W&&Se){const Te=Ce(Pe[0]);t.texStorage2D(r.TEXTURE_2D,Ve,G,Te.width,Te.height)}for(let Te=0,fe=Pe.length;Te<fe;Te++)se=Pe[Te],W?be&&t.texSubImage2D(r.TEXTURE_2D,Te,0,0,Re,$e,se):t.texImage2D(r.TEXTURE_2D,Te,G,Re,$e,se);I.generateMipmaps=!1}else if(W){if(Se){const Te=Ce(Me);t.texStorage2D(r.TEXTURE_2D,Ve,G,Te.width,Te.height)}be&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Re,$e,Me)}else t.texImage2D(r.TEXTURE_2D,0,G,Re,$e,Me);_(I)&&v(le),Qe.__version=de.version,I.onUpdate&&I.onUpdate(I)}O.__version=I.version}function we(O,I,Z){if(I.image.length!==6)return;const le=Ae(O,I),me=I.source;t.bindTexture(r.TEXTURE_CUBE_MAP,O.__webglTexture,r.TEXTURE0+Z);const de=n.get(me);if(me.version!==de.__version||le===!0){t.activeTexture(r.TEXTURE0+Z);const Qe=Dt.getPrimaries(Dt.workingColorSpace),Ne=I.colorSpace===br?null:Dt.getPrimaries(I.colorSpace),it=I.colorSpace===br||Qe===Ne?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,I.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,I.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,it);const ht=I.isCompressedTexture||I.image[0].isCompressedTexture,Me=I.image[0]&&I.image[0].isDataTexture,Re=[];for(let fe=0;fe<6;fe++)!ht&&!Me?Re[fe]=M(I.image[fe],!0,i.maxCubemapSize):Re[fe]=Me?I.image[fe].image:I.image[fe],Re[fe]=at(I,Re[fe]);const $e=Re[0],G=s.convert(I.format,I.colorSpace),se=s.convert(I.type),Pe=b(I.internalFormat,G,se,I.colorSpace),W=I.isVideoTexture!==!0,Se=de.__version===void 0||le===!0,be=me.dataReady;let Ve=P(I,$e);ve(r.TEXTURE_CUBE_MAP,I);let Te;if(ht){W&&Se&&t.texStorage2D(r.TEXTURE_CUBE_MAP,Ve,Pe,$e.width,$e.height);for(let fe=0;fe<6;fe++){Te=Re[fe].mipmaps;for(let We=0;We<Te.length;We++){const ct=Te[We];I.format!==On?G!==null?W?be&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,We,0,0,ct.width,ct.height,G,ct.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,We,Pe,ct.width,ct.height,0,ct.data):ke("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):W?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,We,0,0,ct.width,ct.height,G,se,ct.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,We,Pe,ct.width,ct.height,0,G,se,ct.data)}}}else{if(Te=I.mipmaps,W&&Se){Te.length>0&&Ve++;const fe=Ce(Re[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,Ve,Pe,fe.width,fe.height)}for(let fe=0;fe<6;fe++)if(Me){W?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,0,0,Re[fe].width,Re[fe].height,G,se,Re[fe].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,Pe,Re[fe].width,Re[fe].height,0,G,se,Re[fe].data);for(let We=0;We<Te.length;We++){const Pt=Te[We].image[fe].image;W?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,We+1,0,0,Pt.width,Pt.height,G,se,Pt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,We+1,Pe,Pt.width,Pt.height,0,G,se,Pt.data)}}else{W?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,0,0,G,se,Re[fe]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,Pe,G,se,Re[fe]);for(let We=0;We<Te.length;We++){const ct=Te[We];W?be&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,We+1,0,0,G,se,ct.image[fe]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+fe,We+1,Pe,G,se,ct.image[fe])}}}_(I)&&v(r.TEXTURE_CUBE_MAP),de.__version=me.version,I.onUpdate&&I.onUpdate(I)}O.__version=I.version}function Ee(O,I,Z,le,me,de){const Qe=s.convert(Z.format,Z.colorSpace),Ne=s.convert(Z.type),it=b(Z.internalFormat,Qe,Ne,Z.colorSpace),ht=n.get(I),Me=n.get(Z);if(Me.__renderTarget=I,!ht.__hasExternalTextures){const Re=Math.max(1,I.width>>de),$e=Math.max(1,I.height>>de);me===r.TEXTURE_3D||me===r.TEXTURE_2D_ARRAY?t.texImage3D(me,de,it,Re,$e,I.depth,0,Qe,Ne,null):t.texImage2D(me,de,it,Re,$e,0,Qe,Ne,null)}t.bindFramebuffer(r.FRAMEBUFFER,O),tt(I)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,le,me,Me.__webglTexture,0,k(I)):(me===r.TEXTURE_2D||me>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&me<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,le,me,Me.__webglTexture,de),t.bindFramebuffer(r.FRAMEBUFFER,null)}function rt(O,I,Z){if(r.bindRenderbuffer(r.RENDERBUFFER,O),I.depthBuffer){const le=I.depthTexture,me=le&&le.isDepthTexture?le.type:null,de=E(I.stencilBuffer,me),Qe=I.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;tt(I)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,k(I),de,I.width,I.height):Z?r.renderbufferStorageMultisample(r.RENDERBUFFER,k(I),de,I.width,I.height):r.renderbufferStorage(r.RENDERBUFFER,de,I.width,I.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Qe,r.RENDERBUFFER,O)}else{const le=I.textures;for(let me=0;me<le.length;me++){const de=le[me],Qe=s.convert(de.format,de.colorSpace),Ne=s.convert(de.type),it=b(de.internalFormat,Qe,Ne,de.colorSpace);tt(I)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,k(I),it,I.width,I.height):Z?r.renderbufferStorageMultisample(r.RENDERBUFFER,k(I),it,I.width,I.height):r.renderbufferStorage(r.RENDERBUFFER,it,I.width,I.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function He(O,I,Z){const le=I.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(r.FRAMEBUFFER,O),!(I.depthTexture&&I.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const me=n.get(I.depthTexture);if(me.__renderTarget=I,(!me.__webglTexture||I.depthTexture.image.width!==I.width||I.depthTexture.image.height!==I.height)&&(I.depthTexture.image.width=I.width,I.depthTexture.image.height=I.height,I.depthTexture.needsUpdate=!0),le){if(me.__webglInit===void 0&&(me.__webglInit=!0,I.depthTexture.addEventListener("dispose",D)),me.__webglTexture===void 0){me.__webglTexture=r.createTexture(),t.bindTexture(r.TEXTURE_CUBE_MAP,me.__webglTexture),ve(r.TEXTURE_CUBE_MAP,I.depthTexture);const ht=s.convert(I.depthTexture.format),Me=s.convert(I.depthTexture.type);let Re;I.depthTexture.format===ar?Re=r.DEPTH_COMPONENT24:I.depthTexture.format===Zr&&(Re=r.DEPTH24_STENCIL8);for(let $e=0;$e<6;$e++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$e,0,Re,I.width,I.height,0,ht,Me,null)}}else X(I.depthTexture,0);const de=me.__webglTexture,Qe=k(I),Ne=le?r.TEXTURE_CUBE_MAP_POSITIVE_X+Z:r.TEXTURE_2D,it=I.depthTexture.format===Zr?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;if(I.depthTexture.format===ar)tt(I)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,it,Ne,de,0,Qe):r.framebufferTexture2D(r.FRAMEBUFFER,it,Ne,de,0);else if(I.depthTexture.format===Zr)tt(I)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,it,Ne,de,0,Qe):r.framebufferTexture2D(r.FRAMEBUFFER,it,Ne,de,0);else throw new Error("Unknown depthTexture format")}function De(O){const I=n.get(O),Z=O.isWebGLCubeRenderTarget===!0;if(I.__boundDepthTexture!==O.depthTexture){const le=O.depthTexture;if(I.__depthDisposeCallback&&I.__depthDisposeCallback(),le){const me=()=>{delete I.__boundDepthTexture,delete I.__depthDisposeCallback,le.removeEventListener("dispose",me)};le.addEventListener("dispose",me),I.__depthDisposeCallback=me}I.__boundDepthTexture=le}if(O.depthTexture&&!I.__autoAllocateDepthBuffer)if(Z)for(let le=0;le<6;le++)He(I.__webglFramebuffer[le],O,le);else{const le=O.texture.mipmaps;le&&le.length>0?He(I.__webglFramebuffer[0],O,0):He(I.__webglFramebuffer,O,0)}else if(Z){I.__webglDepthbuffer=[];for(let le=0;le<6;le++)if(t.bindFramebuffer(r.FRAMEBUFFER,I.__webglFramebuffer[le]),I.__webglDepthbuffer[le]===void 0)I.__webglDepthbuffer[le]=r.createRenderbuffer(),rt(I.__webglDepthbuffer[le],O,!1);else{const me=O.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,de=I.__webglDepthbuffer[le];r.bindRenderbuffer(r.RENDERBUFFER,de),r.framebufferRenderbuffer(r.FRAMEBUFFER,me,r.RENDERBUFFER,de)}}else{const le=O.texture.mipmaps;if(le&&le.length>0?t.bindFramebuffer(r.FRAMEBUFFER,I.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,I.__webglFramebuffer),I.__webglDepthbuffer===void 0)I.__webglDepthbuffer=r.createRenderbuffer(),rt(I.__webglDepthbuffer,O,!1);else{const me=O.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,de=I.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,de),r.framebufferRenderbuffer(r.FRAMEBUFFER,me,r.RENDERBUFFER,de)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function _t(O,I,Z){const le=n.get(O);I!==void 0&&Ee(le.__webglFramebuffer,O,O.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),Z!==void 0&&De(O)}function Je(O){const I=O.texture,Z=n.get(O),le=n.get(I);O.addEventListener("dispose",N);const me=O.textures,de=O.isWebGLCubeRenderTarget===!0,Qe=me.length>1;if(Qe||(le.__webglTexture===void 0&&(le.__webglTexture=r.createTexture()),le.__version=I.version,o.memory.textures++),de){Z.__webglFramebuffer=[];for(let Ne=0;Ne<6;Ne++)if(I.mipmaps&&I.mipmaps.length>0){Z.__webglFramebuffer[Ne]=[];for(let it=0;it<I.mipmaps.length;it++)Z.__webglFramebuffer[Ne][it]=r.createFramebuffer()}else Z.__webglFramebuffer[Ne]=r.createFramebuffer()}else{if(I.mipmaps&&I.mipmaps.length>0){Z.__webglFramebuffer=[];for(let Ne=0;Ne<I.mipmaps.length;Ne++)Z.__webglFramebuffer[Ne]=r.createFramebuffer()}else Z.__webglFramebuffer=r.createFramebuffer();if(Qe)for(let Ne=0,it=me.length;Ne<it;Ne++){const ht=n.get(me[Ne]);ht.__webglTexture===void 0&&(ht.__webglTexture=r.createTexture(),o.memory.textures++)}if(O.samples>0&&tt(O)===!1){Z.__webglMultisampledFramebuffer=r.createFramebuffer(),Z.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,Z.__webglMultisampledFramebuffer);for(let Ne=0;Ne<me.length;Ne++){const it=me[Ne];Z.__webglColorRenderbuffer[Ne]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,Z.__webglColorRenderbuffer[Ne]);const ht=s.convert(it.format,it.colorSpace),Me=s.convert(it.type),Re=b(it.internalFormat,ht,Me,it.colorSpace,O.isXRRenderTarget===!0),$e=k(O);r.renderbufferStorageMultisample(r.RENDERBUFFER,$e,Re,O.width,O.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ne,r.RENDERBUFFER,Z.__webglColorRenderbuffer[Ne])}r.bindRenderbuffer(r.RENDERBUFFER,null),O.depthBuffer&&(Z.__webglDepthRenderbuffer=r.createRenderbuffer(),rt(Z.__webglDepthRenderbuffer,O,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(de){t.bindTexture(r.TEXTURE_CUBE_MAP,le.__webglTexture),ve(r.TEXTURE_CUBE_MAP,I);for(let Ne=0;Ne<6;Ne++)if(I.mipmaps&&I.mipmaps.length>0)for(let it=0;it<I.mipmaps.length;it++)Ee(Z.__webglFramebuffer[Ne][it],O,I,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,it);else Ee(Z.__webglFramebuffer[Ne],O,I,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0);_(I)&&v(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Qe){for(let Ne=0,it=me.length;Ne<it;Ne++){const ht=me[Ne],Me=n.get(ht);let Re=r.TEXTURE_2D;(O.isWebGL3DRenderTarget||O.isWebGLArrayRenderTarget)&&(Re=O.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(Re,Me.__webglTexture),ve(Re,ht),Ee(Z.__webglFramebuffer,O,ht,r.COLOR_ATTACHMENT0+Ne,Re,0),_(ht)&&v(Re)}t.unbindTexture()}else{let Ne=r.TEXTURE_2D;if((O.isWebGL3DRenderTarget||O.isWebGLArrayRenderTarget)&&(Ne=O.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(Ne,le.__webglTexture),ve(Ne,I),I.mipmaps&&I.mipmaps.length>0)for(let it=0;it<I.mipmaps.length;it++)Ee(Z.__webglFramebuffer[it],O,I,r.COLOR_ATTACHMENT0,Ne,it);else Ee(Z.__webglFramebuffer,O,I,r.COLOR_ATTACHMENT0,Ne,0);_(I)&&v(Ne),t.unbindTexture()}O.depthBuffer&&De(O)}function xe(O){const I=O.textures;for(let Z=0,le=I.length;Z<le;Z++){const me=I[Z];if(_(me)){const de=S(O),Qe=n.get(me).__webglTexture;t.bindTexture(de,Qe),v(de),t.unbindTexture()}}}const _e=[],ye=[];function Ie(O){if(O.samples>0){if(tt(O)===!1){const I=O.textures,Z=O.width,le=O.height;let me=r.COLOR_BUFFER_BIT;const de=O.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Qe=n.get(O),Ne=I.length>1;if(Ne)for(let ht=0;ht<I.length;ht++)t.bindFramebuffer(r.FRAMEBUFFER,Qe.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+ht,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Qe.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+ht,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Qe.__webglMultisampledFramebuffer);const it=O.texture.mipmaps;it&&it.length>0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Qe.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Qe.__webglFramebuffer);for(let ht=0;ht<I.length;ht++){if(O.resolveDepthBuffer&&(O.depthBuffer&&(me|=r.DEPTH_BUFFER_BIT),O.stencilBuffer&&O.resolveStencilBuffer&&(me|=r.STENCIL_BUFFER_BIT)),Ne){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Qe.__webglColorRenderbuffer[ht]);const Me=n.get(I[ht]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,Me,0)}r.blitFramebuffer(0,0,Z,le,0,0,Z,le,me,r.NEAREST),u===!0&&(_e.length=0,ye.length=0,_e.push(r.COLOR_ATTACHMENT0+ht),O.depthBuffer&&O.resolveDepthBuffer===!1&&(_e.push(de),ye.push(de),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,ye)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,_e))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Ne)for(let ht=0;ht<I.length;ht++){t.bindFramebuffer(r.FRAMEBUFFER,Qe.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+ht,r.RENDERBUFFER,Qe.__webglColorRenderbuffer[ht]);const Me=n.get(I[ht]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Qe.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+ht,r.TEXTURE_2D,Me,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Qe.__webglMultisampledFramebuffer)}else if(O.depthBuffer&&O.resolveDepthBuffer===!1&&u){const I=O.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[I])}}}function k(O){return Math.min(i.maxSamples,O.samples)}function tt(O){const I=n.get(O);return O.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&I.__useRenderToTexture!==!1}function Be(O){const I=o.render.frame;d.get(O)!==I&&(d.set(O,I),O.update())}function at(O,I){const Z=O.colorSpace,le=O.format,me=O.type;return O.isCompressedTexture===!0||O.isVideoTexture===!0||Z!==Gs&&Z!==br&&(Dt.getTransfer(Z)===Vt?(le!==On||me!==Hn)&&ke("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):ot("WebGLTextures: Unsupported texture color space:",Z)),I}function Ce(O){return typeof HTMLImageElement<"u"&&O instanceof HTMLImageElement?(h.width=O.naturalWidth||O.width,h.height=O.naturalHeight||O.height):typeof VideoFrame<"u"&&O instanceof VideoFrame?(h.width=O.displayWidth,h.height=O.displayHeight):(h.width=O.width,h.height=O.height),h}this.allocateTextureUnit=H,this.resetTextureUnits=V,this.setTexture2D=X,this.setTexture2DArray=q,this.setTexture3D=Y,this.setTextureCube=J,this.rebindTextures=_t,this.setupRenderTarget=Je,this.updateRenderTargetMipmap=xe,this.updateMultisampleRenderTarget=Ie,this.setupDepthRenderbuffer=De,this.setupFrameBufferTexture=Ee,this.useMultisampledRTT=tt,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function E_(r,e){function t(n,i=br){let s;const o=Dt.getTransfer(i);if(n===Hn)return r.UNSIGNED_BYTE;if(n===Eh)return r.UNSIGNED_SHORT_4_4_4_4;if(n===Th)return r.UNSIGNED_SHORT_5_5_5_1;if(n===nm)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===im)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===em)return r.BYTE;if(n===tm)return r.SHORT;if(n===qo)return r.UNSIGNED_SHORT;if(n===wh)return r.INT;if(n===Ri)return r.UNSIGNED_INT;if(n===Un)return r.FLOAT;if(n===Hi)return r.HALF_FLOAT;if(n===rm)return r.ALPHA;if(n===sm)return r.RGB;if(n===On)return r.RGBA;if(n===ar)return r.DEPTH_COMPONENT;if(n===Zr)return r.DEPTH_STENCIL;if(n===Ah)return r.RED;if(n===bl)return r.RED_INTEGER;if(n===Vs)return r.RG;if(n===Ch)return r.RG_INTEGER;if(n===Rh)return r.RGBA_INTEGER;if(n===Qa||n===$a||n===el||n===tl)if(o===Vt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Qa)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===$a)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===el)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===tl)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Qa)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===$a)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===el)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===tl)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Fu||n===Bu||n===ku||n===zu)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Fu)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Bu)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ku)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===zu)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Vu||n===Gu||n===Hu||n===Wu||n===ju||n===Xu||n===Yu)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Vu||n===Gu)return o===Vt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Hu)return o===Vt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===Wu)return s.COMPRESSED_R11_EAC;if(n===ju)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Xu)return s.COMPRESSED_RG11_EAC;if(n===Yu)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===qu||n===Zu||n===Ju||n===Ku||n===Qu||n===$u||n===eh||n===th||n===nh||n===ih||n===rh||n===sh||n===oh||n===ah)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===qu)return o===Vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Zu)return o===Vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ju)return o===Vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Ku)return o===Vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Qu)return o===Vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===$u)return o===Vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===eh)return o===Vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===th)return o===Vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===nh)return o===Vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===ih)return o===Vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===rh)return o===Vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===sh)return o===Vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===oh)return o===Vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ah)return o===Vt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===lh||n===ch||n===uh)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===lh)return o===Vt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===ch)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===uh)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===hh||n===dh||n===fh||n===ph)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===hh)return s.COMPRESSED_RED_RGTC1_EXT;if(n===dh)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===fh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===ph)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Zo?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const aR=`
4026void main() {
4027
4028	gl_Position = vec4( position, 1.0 );
4029
4030}`,lR=`
4031uniform sampler2DArray depthColor;
4032uniform float depthWidth;
4033uniform float depthHeight;
4034
4035void main() {
4036
4037	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
4038
4039	if ( coord.x >= 1.0 ) {
4040
4041		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
4042
4043	} else {
4044
4045		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
4046
4047	}
4048
4049}`;class cR{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new mm(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Ii({vertexShader:aR,fragmentShader:lR,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new dn(new ia(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class uR extends lr{constructor(e,t){super();const n=this;let i=null,s=1,o=null,c="local-floor",u=1,h=null,d=null,f=null,m=null,g=null,x=null;const M=typeof XRWebGLBinding<"u",_=new cR,v={},S=t.getContextAttributes();let b=null,E=null;const P=[],D=[],N=new ge;let A=null;const R=new Zt;R.viewport=new jt;const B=new Zt;B.viewport=new jt;const L=[R,B],V=new d_;let H=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(he){let we=P[he];return we===void 0&&(we=new Eu,P[he]=we),we.getTargetRaySpace()},this.getControllerGrip=function(he){let we=P[he];return we===void 0&&(we=new Eu,P[he]=we),we.getGripSpace()},this.getHand=function(he){let we=P[he];return we===void 0&&(we=new Eu,P[he]=we),we.getHandSpace()};function X(he){const we=D.indexOf(he.inputSource);if(we===-1)return;const Ee=P[we];Ee!==void 0&&(Ee.update(he.inputSource,he.frame,h||o),Ee.dispatchEvent({type:he.type,data:he.inputSource}))}function q(){i.removeEventListener("select",X),i.removeEventListener("selectstart",X),i.removeEventListener("selectend",X),i.removeEventListener("squeeze",X),i.removeEventListener("squeezestart",X),i.removeEventListener("squeezeend",X),i.removeEventListener("end",q),i.removeEventListener("inputsourceschange",Y);for(let he=0;he<P.length;he++){const we=D[he];we!==null&&(D[he]=null,P[he].disconnect(we))}H=null,j=null,_.reset();for(const he in v)delete v[he];e.setRenderTarget(b),g=null,m=null,f=null,i=null,E=null,vt.stop(),n.isPresenting=!1,e.setPixelRatio(A),e.setSize(N.width,N.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(he){s=he,n.isPresenting===!0&&ke("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(he){c=he,n.isPresenting===!0&&ke("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||o},this.setReferenceSpace=function(he){h=he},this.getBaseLayer=function(){return m!==null?m:g},this.getBinding=function(){return f===null&&M&&(f=new XRWebGLBinding(i,t)),f},this.getFrame=function(){return x},this.getSession=function(){return i},this.setSession=async function(he){if(i=he,i!==null){if(b=e.getRenderTarget(),i.addEventListener("select",X),i.addEventListener("selectstart",X),i.addEventListener("selectend",X),i.addEventListener("squeeze",X),i.addEventListener("squeezestart",X),i.addEventListener("squeezeend",X),i.addEventListener("end",q),i.addEventListener("inputsourceschange",Y),S.xrCompatible!==!0&&await t.makeXRCompatible(),A=e.getPixelRatio(),e.getSize(N),M&&"createProjectionLayer"in XRWebGLBinding.prototype){let Ee=null,rt=null,He=null;S.depth&&(He=S.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Ee=S.stencil?Zr:ar,rt=S.stencil?Zo:Ri);const De={colorFormat:t.RGBA8,depthFormat:He,scaleFactor:s};f=this.getBinding(),m=f.createProjectionLayer(De),i.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),E=new ni(m.textureWidth,m.textureHeight,{format:On,type:Hn,depthTexture:new js(m.textureWidth,m.textureHeight,rt,void 0,void 0,void 0,void 0,void 0,void 0,Ee),stencilBuffer:S.stencil,colorSpace:e.outputColorSpace,samples:S.antialias?4:0,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}else{const Ee={antialias:S.antialias,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:s};g=new XRWebGLLayer(i,t,Ee),i.updateRenderState({baseLayer:g}),e.setPixelRatio(1),e.setSize(g.framebufferWidth,g.framebufferHeight,!1),E=new ni(g.framebufferWidth,g.framebufferHeight,{format:On,type:Hn,colorSpace:e.outputColorSpace,stencilBuffer:S.stencil,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}E.isXRRenderTarget=!0,this.setFoveation(u),h=null,o=await i.requestReferenceSpace(c),vt.setContext(i),vt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function Y(he){for(let we=0;we<he.removed.length;we++){const Ee=he.removed[we],rt=D.indexOf(Ee);rt>=0&&(D[rt]=null,P[rt].disconnect(Ee))}for(let we=0;we<he.added.length;we++){const Ee=he.added[we];let rt=D.indexOf(Ee);if(rt===-1){for(let De=0;De<P.length;De++)if(De>=D.length){D.push(Ee),rt=De;break}else if(D[De]===null){D[De]=Ee,rt=De;break}if(rt===-1)break}const He=P[rt];He&&He.connect(Ee)}}const J=new F,te=new F;function oe(he,we,Ee){J.setFromMatrixPosition(we.matrixWorld),te.setFromMatrixPosition(Ee.matrixWorld);const rt=J.distanceTo(te),He=we.projectionMatrix.elements,De=Ee.projectionMatrix.elements,_t=He[14]/(He[10]-1),Je=He[14]/(He[10]+1),xe=(He[9]+1)/He[5],_e=(He[9]-1)/He[5],ye=(He[8]-1)/He[0],Ie=(De[8]+1)/De[0],k=_t*ye,tt=_t*Ie,Be=rt/(-ye+Ie),at=Be*-ye;if(we.matrixWorld.decompose(he.position,he.quaternion,he.scale),he.translateX(at),he.translateZ(Be),he.matrixWorld.compose(he.position,he.quaternion,he.scale),he.matrixWorldInverse.copy(he.matrixWorld).invert(),He[10]===-1)he.projectionMatrix.copy(we.projectionMatrix),he.projectionMatrixInverse.copy(we.projectionMatrixInverse);else{const Ce=_t+Be,O=Je+Be,I=k-at,Z=tt+(rt-at),le=xe*Je/O*Ce,me=_e*Je/O*Ce;he.projectionMatrix.makePerspective(I,Z,le,me,Ce,O),he.projectionMatrixInverse.copy(he.projectionMatrix).invert()}}function ce(he,we){we===null?he.matrixWorld.copy(he.matrix):he.matrixWorld.multiplyMatrices(we.matrixWorld,he.matrix),he.matrixWorldInverse.copy(he.matrixWorld).invert()}this.updateCamera=function(he){if(i===null)return;let we=he.near,Ee=he.far;_.texture!==null&&(_.depthNear>0&&(we=_.depthNear),_.depthFar>0&&(Ee=_.depthFar)),V.near=B.near=R.near=we,V.far=B.far=R.far=Ee,(H!==V.near||j!==V.far)&&(i.updateRenderState({depthNear:V.near,depthFar:V.far}),H=V.near,j=V.far),V.layers.mask=he.layers.mask|6,R.layers.mask=V.layers.mask&-5,B.layers.mask=V.layers.mask&-3;const rt=he.parent,He=V.cameras;ce(V,rt);for(let De=0;De<He.length;De++)ce(He[De],rt);He.length===2?oe(V,R,B):V.projectionMatrix.copy(R.projectionMatrix),ve(he,V,rt)};function ve(he,we,Ee){Ee===null?he.matrix.copy(we.matrixWorld):(he.matrix.copy(Ee.matrixWorld),he.matrix.invert(),he.matrix.multiply(we.matrixWorld)),he.matrix.decompose(he.position,he.quaternion,he.scale),he.updateMatrixWorld(!0),he.projectionMatrix.copy(we.projectionMatrix),he.projectionMatrixInverse.copy(we.projectionMatrixInverse),he.isPerspectiveCamera&&(he.fov=Jo*2*Math.atan(1/he.projectionMatrix.elements[5]),he.zoom=1)}this.getCamera=function(){return V},this.getFoveation=function(){if(!(m===null&&g===null))return u},this.setFoveation=function(he){u=he,m!==null&&(m.fixedFoveation=he),g!==null&&g.fixedFoveation!==void 0&&(g.fixedFoveation=he)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(V)},this.getCameraTexture=function(he){return v[he]};let Ae=null;function dt(he,we){if(d=we.getViewerPose(h||o),x=we,d!==null){const Ee=d.views;g!==null&&(e.setRenderTargetFramebuffer(E,g.framebuffer),e.setRenderTarget(E));let rt=!1;Ee.length!==V.cameras.length&&(V.cameras.length=0,rt=!0);for(let Je=0;Je<Ee.length;Je++){const xe=Ee[Je];let _e=null;if(g!==null)_e=g.getViewport(xe);else{const Ie=f.getViewSubImage(m,xe);_e=Ie.viewport,Je===0&&(e.setRenderTargetTextures(E,Ie.colorTexture,Ie.depthStencilTexture),e.setRenderTarget(E))}let ye=L[Je];ye===void 0&&(ye=new Zt,ye.layers.enable(Je),ye.viewport=new jt,L[Je]=ye),ye.matrix.fromArray(xe.transform.matrix),ye.matrix.decompose(ye.position,ye.quaternion,ye.scale),ye.projectionMatrix.fromArray(xe.projectionMatrix),ye.projectionMatrixInverse.copy(ye.projectionMatrix).invert(),ye.viewport.set(_e.x,_e.y,_e.width,_e.height),Je===0&&(V.matrix.copy(ye.matrix),V.matrix.decompose(V.position,V.quaternion,V.scale)),rt===!0&&V.cameras.push(ye)}const He=i.enabledFeatures;if(He&&He.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&M){f=n.getBinding();const Je=f.getDepthInformation(Ee[0]);Je&&Je.isValid&&Je.texture&&_.init(Je,i.renderState)}if(He&&He.includes("camera-access")&&M){e.state.unbindTexture(),f=n.getBinding();for(let Je=0;Je<Ee.length;Je++){const xe=Ee[Je].camera;if(xe){let _e=v[xe];_e||(_e=new mm,v[xe]=_e);const ye=f.getCameraImage(xe);_e.sourceTexture=ye}}}}for(let Ee=0;Ee<P.length;Ee++){const rt=D[Ee],He=P[Ee];rt!==null&&He!==void 0&&He.update(rt,we,h||o)}Ae&&Ae(he,we),we.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:we}),x=null}const vt=new __;vt.setAnimationLoop(dt),this.setAnimationLoop=function(he){Ae=he},this.dispose=function(){}}}const As=new mi,hR=new yt;function dR(r,e){function t(_,v){_.matrixAutoUpdate===!0&&_.updateMatrix(),v.value.copy(_.matrix)}function n(_,v){v.color.getRGB(_.fogColor.value,Vy(r)),v.isFog?(_.fogNear.value=v.near,_.fogFar.value=v.far):v.isFogExp2&&(_.fogDensity.value=v.density)}function i(_,v,S,b,E){v.isMeshBasicMaterial?s(_,v):v.isMeshLambertMaterial?(s(_,v),v.envMap&&(_.envMapIntensity.value=v.envMapIntensity)):v.isMeshToonMaterial?(s(_,v),f(_,v)):v.isMeshPhongMaterial?(s(_,v),d(_,v),v.envMap&&(_.envMapIntensity.value=v.envMapIntensity)):v.isMeshStandardMaterial?(s(_,v),m(_,v),v.isMeshPhysicalMaterial&&g(_,v,E)):v.isMeshMatcapMaterial?(s(_,v),x(_,v)):v.isMeshDepthMaterial?s(_,v):v.isMeshDistanceMaterial?(s(_,v),M(_,v)):v.isMeshNormalMaterial?s(_,v):v.isLineBasicMaterial?(o(_,v),v.isLineDashedMaterial&&c(_,v)):v.isPointsMaterial?u(_,v,S,b):v.isSpriteMaterial?h(_,v):v.isShadowMaterial?(_.color.value.copy(v.color),_.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function s(_,v){_.opacity.value=v.opacity,v.color&&_.diffuse.value.copy(v.color),v.emissive&&_.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(_.map.value=v.map,t(v.map,_.mapTransform)),v.alphaMap&&(_.alphaMap.value=v.alphaMap,t(v.alphaMap,_.alphaMapTransform)),v.bumpMap&&(_.bumpMap.value=v.bumpMap,t(v.bumpMap,_.bumpMapTransform),_.bumpScale.value=v.bumpScale,v.side===jn&&(_.bumpScale.value*=-1)),v.normalMap&&(_.normalMap.value=v.normalMap,t(v.normalMap,_.normalMapTransform),_.normalScale.value.copy(v.normalScale),v.side===jn&&_.normalScale.value.negate()),v.displacementMap&&(_.displacementMap.value=v.displacementMap,t(v.displacementMap,_.displacementMapTransform),_.displacementScale.value=v.displacementScale,_.displacementBias.value=v.displacementBias),v.emissiveMap&&(_.emissiveMap.value=v.emissiveMap,t(v.emissiveMap,_.emissiveMapTransform)),v.specularMap&&(_.specularMap.value=v.specularMap,t(v.specularMap,_.specularMapTransform)),v.alphaTest>0&&(_.alphaTest.value=v.alphaTest);const S=e.get(v),b=S.envMap,E=S.envMapRotation;b&&(_.envMap.value=b,As.copy(E),As.x*=-1,As.y*=-1,As.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(As.y*=-1,As.z*=-1),_.envMapRotation.value.setFromMatrix4(hR.makeRotationFromEuler(As)),_.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=v.reflectivity,_.ior.value=v.ior,_.refractionRatio.value=v.refractionRatio),v.lightMap&&(_.lightMap.value=v.lightMap,_.lightMapIntensity.value=v.lightMapIntensity,t(v.lightMap,_.lightMapTransform)),v.aoMap&&(_.aoMap.value=v.aoMap,_.aoMapIntensity.value=v.aoMapIntensity,t(v.aoMap,_.aoMapTransform))}function o(_,v){_.diffuse.value.copy(v.color),_.opacity.value=v.opacity,v.map&&(_.map.value=v.map,t(v.map,_.mapTransform))}function c(_,v){_.dashSize.value=v.dashSize,_.totalSize.value=v.dashSize+v.gapSize,_.scale.value=v.scale}function u(_,v,S,b){_.diffuse.value.copy(v.color),_.opacity.value=v.opacity,_.size.value=v.size*S,_.scale.value=b*.5,v.map&&(_.map.value=v.map,t(v.map,_.uvTransform)),v.alphaMap&&(_.alphaMap.value=v.alphaMap,t(v.alphaMap,_.alphaMapTransform)),v.alphaTest>0&&(_.alphaTest.value=v.alphaTest)}function h(_,v){_.diffuse.value.copy(v.color),_.opacity.value=v.opacity,_.rotation.value=v.rotation,v.map&&(_.map.value=v.map,t(v.map,_.mapTransform)),v.alphaMap&&(_.alphaMap.value=v.alphaMap,t(v.alphaMap,_.alphaMapTransform)),v.alphaTest>0&&(_.alphaTest.value=v.alphaTest)}function d(_,v){_.specular.value.copy(v.specular),_.shininess.value=Math.max(v.shininess,1e-4)}function f(_,v){v.gradientMap&&(_.gradientMap.value=v.gradientMap)}function m(_,v){_.metalness.value=v.metalness,v.metalnessMap&&(_.metalnessMap.value=v.metalnessMap,t(v.metalnessMap,_.metalnessMapTransform)),_.roughness.value=v.roughness,v.roughnessMap&&(_.roughnessMap.value=v.roughnessMap,t(v.roughnessMap,_.roughnessMapTransform)),v.envMap&&(_.envMapIntensity.value=v.envMapIntensity)}function g(_,v,S){_.ior.value=v.ior,v.sheen>0&&(_.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),_.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(_.sheenColorMap.value=v.sheenColorMap,t(v.sheenColorMap,_.sheenColorMapTransform)),v.sheenRoughnessMap&&(_.sheenRoughnessMap.value=v.sheenRoughnessMap,t(v.sheenRoughnessMap,_.sheenRoughnessMapTransform))),v.clearcoat>0&&(_.clearcoat.value=v.clearcoat,_.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(_.clearcoatMap.value=v.clearcoatMap,t(v.clearcoatMap,_.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,t(v.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(_.clearcoatNormalMap.value=v.clearcoatNormalMap,t(v.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===jn&&_.clearcoatNormalScale.value.negate())),v.dispersion>0&&(_.dispersion.value=v.dispersion),v.iridescence>0&&(_.iridescence.value=v.iridescence,_.iridescenceIOR.value=v.iridescenceIOR,_.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(_.iridescenceMap.value=v.iridescenceMap,t(v.iridescenceMap,_.iridescenceMapTransform)),v.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=v.iridescenceThicknessMap,t(v.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),v.transmission>0&&(_.transmission.value=v.transmission,_.transmissionSamplerMap.value=S.texture,_.transmissionSamplerSize.value.set(S.width,S.height),v.transmissionMap&&(_.transmissionMap.value=v.transmissionMap,t(v.transmissionMap,_.transmissionMapTransform)),_.thickness.value=v.thickness,v.thicknessMap&&(_.thicknessMap.value=v.thicknessMap,t(v.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=v.attenuationDistance,_.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(_.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(_.anisotropyMap.value=v.anisotropyMap,t(v.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=v.specularIntensity,_.specularColor.value.copy(v.specularColor),v.specularColorMap&&(_.specularColorMap.value=v.specularColorMap,t(v.specularColorMap,_.specularColorMapTransform)),v.specularIntensityMap&&(_.specularIntensityMap.value=v.specularIntensityMap,t(v.specularIntensityMap,_.specularIntensityMapTransform))}function x(_,v){v.matcap&&(_.matcap.value=v.matcap)}function M(_,v){const S=e.get(v).light;_.referencePosition.value.setFromMatrixPosition(S.matrixWorld),_.nearDistance.value=S.shadow.camera.near,_.farDistance.value=S.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function fR(r,e,t,n){let i={},s={},o=[];const c=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function u(S,b){const E=b.program;n.uniformBlockBinding(S,E)}function h(S,b){let E=i[S.id];E===void 0&&(x(S),E=d(S),i[S.id]=E,S.addEventListener("dispose",_));const P=b.program;n.updateUBOMapping(S,P);const D=e.render.frame;s[S.id]!==D&&(m(S),s[S.id]=D)}function d(S){const b=f();S.__bindingPointIndex=b;const E=r.createBuffer(),P=S.__size,D=S.usage;return r.bindBuffer(r.UNIFORM_BUFFER,E),r.bufferData(r.UNIFORM_BUFFER,P,D),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,b,E),E}function f(){for(let S=0;S<c;S++)if(o.indexOf(S)===-1)return o.push(S),S;return ot("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(S){const b=i[S.id],E=S.uniforms,P=S.__cache;r.bindBuffer(r.UNIFORM_BUFFER,b);for(let D=0,N=E.length;D<N;D++){const A=Array.isArray(E[D])?E[D]:[E[D]];for(let R=0,B=A.length;R<B;R++){const L=A[R];if(g(L,D,R,P)===!0){const V=L.__offset,H=Array.isArray(L.value)?L.value:[L.value];let j=0;for(let X=0;X<H.length;X++){const q=H[X],Y=M(q);typeof q=="number"||typeof q=="boolean"?(L.__data[0]=q,r.bufferSubData(r.UNIFORM_BUFFER,V+j,L.__data)):q.isMatrix3?(L.__data[0]=q.elements[0],L.__data[1]=q.elements[1],L.__data[2]=q.elements[2],L.__data[3]=0,L.__data[4]=q.elements[3],L.__data[5]=q.elements[4],L.__data[6]=q.elements[5],L.__data[7]=0,L.__data[8]=q.elements[6],L.__data[9]=q.elements[7],L.__data[10]=q.elements[8],L.__data[11]=0):(q.toArray(L.__data,j),j+=Y.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,V,L.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function g(S,b,E,P){const D=S.value,N=b+"_"+E;if(P[N]===void 0)return typeof D=="number"||typeof D=="boolean"?P[N]=D:P[N]=D.clone(),!0;{const A=P[N];if(typeof D=="number"||typeof D=="boolean"){if(A!==D)return P[N]=D,!0}else if(A.equals(D)===!1)return A.copy(D),!0}return!1}function x(S){const b=S.uniforms;let E=0;const P=16;for(let N=0,A=b.length;N<A;N++){const R=Array.isArray(b[N])?b[N]:[b[N]];for(let B=0,L=R.length;B<L;B++){const V=R[B],H=Array.isArray(V.value)?V.value:[V.value];for(let j=0,X=H.length;j<X;j++){const q=H[j],Y=M(q),J=E%P,te=J%Y.boundary,oe=J+te;E+=te,oe!==0&&P-oe<Y.storage&&(E+=P-oe),V.__data=new Float32Array(Y.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=E,E+=Y.storage}}}const D=E%P;return D>0&&(E+=P-D),S.__size=E,S.__cache={},this}function M(S){const b={boundary:0,storage:0};return typeof S=="number"||typeof S=="boolean"?(b.boundary=4,b.storage=4):S.isVector2?(b.boundary=8,b.storage=8):S.isVector3||S.isColor?(b.boundary=16,b.storage=12):S.isVector4?(b.boundary=16,b.storage=16):S.isMatrix3?(b.boundary=48,b.storage=48):S.isMatrix4?(b.boundary=64,b.storage=64):S.isTexture?ke("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ke("WebGLRenderer: Unsupported uniform value type.",S),b}function _(S){const b=S.target;b.removeEventListener("dispose",_);const E=o.indexOf(b.__bindingPointIndex);o.splice(E,1),r.deleteBuffer(i[b.id]),delete i[b.id],delete s[b.id]}function v(){for(const S in i)r.deleteBuffer(i[S]);o=[],i={},s={}}return{bind:u,update:h,dispose:v}}const pR=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let nr=null;function mR(){return nr===null&&(nr=new Vi(pR,16,16,Vs,Hi),nr.name="DFG_LUT",nr.minFilter=Xt,nr.magFilter=Xt,nr.wrapS=ti,nr.wrapT=ti,nr.generateMipmaps=!1,nr.needsUpdate=!0),nr}class T_{constructor(e={}){const{canvas:t=my(),context:n=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:c=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:h=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:m=!1,outputBufferType:g=Hn}=e;this.isWebGLRenderer=!0;let x;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");x=n.getContextAttributes().alpha}else x=o;const M=g,_=new Set([Rh,Ch,bl]),v=new Set([Hn,Ri,qo,Zo,Eh,Th]),S=new Uint32Array(4),b=new Int32Array(4);let E=null,P=null;const D=[],N=[];let A=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Ci,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const R=this;let B=!1;this._outputColorSpace=$n;let L=0,V=0,H=null,j=-1,X=null;const q=new jt,Y=new jt;let J=null;const te=new Ke(0);let oe=0,ce=t.width,ve=t.height,Ae=1,dt=null,vt=null;const he=new jt(0,0,ce,ve),we=new jt(0,0,ce,ve);let Ee=!1;const rt=new na;let He=!1,De=!1;const _t=new yt,Je=new F,xe=new jt,_e={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ye=!1;function Ie(){return H===null?Ae:1}let k=n;function tt(U,Q){return t.getContext(U,Q)}try{const U={alpha:!0,depth:i,stencil:s,antialias:c,premultipliedAlpha:u,preserveDrawingBuffer:h,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Sh}`),t.addEventListener("webglcontextlost",We,!1),t.addEventListener("webglcontextrestored",ct,!1),t.addEventListener("webglcontextcreationerror",Pt,!1),k===null){const Q="webgl2";if(k=tt(Q,U),k===null)throw tt(Q)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(U){throw ot("WebGLRenderer: "+U.message),U}let Be,at,Ce,O,I,Z,le,me,de,Qe,Ne,it,ht,Me,Re,$e,G,se,Pe,W,Se,be,Ve;function Te(){Be=new xC(k),Be.init(),Se=new E_(k,Be),at=new cC(k,Be,e,Se),Ce=new sR(k,Be),at.reversedDepthBuffer&&m&&Ce.buffers.depth.setReversed(!0),O=new _C(k),I=new j2,Z=new oR(k,Be,Ce,I,at,Se,O),le=new gC(R),me=new EE(k),be=new aC(k,me),de=new vC(k,me,O,be),Qe=new MC(k,de,me,be,O),se=new SC(k,at,Z),Re=new uC(I),Ne=new W2(R,le,Be,at,be,Re),it=new dR(R,I),ht=new Y2,Me=new $2(Be),G=new oC(R,le,Ce,Qe,x,u),$e=new rR(R,Qe,at),Ve=new fR(k,O,at,Ce),Pe=new lC(k,Be,O),W=new yC(k,Be,O),O.programs=Ne.programs,R.capabilities=at,R.extensions=Be,R.properties=I,R.renderLists=ht,R.shadowMap=$e,R.state=Ce,R.info=O}Te(),M!==Hn&&(A=new wC(M,t.width,t.height,i,s));const fe=new uR(R,k);this.xr=fe,this.getContext=function(){return k},this.getContextAttributes=function(){return k.getContextAttributes()},this.forceContextLoss=function(){const U=Be.get("WEBGL_lose_context");U&&U.loseContext()},this.forceContextRestore=function(){const U=Be.get("WEBGL_lose_context");U&&U.restoreContext()},this.getPixelRatio=function(){return Ae},this.setPixelRatio=function(U){U!==void 0&&(Ae=U,this.setSize(ce,ve,!1))},this.getSize=function(U){return U.set(ce,ve)},this.setSize=function(U,Q,ae=!0){if(fe.isPresenting){ke("WebGLRenderer: Can't change size while VR device is presenting.");return}ce=U,ve=Q,t.width=Math.floor(U*Ae),t.height=Math.floor(Q*Ae),ae===!0&&(t.style.width=U+"px",t.style.height=Q+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,U,Q)},this.getDrawingBufferSize=function(U){return U.set(ce*Ae,ve*Ae).floor()},this.setDrawingBufferSize=function(U,Q,ae){ce=U,ve=Q,Ae=ae,t.width=Math.floor(U*ae),t.height=Math.floor(Q*ae),this.setViewport(0,0,U,Q)},this.setEffects=function(U){if(M===Hn){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(U){for(let Q=0;Q<U.length;Q++)if(U[Q].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}A.setEffects(U||[])},this.getCurrentViewport=function(U){return U.copy(q)},this.getViewport=function(U){return U.copy(he)},this.setViewport=function(U,Q,ae,ie){U.isVector4?he.set(U.x,U.y,U.z,U.w):he.set(U,Q,ae,ie),Ce.viewport(q.copy(he).multiplyScalar(Ae).round())},this.getScissor=function(U){return U.copy(we)},this.setScissor=function(U,Q,ae,ie){U.isVector4?we.set(U.x,U.y,U.z,U.w):we.set(U,Q,ae,ie),Ce.scissor(Y.copy(we).multiplyScalar(Ae).round())},this.getScissorTest=function(){return Ee},this.setScissorTest=function(U){Ce.setScissorTest(Ee=U)},this.setOpaqueSort=function(U){dt=U},this.setTransparentSort=function(U){vt=U},this.getClearColor=function(U){return U.copy(G.getClearColor())},this.setClearColor=function(){G.setClearColor(...arguments)},this.getClearAlpha=function(){return G.getClearAlpha()},this.setClearAlpha=function(){G.setClearAlpha(...arguments)},this.clear=function(U=!0,Q=!0,ae=!0){let ie=0;if(U){let ne=!1;if(H!==null){const ze=H.texture.format;ne=_.has(ze)}if(ne){const ze=H.texture.type,Xe=v.has(ze),Fe=G.getClearColor(),Ue=G.getClearAlpha(),Oe=Fe.r,mt=Fe.g,ut=Fe.b;Xe?(S[0]=Oe,S[1]=mt,S[2]=ut,S[3]=Ue,k.clearBufferuiv(k.COLOR,0,S)):(b[0]=Oe,b[1]=mt,b[2]=ut,b[3]=Ue,k.clearBufferiv(k.COLOR,0,b))}else ie|=k.COLOR_BUFFER_BIT}Q&&(ie|=k.DEPTH_BUFFER_BIT),ae&&(ie|=k.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ie!==0&&k.clear(ie)},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(){t.removeEventListener("webglcontextlost",We,!1),t.removeEventListener("webglcontextrestored",ct,!1),t.removeEventListener("webglcontextcreationerror",Pt,!1),G.dispose(),ht.dispose(),Me.dispose(),I.dispose(),le.dispose(),Qe.dispose(),be.dispose(),Ve.dispose(),Ne.dispose(),fe.dispose(),fe.removeEventListener("sessionstart",$s),fe.removeEventListener("sessionend",Ul),ri.stop()};function We(U){U.preventDefault(),fl("WebGLRenderer: Context Lost."),B=!0}function ct(){fl("WebGLRenderer: Context Restored."),B=!1;const U=O.autoReset,Q=$e.enabled,ae=$e.autoUpdate,ie=$e.needsUpdate,ne=$e.type;Te(),O.autoReset=U,$e.enabled=Q,$e.autoUpdate=ae,$e.needsUpdate=ie,$e.type=ne}function Pt(U){ot("WebGLRenderer: A WebGL context could not be created. Reason: ",U.statusMessage)}function Ct(U){const Q=U.target;Q.removeEventListener("dispose",Ct),xn(Q)}function xn(U){Tn(U),I.remove(U)}function Tn(U){const Q=I.get(U).programs;Q!==void 0&&(Q.forEach(function(ae){Ne.releaseProgram(ae)}),U.isShaderMaterial&&Ne.releaseShaderCache(U))}this.renderBufferDirect=function(U,Q,ae,ie,ne,ze){Q===null&&(Q=_e);const Xe=ne.isMesh&&ne.matrixWorld.determinant()<0,Fe=sd(U,Q,ae,ie,ne);Ce.setMaterial(ie,Xe);let Ue=ae.index,Oe=1;if(ie.wireframe===!0){if(Ue=de.getWireframeAttribute(ae),Ue===void 0)return;Oe=2}const mt=ae.drawRange,ut=ae.attributes.position;let Ze=mt.start*Oe,It=(mt.start+mt.count)*Oe;ze!==null&&(Ze=Math.max(Ze,ze.start*Oe),It=Math.min(It,(ze.start+ze.count)*Oe)),Ue!==null?(Ze=Math.max(Ze,0),It=Math.min(It,Ue.count)):ut!=null&&(Ze=Math.max(Ze,0),It=Math.min(It,ut.count));const Gt=It-Ze;if(Gt<0||Gt===1/0)return;be.setup(ne,ie,Fe,ae,Ue);let Rt,Nt=Pe;if(Ue!==null&&(Rt=me.get(Ue),Nt=W,Nt.setIndex(Rt)),ne.isMesh)ie.wireframe===!0?(Ce.setLineWidth(ie.wireframeLinewidth*Ie()),Nt.setMode(k.LINES)):Nt.setMode(k.TRIANGLES);else if(ne.isLine){let fn=ie.linewidth;fn===void 0&&(fn=1),Ce.setLineWidth(fn*Ie()),ne.isLineSegments?Nt.setMode(k.LINES):ne.isLineLoop?Nt.setMode(k.LINE_LOOP):Nt.setMode(k.LINE_STRIP)}else ne.isPoints?Nt.setMode(k.POINTS):ne.isSprite&&Nt.setMode(k.TRIANGLES);if(ne.isBatchedMesh)if(ne._multiDrawInstances!==null)pl("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Nt.renderMultiDrawInstances(ne._multiDrawStarts,ne._multiDrawCounts,ne._multiDrawCount,ne._multiDrawInstances);else if(Be.get("WEBGL_multi_draw"))Nt.renderMultiDraw(ne._multiDrawStarts,ne._multiDrawCounts,ne._multiDrawCount);else{const fn=ne._multiDrawStarts,nt=ne._multiDrawCounts,vn=ne._multiDrawCount,Lt=Ue?me.get(Ue).bytesPerElement:1,Jt=I.get(ie).currentProgram.getUniforms();for(let gi=0;gi<vn;gi++)Jt.setValue(k,"_gl_DrawID",gi),Nt.render(fn[gi]/Lt,nt[gi])}else if(ne.isInstancedMesh)Nt.renderInstances(Ze,Gt,ne.count);else if(ae.isInstancedBufferGeometry){const fn=ae._maxInstanceCount!==void 0?ae._maxInstanceCount:1/0,nt=Math.min(ae.instanceCount,fn);Nt.renderInstances(Ze,Gt,nt)}else Nt.render(Ze,Gt)};function Dl(U,Q,ae){U.transparent===!0&&U.side===hn&&U.forceSinglePass===!1?(U.side=jn,U.needsUpdate=!0,to(U,Q,ae),U.side=Cr,U.needsUpdate=!0,to(U,Q,ae),U.side=hn):to(U,Q,ae)}this.compile=function(U,Q,ae=null){ae===null&&(ae=U),P=Me.get(ae),P.init(Q),N.push(P),ae.traverseVisible(function(ne){ne.isLight&&ne.layers.test(Q.layers)&&(P.pushLight(ne),ne.castShadow&&P.pushShadow(ne))}),U!==ae&&U.traverseVisible(function(ne){ne.isLight&&ne.layers.test(Q.layers)&&(P.pushLight(ne),ne.castShadow&&P.pushShadow(ne))}),P.setupLights();const ie=new Set;return U.traverse(function(ne){if(!(ne.isMesh||ne.isPoints||ne.isLine||ne.isSprite))return;const ze=ne.material;if(ze)if(Array.isArray(ze))for(let Xe=0;Xe<ze.length;Xe++){const Fe=ze[Xe];Dl(Fe,ae,ne),ie.add(Fe)}else Dl(ze,ae,ne),ie.add(ze)}),P=N.pop(),ie},this.compileAsync=function(U,Q,ae=null){const ie=this.compile(U,Q,ae);return new Promise(ne=>{function ze(){if(ie.forEach(function(Xe){I.get(Xe).currentProgram.isReady()&&ie.delete(Xe)}),ie.size===0){ne(U);return}setTimeout(ze,10)}Be.get("KHR_parallel_shader_compile")!==null?ze():setTimeout(ze,10)})};let aa=null;function Nl(U){aa&&aa(U)}function $s(){ri.stop()}function Ul(){ri.start()}const ri=new __;ri.setAnimationLoop(Nl),typeof self<"u"&&ri.setContext(self),this.setAnimationLoop=function(U){aa=U,fe.setAnimationLoop(U),U===null?ri.stop():ri.start()},fe.addEventListener("sessionstart",$s),fe.addEventListener("sessionend",Ul),this.render=function(U,Q){if(Q!==void 0&&Q.isCamera!==!0){ot("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(B===!0)return;const ae=fe.enabled===!0&&fe.isPresenting===!0,ie=A!==null&&(H===null||ae)&&A.begin(R,H);if(U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),Q.parent===null&&Q.matrixWorldAutoUpdate===!0&&Q.updateMatrixWorld(),fe.enabled===!0&&fe.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(fe.cameraAutoUpdate===!0&&fe.updateCamera(Q),Q=fe.getCamera()),U.isScene===!0&&U.onBeforeRender(R,U,Q,H),P=Me.get(U,N.length),P.init(Q),N.push(P),_t.multiplyMatrices(Q.projectionMatrix,Q.matrixWorldInverse),rt.setFromProjectionMatrix(_t,di,Q.reversedDepth),De=this.localClippingEnabled,He=Re.init(this.clippingPlanes,De),E=ht.get(U,D.length),E.init(),D.push(E),fe.enabled===!0&&fe.isPresenting===!0){const Xe=R.xr.getDepthSensingMesh();Xe!==null&&la(Xe,Q,-1/0,R.sortObjects)}la(U,Q,0,R.sortObjects),E.finish(),R.sortObjects===!0&&E.sort(dt,vt),ye=fe.enabled===!1||fe.isPresenting===!1||fe.hasDepthSensing()===!1,ye&&G.addToRenderList(E,U),this.info.render.frame++,He===!0&&Re.beginShadows();const ne=P.state.shadowsArray;if($e.render(ne,U,Q),He===!0&&Re.endShadows(),this.info.autoReset===!0&&this.info.reset(),(ie&&A.hasRenderPass())===!1){const Xe=E.opaque,Fe=E.transmissive;if(P.setupLights(),Q.isArrayCamera){const Ue=Q.cameras;if(Fe.length>0)for(let Oe=0,mt=Ue.length;Oe<mt;Oe++){const ut=Ue[Oe];Fl(Xe,Fe,U,ut)}ye&&G.render(U);for(let Oe=0,mt=Ue.length;Oe<mt;Oe++){const ut=Ue[Oe];Ol(E,U,ut,ut.viewport)}}else Fe.length>0&&Fl(Xe,Fe,U,Q),ye&&G.render(U),Ol(E,U,Q)}H!==null&&V===0&&(Z.updateMultisampleRenderTarget(H),Z.updateRenderTargetMipmap(H)),ie&&A.end(R),U.isScene===!0&&U.onAfterRender(R,U,Q),be.resetDefaultState(),j=-1,X=null,N.pop(),N.length>0?(P=N[N.length-1],He===!0&&Re.setGlobalState(R.clippingPlanes,P.state.camera)):P=null,D.pop(),D.length>0?E=D[D.length-1]:E=null};function la(U,Q,ae,ie){if(U.visible===!1)return;if(U.layers.test(Q.layers)){if(U.isGroup)ae=U.renderOrder;else if(U.isLOD)U.autoUpdate===!0&&U.update(Q);else if(U.isLight)P.pushLight(U),U.castShadow&&P.pushShadow(U);else if(U.isSprite){if(!U.frustumCulled||rt.intersectsSprite(U)){ie&&xe.setFromMatrixPosition(U.matrixWorld).applyMatrix4(_t);const Xe=Qe.update(U),Fe=U.material;Fe.visible&&E.push(U,Xe,Fe,ae,xe.z,null)}}else if((U.isMesh||U.isLine||U.isPoints)&&(!U.frustumCulled||rt.intersectsObject(U))){const Xe=Qe.update(U),Fe=U.material;if(ie&&(U.boundingSphere!==void 0?(U.boundingSphere===null&&U.computeBoundingSphere(),xe.copy(U.boundingSphere.center)):(Xe.boundingSphere===null&&Xe.computeBoundingSphere(),xe.copy(Xe.boundingSphere.center)),xe.applyMatrix4(U.matrixWorld).applyMatrix4(_t)),Array.isArray(Fe)){const Ue=Xe.groups;for(let Oe=0,mt=Ue.length;Oe<mt;Oe++){const ut=Ue[Oe],Ze=Fe[ut.materialIndex];Ze&&Ze.visible&&E.push(U,Xe,Ze,ae,xe.z,ut)}}else Fe.visible&&E.push(U,Xe,Fe,ae,xe.z,null)}}const ze=U.children;for(let Xe=0,Fe=ze.length;Xe<Fe;Xe++)la(ze[Xe],Q,ae,ie)}function Ol(U,Q,ae,ie){const{opaque:ne,transmissive:ze,transparent:Xe}=U;P.setupLightsView(ae),He===!0&&Re.setGlobalState(R.clippingPlanes,ae),ie&&Ce.viewport(q.copy(ie)),ne.length>0&&eo(ne,Q,ae),ze.length>0&&eo(ze,Q,ae),Xe.length>0&&eo(Xe,Q,ae),Ce.buffers.depth.setTest(!0),Ce.buffers.depth.setMask(!0),Ce.buffers.color.setMask(!0),Ce.setPolygonOffset(!1)}function Fl(U,Q,ae,ie){if((ae.isScene===!0?ae.overrideMaterial:null)!==null)return;if(P.state.transmissionRenderTarget[ie.id]===void 0){const Ze=Be.has("EXT_color_buffer_half_float")||Be.has("EXT_color_buffer_float");P.state.transmissionRenderTarget[ie.id]=new ni(1,1,{generateMipmaps:!0,type:Ze?Hi:Hn,minFilter:ir,samples:Math.max(4,at.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Dt.workingColorSpace})}const ze=P.state.transmissionRenderTarget[ie.id],Xe=ie.viewport||q;ze.setSize(Xe.z*R.transmissionResolutionScale,Xe.w*R.transmissionResolutionScale);const Fe=R.getRenderTarget(),Ue=R.getActiveCubeFace(),Oe=R.getActiveMipmapLevel();R.setRenderTarget(ze),R.getClearColor(te),oe=R.getClearAlpha(),oe<1&&R.setClearColor(16777215,.5),R.clear(),ye&&G.render(ae);const mt=R.toneMapping;R.toneMapping=Ci;const ut=ie.viewport;if(ie.viewport!==void 0&&(ie.viewport=void 0),P.setupLightsView(ie),He===!0&&Re.setGlobalState(R.clippingPlanes,ie),eo(U,ae,ie),Z.updateMultisampleRenderTarget(ze),Z.updateRenderTargetMipmap(ze),Be.has("WEBGL_multisampled_render_to_texture")===!1){let Ze=!1;for(let It=0,Gt=Q.length;It<Gt;It++){const Rt=Q[It],{object:Nt,geometry:fn,material:nt,group:vn}=Rt;if(nt.side===hn&&Nt.layers.test(ie.layers)){const Lt=nt.side;nt.side=jn,nt.needsUpdate=!0,Bl(Nt,ae,ie,fn,nt,vn),nt.side=Lt,nt.needsUpdate=!0,Ze=!0}}Ze===!0&&(Z.updateMultisampleRenderTarget(ze),Z.updateRenderTargetMipmap(ze))}R.setRenderTarget(Fe,Ue,Oe),R.setClearColor(te,oe),ut!==void 0&&(ie.viewport=ut),R.toneMapping=mt}function eo(U,Q,ae){const ie=Q.isScene===!0?Q.overrideMaterial:null;for(let ne=0,ze=U.length;ne<ze;ne++){const Xe=U[ne],{object:Fe,geometry:Ue,group:Oe}=Xe;let mt=Xe.material;mt.allowOverride===!0&&ie!==null&&(mt=ie),Fe.layers.test(ae.layers)&&Bl(Fe,Q,ae,Ue,mt,Oe)}}function Bl(U,Q,ae,ie,ne,ze){U.onBeforeRender(R,Q,ae,ie,ne,ze),U.modelViewMatrix.multiplyMatrices(ae.matrixWorldInverse,U.matrixWorld),U.normalMatrix.getNormalMatrix(U.modelViewMatrix),ne.onBeforeRender(R,Q,ae,ie,U,ze),ne.transparent===!0&&ne.side===hn&&ne.forceSinglePass===!1?(ne.side=jn,ne.needsUpdate=!0,R.renderBufferDirect(ae,Q,ie,ne,U,ze),ne.side=Cr,ne.needsUpdate=!0,R.renderBufferDirect(ae,Q,ie,ne,U,ze),ne.side=hn):R.renderBufferDirect(ae,Q,ie,ne,U,ze),U.onAfterRender(R,Q,ae,ie,ne,ze)}function to(U,Q,ae){Q.isScene!==!0&&(Q=_e);const ie=I.get(U),ne=P.state.lights,ze=P.state.shadowsArray,Xe=ne.state.version,Fe=Ne.getParameters(U,ne.state,ze,Q,ae),Ue=Ne.getProgramCacheKey(Fe);let Oe=ie.programs;ie.environment=U.isMeshStandardMaterial||U.isMeshLambertMaterial||U.isMeshPhongMaterial?Q.environment:null,ie.fog=Q.fog;const mt=U.isMeshStandardMaterial||U.isMeshLambertMaterial&&!U.envMap||U.isMeshPhongMaterial&&!U.envMap;ie.envMap=le.get(U.envMap||ie.environment,mt),ie.envMapRotation=ie.environment!==null&&U.envMap===null?Q.environmentRotation:U.envMapRotation,Oe===void 0&&(U.addEventListener("dispose",Ct),Oe=new Map,ie.programs=Oe);let ut=Oe.get(Ue);if(ut!==void 0){if(ie.currentProgram===ut&&ie.lightsStateVersion===Xe)return ca(U,Fe),ut}else Fe.uniforms=Ne.getUniforms(U),U.onBeforeCompile(Fe,R),ut=Ne.acquireProgram(Fe,Ue),Oe.set(Ue,ut),ie.uniforms=Fe.uniforms;const Ze=ie.uniforms;return(!U.isShaderMaterial&&!U.isRawShaderMaterial||U.clipping===!0)&&(Ze.clippingPlanes=Re.uniform),ca(U,Fe),ie.needsLights=ad(U),ie.lightsStateVersion=Xe,ie.needsLights&&(Ze.ambientLightColor.value=ne.state.ambient,Ze.lightProbe.value=ne.state.probe,Ze.directionalLights.value=ne.state.directional,Ze.directionalLightShadows.value=ne.state.directionalShadow,Ze.spotLights.value=ne.state.spot,Ze.spotLightShadows.value=ne.state.spotShadow,Ze.rectAreaLights.value=ne.state.rectArea,Ze.ltc_1.value=ne.state.rectAreaLTC1,Ze.ltc_2.value=ne.state.rectAreaLTC2,Ze.pointLights.value=ne.state.point,Ze.pointLightShadows.value=ne.state.pointShadow,Ze.hemisphereLights.value=ne.state.hemi,Ze.directionalShadowMatrix.value=ne.state.directionalShadowMatrix,Ze.spotLightMatrix.value=ne.state.spotLightMatrix,Ze.spotLightMap.value=ne.state.spotLightMap,Ze.pointShadowMatrix.value=ne.state.pointShadowMatrix),ie.currentProgram=ut,ie.uniformsList=null,ut}function kl(U){if(U.uniformsList===null){const Q=U.currentProgram.getUniforms();U.uniformsList=Tu.seqWithValue(Q.seq,U.uniforms)}return U.uniformsList}function ca(U,Q){const ae=I.get(U);ae.outputColorSpace=Q.outputColorSpace,ae.batching=Q.batching,ae.batchingColor=Q.batchingColor,ae.instancing=Q.instancing,ae.instancingColor=Q.instancingColor,ae.instancingMorph=Q.instancingMorph,ae.skinning=Q.skinning,ae.morphTargets=Q.morphTargets,ae.morphNormals=Q.morphNormals,ae.morphColors=Q.morphColors,ae.morphTargetsCount=Q.morphTargetsCount,ae.numClippingPlanes=Q.numClippingPlanes,ae.numIntersection=Q.numClipIntersection,ae.vertexAlphas=Q.vertexAlphas,ae.vertexTangents=Q.vertexTangents,ae.toneMapping=Q.toneMapping}function sd(U,Q,ae,ie,ne){Q.isScene!==!0&&(Q=_e),Z.resetTextureUnits();const ze=Q.fog,Xe=ie.isMeshStandardMaterial||ie.isMeshLambertMaterial||ie.isMeshPhongMaterial?Q.environment:null,Fe=H===null?R.outputColorSpace:H.isXRRenderTarget===!0?H.texture.colorSpace:Gs,Ue=ie.isMeshStandardMaterial||ie.isMeshLambertMaterial&&!ie.envMap||ie.isMeshPhongMaterial&&!ie.envMap,Oe=le.get(ie.envMap||Xe,Ue),mt=ie.vertexColors===!0&&!!ae.attributes.color&&ae.attributes.color.itemSize===4,ut=!!ae.attributes.tangent&&(!!ie.normalMap||ie.anisotropy>0),Ze=!!ae.morphAttributes.position,It=!!ae.morphAttributes.normal,Gt=!!ae.morphAttributes.color;let Rt=Ci;ie.toneMapped&&(H===null||H.isXRRenderTarget===!0)&&(Rt=R.toneMapping);const Nt=ae.morphAttributes.position||ae.morphAttributes.normal||ae.morphAttributes.color,fn=Nt!==void 0?Nt.length:0,nt=I.get(ie),vn=P.state.lights;if(He===!0&&(De===!0||U!==X)){const Kt=U===X&&ie.id===j;Re.setState(ie,U,Kt)}let Lt=!1;ie.version===nt.__version?(nt.needsLights&&nt.lightsStateVersion!==vn.state.version||nt.outputColorSpace!==Fe||ne.isBatchedMesh&&nt.batching===!1||!ne.isBatchedMesh&&nt.batching===!0||ne.isBatchedMesh&&nt.batchingColor===!0&&ne.colorTexture===null||ne.isBatchedMesh&&nt.batchingColor===!1&&ne.colorTexture!==null||ne.isInstancedMesh&&nt.instancing===!1||!ne.isInstancedMesh&&nt.instancing===!0||ne.isSkinnedMesh&&nt.skinning===!1||!ne.isSkinnedMesh&&nt.skinning===!0||ne.isInstancedMesh&&nt.instancingColor===!0&&ne.instanceColor===null||ne.isInstancedMesh&&nt.instancingColor===!1&&ne.instanceColor!==null||ne.isInstancedMesh&&nt.instancingMorph===!0&&ne.morphTexture===null||ne.isInstancedMesh&&nt.instancingMorph===!1&&ne.morphTexture!==null||nt.envMap!==Oe||ie.fog===!0&&nt.fog!==ze||nt.numClippingPlanes!==void 0&&(nt.numClippingPlanes!==Re.numPlanes||nt.numIntersection!==Re.numIntersection)||nt.vertexAlphas!==mt||nt.vertexTangents!==ut||nt.morphTargets!==Ze||nt.morphNormals!==It||nt.morphColors!==Gt||nt.toneMapping!==Rt||nt.morphTargetsCount!==fn)&&(Lt=!0):(Lt=!0,nt.__version=ie.version);let Jt=nt.currentProgram;Lt===!0&&(Jt=to(ie,Q,ne));let gi=!1,ur=!1,Ir=!1;const Ft=Jt.getUniforms(),en=nt.uniforms;if(Ce.useProgram(Jt.program)&&(gi=!0,ur=!0,Ir=!0),ie.id!==j&&(j=ie.id,ur=!0),gi||X!==U){Ce.buffers.depth.getReversed()&&U.reversedDepth!==!0&&(U._reversedDepth=!0,U.updateProjectionMatrix()),Ft.setValue(k,"projectionMatrix",U.projectionMatrix),Ft.setValue(k,"viewMatrix",U.matrixWorldInverse);const ji=Ft.map.cameraPosition;ji!==void 0&&ji.setValue(k,Je.setFromMatrixPosition(U.matrixWorld)),at.logarithmicDepthBuffer&&Ft.setValue(k,"logDepthBufFC",2/(Math.log(U.far+1)/Math.LN2)),(ie.isMeshPhongMaterial||ie.isMeshToonMaterial||ie.isMeshLambertMaterial||ie.isMeshBasicMaterial||ie.isMeshStandardMaterial||ie.isShaderMaterial)&&Ft.setValue(k,"isOrthographic",U.isOrthographicCamera===!0),X!==U&&(X=U,ur=!0,Ir=!0)}if(nt.needsLights&&(vn.state.directionalShadowMap.length>0&&Ft.setValue(k,"directionalShadowMap",vn.state.directionalShadowMap,Z),vn.state.spotShadowMap.length>0&&Ft.setValue(k,"spotShadowMap",vn.state.spotShadowMap,Z),vn.state.pointShadowMap.length>0&&Ft.setValue(k,"pointShadowMap",vn.state.pointShadowMap,Z)),ne.isSkinnedMesh){Ft.setOptional(k,ne,"bindMatrix"),Ft.setOptional(k,ne,"bindMatrixInverse");const Kt=ne.skeleton;Kt&&(Kt.boneTexture===null&&Kt.computeBoneTexture(),Ft.setValue(k,"boneTexture",Kt.boneTexture,Z))}ne.isBatchedMesh&&(Ft.setOptional(k,ne,"batchingTexture"),Ft.setValue(k,"batchingTexture",ne._matricesTexture,Z),Ft.setOptional(k,ne,"batchingIdTexture"),Ft.setValue(k,"batchingIdTexture",ne._indirectTexture,Z),Ft.setOptional(k,ne,"batchingColorTexture"),ne._colorsTexture!==null&&Ft.setValue(k,"batchingColorTexture",ne._colorsTexture,Z));const Yn=ae.morphAttributes;if((Yn.position!==void 0||Yn.normal!==void 0||Yn.color!==void 0)&&se.update(ne,ae,Jt),(ur||nt.receiveShadow!==ne.receiveShadow)&&(nt.receiveShadow=ne.receiveShadow,Ft.setValue(k,"receiveShadow",ne.receiveShadow)),(ie.isMeshStandardMaterial||ie.isMeshLambertMaterial||ie.isMeshPhongMaterial)&&ie.envMap===null&&Q.environment!==null&&(en.envMapIntensity.value=Q.environmentIntensity),en.dfgLUT!==void 0&&(en.dfgLUT.value=mR()),ur&&(Ft.setValue(k,"toneMappingExposure",R.toneMappingExposure),nt.needsLights&&od(en,Ir),ze&&ie.fog===!0&&it.refreshFogUniforms(en,ze),it.refreshMaterialUniforms(en,ie,Ae,ve,P.state.transmissionRenderTarget[U.id]),Tu.upload(k,kl(nt),en,Z)),ie.isShaderMaterial&&ie.uniformsNeedUpdate===!0&&(Tu.upload(k,kl(nt),en,Z),ie.uniformsNeedUpdate=!1),ie.isSpriteMaterial&&Ft.setValue(k,"center",ne.center),Ft.setValue(k,"modelViewMatrix",ne.modelViewMatrix),Ft.setValue(k,"normalMatrix",ne.normalMatrix),Ft.setValue(k,"modelMatrix",ne.matrixWorld),ie.isShaderMaterial||ie.isRawShaderMaterial){const Kt=ie.uniformsGroups;for(let ji=0,Pr=Kt.length;ji<Pr;ji++){const no=Kt[ji];Ve.update(no,Jt),Ve.bind(no,Jt)}}return Jt}function od(U,Q){U.ambientLightColor.needsUpdate=Q,U.lightProbe.needsUpdate=Q,U.directionalLights.needsUpdate=Q,U.directionalLightShadows.needsUpdate=Q,U.pointLights.needsUpdate=Q,U.pointLightShadows.needsUpdate=Q,U.spotLights.needsUpdate=Q,U.spotLightShadows.needsUpdate=Q,U.rectAreaLights.needsUpdate=Q,U.hemisphereLights.needsUpdate=Q}function ad(U){return U.isMeshLambertMaterial||U.isMeshToonMaterial||U.isMeshPhongMaterial||U.isMeshStandardMaterial||U.isShadowMaterial||U.isShaderMaterial&&U.lights===!0}this.getActiveCubeFace=function(){return L},this.getActiveMipmapLevel=function(){return V},this.getRenderTarget=function(){return H},this.setRenderTargetTextures=function(U,Q,ae){const ie=I.get(U);ie.__autoAllocateDepthBuffer=U.resolveDepthBuffer===!1,ie.__autoAllocateDepthBuffer===!1&&(ie.__useRenderToTexture=!1),I.get(U.texture).__webglTexture=Q,I.get(U.depthTexture).__webglTexture=ie.__autoAllocateDepthBuffer?void 0:ae,ie.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(U,Q){const ae=I.get(U);ae.__webglFramebuffer=Q,ae.__useDefaultFramebuffer=Q===void 0};const ld=k.createFramebuffer();this.setRenderTarget=function(U,Q=0,ae=0){H=U,L=Q,V=ae;let ie=null,ne=!1,ze=!1;if(U){const Fe=I.get(U);if(Fe.__useDefaultFramebuffer!==void 0){Ce.bindFramebuffer(k.FRAMEBUFFER,Fe.__webglFramebuffer),q.copy(U.viewport),Y.copy(U.scissor),J=U.scissorTest,Ce.viewport(q),Ce.scissor(Y),Ce.setScissorTest(J),j=-1;return}else if(Fe.__webglFramebuffer===void 0)Z.setupRenderTarget(U);else if(Fe.__hasExternalTextures)Z.rebindTextures(U,I.get(U.texture).__webglTexture,I.get(U.depthTexture).__webglTexture);else if(U.depthBuffer){const mt=U.depthTexture;if(Fe.__boundDepthTexture!==mt){if(mt!==null&&I.has(mt)&&(U.width!==mt.image.width||U.height!==mt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Z.setupDepthRenderbuffer(U)}}const Ue=U.texture;(Ue.isData3DTexture||Ue.isDataArrayTexture||Ue.isCompressedArrayTexture)&&(ze=!0);const Oe=I.get(U).__webglFramebuffer;U.isWebGLCubeRenderTarget?(Array.isArray(Oe[Q])?ie=Oe[Q][ae]:ie=Oe[Q],ne=!0):U.samples>0&&Z.useMultisampledRTT(U)===!1?ie=I.get(U).__webglMultisampledFramebuffer:Array.isArray(Oe)?ie=Oe[ae]:ie=Oe,q.copy(U.viewport),Y.copy(U.scissor),J=U.scissorTest}else q.copy(he).multiplyScalar(Ae).floor(),Y.copy(we).multiplyScalar(Ae).floor(),J=Ee;if(ae!==0&&(ie=ld),Ce.bindFramebuffer(k.FRAMEBUFFER,ie)&&Ce.drawBuffers(U,ie),Ce.viewport(q),Ce.scissor(Y),Ce.setScissorTest(J),ne){const Fe=I.get(U.texture);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Fe.__webglTexture,ae)}else if(ze){const Fe=Q;for(let Ue=0;Ue<U.textures.length;Ue++){const Oe=I.get(U.textures[Ue]);k.framebufferTextureLayer(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0+Ue,Oe.__webglTexture,ae,Fe)}}else if(U!==null&&ae!==0){const Fe=I.get(U.texture);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,Fe.__webglTexture,ae)}j=-1},this.readRenderTargetPixels=function(U,Q,ae,ie,ne,ze,Xe,Fe=0){if(!(U&&U.isWebGLRenderTarget)){ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ue=I.get(U).__webglFramebuffer;if(U.isWebGLCubeRenderTarget&&Xe!==void 0&&(Ue=Ue[Xe]),Ue){Ce.bindFramebuffer(k.FRAMEBUFFER,Ue);try{const Oe=U.textures[Fe],mt=Oe.format,ut=Oe.type;if(U.textures.length>1&&k.readBuffer(k.COLOR_ATTACHMENT0+Fe),!at.textureFormatReadable(mt)){ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!at.textureTypeReadable(ut)){ot("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Q>=0&&Q<=U.width-ie&&ae>=0&&ae<=U.height-ne&&k.readPixels(Q,ae,ie,ne,Se.convert(mt),Se.convert(ut),ze)}finally{const Oe=H!==null?I.get(H).__webglFramebuffer:null;Ce.bindFramebuffer(k.FRAMEBUFFER,Oe)}}},this.readRenderTargetPixelsAsync=async function(U,Q,ae,ie,ne,ze,Xe,Fe=0){if(!(U&&U.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ue=I.get(U).__webglFramebuffer;if(U.isWebGLCubeRenderTarget&&Xe!==void 0&&(Ue=Ue[Xe]),Ue)if(Q>=0&&Q<=U.width-ie&&ae>=0&&ae<=U.height-ne){Ce.bindFramebuffer(k.FRAMEBUFFER,Ue);const Oe=U.textures[Fe],mt=Oe.format,ut=Oe.type;if(U.textures.length>1&&k.readBuffer(k.COLOR_ATTACHMENT0+Fe),!at.textureFormatReadable(mt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!at.textureTypeReadable(ut))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ze=k.createBuffer();k.bindBuffer(k.PIXEL_PACK_BUFFER,Ze),k.bufferData(k.PIXEL_PACK_BUFFER,ze.byteLength,k.STREAM_READ),k.readPixels(Q,ae,ie,ne,Se.convert(mt),Se.convert(ut),0);const It=H!==null?I.get(H).__webglFramebuffer:null;Ce.bindFramebuffer(k.FRAMEBUFFER,It);const Gt=k.fenceSync(k.SYNC_GPU_COMMANDS_COMPLETE,0);return k.flush(),await T1(k,Gt,4),k.bindBuffer(k.PIXEL_PACK_BUFFER,Ze),k.getBufferSubData(k.PIXEL_PACK_BUFFER,0,ze),k.deleteBuffer(Ze),k.deleteSync(Gt),ze}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(U,Q=null,ae=0){const ie=Math.pow(2,-ae),ne=Math.floor(U.image.width*ie),ze=Math.floor(U.image.height*ie),Xe=Q!==null?Q.x:0,Fe=Q!==null?Q.y:0;Z.setTexture2D(U,0),k.copyTexSubImage2D(k.TEXTURE_2D,ae,0,0,Xe,Fe,ne,ze),Ce.unbindTexture()};const cd=k.createFramebuffer(),ud=k.createFramebuffer();this.copyTextureToTexture=function(U,Q,ae=null,ie=null,ne=0,ze=0){let Xe,Fe,Ue,Oe,mt,ut,Ze,It,Gt;const Rt=U.isCompressedTexture?U.mipmaps[ze]:U.image;if(ae!==null)Xe=ae.max.x-ae.min.x,Fe=ae.max.y-ae.min.y,Ue=ae.isBox3?ae.max.z-ae.min.z:1,Oe=ae.min.x,mt=ae.min.y,ut=ae.isBox3?ae.min.z:0;else{const en=Math.pow(2,-ne);Xe=Math.floor(Rt.width*en),Fe=Math.floor(Rt.height*en),U.isDataArrayTexture?Ue=Rt.depth:U.isData3DTexture?Ue=Math.floor(Rt.depth*en):Ue=1,Oe=0,mt=0,ut=0}ie!==null?(Ze=ie.x,It=ie.y,Gt=ie.z):(Ze=0,It=0,Gt=0);const Nt=Se.convert(Q.format),fn=Se.convert(Q.type);let nt;Q.isData3DTexture?(Z.setTexture3D(Q,0),nt=k.TEXTURE_3D):Q.isDataArrayTexture||Q.isCompressedArrayTexture?(Z.setTexture2DArray(Q,0),nt=k.TEXTURE_2D_ARRAY):(Z.setTexture2D(Q,0),nt=k.TEXTURE_2D),k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,Q.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Q.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,Q.unpackAlignment);const vn=k.getParameter(k.UNPACK_ROW_LENGTH),Lt=k.getParameter(k.UNPACK_IMAGE_HEIGHT),Jt=k.getParameter(k.UNPACK_SKIP_PIXELS),gi=k.getParameter(k.UNPACK_SKIP_ROWS),ur=k.getParameter(k.UNPACK_SKIP_IMAGES);k.pixelStorei(k.UNPACK_ROW_LENGTH,Rt.width),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,Rt.height),k.pixelStorei(k.UNPACK_SKIP_PIXELS,Oe),k.pixelStorei(k.UNPACK_SKIP_ROWS,mt),k.pixelStorei(k.UNPACK_SKIP_IMAGES,ut);const Ir=U.isDataArrayTexture||U.isData3DTexture,Ft=Q.isDataArrayTexture||Q.isData3DTexture;if(U.isDepthTexture){const en=I.get(U),Yn=I.get(Q),Kt=I.get(en.__renderTarget),ji=I.get(Yn.__renderTarget);Ce.bindFramebuffer(k.READ_FRAMEBUFFER,Kt.__webglFramebuffer),Ce.bindFramebuffer(k.DRAW_FRAMEBUFFER,ji.__webglFramebuffer);for(let Pr=0;Pr<Ue;Pr++)Ir&&(k.framebufferTextureLayer(k.READ_FRAMEBUFFER,k.COLOR_ATTACHMENT0,I.get(U).__webglTexture,ne,ut+Pr),k.framebufferTextureLayer(k.DRAW_FRAMEBUFFER,k.COLOR_ATTACHMENT0,I.get(Q).__webglTexture,ze,Gt+Pr)),k.blitFramebuffer(Oe,mt,Xe,Fe,Ze,It,Xe,Fe,k.DEPTH_BUFFER_BIT,k.NEAREST);Ce.bindFramebuffer(k.READ_FRAMEBUFFER,null),Ce.bindFramebuffer(k.DRAW_FRAMEBUFFER,null)}else if(ne!==0||U.isRenderTargetTexture||I.has(U)){const en=I.get(U),Yn=I.get(Q);Ce.bindFramebuffer(k.READ_FRAMEBUFFER,cd),Ce.bindFramebuffer(k.DRAW_FRAMEBUFFER,ud);for(let Kt=0;Kt<Ue;Kt++)Ir?k.framebufferTextureLayer(k.READ_FRAMEBUFFER,k.COLOR_ATTACHMENT0,en.__webglTexture,ne,ut+Kt):k.framebufferTexture2D(k.READ_FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,en.__webglTexture,ne),Ft?k.framebufferTextureLayer(k.DRAW_FRAMEBUFFER,k.COLOR_ATTACHMENT0,Yn.__webglTexture,ze,Gt+Kt):k.framebufferTexture2D(k.DRAW_FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,Yn.__webglTexture,ze),ne!==0?k.blitFramebuffer(Oe,mt,Xe,Fe,Ze,It,Xe,Fe,k.COLOR_BUFFER_BIT,k.NEAREST):Ft?k.copyTexSubImage3D(nt,ze,Ze,It,Gt+Kt,Oe,mt,Xe,Fe):k.copyTexSubImage2D(nt,ze,Ze,It,Oe,mt,Xe,Fe);Ce.bindFramebuffer(k.READ_FRAMEBUFFER,null),Ce.bindFramebuffer(k.DRAW_FRAMEBUFFER,null)}else Ft?U.isDataTexture||U.isData3DTexture?k.texSubImage3D(nt,ze,Ze,It,Gt,Xe,Fe,Ue,Nt,fn,Rt.data):Q.isCompressedArrayTexture?k.compressedTexSubImage3D(nt,ze,Ze,It,Gt,Xe,Fe,Ue,Nt,Rt.data):k.texSubImage3D(nt,ze,Ze,It,Gt,Xe,Fe,Ue,Nt,fn,Rt):U.isDataTexture?k.texSubImage2D(k.TEXTURE_2D,ze,Ze,It,Xe,Fe,Nt,fn,Rt.data):U.isCompressedTexture?k.compressedTexSubImage2D(k.TEXTURE_2D,ze,Ze,It,Rt.width,Rt.height,Nt,Rt.data):k.texSubImage2D(k.TEXTURE_2D,ze,Ze,It,Xe,Fe,Nt,fn,Rt);k.pixelStorei(k.UNPACK_ROW_LENGTH,vn),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,Lt),k.pixelStorei(k.UNPACK_SKIP_PIXELS,Jt),k.pixelStorei(k.UNPACK_SKIP_ROWS,gi),k.pixelStorei(k.UNPACK_SKIP_IMAGES,ur),ze===0&&Q.generateMipmaps&&k.generateMipmap(nt),Ce.unbindTexture()},this.initRenderTarget=function(U){I.get(U).__webglFramebuffer===void 0&&Z.setupRenderTarget(U)},this.initTexture=function(U){U.isCubeTexture?Z.setTextureCube(U,0):U.isData3DTexture?Z.setTexture3D(U,0):U.isDataArrayTexture||U.isCompressedArrayTexture?Z.setTexture2DArray(U,0):Z.setTexture2D(U,0),
4049Ce.unbindTexture()},this.resetState=function(){L=0,V=0,H=null,Ce.reset(),be.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return di}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Dt._getDrawingBufferColorSpace(e),t.unpackColorSpace=Dt._getUnpackColorSpace()}}const gR=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Mh,AddEquation:qr,AddOperation:ty,AdditiveAnimationBlendMode:om,AdditiveBlending:Ep,AgXToneMapping:Kp,AlphaFormat:rm,AlwaysCompare:fy,AlwaysDepth:Pu,AlwaysStencilFunc:Ip,AmbientLight:o_,AnimationAction:g_,AnimationClip:_l,AnimationLoader:xw,AnimationMixer:Yw,AnimationObjectGroup:jw,AnimationUtils:fw,ArcCurve:Iy,ArrayCamera:d_,ArrowHelper:gE,AttachedBindMode:Cp,Audio:p_,AudioAnalyser:Uw,AudioContext:Lm,AudioListener:Lw,AudioLoader:Cw,AxesHelper:xE,BackSide:jn,BasicDepthPacking:oy,BasicShadowMap:Uv,BatchedMesh:wy,BezierInterpolant:$y,Bone:fm,BooleanKeyframeTrack:Js,Box2:eE,Box3:Fn,Box3Helper:pE,BoxGeometry:Zs,BoxHelper:fE,BufferAttribute:Ht,BufferGeometry:xt,BufferGeometryLoader:u_,ByteType:em,Cache:rr,Camera:Il,CameraHelper:dE,CanvasTexture:Db,CapsuleGeometry:Vh,CatmullRomCurve3:Py,CineonToneMapping:Zp,CircleGeometry:Gh,ClampToEdgeWrapping:ti,Clock:v_,Color:Ke,ColorKeyframeTrack:Cm,ColorManagement:Dt,Compatibility:S1,CompressedArrayTexture:Pb,CompressedCubeTexture:Lb,CompressedTexture:zh,CompressedTextureLoader:vw,ConeGeometry:Tl,ConstantAlphaFactor:Qv,ConstantColorFactor:Jv,Controls:yE,CubeCamera:h_,CubeDepthTexture:Cy,CubeReflectionMapping:or,CubeRefractionMapping:Qr,CubeTexture:wl,CubeTextureLoader:yw,CubeUVReflectionMapping:ta,CubicBezierCurve:xm,CubicBezierCurve3:Ly,CubicInterpolant:Ky,CullFaceBack:wp,CullFaceFront:Nv,CullFaceFrontBack:DM,CullFaceNone:Dv,Curve:Wi,CurvePath:Ny,CustomBlending:Ov,CustomToneMapping:Jp,CylinderGeometry:El,Cylindrical:$w,Data3DTexture:Nh,DataArrayTexture:Dh,DataTexture:Vi,DataTextureLoader:_w,DataUtils:rb,DecrementStencilOp:QM,DecrementWrapStencilOp:e1,DefaultLoadingManager:t_,DepthFormat:ar,DepthStencilFormat:Zr,DepthTexture:js,DetachedBindMode:ny,DirectionalLight:s_,DirectionalLightHelper:hE,DiscreteInterpolant:Qy,DodecahedronGeometry:Hh,DoubleSide:hn,DstAlphaFactor:jv,DstColorFactor:Yv,DynamicCopyUsage:m1,DynamicDrawUsage:c1,DynamicReadUsage:d1,EdgesGeometry:Ry,EllipseCurve:Wh,EqualCompare:uy,EqualDepth:Du,EqualStencilFunc:r1,EquirectangularReflectionMapping:Za,EquirectangularRefractionMapping:Ja,Euler:mi,EventDispatcher:lr,ExternalTexture:mm,ExtrudeGeometry:jh,FileLoader:Rr,Float16BufferAttribute:hb,Float32BufferAttribute:qe,FloatType:Un,Fog:Oh,FogExp2:Uh,FramebufferTexture:Ib,FrontSide:Cr,Frustum:na,FrustumArray:kh,GLBufferAttribute:Qw,GLSL1:x1,GLSL3:Pp,GreaterCompare:hy,GreaterDepth:Uu,GreaterEqualCompare:Lh,GreaterEqualDepth:Nu,GreaterEqualStencilFunc:l1,GreaterStencilFunc:o1,GridHelper:cE,Group:Ho,HalfFloatType:Hi,HemisphereLight:n_,HemisphereLightHelper:lE,IcosahedronGeometry:Xh,ImageBitmapLoader:Aw,ImageLoader:Sl,ImageUtils:xy,IncrementStencilOp:KM,IncrementWrapStencilOp:$M,InstancedBufferAttribute:Ko,InstancedBufferGeometry:c_,InstancedInterleavedBuffer:Kw,InstancedMesh:by,Int16BufferAttribute:cb,Int32BufferAttribute:ub,Int8BufferAttribute:ob,IntType:wh,InterleavedBuffer:Fh,InterleavedBufferAttribute:Ws,Interpolant:sa,InterpolateBezier:Rp,InterpolateDiscrete:ll,InterpolateLinear:mh,InterpolateSmooth:wu,InterpolationSamplingMode:_1,InterpolationSamplingType:y1,InvertStencilOp:t1,KeepStencilOp:Is,KeyframeTrack:Pi,LOD:Sy,LatheGeometry:Yh,Layers:Bs,LessCompare:cy,LessDepth:Lu,LessEqualCompare:Ph,LessEqualDepth:zs,LessEqualStencilFunc:s1,LessStencilFunc:i1,Light:rs,LightProbe:l_,Line:es,Line3:iE,LineBasicMaterial:Xn,LineCurve:vm,LineCurve3:Dy,LineDashedMaterial:Zy,LineLoop:Ey,LineSegments:cr,LinearFilter:Xt,LinearInterpolant:Am,LinearMipMapLinearFilter:BM,LinearMipMapNearestFilter:FM,LinearMipmapLinearFilter:ir,LinearMipmapNearestFilter:Ka,LinearSRGBColorSpace:Gs,LinearToneMapping:Yp,LinearTransfer:ul,Loader:ii,LoaderUtils:Op,LoadingManager:Rm,LoopOnce:iy,LoopPingPong:sy,LoopRepeat:ry,MOUSE:hi,Material:Bn,MaterialBlending:NM,MaterialLoader:$h,MathUtils:W1,Matrix2:Om,Matrix3:bt,Matrix4:yt,MaxEquation:zv,Mesh:dn,MeshBasicMaterial:ns,MeshDepthMaterial:wm,MeshDistanceMaterial:Em,MeshLambertMaterial:Yy,MeshMatcapMaterial:qy,MeshNormalMaterial:Xy,MeshPhongMaterial:Wy,MeshPhysicalMaterial:Hy,MeshStandardMaterial:bm,MeshToonMaterial:jy,MinEquation:kv,MirroredRepeatWrapping:al,MixOperation:ey,MultiplyBlending:Ap,MultiplyOperation:Ml,NearestFilter:an,NearestMipMapLinearFilter:OM,NearestMipMapNearestFilter:UM,NearestMipmapLinearFilter:Vo,NearestMipmapNearestFilter:$p,NeutralToneMapping:Qp,NeverCompare:ly,NeverDepth:Iu,NeverStencilFunc:n1,NoBlending:sr,NoColorSpace:br,NoNormalPacking:XM,NoToneMapping:Ci,NormalAnimationBlendMode:Ih,NormalBlending:Os,NormalGAPacking:qM,NormalRGPacking:YM,NotEqualCompare:dy,NotEqualDepth:Ou,NotEqualStencilFunc:a1,NumberKeyframeTrack:vl,Object3D:Ot,ObjectLoader:Ew,ObjectSpaceNormalMap:ay,OctahedronGeometry:Al,OneFactor:Gv,OneMinusConstantAlphaFactor:$v,OneMinusConstantColorFactor:Kv,OneMinusDstAlphaFactor:Xv,OneMinusDstColorFactor:qv,OneMinusSrcAlphaFactor:Ru,OneMinusSrcColorFactor:Wv,Orthogra
vendor: 15,168 bytes, line 4049
4049phicCamera:Gi,PCFShadowMap:jo,PCFSoftShadowMap:qa,PMREMGenerator:zp,Path:yh,PerspectiveCamera:Zt,Plane:Bi,PlaneGeometry:ia,PlaneHelper:mE,PointLight:r_,PointLightHelper:oE,Points:Ty,PointsMaterial:pm,PolarGridHelper:uE,PolyhedronGeometry:is,PositionalAudio:Nw,PropertyBinding:Ut,PropertyMixer:m_,QuadraticBezierCurve:ym,QuadraticBezierCurve3:_m,Quaternion:wn,QuaternionKeyframeTrack:Rl,QuaternionLinearInterpolant:e_,R11_EAC_Format:Wu,RED_GREEN_RGTC2_Format:fh,RED_RGTC1_Format:hh,REVISION:Sh,RG11_EAC_Format:Xu,RGBADepthPacking:HM,RGBAFormat:On,RGBAIntegerFormat:Rh,RGBA_ASTC_10x10_Format:sh,RGBA_ASTC_10x5_Format:nh,RGBA_ASTC_10x6_Format:ih,RGBA_ASTC_10x8_Format:rh,RGBA_ASTC_12x10_Format:oh,RGBA_ASTC_12x12_Format:ah,RGBA_ASTC_4x4_Format:qu,RGBA_ASTC_5x4_Format:Zu,RGBA_ASTC_5x5_Format:Ju,RGBA_ASTC_6x5_Format:Ku,RGBA_ASTC_6x6_Format:Qu,RGBA_ASTC_8x5_Format:$u,RGBA_ASTC_8x6_Format:eh,RGBA_ASTC_8x8_Format:th,RGBA_BPTC_Format:lh,RGBA_ETC2_EAC_Format:Hu,RGBA_PVRTC_2BPPV1_Format:zu,RGBA_PVRTC_4BPPV1_Format:ku,RGBA_S3TC_DXT1_Format:$a,RGBA_S3TC_DXT3_Format:el,RGBA_S3TC_DXT5_Format:tl,RGBDepthPacking:WM,RGBFormat:sm,RGBIntegerFormat:kM,RGB_BPTC_SIGNED_Format:ch,RGB_BPTC_UNSIGNED_Format:uh,RGB_ETC1_Format:Vu,RGB_ETC2_Format:Gu,RGB_PVRTC_2BPPV1_Format:Bu,RGB_PVRTC_4BPPV1_Format:Fu,RGB_S3TC_DXT1_Format:Qa,RGDepthPacking:jM,RGFormat:Vs,RGIntegerFormat:Ch,RawShaderMaterial:Mm,Ray:qs,Raycaster:x_,RectAreaLight:a_,RedFormat:Ah,RedIntegerFormat:bl,ReinhardToneMapping:qp,RenderTarget:lm,RenderTarget3D:qw,RepeatWrapping:ol,ReplaceStencilOp:JM,ReverseSubtractEquation:Bv,RingGeometry:qh,SIGNED_R11_EAC_Format:ju,SIGNED_RED_GREEN_RGTC2_Format:ph,SIGNED_RED_RGTC1_Format:dh,SIGNED_RG11_EAC_Format:Yu,SRGBColorSpace:$n,SRGBTransfer:Vt,Scene:cm,ShaderChunk:Et,ShaderLib:ki,ShaderMaterial:Ii,ShadowMaterial:zy,Shape:Ar,ShapeGeometry:ra,ShapePath:vE,ShapeUtils:zi,ShortType:tm,Skeleton:Bh,SkeletonHelper:sE,SkinnedMesh:My,Source:Jr,Sphere:En,SphereGeometry:Cl,Spherical:Bp,SphericalHarmonics3:Pm,SplineCurve:Sm,SpotLight:i_,SpotLightHelper:rE,Sprite:_y,SpriteMaterial:dm,SrcAlphaFactor:Cu,SrcAlphaSaturateFactor:Zv,SrcColorFactor:Hv,StaticCopyUsage:p1,StaticDrawUsage:hl,StaticReadUsage:h1,StereoCamera:Rw,StreamCopyUsage:g1,StreamDrawUsage:u1,StreamReadUsage:f1,StringKeyframeTrack:Ks,SubtractEquation:Fv,SubtractiveBlending:Tp,TOUCH:Fi,TangentSpaceNormalMap:ts,TetrahedronGeometry:Zh,Texture:rn,TextureLoader:Sw,TextureUtils:wE,Timer:f_,TimestampQuery:v1,TorusGeometry:Jh,TorusKnotGeometry:Kh,Triangle:ei,TriangleFanDrawMode:GM,TriangleStripDrawMode:VM,TrianglesDrawMode:zM,TubeGeometry:Qh,UVMapping:bh,Uint16BufferAttribute:um,Uint32BufferAttribute:hm,Uint8BufferAttribute:ab,Uint8ClampedBufferAttribute:lb,Uniform:Um,UniformsGroup:Jw,UniformsLib:Ge,UniformsUtils:Gy,UnsignedByteType:Hn,UnsignedInt101111Type:im,UnsignedInt248Type:Zo,UnsignedInt5999Type:nm,UnsignedIntType:Ri,UnsignedShort4444Type:Eh,UnsignedShort5551Type:Th,UnsignedShortType:qo,VSMShadowMap:Ls,Vector2:ge,Vector3:F,Vector4:jt,VectorKeyframeTrack:yl,VideoFrameTexture:Rb,VideoTexture:Ay,WebGL3DRenderTarget:Z1,WebGLArrayRenderTarget:q1,WebGLCoordinateSystem:di,WebGLCubeRenderTarget:Fm,WebGLRenderTarget:ni,WebGLRenderer:T_,WebGLUtils:E_,WebGPUCoordinateSystem:Hs,WebXRController:Eu,WireframeGeometry:ky,WrapAroundEnding:cl,ZeroCurvatureEnding:Ds,ZeroFactor:Vv,ZeroSlopeEnding:Ns,ZeroStencilOp:ZM,createCanvasElement:my,error:ot,getConsoleFunction:E1,log:fl,setConsoleFunction:w1,warn:ke,warnOnce:pl},Symbol.toStringTag,{value:"Module"}));var sp={exports:{}},Yr={};var Zx;function xR(){return Zx||(Zx=1,Yr.ConcurrentRoot=1,Yr.ContinuousEventPriority=4,Yr.DefaultEventPriority=16,Yr.DiscreteEventPriority=1,Yr.IdleEventPriority=536870912,Yr.LegacyRoot=0),Yr}var Jx;function vR(){return Jx||(Jx=1,sp.exports=xR()),sp.exports}var Wo=vR();function yR(r){let e;const t=new Set,n=(h,d)=>{const f=typeof h=="function"?h(e):h;if(f!==e){const m=e;e=d?f:Object.assign({},e,f),t.forEach(g=>g(e,m))}},i=()=>e,s=(h,d=i,f=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let m=d(e);function g(){const x=d(e);if(!f(m,x)){const M=m;h(m=x,M)}}return t.add(g),()=>t.delete(g)},u={setState:n,getState:i,subscribe:(h,d,f)=>d||f?s(h,d,f):(t.add(h),()=>t.delete(h)),destroy:()=>t.clear()};return e=r(n,i,u),u}const _R=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),Kx=_R?ee.useEffect:ee.useLayoutEffect;function SR(r){const e=typeof r=="function"?yR(r):r,t=(n=e.getState,i=Object.is)=>{const[,s]=ee.useReducer(_=>_+1,0),o=e.getState(),c=ee.useRef(o),u=ee.useRef(n),h=ee.useRef(i),d=ee.useRef(!1),f=ee.useRef();f.current===void 0&&(f.current=n(o));let m,g=!1;(c.current!==o||u.current!==n||h.current!==i||d.current)&&(m=n(o),g=!i(f.current,m)),Kx(()=>{g&&(f.current=m),c.current=o,u.current=n,h.current=i,d.current=!1});const x=ee.useRef(o);Kx(()=>{const _=()=>{try{const S=e.getState(),b=u.current(S);h.current(f.current,b)||(c.current=S,f.current=b,s())}catch{d.current=!0,s()}},v=e.subscribe(_);return e.getState()!==x.current&&_(),v},[]);const M=g?m:f.current;return ee.useDebugValue(M),M};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const n=[t,e];return{next(){const i=n.length<=0;return{value:n.shift(),done:i}}}},t}var op={exports:{}},ap={exports:{}},lp={};var Qx;function MR(){return Qx||(Qx=1,(function(r){function e(J,te){var oe=J.length;J.push(te);e:for(;0<oe;){var ce=oe-1>>>1,ve=J[ce];if(0<i(ve,te))J[ce]=te,J[oe]=ve,oe=ce;else break e}}function t(J){return J.length===0?null:J[0]}function n(J){if(J.length===0)return null;var te=J[0],oe=J.pop();if(oe!==te){J[0]=oe;e:for(var ce=0,ve=J.length,Ae=ve>>>1;ce<Ae;){var dt=2*(ce+1)-1,vt=J[dt],he=dt+1,we=J[he];if(0>i(vt,oe))he<ve&&0>i(we,vt)?(J[ce]=we,J[he]=oe,ce=he):(J[ce]=vt,J[dt]=oe,ce=dt);else if(he<ve&&0>i(we,oe))J[ce]=we,J[he]=oe,ce=he;else break e}}return te}function i(J,te){var oe=J.sortIndex-te.sortIndex;return oe!==0?oe:J.id-te.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;r.unstable_now=function(){return s.now()}}else{var o=Date,c=o.now();r.unstable_now=function(){return o.now()-c}}var u=[],h=[],d=1,f=null,m=3,g=!1,x=!1,M=!1,_=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(J){for(var te=t(h);te!==null;){if(te.callback===null)n(h);else if(te.startTime<=J)n(h),te.sortIndex=te.expirationTime,e(u,te);else break;te=t(h)}}function E(J){if(M=!1,b(J),!x)if(t(u)!==null)x=!0,q(P);else{var te=t(h);te!==null&&Y(E,te.startTime-J)}}function P(J,te){x=!1,M&&(M=!1,v(A),A=-1),g=!0;var oe=m;try{for(b(te),f=t(u);f!==null&&(!(f.expirationTime>te)||J&&!L());){var ce=f.callback;if(typeof ce=="function"){f.callback=null,m=f.priorityLevel;var ve=ce(f.expirationTime<=te);te=r.unstable_now(),typeof ve=="function"?f.callback=ve:f===t(u)&&n(u),b(te)}else n(u);f=t(u)}if(f!==null)var Ae=!0;else{var dt=t(h);dt!==null&&Y(E,dt.startTime-te),Ae=!1}return Ae}finally{f=null,m=oe,g=!1}}var D=!1,N=null,A=-1,R=5,B=-1;function L(){return!(r.unstable_now()-B<R)}function V(){if(N!==null){var J=r.unstable_now();B=J;var te=!0;try{te=N(!0,J)}finally{te?H():(D=!1,N=null)}}else D=!1}var H;if(typeof S=="function")H=function(){S(V)};else if(typeof MessageChannel<"u"){var j=new MessageChannel,X=j.port2;j.port1.onmessage=V,H=function(){X.postMessage(null)}}else H=function(){_(V,0)};function q(J){N=J,D||(D=!0,H())}function Y(J,te){A=_(function(){J(r.unstable_now())},te)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(J){J.callback=null},r.unstable_continueExecution=function(){x||g||(x=!0,q(P))},r.unstable_forceFrameRate=function(J){0>J||125<J?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<J?Math.floor(1e3/J):5},r.unstable_getCurrentPriorityLevel=function(){return m},r.unstable_getFirstCallbackNode=function(){return t(u)},r.unstable_next=function(J){switch(m){case 1:case 2:case 3:var te=3;break;default:te=m}var oe=m;m=te;try{return J()}finally{m=oe}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(J,te){switch(J){case 1:case 2:case 3:case 4:case 5:break;default:J=3}var oe=m;m=J;try{return te()}finally{m=oe}},r.unstable_scheduleCallback=function(J,te,oe){var ce=r.unstable_now();switch(typeof oe=="object"&&oe!==null?(oe=oe.delay,oe=typeof oe=="number"&&0<oe?ce+oe:ce):oe=ce,J){case 1:var ve=-1;break;case 2:ve=250;break;case 5:ve=1073741823;break;case 4:ve=1e4;break;default:ve=5e3}return ve=oe+ve,J={id:d++,callback:te,priorityLevel:J,startTime:oe,expirationTime:ve,sortIndex:-1},oe>ce?(J.sortIndex=oe,e(h,J),t(u)===null&&J===t(h)&&(M?(v(A),A=-1):M=!0,Y(E,oe-ce))):(J.sortIndex=ve,e(u,J),x||g||(x=!0,q(P))),J},r.unstable_shouldYield=L,r.unstable_wrapCallback=function(J){var te=m;return function(){var oe=m;m=te;try{return J.apply(this,arguments)}finally{m=oe}}}})(lp)),lp}var $x;function A_(){return $x||($x=1,ap.exports=MR()),ap.exports}var cp,ev;function bR(){return ev||(ev=1,cp=function(e){var t={},n=OS(),i=A_(),s=Object.assign;function o(a){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+a,p=1;p<arguments.length;p++)l+="&args[]="+encodeURIComponent(arguments[p]);return"Minified React error #"+a+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,u=Symbol.for("react.element"),h=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),x=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),E=Symbol.for("react.offscreen"),P=Symbol.iterator;function D(a){return a===null||typeof a!="object"?null:(a=P&&a[P]||a["@@iterator"],typeof a=="function"?a:null)}function N(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case d:return"Fragment";case h:return"Portal";case m:return"Profiler";case f:return"StrictMode";case _:return"Suspense";case v:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case x:return(a.displayName||"Context")+".Consumer";case g:return(a._context.displayName||"Context")+".Provider";case M:var l=a.render;return a=a.displayName,a||(a=l.displayName||l.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case S:return l=a.displayName||null,l!==null?l:N(a.type)||"Memo";case b:l=a._payload,a=a._init;try{return N(a(l))}catch{}}return null}function A(a){var l=a.type;switch(a.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=l.render,a=a.displayName||a.name||"",l.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return N(l);case 8:return l===f?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function R(a){var l=a,p=a;if(a.alternate)for(;l.return;)l=l.return;else{a=l;do l=a,(l.flags&4098)!==0&&(p=l.return),a=l.return;while(a)}return l.tag===3?p:null}function B(a){if(R(a)!==a)throw Error(o(188))}function L(a){var l=a.alternate;if(!l){if(l=R(a),l===null)throw Error(o(188));return l!==a?null:a}for(var p=a,y=l;;){var w=p.return;if(w===null)break;var C=w.alternate;if(C===null){if(y=w.return,y!==null){p=y;continue}break}if(w.child===C.child){for(C=w.child;C;){if(C===p)return B(w),a;if(C===y)return B(w),l;C=C.sibling}throw Error(o(188))}if(p.return!==y.return)p=w,y=C;else{for(var z=!1,K=w.child;K;){if(K===p){z=!0,p=w,y=C;break}if(K===y){z=!0,y=w,p=C;break}K=K.sibling}if(!z){for(K=C.child;K;){if(K===p){z=!0,p=C,y=w;break}if(K===y){z=!0,y=C,p=w;break}K=K.sibling}if(!z)throw Error(o(189))}}if(p.alternate!==y)throw Error(o(190))}if(p.tag!==3)throw Error(o(188));return p.stateNode.current===p?a:l}function V(a){return a=L(a),a!==null?H(a):null}function H(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){var l=H(a);if(l!==null)return l;a=a.sibling}return null}function j(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){if(a.tag!==4){var l=j(a);if(l!==null)return l}a=a.sibling}return null}var X=Array.isArray,q=e.getPublicInstance,Y=e.getRootHostContext,J=e.getChildHostContext,te=e.prepareForCommit,oe=e.resetAfterCommit,ce=e.createInstance,ve=e.appendInitialChild,Ae=e.finalizeInitialChildren,dt=e.prepareUpdate,vt=e.shouldSetTextContent,he=e.createTextInstance,we=e.scheduleTimeout,Ee=e.cancelTimeout,rt=e.noTimeout,He=e.isPrimaryRenderer,De=e.supportsMutation,_t=e.supportsPersistence,Je=e.supportsHydration,xe=e.getInstanceFromNode,_e=e.preparePortalMount,ye=e.getCurrentEventPriority,Ie=e.detachDeletedInstance,k=e.supportsMicrotasks,tt=e.scheduleMicrotask,Be=e.supportsTestSelectors,at=e.findFiberRoot,Ce=e.getBoundingRect,O=e.getTextContent,I=e.isHiddenSubtree,Z=e.matchAccessibilityRole,le=e.setFocusIfFocusable,me=e.setupIntersectionObserver,de=e.appendChild,Qe=e.appendChildToContainer,Ne=e.commitTextUpdate,it=e.commitMount,ht=e.commitUpdate,Me=e.insertBefore,Re=e.insertInContainerBefore,$e=e.removeChild,G=e.removeChildFromContainer,se=e.resetTextContent,Pe=e.hideInstance,W=e.hideTextInstance,Se=e.unhideInstance,be=e.unhideTextInstance,Ve=e.clearContainer,Te=e.cloneInstance,fe=e.createContainerChildSet,We=e.appendChildToContainerChildSet,ct=e.finalizeContainerChildren,Pt=e.replaceContainerChildren,Ct=e.cloneHiddenInstance,xn=e.cloneHiddenTextInstance,Tn=e.canHydrateInstance,Dl=e.canHydrateTextInstance,aa=e.canHydrateSuspenseInstance,Nl=e.isSuspenseInstancePending,$s=e.isSuspenseInstanceFallback,Ul=e.registerSuspenseInstanceRetry,ri=e.getNextHydratableSibling,la=e.getFirstHydratableChild,Ol=e.getFirstHydratableChildWithinContainer,Fl=e.getFirstHydratableChildWithinSuspenseInstance,eo=e.hydrateInstance,Bl=e.hydrateTextInstance,to=e.hydrateSuspenseInstance,kl=e.getNextHydratableInstanceAfterSuspenseInstance,ca=e.commitHydratedContainer,sd=e.commitHydratedSuspenseInstance,od=e.clearSuspenseBoundary,ad=e.clearSuspenseBoundaryFromContainer,ld=e.shouldDeleteUnhydratedTailInstances,cd=e.didNotMatchHydratedContainerTextInstance,ud=e.didNotMatchHydratedTextInstance,U;
vendor: 4,328 bytes, lines 4049-4053
4049function Q(a){if(U===void 0)try{throw Error()}catch(p){var l=p.stack.trim().match(/\n( *(at )?)/);U=l&&l[1]||""}return`
4050`+U+a}var ae=!1;function ie(a,l){if(!a||ae)return"";ae=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(Le){var y=Le}Reflect.construct(a,[],l)}else{try{l.call()}catch(Le){y=Le}a.call(l.prototype)}else{try{throw Error()}catch(Le){y=Le}a()}}catch(Le){if(Le&&y&&typeof Le.stack=="string"){for(var w=Le.stack.split(`
4051`),C=y.stack.split(`
4052`),z=w.length-1,K=C.length-1;1<=z&&0<=K&&w[z]!==C[K];)K--;for(;1<=z&&0<=K;z--,K--)if(w[z]!==C[K]){if(z!==1||K!==1)do if(z--,K--,0>K||w[z]!==C[K]){var pe=`
4053`+w[z].replace(" at new "," at ");return a.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",a.displayName)),pe}while(1<=z&&0<=K);break}}}finally{ae=!1,Error.prepareStackTrace=p}return(a=a?a.displayName||a.name:"")?Q(a):""}var ne=Object.prototype.hasOwnProperty,ze=[],Xe=-1;function Fe(a){return{current:a}}function Ue(a){0>Xe||(a.current=ze[Xe],ze[Xe]=null,Xe--)}function Oe(a,l){Xe++,ze[Xe]=a.current,a.current=l}var mt={},ut=Fe(mt),Ze=Fe(!1),It=mt;function Gt(a,l){var p=a.type.contextTypes;if(!p)return mt;var y=a.stateNode;if(y&&y.__reactInternalMemoizedUnmaskedChildContext===l)return y.__reactInternalMemoizedMaskedChildContext;var w={},C;for(C in p)w[C]=l[C];return y&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=l,a.__reactInternalMemoizedMaskedChildContext=w),w}function Rt(a){return a=a.childContextTypes,a!=null}function Nt(){Ue(Ze),Ue(ut)}function fn(a,l,p){if(ut.current!==mt)throw Error(o(168));Oe(ut,l),Oe(Ze,p)}function nt(a,l,p){var y=a.stateNode;if(l=l.childContextTypes,typeof y.getChildContext!="function")return p;y=y.getChildContext();for(var w in y)if(!(w in l))throw Error(o(108,A(a)||"Unknown",w));return s({},p,y)}function vn(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||mt,It=ut.current,Oe(ut,a),Oe(Ze,Ze.current),!0}function Lt(a,l,p){var y=a.stateNode;if(!y)throw Error(o(169));p?(a=nt(a,l,It),y.__reactInternalMemoizedMergedChildContext=a,Ue(Ze),Ue(ut),Oe(ut,a)):Ue(Ze),Oe(Ze,p)}var Jt=Math.clz32?Math.clz32:Ir,gi=Math.log,ur=Math.LN2;function Ir(a){return a>>>=0,a===0?32:31-(gi(a)/ur|0)|0}var Ft=64,en=4194304;function Yn(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function Kt(a,l){var p=a.pendingLanes;if(p===0)return 0;var y=0,w=a.suspendedLanes,C=a.pingedLanes,z=p&268435455;if(z!==0){var K=z&~w;K!==0?y=Yn(K):(C&=z,C!==0&&(y=Yn(C)))}else z=p&~w,z!==0?y=Yn(z):C!==0&&(y=Yn(C));if(y===0)return 0;if(l!==0&&l!==y&&(l&w)===0&&(w=y&-y,C=l&-l,w>=C||w===16&&(C&4194240)!==0))return l;if((y&4)!==0&&(y|=p&16),l=a.entangledLanes,l!==0)for(a=a.entanglements,l&=y;0<l;)p=31-Jt(l),w=1<<p,y|=a[p],l&=~w;return y}function ji(a,l){switch(a){case 1:case 2:case 4:return l+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Pr(a,l){for(var p=a.suspendedLanes,y=a.pingedLanes,w=a.expirationTimes,C=a.pendingLanes;0<C;){var z=31-Jt(C),K=1<<z,pe=w[z];pe===-1?((K&p)===0||(K&y)!==0)&&(w[z]=ji(K,l)):pe<=l&&(a.expiredLanes|=K),C&=~K}}function no(a){return a=a.pendingLanes&-1073741825,a!==0?a:a&1073741824?1073741824:0}function hd(a){for(var l=[],p=0;31>p;p++)l.push(a);return l}function ua(a,l,p){a.pendingLanes|=l,l!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,l=31-Jt(l),a[l]=p}
vendor: 23,136 bytes, line 4053
4053function J_(a,l){var p=a.pendingLanes&~l;a.pendingLanes=l,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=l,a.mutableReadLanes&=l,a.entangledLanes&=l,l=a.entanglements;var y=a.eventTimes;for(a=a.expirationTimes;0<p;){var w=31-Jt(p),C=1<<w;l[w]=0,y[w]=-1,a[w]=-1,p&=~C}}function dd(a,l){var p=a.entangledLanes|=l;for(a=a.entanglements;p;){var y=31-Jt(p),w=1<<y;w&l|a[y]&l&&(a[y]|=l),p&=~w}}var Bt=0;function Hm(a){return a&=-a,1<a?4<a?(a&268435455)!==0?16:536870912:4:1}var fd=i.unstable_scheduleCallback,Wm=i.unstable_cancelCallback,K_=i.unstable_shouldYield,Q_=i.unstable_requestPaint,yn=i.unstable_now,pd=i.unstable_ImmediatePriority,$_=i.unstable_UserBlockingPriority,md=i.unstable_NormalPriority,eS=i.unstable_IdlePriority,zl=null,Xi=null;function tS(a){if(Xi&&typeof Xi.onCommitFiberRoot=="function")try{Xi.onCommitFiberRoot(zl,a,void 0,(a.current.flags&128)===128)}catch{}}function nS(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var Yi=typeof Object.is=="function"?Object.is:nS,hr=null,Vl=!1,gd=!1;function jm(a){hr===null?hr=[a]:hr.push(a)}function iS(a){Vl=!0,jm(a)}function qi(){if(!gd&&hr!==null){gd=!0;var a=0,l=Bt;try{var p=hr;for(Bt=1;a<p.length;a++){var y=p[a];do y=y(!0);while(y!==null)}hr=null,Vl=!1}catch(w){throw hr!==null&&(hr=hr.slice(a+1)),fd(pd,qi),w}finally{Bt=l,gd=!1}}return null}var rS=c.ReactCurrentBatchConfig;function Gl(a,l){if(Yi(a,l))return!0;if(typeof a!="object"||a===null||typeof l!="object"||l===null)return!1;var p=Object.keys(a),y=Object.keys(l);if(p.length!==y.length)return!1;for(y=0;y<p.length;y++){var w=p[y];if(!ne.call(l,w)||!Yi(a[w],l[w]))return!1}return!0}function sS(a){switch(a.tag){case 5:return Q(a.type);case 16:return Q("Lazy");case 13:return Q("Suspense");case 19:return Q("SuspenseList");case 0:case 2:case 15:return a=ie(a.type,!1),a;case 11:return a=ie(a.type.render,!1),a;case 1:return a=ie(a.type,!0),a;default:return""}}function Li(a,l){if(a&&a.defaultProps){l=s({},l),a=a.defaultProps;for(var p in a)l[p]===void 0&&(l[p]=a[p]);return l}return l}var Hl=Fe(null),Wl=null,io=null,xd=null;function vd(){xd=io=Wl=null}function Xm(a,l,p){He?(Oe(Hl,l._currentValue),l._currentValue=p):(Oe(Hl,l._currentValue2),l._currentValue2=p)}function yd(a){var l=Hl.current;Ue(Hl),He?a._currentValue=l:a._currentValue2=l}function _d(a,l,p){for(;a!==null;){var y=a.alternate;if((a.childLanes&l)!==l?(a.childLanes|=l,y!==null&&(y.childLanes|=l)):y!==null&&(y.childLanes&l)!==l&&(y.childLanes|=l),a===p)break;a=a.return}}function ro(a,l){Wl=a,xd=io=null,a=a.dependencies,a!==null&&a.firstContext!==null&&((a.lanes&l)!==0&&(ai=!0),a.firstContext=null)}function xi(a){var l=He?a._currentValue:a._currentValue2;if(xd!==a)if(a={context:a,memoizedValue:l,next:null},io===null){if(Wl===null)throw Error(o(308));io=a,Wl.dependencies={lanes:0,firstContext:a}}else io=io.next=a;return l}var Zi=null,Lr=!1;function Sd(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ym(a,l){a=a.updateQueue,l.updateQueue===a&&(l.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function dr(a,l){return{eventTime:a,lane:l,tag:0,payload:null,callback:null,next:null}}function Dr(a,l){var p=a.updateQueue;p!==null&&(p=p.shared,ln!==null&&(a.mode&1)!==0&&(At&2)===0?(a=p.interleaved,a===null?(l.next=l,Zi===null?Zi=[p]:Zi.push(p)):(l.next=a.next,a.next=l),p.interleaved=l):(a=p.pending,a===null?l.next=l:(l.next=a.next,a.next=l),p.pending=l))}function jl(a,l,p){if(l=l.updateQueue,l!==null&&(l=l.shared,(p&4194240)!==0)){var y=l.lanes;y&=a.pendingLanes,p|=y,l.lanes=p,dd(a,p)}}function qm(a,l){var p=a.updateQueue,y=a.alternate;if(y!==null&&(y=y.updateQueue,p===y)){var w=null,C=null;if(p=p.firstBaseUpdate,p!==null){do{var z={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};C===null?w=C=z:C=C.next=z,p=p.next}while(p!==null);C===null?w=C=l:C=C.next=l}else w=C=l;p={baseState:y.baseState,firstBaseUpdate:w,lastBaseUpdate:C,shared:y.shared,effects:y.effects},a.updateQueue=p;return}a=p.lastBaseUpdate,a===null?p.firstBaseUpdate=l:a.next=l,p.lastBaseUpdate=l}function Xl(a,l,p,y){var w=a.updateQueue;Lr=!1;var C=w.firstBaseUpdate,z=w.lastBaseUpdate,K=w.shared.pending;if(K!==null){w.shared.pending=null;var pe=K,Le=pe.next;pe.next=null,z===null?C=Le:z.next=Le,z=pe;var et=a.alternate;et!==null&&(et=et.updateQueue,K=et.lastBaseUpdate,K!==z&&(K===null?et.firstBaseUpdate=Le:K.next=Le,et.lastBaseUpdate=pe))}if(C!==null){var St=w.baseState;z=0,et=Le=pe=null,K=C;do{var ft=K.lane,Wt=K.eventTime;if((y&ft)===ft){et!==null&&(et=et.next={eventTime:Wt,lane:0,tag:K.tag,payload:K.payload,callback:K.callback,next:null});e:{var lt=a,In=K;switch(ft=l,Wt=p,In.tag){case 1:if(lt=In.payload,typeof lt=="function"){St=lt.call(Wt,St,ft);break e}St=lt;break e;case 3:lt.flags=lt.flags&-65537|128;case 0:if(lt=In.payload,ft=typeof lt=="function"?lt.call(Wt,St,ft):lt,ft==null)break e;St=s({},St,ft);break e;case 2:Lr=!0}}K.callback!==null&&K.lane!==0&&(a.flags|=64,ft=w.effects,ft===null?w.effects=[K]:ft.push(K))}else Wt={eventTime:Wt,lane:ft,tag:K.tag,payload:K.payload,callback:K.callback,next:null},et===null?(Le=et=Wt,pe=St):et=et.next=Wt,z|=ft;if(K=K.next,K===null){if(K=w.shared.pending,K===null)break;ft=K,K=ft.next,ft.next=null,w.lastBaseUpdate=ft,w.shared.pending=null}}while(!0);if(et===null&&(pe=St),w.baseState=pe,w.firstBaseUpdate=Le,w.lastBaseUpdate=et,l=w.shared.interleaved,l!==null){w=l;do z|=w.lane,w=w.next;while(w!==l)}else C===null&&(w.shared.lanes=0);po|=z,a.lanes=z,a.memoizedState=St}}function Zm(a,l,p){if(a=l.effects,l.effects=null,a!==null)for(l=0;l<a.length;l++){var y=a[l],w=y.callback;if(w!==null){if(y.callback=null,y=p,typeof w!="function")throw Error(o(191,w));w.call(y)}}}var Jm=new n.Component().refs;function Md(a,l,p,y){l=a.memoizedState,p=p(y,l),p=p==null?l:s({},l,p),a.memoizedState=p,a.lanes===0&&(a.updateQueue.baseState=p)}var Yl={isMounted:function(a){return(a=a._reactInternals)?R(a)===a:!1},enqueueSetState:function(a,l,p){a=a._reactInternals;var y=zn(),w=Or(a),C=dr(y,w);C.payload=l,p!=null&&(C.callback=p),Dr(a,C),l=Mi(a,w,y),l!==null&&jl(l,a,w)},enqueueReplaceState:function(a,l,p){a=a._reactInternals;var y=zn(),w=Or(a),C=dr(y,w);C.tag=1,C.payload=l,p!=null&&(C.callback=p),Dr(a,C),l=Mi(a,w,y),l!==null&&jl(l,a,w)},enqueueForceUpdate:function(a,l){a=a._reactInternals;var p=zn(),y=Or(a),w=dr(p,y);w.tag=2,l!=null&&(w.callback=l),Dr(a,w),l=Mi(a,y,p),l!==null&&jl(l,a,y)}};function Km(a,l,p,y,w,C,z){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(y,C,z):l.prototype&&l.prototype.isPureReactComponent?!Gl(p,y)||!Gl(w,C):!0}function Qm(a,l,p){var y=!1,w=mt,C=l.contextType;return typeof C=="object"&&C!==null?C=xi(C):(w=Rt(l)?It:ut.current,y=l.contextTypes,C=(y=y!=null)?Gt(a,w):mt),l=new l(p,C),a.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Yl,a.stateNode=l,l._reactInternals=a,y&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=w,a.__reactInternalMemoizedMaskedChildContext=C),l}function $m(a,l,p,y){a=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(p,y),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(p,y),l.state!==a&&Yl.enqueueReplaceState(l,l.state,null)}function bd(a,l,p,y){var w=a.stateNode;w.props=p,w.state=a.memoizedState,w.refs=Jm,Sd(a);var C=l.contextType;typeof C=="object"&&C!==null?w.context=xi(C):(C=Rt(l)?It:ut.current,w.context=Gt(a,C)),w.state=a.memoizedState,C=l.getDerivedStateFromProps,typeof C=="function"&&(Md(a,l,C,p),w.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(l=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),l!==w.state&&Yl.enqueueReplaceState(w,w.state,null),Xl(a,p,w,y),w.state=a.memoizedState),typeof w.componentDidMount=="function"&&(a.flags|=4194308)}var so=[],oo=0,ql=null,Zl=0,vi=[],yi=0,ss=null,fr=1,pr="";function os(a,l){so[oo++]=Zl,so[oo++]=ql,ql=a,Zl=l}function eg(a,l,p){vi[yi++]=fr,vi[yi++]=pr,vi[yi++]=ss,ss=a;var y=fr;a=pr;var w=32-Jt(y)-1;y&=~(1<<w),p+=1;var C=32-Jt(l)+w;if(30<C){var z=w-w%5;C=(y&(1<<z)-1).toString(32),y>>=z,w-=z,fr=1<<32-Jt(l)+w|p<<w|y,pr=C+a}else fr=1<<C|p<<w|y,pr=a}function wd(a){a.return!==null&&(os(a,1),eg(a,1,0))}function Ed(a){for(;a===ql;)ql=so[--oo],so[oo]=null,Zl=so[--oo],so[oo]=null;for(;a===ss;)ss=vi[--yi],vi[yi]=null,pr=vi[--yi],vi[yi]=null,fr=vi[--yi],vi[yi]=null}var si=null,oi=null,qt=!1,ha=!1,Di=null;function tg(a,l){var p=bi(5,null,null,0);p.elementType="DELETED",p.stateNode=l,p.return=a,l=a.deletions,l===null?(a.deletions=[p],a.flags|=16):l.push(p)}function ng(a,l){switch(a.tag){case 5:return l=Tn(l,a.type,a.pendingProps),l!==null?(a.stateNode=l,si=a,oi=la(l),!0):!1;case 6:return l=Dl(l,a.pendingProps),l!==null?(a.stateNode=l,si=a,oi=null,!0):!1;case 13:if(l=aa(l),l!==null){var p=ss!==null?{id:fr,overflow:pr}:null;return a.memoizedState={dehydrated:l,treeContext:p,retryLane:1073741824},p=bi(18,null,null,0),p.stateNode=l,p.return=a,a.child=p,si=a,oi=null,!0}return!1;default:return!1}}function Td(a){return(a.mode&1)!==0&&(a.flags&128)===0}function Ad(a){if(qt){var l=oi;if(l){var p=l;if(!ng(a,l)){if(Td(a))throw Error(o(418));l=ri(p);var y=si;l&&ng(a,l)?tg(y,p):(a.flags=a.flags&-4097|2,qt=!1,si=a)}}else{if(Td(a))throw Error(o(418));a.flags=a.flags&-4097|2,qt=!1,si=a}}}function ig(a){for(a=a.return;a!==null&&a.tag!==5&&a.tag!==3&&a.tag!==13;)a=a.return;si=a}function da(a){if(!Je||a!==si)return!1;if(!qt)return ig(a),qt=!0,!1;if(a.tag!==3&&(a.tag!==5||ld(a.type)&&!vt(a.type,a.memoizedProps))){var l=oi;if(l){if(Td(a)){for(a=oi;a;)a=ri(a);throw Error(o(418))}for(;l;)tg(a,l),l=ri(l)}}if(ig(a),a.tag===13){if(!Je)throw Error(o(316));if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(o(317));oi=kl(a)}else oi=si?ri(a.stateNode):null;return!0}function ao(){Je&&(oi=si=null,ha=qt=!1)}function Cd(a){Di===null?Di=[a]:Di.push(a)}function fa(a,l,p){if(a=p.ref,a!==null&&typeof a!="function"&&typeof a!="object"){if(p._owner){if(p=p._owner,p){if(p.tag!==1)throw Error(o(309));var y=p.stateNode}if(!y)throw Error(o(147,a));var w=y,C=""+a;return l!==null&&l.ref!==null&&typeof l.ref=="function"&&l.ref._stringRef===C?l.ref:(l=function(z){var K=w.refs;K===Jm&&(K=w.refs={}),z===null?delete K[C]:K[C]=z},l._stringRef=C,l)}if(typeof a!="string")throw Error(o(284));if(!p._owner)throw Error(o(290,a))}return a}function Jl(a,l){throw a=Object.prototype.toString.call(l),Error(o(31,a==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":a))}function rg(a){var l=a._init;return l(a._payload)}function sg(a){function l(re,$){if(a){var ue=re.deletions;ue===null?(re.deletions=[$],re.flags|=16):ue.push($)}}function p(re,$){if(!a)return null;for(;$!==null;)l(re,$),$=$.sibling;return null}function y(re,$){for(re=new Map;$!==null;)$.key!==null?re.set($.key,$):re.set($.index,$),$=$.sibling;return re}function w(re,$){return re=Br(re,$),re.index=0,re.sibling=null,re}function C(re,$,ue){return re.index=ue,a?(ue=re.alternate,ue!==null?(ue=ue.index,ue<$?(re.flags|=2,$):ue):(re.flags|=2,$)):(re.flags|=1048576,$)}function z(re){return a&&re.alternate===null&&(re.flags|=2),re}function K(re,$,ue,Ye){return $===null||$.tag!==6?($=df(ue,re.mode,Ye),$.return=re,$):($=w($,ue),$.return=re,$)}function pe(re,$,ue,Ye){var st=ue.type;return st===d?et(re,$,ue.props.children,Ye,ue.key):$!==null&&($.elementType===st||typeof st=="object"&&st!==null&&st.$$typeof===b&&rg(st)===$.type)?(Ye=w($,ue.props),Ye.ref=fa(re,$,ue),Ye.return=re,Ye):(Ye=Ac(ue.type,ue.key,ue.props,null,re.mode,Ye),Ye.ref=fa(re,$,ue),Ye.return=re,Ye)}function Le(re,$,ue,Ye){return $===null||$.tag!==4||$.stateNode.containerInfo!==ue.containerInfo||$.stateNode.implementation!==ue.implementation?($=ff(ue,re.mode,Ye),$.return=re,$):($=w($,ue.children||[]),$.return=re,$)}function et(re,$,ue,Ye,st){return $===null||$.tag!==7?($=fs(ue,re.mode,Ye,st),$.return=re,$):($=w($,ue),$.return=re,$)}function St(re,$,ue){if(typeof $=="string"&&$!==""||typeof $=="number")return $=df(""+$,re.mode,ue),$.return=re,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case u:return ue=Ac($.type,$.key,$.props,null,re.mode,ue),ue.ref=fa(re,null,$),ue.return=re,ue;case h:return $=ff($,re.mode,ue),$.return=re,$;case b:var Ye=$._init;return St(re,Ye($._payload),ue)}if(X($)||D($))return $=fs($,re.mode,ue,null),$.return=re,$;Jl(re,$)}return null}function ft(re,$,ue,Ye){var st=$!==null?$.key:null;if(typeof ue=="string"&&ue!==""||typeof ue=="number")return st!==null?null:K(re,$,""+ue,Ye);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case u:return ue.key===st?pe(re,$,ue,Ye):null;case h:return ue.key===st?Le(re,$,ue,Ye):null;case b:return st=ue._init,ft(re,$,st(ue._payload),Ye)}if(X(ue)||D(ue))return st!==null?null:et(re,$,ue,Ye,null);Jl(re,ue)}return null}function Wt(re,$,ue,Ye,st){if(typeof Ye=="string"&&Ye!==""||typeof Ye=="number")return re=re.get(ue)||null,K($,re,""+Ye,st);if(typeof Ye=="object"&&Ye!==null){switch(Ye.$$typeof){case u:return re=re.get(Ye.key===null?ue:Ye.key)||null,pe($,re,Ye,st);case h:return re=re.get(Ye.key===null?ue:Ye.key)||null,Le($,re,Ye,st);case b:var Tt=Ye._init;return Wt(re,$,ue,Tt(Ye._payload),st)}if(X(Ye)||D(Ye))return re=re.get(ue)||null,et($,re,Ye,st,null);Jl($,Ye)}return null}function lt(re,$,ue,Ye){for(var st=null,Tt=null,Mt=$,kt=$=0,Sn=null;Mt!==null&&kt<ue.length;kt++){Mt.index>kt?(Sn=Mt,Mt=null):Sn=Mt.sibling;var zt=ft(re,Mt,ue[kt],Ye);if(zt===null){Mt===null&&(Mt=Sn);break}a&&Mt&&zt.alternate===null&&l(re,Mt),$=C(zt,$,kt),Tt===null?st=zt:Tt.sibling=zt,Tt=zt,Mt=Sn}if(kt===ue.length)return p(re,Mt),qt&&os(re,kt),st;if(Mt===null){for(;kt<ue.length;kt++)Mt=St(re,ue[kt],Ye),Mt!==null&&($=C(Mt,$,kt),Tt===null?st=Mt:Tt.sibling=Mt,Tt=Mt);return qt&&os(re,kt),st}for(Mt=y(re,Mt);kt<ue.length;kt++)Sn=Wt(Mt,re,kt,ue[kt],Ye),Sn!==null&&(a&&Sn.alternate!==null&&Mt.delete(Sn.key===null?kt:Sn.key),$=C(Sn,$,kt),Tt===null?st=Sn:Tt.sibling=Sn,Tt=Sn);return a&&Mt.forEach(function(kr){return l(re,kr)}),qt&&os(re,kt),st}function In(re,$,ue,Ye){var st=D(ue);if(typeof st!="function")throw Error(o(150));if(ue=st.call(ue),ue==null)throw Error(o(151));for(var Tt=st=null,Mt=$,kt=$=0,Sn=null,zt=ue.next();Mt!==null&&!zt.done;kt++,zt=ue.next()){Mt.index>kt?(Sn=Mt,Mt=null):Sn=Mt.sibling;var kr=ft(re,Mt,zt.value,Ye);if(kr===null){Mt===null&&(Mt=Sn);break}a&&Mt&&kr.alternate===null&&l(re,Mt),$=C(kr,$,kt),Tt===null?st=kr:Tt.sibling=kr,Tt=kr,Mt=Sn}if(zt.done)return p(re,Mt),qt&&os(re,kt),st;if(Mt===null){for(;!zt.done;kt++,zt=ue.next())zt=St(re,zt.value,Ye),zt!==null&&($=C(zt,$,kt),Tt===null?st=zt:Tt.sibling=zt,Tt=zt);return qt&&os(re,kt),st}for(Mt=y(re,Mt);!zt.done;kt++,zt=ue.next())zt=Wt(Mt,re,kt,zt.value,Ye),zt!==null&&(a&&zt.alternate!==null&&Mt.delete(zt.key===null?kt:zt.key),$=C(zt,$,kt),Tt===null?st=zt:Tt.sibling=zt,Tt=zt);return a&&Mt.forEach(function(US){return l(re,US)}),qt&&os(re,kt),st}function wi(re,$,ue,Ye){if(typeof ue=="object"&&ue!==null&&ue.type===d&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case u:e:{for(var st=ue.key,Tt=$;Tt!==null;){if(Tt.key===st){if(st=ue.type,st===d){if(Tt.tag===7){p(re,Tt.sibling),$=w(Tt,ue.props.children),$.return=re,re=$;break e}}else if(Tt.elementType===st||typeof st=="object"&&st!==null&&st.$$typeof===b&&rg(st)===Tt.type){p(re,Tt.sibling),$=w(Tt,ue.props),$.ref=fa(re,Tt,ue),$.return=re,re=$;break e}p(re,Tt);break}else l(re,Tt);Tt=Tt.sibling}ue.type===d?($=fs(ue.props.children,re.mode,Ye,ue.key),$.return=re,re=$):(Ye=Ac(ue.type,ue.key,ue.props,null,re.mode,Ye),Ye.ref=fa(re,$,ue),Ye.return=re,re=Ye)}return z(re);case h:e:{for(Tt=ue.key;$!==null;){if($.key===Tt)if($.tag===4&&$.stateNode.containerInfo===ue.containerInfo&&$.stateNode.implementation===ue.implementation){p(re,$.sibling),$=w($,ue.children||[]),$.return=re,re=$;break e}else{p(re,$);break}else l(re,$);$=$.sibling}$=ff(ue,re.mode,Ye),$.return=re,re=$}return z(re);case b:return Tt=ue._init,wi(re,$,Tt(ue._payload),Ye)}if(X(ue))return lt(re,$,ue,Ye);if(D(ue))return In(re,$,ue,Ye);Jl(re,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"?(ue=""+ue,$!==null&&$.tag===6?(p(re,$.sibling),$=w($,ue),$.return=re,re=$):(p(re,$),$=df(ue,re.mode,Ye),$.return=re,re=$),z(re)):p(re,$)}return wi}var lo=sg(!0),og=sg(!1),pa={},_i=Fe(pa),ma=Fe(pa),co=Fe(pa);function Ji(a){if(a===pa)throw Error(o(174));return a}function Rd(a,l){Oe(co,l),Oe(ma,a),Oe(_i,pa),a=Y(l),Ue(_i),Oe(_i,a)}function uo(){Ue(_i),Ue(ma),Ue(co)}function ag(a){var l=Ji(co.current),p=Ji(_i.current);l=J(p,a.type,l),p!==l&&(Oe(ma,a),Oe(_i,l))}function Id(a){ma.current===a&&(Ue(_i),Ue(ma))}var Qt=Fe(0);function Kl(a){for(var l=a;l!==null;){if(l.tag===13){var p=l.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||Nl(p)||$s(p)))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Pd=[];function Ld(){for(var a=0;a<Pd.length;a++){var l=Pd[a];He?l._workInProgressVersionPrimary=null:l._workInProgressVersionSecondary=null}Pd.length=0}var Ql=c.ReactCurrentDispatcher,Si=c.ReactCurrentBatchConfig,ho=0,tn=null,An=null,_n=null,$l=!1,ga=!1,xa=0,oS=0;function Cn(){throw Error(o(321))}function Dd(a,l){if(l===null)return!1;for(var p=0;p<l.length&&p<a.length;p++)if(!Yi(a[p],l[p]))return!1;return!0}function Nd(a,l,p,y,w,C){if(ho=C,tn=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,Ql.current=a===null||a.memoizedState===null?uS:hS,a=p(y,w),ga){C=0;do{if(ga=!1,xa=0,25<=C)throw Error(o(301));C+=1,_n=An=null,l.updateQueue=null,Ql.current=dS,a=p(y,w)}while(ga)}if(Ql.current=rc,l=An!==null&&An.next!==null,ho=0,_n=An=tn=null,$l=!1,l)throw Error(o(300));return a}function Ud(){var a=xa!==0;return xa=0,a}function mr(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _n===null?tn.memoizedState=_n=a:_n=_n.next=a,_n}function Ki(){if(An===null){var a=tn.alternate;a=a!==null?a.memoizedState:null}else a=An.next;var l=_n===null?tn.memoizedState:_n.next;if(l!==null)_n=l,An=a;else{if(a===null)throw Error(o(310));An=a,a={memoizedState:An.memoizedState,baseState:An.baseState,baseQueue:An.baseQueue,queue:An.queue,next:null},_n===null?tn.memoizedState=_n=a:_n=_n.next=a}return _n}function as(a,l){return typeof l=="function"?l(a):l}function ec(a){var l=Ki(),p=l.queue;if(p===null)throw Error(o(311));p.lastRenderedReducer=a;var y=An,w=y.baseQueue,C=p.pending;if(C!==null){if(w!==null){var z=w.next;w.next=C.next,C.next=z}y.baseQueue=w=C,p.pending=null}if(w!==null){C=w.next,y=y.baseState;var K=z=null,pe=null,Le=C;do{var et=Le.lane;if((ho&et)===et)pe!==null&&(pe=pe.next={lane:0,action:Le.action,hasEagerState:Le.hasEagerState,eagerState:Le.eagerState,next:null}),y=Le.hasEagerState?Le.eagerState:a(y,Le.action);else{var St={lane:et,action:Le.action,hasEagerState:Le.hasEagerState,eagerState:Le.eagerState,next:null};pe===null?(K=pe=St,z=y):pe=pe.next=St,tn.lanes|=et,po|=et}Le=Le.next}while(Le!==null&&Le!==C);pe===null?z=y:pe.next=K,Yi(y,l.memoizedState)||(ai=!0),l.memoizedState=y,l.baseState=z,l.baseQueue=pe,p.lastRenderedState=y}if(a=p.interleaved,a!==null){w=a;do C=w.lane,tn.lanes|=C,po|=C,w=w.next;while(w!==a)}else w===null&&(p.lanes=0);return[l.memoizedState,p.dispatch]}function tc(a){var l=Ki(),p=l.queue;if(p===null)throw Error(o(311));p.lastRenderedReducer=a;var y=p.dispatch,w=p.pending,C=l.memoizedState;if(w!==null){p.pending=null;var z=w=w.next;do C=a(C,z.action),z=z.next;while(z!==w);Yi(C,l.memoizedState)||(ai=!0),l.memoizedState=C,l.baseQueue===null&&(l.baseState=C),p.lastRenderedState=C}return[C,y]}function lg(){}function cg(a,l){var p=tn,y=Ki(),w=l(),C=!Yi(y.memoizedState,w);if(C&&(y.memoizedState=w,ai=!0),y=y.queue,ya(dg.bind(null,p,y,a),[a]),y.getSnapshot!==l||C||_n!==null&&_n.memoizedState.tag&1){if(p.flags|=2048,va(9,hg.bind(null,p,y,w,l),void 0,null),ln===null)throw Error(o(349));(ho&30)!==0||ug(p,l,w)}return w}function ug(a,l,p){a.flags|=16384,a={getSnapshot:l,value:p},l=tn.updateQueue,l===null?(l={lastEffect:null,stores:null},tn.updateQueue=l,l.stores=[a]):(p=l.stores,p===null?l.stores=[a]:p.push(a))}function hg(a,l,p,y){l.value=p,l.getSnapshot=y,fg(l)&&Mi(a,1,-1)}function dg(a,l,p){return p(function(){fg(l)&&Mi(a,1,-1)})}function fg(a){var l=a.getSnapshot;a=a.value;try{var p=l();return!Yi(a,p)}catch{return!0}}function Od(a){var l=mr();return typeof a=="function"&&(a=a()),l.memoizedState=l.baseState=a,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:a},l.queue=a,a=a.dispatch=cS.bind(null,tn,a),[l.memoizedState,a]}function va(a,l,p,y){return a={tag:a,create:l,destroy:p,deps:y,next:null},l=tn.updateQueue,l===null?(l={lastEffect:null,stores:null},tn.updateQueue=l,l.lastEffect=a.next=a):(p=l.lastEffect,p===null?l.lastEffect=a.next=a:(y=p.next,p.next=a,a.next=y,l.lastEffect=a)),a}function pg(){return Ki().memoizedState}function nc(a,l,p,y){var w=mr();tn.flags|=a,w.memoizedState=va(1|l,p,void 0,y===void 0?null:y)}function ic(a,l,p,y){var w=Ki();y=y===void 0?null:y;var C=void 0;if(An!==null){var z=An.memoizedState;if(C=z.destroy,y!==null&&Dd(y,z.deps)){w.memoizedState=va(l,p,C,y);return}}tn.flags|=a,w.memoizedState=va(1|l,p,C,y)}function Fd(a,l){return nc(8390656,8,a,l)}function ya(a,l){return ic(2048,8,a,l)}function mg(a,l){return ic(4,2,a,l)}function gg(a,l){return ic(4,4,a,l)}function xg(a,l){if(typeof l=="function")return a=a(),l(a),function(){l(null)};if(l!=null)return a=a(),l.current=a,function(){l.current=null}}function vg(a,l,p){return p=p!=null?p.concat([a]):null,ic(4,4,xg.bind(null,l,a),p)}function Bd(){}function yg(a,l){var p=Ki();l=l===void 0?null:l;var y=p.memoizedState;return y!==null&&l!==null&&Dd(l,y[1])?y[0]:(p.memoizedState=[a,l],a)}function _g(a,l){var p=Ki();l=l===void 0?null:l;var y=p.memoizedState;return y!==null&&l!==null&&Dd(l,y[1])?y[0]:(a=a(),p.memoizedState=[a,l],a)}function aS(a,l){var p=Bt;Bt=p!==0&&4>p?p:4,a(!0);var y=Si.transition;Si.transition={};try{a(!1),l()}finally{Bt=p,Si.transition=y}}function Sg(){return Ki().memoizedState}function lS(a,l,p){var y=Or(a);p={lane:y,action:p,hasEagerState:!1,eagerState:null,next:null},Mg(a)?bg(l,p):(wg(a,l,p),p=zn(),a=Mi(a,y,p),a!==null&&Eg(a,l,y))}function cS(a,l,p){var y=Or(a),w={lane:y,action:p,hasEagerState:!1,eagerState:null,next:null};if(Mg(a))bg(l,w);else{wg(a,l,w);var C=a.alternate;if(a.lanes===0&&(C===null||C.lanes===0)&&(C=l.lastRenderedReducer,C!==null))try{var z=l.lastRenderedState,K=C(z,p);if(w.hasEagerState=!0,w.eagerState=K,Yi(K,z))return}catch{}p=zn(),a=Mi(a,y,p),a!==null&&Eg(a,l,y)}}function Mg(a){var l=a.alternate;return a===tn||l!==null&&l===tn}function bg(a,l){ga=$l=!0;
4053var p=a.pending;p===null?l.next=l:(l.next=p.next,p.next=l),a.pending=l}function wg(a,l,p){ln!==null&&(a.mode&1)!==0&&(At&2)===0?(a=l.interleaved,a===null?(p.next=p,Zi===null?Zi=[l]:Zi.push(l)):(p.next=a.next,a.next=p),l.interleaved=p):(a=l.pending,a===null?p.next=p:(p.next=a.next,a.next=p),l.pending=p)}function Eg(a,l,p){if((p&4194240)!==0){var y=l.lanes;y&=a.pendingLanes,p|=y,l.lanes=p,dd(a,p)}}var rc={readContext:xi,useCallback:Cn,useContext:Cn,useEffect:Cn,useImperativeHandle:Cn,useInsertionEffect:Cn,useLayoutEffect:Cn,useMemo:Cn,useReducer:Cn,useRef:Cn,useState:Cn,useDebugValue:Cn,useDeferredValue:Cn,useTransition:Cn,useMutableSource:Cn,useSyncExternalStore:Cn,useId:Cn,unstable_isNewReconciler:!1},uS={readContext:xi,useCallback:function(a,l){return mr().memoizedState=[a,l===void 0?null:l],a},useContext:xi,useEffect:Fd,useImperativeHandle:function(a,l,p){return p=p!=null?p.concat([a]):null,nc(4194308,4,xg.bind(null,l,a),p)},useLayoutEffect:function(a,l){return nc(4194308,4,a,l)},useInsertionEffect:function(a,l){return nc(4,2,a,l)},useMemo:function(a,l){var p=mr();return l=l===void 0?null:l,a=a(),p.memoizedState=[a,l],a},useReducer:function(a,l,p){var y=mr();return l=p!==void 0?p(l):l,y.memoizedState=y.baseState=l,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:l},y.queue=a,a=a.dispatch=lS.bind(null,tn,a),[y.memoizedState,a]}
vendor: 11,007 bytes, lines 4053-4055
4053,useRef:function(a){var l=mr();return a={current:a},l.memoizedState=a},useState:Od,useDebugValue:Bd,useDeferredValue:function(a){var l=Od(a),p=l[0],y=l[1];return Fd(function(){var w=Si.transition;Si.transition={};try{y(a)}finally{Si.transition=w}},[a]),p},useTransition:function(){var a=Od(!1),l=a[0];return a=aS.bind(null,a[1]),mr().memoizedState=a,[l,a]},useMutableSource:function(){},useSyncExternalStore:function(a,l,p){var y=tn,w=mr();if(qt){if(p===void 0)throw Error(o(407));p=p()}else{if(p=l(),ln===null)throw Error(o(349));(ho&30)!==0||ug(y,l,p)}w.memoizedState=p;var C={value:p,getSnapshot:l};return w.queue=C,Fd(dg.bind(null,y,C,a),[a]),y.flags|=2048,va(9,hg.bind(null,y,C,p,l),void 0,null),p},useId:function(){var a=mr(),l=ln.identifierPrefix;if(qt){var p=pr,y=fr;p=(y&~(1<<32-Jt(y)-1)).toString(32)+p,l=":"+l+"R"+p,p=xa++,0<p&&(l+="H"+p.toString(32)),l+=":"}else p=oS++,l=":"+l+"r"+p.toString(32)+":";return a.memoizedState=l},unstable_isNewReconciler:!1},hS={readContext:xi,useCallback:yg,useContext:xi,useEffect:ya,useImperativeHandle:vg,useInsertionEffect:mg,useLayoutEffect:gg,useMemo:_g,useReducer:ec,useRef:pg,useState:function(){return ec(as)},useDebugValue:Bd,useDeferredValue:function(a){var l=ec(as),p=l[0],y=l[1];return ya(function(){var w=Si.transition;Si.transition={};try{y(a)}finally{Si.transition=w}},[a]),p},useTransition:function(){var a=ec(as)[0],l=Ki().memoizedState;return[a,l]},useMutableSource:lg,useSyncExternalStore:cg,useId:Sg,unstable_isNewReconciler:!1},dS={readContext:xi,useCallback:yg,useContext:xi,useEffect:ya,useImperativeHandle:vg,useInsertionEffect:mg,useLayoutEffect:gg,useMemo:_g,useReducer:tc,useRef:pg,useState:function(){return tc(as)},useDebugValue:Bd,useDeferredValue:function(a){var l=tc(as),p=l[0],y=l[1];return ya(function(){var w=Si.transition;Si.transition={};try{y(a)}finally{Si.transition=w}},[a]),p},useTransition:function(){var a=tc(as)[0],l=Ki().memoizedState;return[a,l]},useMutableSource:lg,useSyncExternalStore:cg,useId:Sg,unstable_isNewReconciler:!1};function kd(a,l){try{var p="",y=l;do p+=sS(y),y=y.return;while(y);var w=p}catch(C){w=`
4054Error generating stack: `+C.message+`
4055`+C.stack}return{value:a,source:l,stack:w}}function zd(a,l){try{console.error(l.value)}catch(p){setTimeout(function(){throw p})}}var fS=typeof WeakMap=="function"?WeakMap:Map;function Tg(a,l,p){p=dr(-1,p),p.tag=3,p.payload={element:null};var y=l.value;return p.callback=function(){_c||(_c=!0,sf=y),zd(a,l)},p}function Ag(a,l,p){p=dr(-1,p),p.tag=3;var y=a.type.getDerivedStateFromError;if(typeof y=="function"){var w=l.value;p.payload=function(){return y(w)},p.callback=function(){zd(a,l)}}var C=a.stateNode;return C!==null&&typeof C.componentDidCatch=="function"&&(p.callback=function(){zd(a,l),typeof y!="function"&&(Nr===null?Nr=new Set([this]):Nr.add(this));var z=l.stack;this.componentDidCatch(l.value,{componentStack:z!==null?z:""})}),p}function Cg(a,l,p){var y=a.pingCache;if(y===null){y=a.pingCache=new fS;var w=new Set;y.set(l,w)}else w=y.get(l),w===void 0&&(w=new Set,y.set(l,w));w.has(p)||(w.add(p),a=AS.bind(null,a,l,p),l.then(a,a))}function Rg(a){do{var l;if((l=a.tag===13)&&(l=a.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return a;a=a.return}while(a!==null);return null}function Ig(a,l,p,y,w){return(a.mode&1)===0?(a===l?a.flags|=65536:(a.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(l=dr(-1,1),l.tag=2,Dr(p,l))),p.lanes|=1),a):(a.flags|=65536,a.lanes=w,a)}function Qi(a){a.flags|=4}function Pg(a,l){if(a!==null&&a.child===l.child)return!0;if((l.flags&16)!==0)return!1;for(a=l.child;a!==null;){if((a.flags&12854)!==0||(a.subtreeFlags&12854)!==0)return!1;a=a.sibling}return!0}var _a,Sa,sc,oc;if(De)_a=function(a,l){for(var p=l.child;p!==null;){if(p.tag===5||p.tag===6)ve(a,p.stateNode);else if(p.tag!==4&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===l)break;for(;p.sibling===null;){if(p.return===null||p.return===l)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},Sa=function(){},sc=function(a,l,p,y,w){if(a=a.memoizedProps,a!==y){var C=l.stateNode,z=Ji(_i.current);p=dt(C,p,a,y,w,z),(l.updateQueue=p)&&Qi(l)}},oc=function(a,l,p,y){p!==y&&Qi(l)};else if(_t){_a=function(a,l,p,y){for(var w=l.child;w!==null;){if(w.tag===5){var C=w.stateNode;p&&y&&(C=Ct(C,w.type,w.memoizedProps,w)),ve(a,C)}else if(w.tag===6)C=w.stateNode,p&&y&&(C=xn(C,w.memoizedProps,w)),ve(a,C);else if(w.tag!==4){if(w.tag===22&&w.memoizedState!==null)C=w.child,C!==null&&(C.return=w),_a(a,w,!0,!0);else if(w.child!==null){w.child.return=w,w=w.child;continue}}if(w===l)break;for(;w.sibling===null;){if(w.return===null||w.return===l)return;w=w.return}w.sibling.return=w.return,w=w.sibling}};var Lg=function(a,l,p,y){for(var w=l.child;w!==null;){if(w.tag===5){var C=w.stateNode;p&&y&&(C=Ct(C,w.type,w.memoizedProps,w)),We(a,C)}else if(w.tag===6)C=w.stateNode,p&&y&&(C=xn(C,w.memoizedProps,w)),We(a,C);else if(w.tag!==4){if(w.tag===22&&w.memoizedState!==null)C=w.child,C!==null&&(C.return=w),Lg(a,w,!0,!0);else if(w.child!==null){w.child.return=w,w=w.child;continue}}if(w===l)break;for(;w.sibling===null;){if(w.return===null||w.return===l)return;w=w.return}w.sibling.return=w.return,w=w.sibling}};Sa=function(a,l){var p=l.stateNode;if(!Pg(a,l)){a=p.containerInfo;var y=fe(a);Lg(y,l,!1,!1),p.pendingChildren=y,Qi(l),ct(a,y)}},sc=function(a,l,p,y,w){var C=a.stateNode,z=a.memoizedProps;if((a=Pg(a,l))&&z===y)l.stateNode=C;else{var K=l.stateNode,pe=Ji(_i.current),Le=null;z!==y&&(Le=dt(K,p,z,y,w,pe)),a&&Le===null?l.stateNode=C:(C=Te(C,Le,p,z,y,l,a,K),Ae(C,p,y,w,pe)&&Qi(l),l.stateNode=C,a?Qi(l):_a(C,l,!1,!1))}},oc=function(a,l,p,y){p!==y?(a=Ji(co.current),p=Ji(_i.current),l.stateNode=he(y,a,p,l),Qi(l)):l.stateNode=a.stateNode}}else Sa=function(){},sc=function(){},oc=function(){};function Ma(a,l){if(!qt)switch(a.tailMode){case"hidden":l=a.tail;for(var p=null;l!==null;)l.alternate!==null&&(p=l),l=l.sibling;p===null?a.tail=null:p.sibling=null;break;case"collapsed":p=a.tail;for(var y=null;p!==null;)p.alternate!==null&&(y=p),p=p.sibling;y===null?l||a.tail===null?a.tail=null:a.tail.sibling=null:y.sibling=null}}function Rn(a){var l=a.alternate!==null&&a.alternate.child===a.child,p=0,y=0;if(l)for(var w=a.child;w!==null;)p|=w.lanes|w.childLanes,y|=w.subtreeFlags&14680064,y|=w.flags&14680064,w.return=a,w=w.sibling;else for(w=a.child;w!==null;)p|=w.lanes|w.childLanes,y|=w.subtreeFlags,y|=w.flags,w.return=a,w=w.sibling;return a.subtreeFlags|=y,a.childLanes=p,l}function pS(a,l,p){var y=l.pendingProps;switch(Ed(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rn(l),null;case 1:return Rt(l.type)&&Nt(),Rn(l),null;case 3:return y=l.stateNode,uo(),Ue(Ze),Ue(ut),Ld(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(a===null||a.child===null)&&(da(l)?Qi(l):a===null||a.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Di!==null&&(lf(Di),Di=null))),Sa(a,l),Rn(l),null;case 5:Id(l),p=Ji(co.current);var w=l.type;if(a!==null&&l.stateNode!=null)sc(a,l,w,y,p),a.ref!==l.ref&&(l.flags|=512,l.flags|=2097152);else{if(!y){if(l.stateNode===null)throw Error(o(166));return Rn(l),null}if(a=Ji(_i.current),da(l)){if(!Je)throw Error(o(175));a=eo(l.stateNode,l.type,l.memoizedProps,p,a,l,!ha),l.updateQueue=a,a!==null&&Qi(l)}else{var C=ce(w,y,p,a,l);_a(C,l,!1,!1),l.stateNode=C,Ae(C,w,y,p,a)&&Qi(l)}l.ref!==null&&(l.flags|=512,l.flags|=2097152)}return Rn(l),null;case 6:if(a&&l.stateNode!=null)oc(a,l,a.memoizedProps,y);else{if(typeof y!="string"&&l.stateNode===null)throw Error(o(166));if(a=Ji(co.current),p=Ji(_i.current),da(l)){if(!Je)throw Error(o(176));if(a=l.stateNode,y=l.memoizedProps,(p=Bl(a,y,l,!ha))&&(w=si,w!==null))switch(C=(w.mode&1)!==0,w.tag){case 3:cd(w.stateNode.containerInfo,a,y,C);break;case 5:ud(w.type,w.memoizedProps,w.stateNode,a,y,C)}p&&Qi(l)}else l.stateNode=he(y,a,p,l)}return Rn(l),null;case 13:if(Ue(Qt),y=l.memoizedState,qt&&oi!==null&&(l.mode&1)!==0&&(l.flags&128)===0){for(a=oi;a;)a=ri(a);return ao(),l.flags|=98560,l}if(y!==null&&y.dehydrated!==null){if(y=da(l),a===null){if(!y)throw Error(o(318));if(!Je)throw Error(o(344));if(a=l.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(o(317));to(a,l)}else ao(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;return Rn(l),null}return Di!==null&&(lf(Di),Di=null),(l.flags&128)!==0?(l.lanes=p,l):(y=y!==null,p=!1,a===null?da(l):p=a.memoizedState!==null,y&&!p&&(l.child.flags|=8192,(l.mode&1)!==0&&(a===null||(Qt.current&1)!==0?pn===0&&(pn=3):uf())),l.updateQueue!==null&&(l.flags|=4),Rn(l),null);case 4:return uo(),Sa(a,l),a===null&&_e(l.stateNode.containerInfo),Rn(l),null;case 10:return yd(l.type._context),Rn(l),null;case 17:return Rt(l.type)&&Nt(),Rn(l),null;case 19:if(Ue(Qt),w=l.memoizedState,w===null)return Rn(l),null;if(y=(l.flags&128)!==0,C=w.rendering,C===null)if(y)Ma(w,!1);else{if(pn!==0||a!==null&&(a.flags&128)!==0)for(a=l.child;a!==null;){if(C=Kl(a),C!==null){for(l.flags|=128,Ma(w,!1),a=C.updateQueue,a!==null&&(l.updateQueue=a,l.flags|=4),l.subtreeFlags=0,a=p,y=l.child;y!==null;)p=y,w=a,p.flags&=14680066,C=p.alternate,C===null?(p.childLanes=0,p.lanes=w,p.child=null,p.subtreeFlags=0,p.memoizedProps=null,p.memoizedState=null,p.updateQueue=null,p.dependencies=null,p.stateNode=null):(p.childLanes=C.childLanes,p.lanes=C.lanes,p.child=C.child,p.subtreeFlags=0,p.deletions=null,p.memoizedProps=C.memoizedProps,p.memoizedState=C.memoizedState,p.updateQueue=C.updateQueue,p.type=C.type,w=C.dependencies,p.dependencies=w===null?null:{lanes:w.lanes,firstContext:w.firstContext}),y=y.sibling;return Oe(Qt,Qt.current&1|2),l.child}a=a.sibling}w.tail!==null&&yn()>rf&&(l.flags|=128,y=!0,Ma(w,!1),l.lanes=4194304)}else{if(!y)if(a=Kl(C),a!==null){if(l.flags|=128,y=!0,a=a.updateQueue,a!==null&&(l.updateQueue=a,l.flags|=4),Ma(w,!0),w.tail===null&&w.tailMode==="hidden"&&!C.alternate&&!qt)return Rn(l),null}else 2*yn()-w.renderingStartTime>rf&&p!==1073741824&&(l.flags|=128,y=!0,Ma(w,!1),l.lanes=4194304);w.isBackwards?(C.sibling=l.child,l.child=C):(a=w.last,a!==null?a.sibling=C:l.child=C,w.last=C)}return w.tail!==null?(l=w.tail,w.rendering=l,w.tail=l.sibling,w.renderingStartTime=yn(),l.sibling=null,a=Qt.current,Oe(Qt,y?a&1|2:a&1),l):(Rn(l),null);case 22:case 23:return cf(),y=l.memoizedState!==null,a!==null&&a.memoizedState!==null!==y&&(l.flags|=8192),y&&(l.mode&1)!==0?(li&1073741824)!==0&&(Rn(l),De&&l.subtreeFlags&6&&(l.flags|=8192)):Rn(l),null;case 24:return null;case 25:return null}throw Error(o(156,l.tag))}var mS=c.ReactCurrentOwner,ai=!1;function kn(a,l,p,y){l.child=a===null?og(l,null,p,y):lo(l,a.child,p,y)}function Dg(a,l,p,y,w){p=p.render;var C=l.ref;return ro(l,w),y=Nd(a,l,p,y,C,w),p=Ud(),a!==null&&!ai?(l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~w,gr(a,l,w)):(qt&&p&&wd(l),l.flags|=1,kn(a,l,y,w),l.child)}function Ng(a,l,p,y,w){if(a===null){var C=p.type;return typeof C=="function"&&!hf(C)&&C.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(l.tag=15,l.type=C,Ug(a,l,C,y,w)):(a=Ac(p.type,null,y,l,l.mode,w
vendor: 5,228 bytes, line 4055
4055),a.ref=l.ref,a.return=l,l.child=a)}if(C=a.child,(a.lanes&w)===0){var z=C.memoizedProps;if(p=p.compare,p=p!==null?p:Gl,p(z,y)&&a.ref===l.ref)return gr(a,l,w)}return l.flags|=1,a=Br(C,y),a.ref=l.ref,a.return=l,l.child=a}function Ug(a,l,p,y,w){if(a!==null&&Gl(a.memoizedProps,y)&&a.ref===l.ref)if(ai=!1,(a.lanes&w)!==0)(a.flags&131072)!==0&&(ai=!0);else return l.lanes=a.lanes,gr(a,l,w);return Vd(a,l,p,y,w)}function Og(a,l,p){var y=l.pendingProps,w=y.children,C=a!==null?a.memoizedState:null;if(y.mode==="hidden")if((l.mode&1)===0)l.memoizedState={baseLanes:0,cachePool:null},Oe(fo,li),li|=p;else if((p&1073741824)!==0)l.memoizedState={baseLanes:0,cachePool:null},y=C!==null?C.baseLanes:p,Oe(fo,li),li|=y;else return a=C!==null?C.baseLanes|p:p,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:a,cachePool:null},l.updateQueue=null,Oe(fo,li),li|=a,null;else C!==null?(y=C.baseLanes|p,l.memoizedState=null):y=p,Oe(fo,li),li|=y;return kn(a,l,w,p),l.child}function Fg(a,l){var p=l.ref;(a===null&&p!==null||a!==null&&a.ref!==p)&&(l.flags|=512,l.flags|=2097152)}function Vd(a,l,p,y,w){var C=Rt(p)?It:ut.current;return C=Gt(l,C),ro(l,w),p=Nd(a,l,p,y,C,w),y=Ud(),a!==null&&!ai?(l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~w,gr(a,l,w)):(qt&&y&&wd(l),l.flags|=1,kn(a,l,p,w),l.child)}function Bg(a,l,p,y,w){if(Rt(p)){var C=!0;vn(l)}else C=!1;if(ro(l,w),l.stateNode===null)a!==null&&(a.alternate=null,l.alternate=null,l.flags|=2),Qm(l,p,y),bd(l,p,y,w),y=!0;else if(a===null){var z=l.stateNode,K=l.memoizedProps;z.props=K;var pe=z.context,Le=p.contextType;typeof Le=="object"&&Le!==null?Le=xi(Le):(Le=Rt(p)?It:ut.current,Le=Gt(l,Le));var et=p.getDerivedStateFromProps,St=typeof et=="function"||typeof z.getSnapshotBeforeUpdate=="function";St||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(K!==y||pe!==Le)&&$m(l,z,y,Le),Lr=!1;var ft=l.memoizedState;z.state=ft,Xl(l,y,z,w),pe=l.memoizedState,K!==y||ft!==pe||Ze.current||Lr?(typeof et=="function"&&(Md(l,p,et,y),pe=l.memoizedState),(K=Lr||Km(l,p,K,y,ft,pe,Le))?(St||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount()),typeof z.componentDidMount=="function"&&(l.flags|=4194308)):(typeof z.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=y,l.memoizedState=pe),z.props=y,z.state=pe,z.context=Le,y=K):(typeof z.componentDidMount=="function"&&(l.flags|=4194308),y=!1)}else{z=l.stateNode,Ym(a,l),K=l.memoizedProps,Le=l.type===l.elementType?K:Li(l.type,K),z.props=Le,St=l.pendingProps,ft=z.context,pe=p.contextType,typeof pe=="object"&&pe!==null?pe=xi(pe):(pe=Rt(p)?It:ut.current,pe=Gt(l,pe));var Wt=p.getDerivedStateFromProps;(et=typeof Wt=="function"||typeof z.getSnapshotBeforeUpdate=="function")||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(K!==St||ft!==pe)&&$m(l,z,y,pe),Lr=!1,ft=l.memoizedState,z.state=ft,Xl(l,y,z,w);var lt=l.memoizedState;K!==St||ft!==lt||Ze.current||Lr?(typeof Wt=="function"&&(Md(l,p,Wt,y),lt=l.memoizedState),(Le=Lr||Km(l,p,Le,y,ft,lt,pe)||!1)?(et||typeof z.UNSAFE_componentWillUpdate!="function"&&typeof z.componentWillUpdate!="function"||(typeof z.componentWillUpdate=="function"&&z.componentWillUpdate(y,lt,pe),typeof z.UNSAFE_componentWillUpdate=="function"&&z.UNSAFE_componentWillUpdate(y,lt,pe)),typeof z.componentDidUpdate=="function"&&(l.flags|=4),typeof z.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof z.componentDidUpdate!="function"||K===a.memoizedProps&&ft===a.memoizedState||(l.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||K===a.memoizedProps&&ft===a.memoizedState||(l.flags|=1024),l.memoizedProps=y,l.memoizedState=lt),z.props=y,z.state=lt,z.context=pe,y=Le):(typeof z.componentDidUpdate!="function"||K===a.memoizedProps&&ft===a.memoizedState||(l.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||K===a.memoizedProps&&ft===a.memoizedState||(l.flags|=1024),y=!1)}return Gd(a,l,p,y,C,w)}function Gd(a,l,p,y,w,C){Fg(a,l);var z=(l.flags&128)!==0;if(!y&&!z)return w&&Lt(l,p,!1),gr(a,l,C);y=l.stateNode,mS.current=l;var K=z&&typeof p.getDerivedStateFromError!="function"?null:y.render();return l.flags|=1,a!==null&&z?(l.child=lo(l,a.child,null,C),l.child=lo(l,null,K,C)):kn(a,l,K,C),l.memoizedState=y.state,w&&Lt(l,p,!0),l.child}function kg(a){var l=a.stateNode;l.pendingContext?fn(a,l.pendingContext,l.pendingContext!==l.context):l.context&&fn(a,l.context,!1),Rd(a,l.containerInfo)}function zg(a,l,p,y,w){return ao(),Cd(w),l.flags|=256,kn(a,l,p,y),l.child}var ac={dehydrated:null,treeContext:null,retryLane:0};function lc(a){return{baseLanes:a,cachePool:null}}function Vg(a,l,p){var y=l.pendingProps,w=Qt.current,C=!1,z=(l.flags&128)!==0,K;if((K=z)||(K=a!==null&&a.memoizedState===null?!1:(w&2)!==0),K?(C=!0,l.flags&=-129):(a===null||a.memoizedState!==null)&&(w|=1),Oe(Qt,w&1),a===null)return Ad(l),a=l.memoizedState,a!==null&&(a=a.dehydrated,a!==null)?((l.mode&1)===0?l.lanes=1:$s(a)?l.lanes=8:l.lanes=1073741824,null):(w=y.children,a=y.fallback,C?(y=l.mode,C=l.child,w={mode:"hidden",children:w}
4055,(y&1)===0&&C!==null?(C.childLanes=0,C.pendingProps=w):C=Cc(w,y,0,null),a=fs(a,y,p,null),C.return=l,a.return=l,C.sibling=a,l.child=C,l.child.memoizedState=lc(p),l.memoizedState=ac,a):Hd(l,w));if(w=a.memoizedState,w!==null){if(K=w.dehydrated,K!==null){if(z)return l.flags&256?(l.flags&=-257,cc(a,l,p,Error(o(422)))):l.memoizedState!==null?(l.child=a.child,l.flags|=128,null):(C=y.fallback,w=l.mode,y=Cc({mode:"visible",children:y.children},w,0,null),C=fs(C,w,p,null),C.flags|=2,y.return=l,C.return=l,y.sibling=C,l.child=y,(l.mode&1)!==0&&lo(l,a.child,null,p),l.child.memoizedState=lc(p),l.memoizedState=ac,C);if((l.mode&1)===0)l=cc(a,l,p,null);else if($s(K))l=cc(a,l,p,Error(o(419)));else if(y=(p&a.childLanes)!==0,ai||y){if(y=ln,y!==null){switch(p&-p){case 4:C=2;break;case 16:C=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:C=32;break;case 536870912:C=268435456;break;default:C=0}y=(C&(y.suspendedLanes|p))!==0?0:C,y!==0&&y!==w.retryLane&&(w.retryLane=y,Mi(a,y,-1))}uf(),l=cc(a,l,p,Error(o(421)))}else Nl(K)?(l.flags|=128,l.child=a.child,l=CS.bind(null,a),Ul(K,l),l=null):(p=w.treeContext,Je&&(oi=Fl(K),si=l,qt=!0,Di=null,ha=!1,p!==null&&(vi[yi++]=fr,vi[yi++]=pr,vi[yi++]=ss,fr=p.id,pr=p.overflow,ss=l)),l=Hd(l,l.pendingProps.children),l.flags|=4096);return l}return C?(y=Hg(a,l,y.children,y.fallback,p),C=l.child,w=a.child.memoizedState,C.memoizedState=w===null?lc(p):{baseLanes:w.baseLanes|p,cachePool:null},C.childLanes=a.childLanes&~p,l.memoizedState=ac,y):(p=Gg(a,l,y.children,p),l.memoizedState=null,p)}return C?(y=Hg(a,l,y.children,y.fallback,p),C=l.child,w=a.child.memoizedState,C.memoizedState=w===null?lc(p):{baseLanes:w.baseLanes|p,cachePool:null},C.childLanes=a.childLanes&~p,l.memoizedState=ac,y):(p=Gg(a,l,y.children,p),l.memoizedState=null,p)}function Hd(a,l){return l=Cc({mode:"visible",children:l},a.mode,0,null),l.return=a,a.child=l}function Gg(a,l,p,y){var w=a.child;return a=w.sibling,p=Br(w,{mode:"visible",children:p}),(l.mode&1)===0&&(p.lanes=y),p.return=l,p.sibling=null,a!==null&&(y=l.deletions,y===null?(l.deletions=[a],l.flags|=16):y.push(a)),l.child=p}function Hg(a,l,p,y,w){var C=l.mode;a=a.child;var z=a.sibling,K={mode:"hidden",children:p};return(C&1)===0&&l.child!==a?(p=l.child,p.childLanes=0,p.pendingProps=K,l.deletions=null):(p=Br(a,K),p.subtreeFlags=a.subtreeFlags&14680064),z!==null?y=Br(z,y):(y=fs(y,C,w,null),y.flags|=2),y.return=l,p.return=l,p.sibling=y,l.child=p,y}function cc(a,l,p,y){return y!==null&&Cd(y),lo(l,a.child,null,p),a=Hd(l,l.pendingProps.children),a.flags|=2,l.memoizedState=null,a}function Wg(a,l,p){a.lanes|=l;var y=a.alternate;y!==null&&(y.lanes|=l),_d(a.return,l,p)}function Wd(a,l,p,y,w){var C=a.memoizedState;C===null?a.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:y,tail:p,tailMode:w}:(C.isBackwards=l,C.rendering=null,C.renderingStartTime=0,C.last=y,C.tail=p,C.tailMode=w)}function jg(a,l,p){var y=l.pendingProps,w=y.revealOrder,C=y.tail;if(kn(a,l,y.children,p),y=Qt.current,(y&2)!==0)y=y&1|2,l.flags|=128;else{if(a!==null&&(a.flags&128)!==0)e:for(a=l.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&Wg(a,p,l);else if(a.tag===19)Wg(a,p,l);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===l)break e;for(;a.sibling===null;){if(a.return===null||a.return===l)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}y&=1}if(Oe(Qt,y),(l.mode&1)===0)l.memoizedState=null;else switch(w){case"forwards":for(p=l.child,w=null;p!==null;)a=p.alternate,a!==null&&Kl(a)===null&&(w=p),p=p.sibling;p=w,p===null?(w=l.child,l.child=null):(w=p.sibling,p.sibling=null),Wd(l,!1,w,p,C);break;case"backwards":for(p=null,w=l.child,l.child=null;w!==null;){if(a=w.alternate,a!==null&&Kl(a)===null){l.child=w;break}a=w.sibling,w.sibling=p,p=w,w=a}Wd(l,!0,p,null,C);break;case"together":Wd(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function gr(a,l,p){if(a!==null&&(l.dependencies=a.dependencies),po|=l.lanes,(p&l.childLanes)===0)return null;if(a!==null&&l.child!==a.child)throw Error(o(153));if(l.child!==null){for(a=l.child,p=Br(a,a.pendingProps),l.child=p,p.return=l;a.sibling!==null;)a=a.sibling,p=p.sibling=Br(a,a.pendingProps),p.return=l;p.sibling=null}return l.child}function gS(a,l,p){switch(l.tag){case 3:kg(l),ao();break;case 5:ag(l);break;case 1:Rt(l.type)&&vn(l);break;case 4:Rd(l,l.stateNode.containerInfo);break;case 10:Xm(l,l.type._context,l.memoizedProps.value);break;case 13:var y=l.memoizedState;if(y!==null)return y.dehydrated!==null?(Oe(Qt,Qt.current&1),l.flags|=128,null):(p&l.child.childLanes)!==0?Vg(a,l,p):(Oe(Qt,Qt.current&1),a=gr(a,l,p),a!==null?a.sibling:null);Oe(Qt,Qt.current&1);break;case 19:if(y=(p&l.childLanes)!==0,(a.flags&128)!==0){if(y)return jg(a,l,p);l.flags|=128}var w=l.memoizedState;if(w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),Oe(Qt,Qt.current),y)break;return null;case 22:case 23:return l.lanes=0,Og(a,l,p)}return gr(a,l,p)}function xS(a,l){switch(Ed(l),l.tag){case 1:return Rt(l.type)&&Nt(),a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 3:return uo(),Ue(Ze),Ue(ut),Ld(),a=l.flags,(a&65536)!==0&&(a&128)===0?(l.flags=a&-65537|128,l):null;case 5:return Id(l),null;case 13:if(Ue(Qt),a=l.memoizedState,a!==null&&a.dehydrated!==null){if(l.alternate===null)throw Error(o(340));ao()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 19:return Ue(Qt),null;case 4:return uo(),null;
vendor: 10,762 bytes, line 4055
4055case 10:return yd(l.type._context),null;case 22:case 23:return cf(),null;case 24:return null;default:return null}}var uc=!1,ls=!1,vS=typeof WeakSet=="function"?WeakSet:Set,je=null;function hc(a,l){var p=a.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(y){Jn(a,l,y)}else p.current=null}function jd(a,l,p){try{p()}catch(y){Jn(a,l,y)}}var Xg=!1;function yS(a,l){for(te(a.containerInfo),je=l;je!==null;)if(a=je,l=a.child,(a.subtreeFlags&1028)!==0&&l!==null)l.return=a,je=l;else for(;je!==null;){a=je;try{var p=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var y=p.memoizedProps,w=p.memoizedState,C=a.stateNode,z=C.getSnapshotBeforeUpdate(a.elementType===a.type?y:Li(a.type,y),w);C.__reactInternalSnapshotBeforeUpdate=z}break;case 3:De&&Ve(a.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(K){Jn(a,a.return,K)}if(l=a.sibling,l!==null){l.return=a.return,je=l;break}je=a.return}return p=Xg,Xg=!1,p}function cs(a,l,p){var y=l.updateQueue;if(y=y!==null?y.lastEffect:null,y!==null){var w=y=y.next;do{if((w.tag&a)===a){var C=w.destroy;w.destroy=void 0,C!==void 0&&jd(l,p,C)}w=w.next}while(w!==y)}}function ba(a,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var p=l=l.next;do{if((p.tag&a)===a){var y=p.create;p.destroy=y()}p=p.next}while(p!==l)}}function Xd(a){var l=a.ref;if(l!==null){var p=a.stateNode;a.tag===5?a=q(p):a=p,typeof l=="function"?l(a):l.current=a}}function Yg(a,l,p){if(Xi&&typeof Xi.onCommitFiberUnmount=="function")try{Xi.onCommitFiberUnmount(zl,l)}catch{}switch(l.tag){case 0:case 11:case 14:case 15:if(a=l.updateQueue,a!==null&&(a=a.lastEffect,a!==null)){var y=a=a.next;do{var w=y,C=w.destroy;w=w.tag,C!==void 0&&((w&2)!==0||(w&4)!==0)&&jd(l,p,C),y=y.next}while(y!==a)}break;case 1:if(hc(l,p),a=l.stateNode,typeof a.componentWillUnmount=="function")try{a.props=l.memoizedProps,a.state=l.memoizedState,a.componentWillUnmount()}catch(z){Jn(l,p,z)}break;case 5:hc(l,p);break;case 4:De?$g(a,l,p):_t&&_t&&(l=l.stateNode.containerInfo,p=fe(l),Pt(l,p))}}function qg(a,l,p){for(var y=l;;)if(Yg(a,y,p),y.child===null||De&&y.tag===4){if(y===l)break;for(;y.sibling===null;){if(y.return===null||y.return===l)return;y=y.return}y.sibling.return=y.return,y=y.sibling}else y.child.return=y,y=y.child}function Zg(a){var l=a.alternate;l!==null&&(a.alternate=null,Zg(l)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(l=a.stateNode,l!==null&&Ie(l)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function Jg(a){return a.tag===5||a.tag===3||a.tag===4}function Kg(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||Jg(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Qg(a){if(De){e:{for(var l=a.return;l!==null;){if(Jg(l))break e;l=l.return}throw Error(o(160))}var p=l;switch(p.tag){case 5:l=p.stateNode,p.flags&32&&(se(l),p.flags&=-33),p=Kg(a),qd(a,p,l);break;case 3:case 4:l=p.stateNode.containerInfo,p=Kg(a),Yd(a,p,l);break;default:throw Error(o(161))}}}function Yd(a,l,p){var y=a.tag;if(y===5||y===6)a=a.stateNode,l?Re(p,a,l):Qe(p,a);else if(y!==4&&(a=a.child,a!==null))for(Yd(a,l,p),a=a.sibling;a!==null;)Yd(a,l,p),a=a.sibling}function qd(a,l,p){var y=a.tag;if(y===5||y===6)a=a.stateNode,l?Me(p,a,l):de(p,a);else if(y!==4&&(a=a.child,a!==null))for(qd(a,l,p),a=a.sibling;a!==null;)qd(a,l,p),a=a.sibling}function $g(a,l,p){for(var y=l,w=!1,C,z;;){if(!w){w=y.return;e:for(;;){if(w===null)throw Error(o(160));switch(C=w.stateNode,w.tag){case 5:z=!1;break e;case 3:C=C.containerInfo,z=!0;break e;case 4:C=C.containerInfo,z=!0;break e}w=w.return}w=!0}if(y.tag===5||y.tag===6)qg(a,y,p),z?G(C,y.stateNode):$e(C,y.stateNode);else if(y.tag===18)z?ad(C,y.stateNode):od(C,y.stateNode);else if(y.tag===4){if(y.child!==null){C=y.stateNode.containerInfo,z=!0,y.child.return=y,y=y.child;continue}}else if(Yg(a,y,p),y.child!==null){y.child.return=y,y=y.child;continue}if(y===l)break;for(;y.sibling===null;){if(y.return===null||y.return===l)return;y=y.return,y.tag===4&&(w=!1)}y.sibling.return=y.return,y=y.sibling}}function Zd(a,l){if(De){switch(l.tag){case 0:case 11:case 14:case 15:cs(3,l,l.return),ba(3,l),cs(5,l,l.return);return;case 1:return;case 5:var p=l.stateNode;if(p!=null){var y=l.memoizedProps;a=a!==null?a.memoizedProps:y;var w=l.type,C=l.updateQueue;l.updateQueue=null,C!==null&&ht(p,C,w,a,y,l)}return;case 6:if(l.stateNode===null)throw Error(o(162));p=l.memoizedProps,Ne(l.stateNode,a!==null?a.memoizedProps:p,p);return;case 3:Je&&a!==null&&a.memoizedState.isDehydrated&&ca(l.stateNode.containerInfo);return;case 12:return;case 13:dc(l);return;case 19:dc(l);return;case 17:return}throw Error(o(163))}switch(l.tag){case 0:case 11:case 14:case 15:cs(3,l,l.return),ba(3,l),cs(5,l,l.return);return;case 12:return;case 13:dc(l);return;case 19:dc(l);return;case 3:Je&&a!==null&&a.memoizedState.isDehydrated&&ca(l.stateNode.containerInfo);break;case 22:case 23:return}e:if(_t){switch(l.tag){case 1:case 5:case 6:break e;case 3:case 4:l=l.stateNode,Pt(l.containerInfo,l.pendingChildren);break e}throw Error(o(163))}}function dc(a){var l=a.updateQueue;if(l!==null){a.updateQueue=null;var p=a.stateNode;p===null&&(p=a.stateNode=new vS),l.forEach(function(y){var w=RS.bind(null,a,y);p.has(y)||(p.add(y),y.then(w,w))})}}function _S(a,l){for(je=l;je!==null;){l=je;var p=l.deletions;if(p!==null)for(var y=0;y<p.length;y++){var w=p[y];try{var C=a;De?$g(C,w,l):qg(C,w,l);var z=w.alternate;z!==null&&(z.return=null),w.return=null}catch(st){Jn(w,l,st)}}if(p=l.child,(l.subtreeFlags&12854)!==0&&p!==null)p.return=l,je=p;else for(;je!==null;){l=je;try{var K=l.flags;if(K&32&&De&&se(l.stateNode),K&512){var pe=l.alternate;if(pe!==null){var Le=pe.ref;Le!==null&&(typeof Le=="function"?Le(null):Le.current=null)}}if(K&8192)switch(l.tag){case 13:if(l.memoizedState!==null){var et=l.alternate;(et===null||et.memoizedState===null)&&(nf=yn())}break;case 22:var St=l.memoizedState!==null,ft=l.alternate,Wt=ft!==null&&ft.memoizedState!==null;if(p=l,De){e:if(y=p,w=St,C=null,De)for(var lt=y;;){if(lt.tag===5){if(C===null){C=lt;var In=lt.stateNode;w?Pe(In):Se(lt.stateNode,lt.memoizedProps)}}else if(lt.tag===6){if(C===null){var wi=lt.stateNode;w?W(wi):be(wi,lt.memoizedProps)}}else if((lt.tag!==22&&lt.tag!==23||lt.memoizedState===null||lt===y)&&lt.child!==null){lt.child.return=lt,lt=lt.child;continue}if(lt===y)break;for(;lt.sibling===null;){if(lt.return===null||lt.return===y)break e;C===lt&&(C=null),lt=lt.return}C===lt&&(C=null),lt.sibling.return=lt.return,lt=lt.sibling}}if(St&&!Wt&&(p.mode&1)!==0){je=p;for(var re=p.child;re!==null;){for(p=je=re;je!==null;){y=je;var $=y.child;switch(y.tag){case 0:case 11:case 14:case 15:cs(4,y,y.return);break;case 1:hc(y,y.return);var ue=y.stateNode;if(typeof ue.componentWillUnmount=="function"){var Ye=y.return;try{ue.props=y.memoizedProps,ue.state=y.memoizedState,ue.componentWillUnmount()}catch(st){Jn(y,Ye,st)}}break;case 5:hc(y,y.return);break;case 22:if(y.memoizedState!==null){n0(p);continue}}$!==null?($.return=y,je=$):n0(p)}re=re.sibling}}}switch(K&4102){case 2:Qg(l),l.flags&=-3;break;case 6:Qg(l),l.flags&=-3,Zd(l.alternate,l);break;case 4096:l.flags&=-4097;break;case 4100:l.flags&=-4097,Zd(l.alternate,l);break;case 4:Zd(l.alternate,l)}}catch(st){Jn(l,l.return,st)}if(p=l.sibling,p!==null){p.return=l.return,je=p;break}je=l.return}}}function SS(a,l,p){je=a,e0(a)}function e0(a,l,p){for(var y=(a.mode&1)!==0;je!==null;){var w=je,C=w.child;if(w.tag===22&&y){var z=w.memoizedState!==null||uc;if(!z){var K=w.alternate,pe=K!==null&&K.memoizedState!==null||ls;K=uc;var Le=ls;if(uc=z,(ls=pe)&&!Le)for(je=w;je!==null;)z=je,pe=z.child,z.tag===22&&z.memoizedState!==null?i0(w):pe!==null?(pe.return=z,je=pe):i0(w);for(;C!==null;)je=C,e0(C),C=C.sibling;je=w,uc=K,ls=Le}t0(a)}else(w.subtreeFlags&8772)!==0&&C!==null?(C.return=w,je=C):t0(a)}}function t0(a){for(;je!==null;){var l=je;if((l.flags&8772)!==0){var p=l.alternate;try{if((l.flags&8772)!==0)switch(l.tag){case 0:case 11:case 15:ls||ba(5,l);break;case 1:var y=l.stateNode;if(l.flags&4&&!ls)if(p===null)y.componentDidMount();else{var w=l.elementType===l.type?p.memoizedProps:Li(l.type,p.memoizedProps);y.componentDidUpdate(w,p.memoizedState,y.__reactInternalSnapshotBeforeUpdate)}var C=l.updateQueue;C!==null&&Zm(l,C,y);break;case 3:var z=l.updateQueue;if(z!==null){if(p=null,l.child!==null)switch(l.child.tag){case 5:p=q(l.child.stateNode);break;case 1:p=l.child.stateNode}Zm(l,z,p)}break;case 5:var K=l.stateNode;p===null&&l.flags&4&&it(K,l.type,l.memoizedProps,l);break;case 6:break;case 4:break;case 12:break;case 13:if(Je&&l.memoizedState===null){var pe=l.alternate;if(pe!==null){var Le=pe.memoizedState;if(Le!==null){var et=Le.dehydrated;et!==null&&sd(et)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(o(163))}ls||l.flags&512&&Xd(l)}catch(St){Jn(l,l.return,St)}}if(l===a){je=null;break}if(p=l.sibling,p!==null){p.return=l.return,je=p;break}je=l.return}}function n0(a){for(;je!==null;){var l=je;if(l===a){je=null;break}var p=l.sibling;if(p!==null){p.return=l.return,je=p;break}je=l.return}}function i0(a){for(;je!==null;){var l=je;try{switch(l.tag){case 0:case 11:case 15:var p=l.return;try{ba(4,l)}catch(pe){Jn(l,p,pe)}break;case 1:var y=l.stateNode;if(typeof y.componentDidMount=="function"){var w=l.return;try{y.componentDidMount()}catch(pe){Jn(l,w,pe)}}var C=l.return;try{Xd(l)}catch(pe){Jn(l,C,pe)}break;case 5:var z=l.return;try{Xd(l)}catch(pe){Jn(l,z,pe)}}}catch(pe){Jn(l,l.return,pe)}if(l===a){je=null;break}var K=l.sibling;if(K!==null){K.return=l.return,je=K;break}je=l.return}}var fc=0,pc=1,mc=2,gc=3,xc=4;if(typeof Symbol=="function"&&Symbol.for){var wa=Symbol.for;fc=wa("selector.component"),pc=wa("selector.has_pseudo_class"),mc=wa("selector.role"),gc=wa("selector.test_id"),xc=wa("selector.text")}function Jd(a){var l=xe(a);if(l!=null){if(typeof l.memoizedProps["data-testname"]!="string")throw Error(o(364));return l}if(a=at(a),a===null)throw Error(o(362));return a.stateNode.current}function Kd(a,l){switch(l.$$typeof){case fc:if(a.type===l.value)return!0;break;case pc:e:{l=l.value,a=[a,0];for(var p=0;p<a.length;){var y=a[p++],w=a[p++],C=l[w];if(y.tag!==5||!I(y)){for(;C!=null&&Kd(y,C);)w++,C=l[w];if(w===l.length){l=!0;break e}else for(y=y.child;y!==null;)a.push(y,w),y=y.sibling}}l=!1}return l;case mc:if(a.tag===5&&Z(a.stateNode,l.value))return!0;break;case xc:if((a.tag===5||a.tag===6)&&(a=O(a),a!==null&&0<=a.indexOf(l.value)))return!0;break;case gc:if(a.tag===5&&(a=a.memoizedProps["data-testname"],typeof a=="str
4055ing"&&a.toLowerCase()===l.value.toLowerCase()))return!0;break;default:throw Error(o(365))}return!1}function Qd(a){switch(a.$$typeof){case fc:return"<"+(N(a.value)||"Unknown")+">";case pc:return":has("+(Qd(a)||"")+")";case mc:return'[role="'+a.value+'"]';case xc:return'"'+a.value+'"';case gc:return'[data-testname="'+a.value+'"]';default:throw Error(o(365))}}function r0(a,l){var p=[];a=[a,0];for(var y=0;y<a.length;){var w=a[y++],C=a[y++],z=l[C];if(w.tag!==5||!I(w)){for(;z!=null&&Kd(w,z);)C++,z=l[C];if(C===l.length)p.push(w);else for(w=w.child;w!==null;)a.push(w,C),w=w.sibling}}return p}function $d(a,l){if(!Be)throw Error(o(363));a=Jd(a),a=r0(a,l),l=[],a=Array.from(a);for(var p=0;p<a.length;){var y=a[p++];if(y.tag===5)I(y)||l.push(y.stateNode);else for(y=y.child;y!==null;)a.push(y),y=y.sibling}return l}var MS=Math.ceil,vc=c.ReactCurrentDispatcher,ef=c.ReactCurrentOwner,sn=c.ReactCurrentBatchConfig,At=0,ln=null,cn=null,bn=0,li=0,fo=Fe(0),pn=0,Ea=null,po=0,yc=0,tf=0,Ta=null,qn=null,nf=0,rf=1/0;function mo(){rf=yn()+500}var _c=!1,sf=null,Nr=null,Sc=!1,Ur=null,Mc=0,Aa=0,of=null,bc=-1,wc=0;function zn(){return(At&6)!==0?yn():bc!==-1?bc:bc=yn()}function Or(a){return(a.mode&1)===0?1:(At&2)!==0&&bn!==0?bn&-bn:rS.transition!==null?(wc===0&&(a=Ft,Ft<<=1,(Ft&4194240)===0&&(Ft=64),wc=a),wc):(a=Bt,a!==0?a:ye())}function Mi(a,l,p){if(50<Aa)throw Aa=0,of=null,Error(o(185));var y=Ec(a,l);return y===null?null:(ua(y,l,p),((At&2)===0||y!==ln)&&(y===ln&&((At&2)===0&&(yc|=l),pn===4&&Fr(y,bn)),Zn(y,p),l===1&&At===0&&(a.mode&1)===0&&(mo(),Vl&&qi())),y)}function Ec(a,l){a.lanes|=l;var p=a.alternate;for(p!==null&&(p.lanes|=l),p=a,a=a.return;a!==null;)a.childLanes|=l,p=a.alternate,p!==null&&(p.childLanes|=l),p=a,a=a.return;return p.tag===3?p.stateNode:null}function Zn(a,l){var p=a.callbackNode;Pr(a,l);var y=Kt(a,a===ln?bn:0);if(y===0)p!==null&&Wm(p),a.callbackNode=null,a.callbackPriority=0;else if(l=y&-y,a.callbackPriority!==l){if(p!=null&&Wm(p),l===1)a.tag===0?iS(o0.bind(null,a)):jm(o0.bind(null,a)),k?tt(function(){At===0&&qi()}):fd(pd,qi),p=null;else{switch(Hm(y)){case 1:p=pd;break;case 4:p=$_;break;case 16:p=md;break;case 536870912:p=eS;break;default:p=md}p=m0(p,s0.bind(null,a))}a.callbackPriority=l,a.callbackNode=p}}function s0(a,l){if(bc=-1,wc=0,(At&6)!==0)throw Error(o(327));var p=a.callbackNode;if(ds()&&a.callbackNode!==p)return null;var y=Kt(a,a===ln?bn:0);if(y===0)return null;if((y&30)!==0||(y&a.expiredLanes)!==0||l)l=Tc(a,y);else{l=y;var w=At;At|=2;var C=c0();(ln!==a||bn!==l)&&(mo(),us(a,l));do try{ES();break}catch(K){l0(a,K)}while(!0);vd(),vc.current=C,At=w,cn!==null?l=0:(ln=null,bn=0,l=pn)}if(l!==0){if(l===2&&(w=no(a),w!==0&&(y=w,l=af(a,w))),l===1)throw p=Ea,us(a,0),Fr(a,y),Zn(a,yn()),p;if(l===6)Fr(a,y);else{if(w=a.current.alternate,(y&30)===0&&!bS(w)&&(l=Tc(a,y),l===2&&(C=no(a),C!==0&&(y=C,l=af(a,C))),l===1))throw p=Ea,us(a,0),Fr(a,y),Zn(a,yn()),p;switch(a.finishedWork=w,a.finishedLanes=y,l){case 0:case 1:throw Error(o(345));case 2:hs(a,qn);break;case 3:if(Fr(a,y),(y&130023424)===y&&(l=nf+500-yn(),10<l)){if(Kt(a,0)!==0)break;if(w=a.suspendedLanes,(w&y)!==y){zn(),a.pingedLanes|=a.suspendedLanes&w;break}a.timeoutHandle=we(hs.bind(null,a,qn),l);break}hs(a,qn);break;case 4:if(Fr(a,y),(y&4194240)===y)break;for(l=a.eventTimes,w=-1;0<y;){var z=31-Jt(y);C=1<<z,z=l[z],z>w&&(w=z),y&=~C}if(y=w,y=yn()-y,y=(120>y?120:480>y?480:1080>y?1080:1920>y?1920:3e3>y?3e3:4320>y?4320:1960*MS(y/1960))-y,10<y){a.timeoutHandle=we(hs.bind(null,a,qn),y);break}hs(a,qn);break;case 5:hs(a,qn);break;default:throw Error(o(329))}}}return Zn(a,yn()),a.callbackNode===p?s0.bind(null,a):null}function af(a,l){var p=Ta;return a.current.memoizedState.isDehydrated&&(us(a,l).flags|=256),a=Tc(a,l),a!==2&&(l=qn,qn=p,l!==null&&lf(l)),a}function lf(a){qn===null?qn=a:qn.push.apply(qn,a)}function bS(a){for(var l=a;;){if(l.flags&16384){var p=l.updateQueue;if(p!==null&&(p=p.stores,p!==null))for(var y=0;y<p.length;y++){var w=p[y],C=w.getSnapshot;w=w.value;try{if(!Yi(C(),w))return!1}catch{return!1}}}if(p=l.child,l.subtreeFlags&16384&&p!==null)p.return=l,l=p;else{if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Fr(a,l){for(l&=~tf,l&=~yc,a.suspendedLanes|=l,a.pingedLanes&=~l,a=a.expirationTimes;0<l;){var p=31-Jt(l),y=1<<p;a[p]=-1,l&=~y}}
vendor: 4,385 bytes, line 4055
4055function o0(a){if((At&6)!==0)throw Error(o(327));ds();var l=Kt(a,0);if((l&1)===0)return Zn(a,yn()),null;var p=Tc(a,l);if(a.tag!==0&&p===2){var y=no(a);y!==0&&(l=y,p=af(a,y))}if(p===1)throw p=Ea,us(a,0),Fr(a,l),Zn(a,yn()),p;if(p===6)throw Error(o(345));return a.finishedWork=a.current.alternate,a.finishedLanes=l,hs(a,qn),Zn(a,yn()),null}function a0(a){Ur!==null&&Ur.tag===0&&(At&6)===0&&ds();var l=At;At|=1;var p=sn.transition,y=Bt;try{if(sn.transition=null,Bt=1,a)return a()}finally{Bt=y,sn.transition=p,At=l,(At&6)===0&&qi()}}function cf(){li=fo.current,Ue(fo)}function us(a,l){a.finishedWork=null,a.finishedLanes=0;var p=a.timeoutHandle;if(p!==rt&&(a.timeoutHandle=rt,Ee(p)),cn!==null)for(p=cn.return;p!==null;){var y=p;switch(Ed(y),y.tag){case 1:y=y.type.childContextTypes,y!=null&&Nt();break;case 3:uo(),Ue(Ze),Ue(ut),Ld();break;case 5:Id(y);break;case 4:uo();break;case 13:Ue(Qt);break;case 19:Ue(Qt);break;case 10:yd(y.type._context);break;case 22:case 23:cf()}p=p.return}if(ln=a,cn=a=Br(a.current,null),bn=li=l,pn=0,Ea=null,tf=yc=po=0,qn=Ta=null,Zi!==null){for(l=0;l<Zi.length;l++)if(p=Zi[l],y=p.interleaved,y!==null){p.interleaved=null;var w=y.next,C=p.pending;if(C!==null){var z=C.next;C.next=w,y.next=z}p.pending=y}Zi=null}return a}function l0(a,l){do{var p=cn;try{if(vd(),Ql.current=rc,$l){for(var y=tn.memoizedState;y!==null;){var w=y.queue;w!==null&&(w.pending=null),y=y.next}$l=!1}if(ho=0,_n=An=tn=null,ga=!1,xa=0,ef.current=null,p===null||p.return===null){pn=1,Ea=l,cn=null;break}e:{var C=a,z=p.return,K=p,pe=l;if(l=bn,K.flags|=32768,pe!==null&&typeof pe=="object"&&typeof pe.then=="function"){var Le=pe,et=K,St=et.tag;if((et.mode&1)===0&&(St===0||St===11||St===15)){var ft=et.alternate;ft?(et.updateQueue=ft.updateQueue,et.memoizedState=ft.memoizedState,et.lanes=ft.lanes):(et.updateQueue=null,et.memoizedState=null)}var Wt=Rg(z);if(Wt!==null){Wt.flags&=-257,Ig(Wt,z,K,C,l),Wt.mode&1&&Cg(C,Le,l),l=Wt,pe=Le;var lt=l.updateQueue;if(lt===null){var In=new Set;In.add(pe),l.updateQueue=In}else lt.add(pe);break e}else{if((l&1)===0){Cg(C,Le,l),uf();break e}pe=Error(o(426))}}else if(qt&&K.mode&1){var wi=Rg(z);if(wi!==null){(wi.flags&65536)===0&&(wi.flags|=256),Ig(wi,z,K,C,l),Cd(pe);break e}}C=pe,pn!==4&&(pn=2),Ta===null?Ta=[C]:Ta.push(C),pe=kd(pe,K),K=z;do{switch(K.tag){case 3:K.flags|=65536,l&=-l,K.lanes|=l;var re=Tg(K,pe,l);qm(K,re);break e;case 1:C=pe;var $=K.type,ue=K.stateNode;if((K.flags&128)===0&&(typeof $.getDerivedStateFromError=="function"||ue!==null&&typeof ue.componentDidCatch=="function"&&(Nr===null||!Nr.has(ue)))){K.flags|=65536,l&=-l,K.lanes|=l;var Ye=Ag(K,C,l);qm(K,Ye);break e}}K=K.return}while(K!==null)}h0(p)}catch(st){l=st,cn===p&&p!==null&&(cn=p=p.return);continue}break}while(!0)}function c0(){var a=vc.current;return vc.current=rc,a===null?rc:a}function uf(){(pn===0||pn===3||pn===2)&&(pn=4),ln===null||(po&268435455)===0&&(yc&268435455)===0||Fr(ln,bn)}function Tc(a,l){var p=At;At|=2;var y=c0();ln===a&&bn===l||us(a,l);do try{wS();break}catch(w){l0(a,w)}while(!0);if(vd(),At=p,vc.current=y,cn!==null)throw Error(o(261));return ln=null,bn=0,pn}function wS(){for(;cn!==null;)u0(cn)}function ES(){for(;cn!==null&&!K_();)u0(cn)}function u0(a){var l=p0(a.alternate,a,li);a.memoizedProps=a.pendingProps,l===null?h0(a):cn=l,ef.current=null}function h0(a){var l=a;do{var p=l.alternate;if(a=l.return,(l.flags&32768)===0){if(p=pS(p,l,li),p!==null){cn=p;return}}else{if(p=xS(p,l),p!==null){p.flags&=32767,cn=p;return}if(a!==null)a.flags|=32768,a.subtreeFlags=0,a.deletions=null;else{pn=6,cn=null;return}}if(l=l.sibling,l!==null){cn=l;return}cn=l=a}while(l!==null);pn===0&&(pn=5)}function hs(a,l){var p=Bt,y=sn.transition;try{sn.transition=null,Bt=1,TS(a,l,p)}finally{sn.transition=y,Bt=p}return null}function TS(a,l,p){do ds();while(Ur!==null);if((At&6)!==0)throw Error(o(327));var y=a.finishedWork,w=a.finishedLanes;if(y===null)return null;if(a.finishedWork=null,a.finishedLanes=0,y===a.current)throw Error(o(177));a.callbackNode=null,a.callbackPriority=0;var C=y.lanes|y.childLanes;if(J_(a,C),a===ln&&(cn=ln=null,bn=0),(y.subtreeFlags&2064)===0&&(y.flags&2064)===0||Sc||(Sc=!0,m0(md,function(){return ds(),null})),C=(y.flags&15990)!==0,(y.subtreeFlags&15990)!==0||C){C=sn.transition,sn.transition=null;var z=Bt;Bt=1;var K=At;At|=4,ef.current=null,yS(a,y),_S(a,y),oe(a.containerInfo),a.current=y,SS(y),Q_(),At=K,Bt=z,sn.transition=C}else a.current=y;
vendor: 5,349 bytes, line 4055
4055if(Sc&&(Sc=!1,Ur=a,Mc=w),C=a.pendingLanes,C===0&&(Nr=null),tS(y.stateNode),Zn(a,yn()),l!==null)for(p=a.onRecoverableError,y=0;y<l.length;y++)p(l[y]);if(_c)throw _c=!1,a=sf,sf=null,a;return(Mc&1)!==0&&a.tag!==0&&ds(),C=a.pendingLanes,(C&1)!==0?a===of?Aa++:(Aa=0,of=a):Aa=0,qi(),null}function ds(){if(Ur!==null){var a=Hm(Mc),l=sn.transition,p=Bt;try{if(sn.transition=null,Bt=16>a?16:a,Ur===null)var y=!1;else{if(a=Ur,Ur=null,Mc=0,(At&6)!==0)throw Error(o(331));var w=At;for(At|=4,je=a.current;je!==null;){var C=je,z=C.child;if((je.flags&16)!==0){var K=C.deletions;if(K!==null){for(var pe=0;pe<K.length;pe++){var Le=K[pe];for(je=Le;je!==null;){var et=je;switch(et.tag){case 0:case 11:case 15:cs(8,et,C)}var St=et.child;if(St!==null)St.return=et,je=St;else for(;je!==null;){et=je;var ft=et.sibling,Wt=et.return;if(Zg(et),et===Le){je=null;break}if(ft!==null){ft.return=Wt,je=ft;break}je=Wt}}}var lt=C.alternate;if(lt!==null){var In=lt.child;if(In!==null){lt.child=null;do{var wi=In.sibling;In.sibling=null,In=wi}while(In!==null)}}je=C}}if((C.subtreeFlags&2064)!==0&&z!==null)z.return=C,je=z;else e:for(;je!==null;){if(C=je,(C.flags&2048)!==0)switch(C.tag){case 0:case 11:case 15:cs(9,C,C.return)}var re=C.sibling;if(re!==null){re.return=C.return,je=re;break e}je=C.return}}var $=a.current;for(je=$;je!==null;){z=je;var ue=z.child;if((z.subtreeFlags&2064)!==0&&ue!==null)ue.return=z,je=ue;else e:for(z=$;je!==null;){if(K=je,(K.flags&2048)!==0)try{switch(K.tag){case 0:case 11:case 15:ba(9,K)}}catch(st){Jn(K,K.return,st)}if(K===z){je=null;break e}var Ye=K.sibling;if(Ye!==null){Ye.return=K.return,je=Ye;break e}je=K.return}}if(At=w,qi(),Xi&&typeof Xi.onPostCommitFiberRoot=="function")try{Xi.onPostCommitFiberRoot(zl,a)}catch{}y=!0}return y}finally{Bt=p,sn.transition=l}}return!1}function d0(a,l,p){l=kd(p,l),l=Tg(a,l,1),Dr(a,l),l=zn(),a=Ec(a,1),a!==null&&(ua(a,1,l),Zn(a,l))}function Jn(a,l,p){if(a.tag===3)d0(a,a,p);else for(;l!==null;){if(l.tag===3){d0(l,a,p);break}else if(l.tag===1){var y=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof y.componentDidCatch=="function"&&(Nr===null||!Nr.has(y))){a=kd(p,a),a=Ag(l,a,1),Dr(l,a),a=zn(),l=Ec(l,1),l!==null&&(ua(l,1,a),Zn(l,a));break}}l=l.return}}function AS(a,l,p){var y=a.pingCache;y!==null&&y.delete(l),l=zn(),a.pingedLanes|=a.suspendedLanes&p,ln===a&&(bn&p)===p&&(pn===4||pn===3&&(bn&130023424)===bn&&500>yn()-nf?us(a,0):tf|=p),Zn(a,l)}function f0(a,l){l===0&&((a.mode&1)===0?l=1:(l=en,en<<=1,(en&130023424)===0&&(en=4194304)));var p=zn();a=Ec(a,l),a!==null&&(ua(a,l,p),Zn(a,p))}function CS(a){var l=a.memoizedState,p=0;l!==null&&(p=l.retryLane),f0(a,p)}function RS(a,l){var p=0;switch(a.tag){case 13:var y=a.stateNode,w=a.memoizedState;w!==null&&(p=w.retryLane);break;case 19:y=a.stateNode;break;default:throw Error(o(314))}y!==null&&y.delete(l),f0(a,p)}var p0;p0=function(a,l,p){if(a!==null)if(a.memoizedProps!==l.pendingProps||Ze.current)ai=!0;else{if((a.lanes&p)===0&&(l.flags&128)===0)return ai=!1,gS(a,l,p);ai=(a.flags&131072)!==0}else ai=!1,qt&&(l.flags&1048576)!==0&&eg(l,Zl,l.index);switch(l.lanes=0,l.tag){case 2:var y=l.type;a!==null&&(a.alternate=null,l.alternate=null,l.flags|=2),a=l.pendingProps;var w=Gt(l,ut.current);ro(l,p),w=Nd(null,l,y,a,w,p);var C=Ud();return l.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,Rt(y)?(C=!0,vn(l)):C=!1,l.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,Sd(l),w.updater=Yl,l.stateNode=w,w._reactInternals=l,bd(l,y,a,p),l=Gd(null,l,y,!0,C,p)):(l.tag=0,qt&&C&&wd(l),kn(null,l,w,p),l=l.child),l;case 16:y=l.elementType;e:{switch(a!==null&&(a.alternate=null,l.alternate=null,l.flags|=2),a=l.pendingProps,w=y._init,y=w(y._payload),l.type=y,w=l.tag=PS(y),a=Li(y,a),w){case 0:l=Vd(null,l,y,a,p);break e;case 1:l=Bg(null,l,y,a,p);break e;case 11:l=Dg(null,l,y,a,p);break e;case 14:l=Ng(null,l,y,Li(y.type,a),p);break e}throw Error(o(306,y,""))}return l;case 0:return y=l.type,w=l.pendingProps,w=l.elementType===y?w:Li(y,w),Vd(a,l,y,w,p);case 1:return y=l.type,w=l.pendingProps,w=l.elementType===y?w:Li(y,w),Bg(a,l,y,w,p);case 3:e:{if(kg(l),a===null)throw Error(o(387));y=l.pendingProps,C=l.memoizedState,w=C.element,Ym(a,l),Xl(l,y,null,p);var z=l.memoizedState;if(y=z.element,Je&&C.isDehydrated)if(C={element:y,isDehydrated:!1,cache:z.cache,transitions:z.transitions},l.updateQueue.baseState=C,l.memoizedState=C,l.flags&256){w=Error(o(423)),l=zg(a,l,y,p,w);break e}else if(y!==w){w=Error(o(424)),l=zg(a,l,y,p,w);break e}else for(Je&&(oi=Ol(l.stateNode.containerInfo),si=l,qt=!0,Di=null,ha=!1),p=og(l,null,y,p),l.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(ao(),y===w){l=gr(a,l,p);break e}kn(a,l,y,p)}l=l.child}return l;case 5:return ag(l),a===null&&Ad(l),y=l.type,w=l.pendingProps,C=a!==null?a.memoizedProps:null,z=w.children,vt(y,w)?z=null:C!==null&&vt(y,C)&&(l.flags|=32),Fg(a,l),kn(a,l,z,p),l.child;case 6:return a===null&&Ad(l),null;case 13:return Vg(a,l,p);case 4:return Rd(l,l.stateNode.containerInfo),y=l.pendingProps,a===null?l.child=lo(l,null,y,p):kn(a,l,y,p),l.child;case 11:return y=l.type,w=l.pendingProps,w=l.elementType===y?w:Li(y,w),Dg(a,l,y,w,p);case 7:return kn(a,l,l.pendingProps,p),l.child;case 8:return kn(a,l,l.pendingProps.children,p),l.child;case 12:return kn(a,l,l.pendingProps.children,p),l.child;
vendor: 36,221 bytes, lines 4055-4059
4055case 10:e:{if(y=l.type._context,w=l.pendingProps,C=l.memoizedProps,z=w.value,Xm(l,y,z),C!==null)if(Yi(C.value,z)){if(C.children===w.children&&!Ze.current){l=gr(a,l,p);break e}}else for(C=l.child,C!==null&&(C.return=l);C!==null;){var K=C.dependencies;if(K!==null){z=C.child;for(var pe=K.firstContext;pe!==null;){if(pe.context===y){if(C.tag===1){pe=dr(-1,p&-p),pe.tag=2;var Le=C.updateQueue;if(Le!==null){Le=Le.shared;var et=Le.pending;et===null?pe.next=pe:(pe.next=et.next,et.next=pe),Le.pending=pe}}C.lanes|=p,pe=C.alternate,pe!==null&&(pe.lanes|=p),_d(C.return,p,l),K.lanes|=p;break}pe=pe.next}}else if(C.tag===10)z=C.type===l.type?null:C.child;else if(C.tag===18){if(z=C.return,z===null)throw Error(o(341));z.lanes|=p,K=z.alternate,K!==null&&(K.lanes|=p),_d(z,p,l),z=C.sibling}else z=C.child;if(z!==null)z.return=C;else for(z=C;z!==null;){if(z===l){z=null;break}if(C=z.sibling,C!==null){C.return=z.return,z=C;break}z=z.return}C=z}kn(a,l,w.children,p),l=l.child}return l;case 9:return w=l.type,y=l.pendingProps.children,ro(l,p),w=xi(w),y=y(w),l.flags|=1,kn(a,l,y,p),l.child;case 14:return y=l.type,w=Li(y,l.pendingProps),w=Li(y.type,w),Ng(a,l,y,w,p);case 15:return Ug(a,l,l.type,l.pendingProps,p);case 17:return y=l.type,w=l.pendingProps,w=l.elementType===y?w:Li(y,w),a!==null&&(a.alternate=null,l.alternate=null,l.flags|=2),l.tag=1,Rt(y)?(a=!0,vn(l)):a=!1,ro(l,p),Qm(l,y,w),bd(l,y,w,p),Gd(null,l,y,!0,a,p);case 19:return jg(a,l,p);case 22:return Og(a,l,p)}throw Error(o(156,l.tag))};function m0(a,l){return fd(a,l)}function IS(a,l,p,y){this.tag=a,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=y,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bi(a,l,p,y){return new IS(a,l,p,y)}function hf(a){return a=a.prototype,!(!a||!a.isReactComponent)}function PS(a){if(typeof a=="function")return hf(a)?1:0;if(a!=null){if(a=a.$$typeof,a===M)return 11;if(a===S)return 14}return 2}function Br(a,l){var p=a.alternate;return p===null?(p=bi(a.tag,l,a.key,a.mode),p.elementType=a.elementType,p.type=a.type,p.stateNode=a.stateNode,p.alternate=a,a.alternate=p):(p.pendingProps=l,p.type=a.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=a.flags&14680064,p.childLanes=a.childLanes,p.lanes=a.lanes,p.child=a.child,p.memoizedProps=a.memoizedProps,p.memoizedState=a.memoizedState,p.updateQueue=a.updateQueue,l=a.dependencies,p.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},p.sibling=a.sibling,p.index=a.index,p.ref=a.ref,p}function Ac(a,l,p,y,w,C){var z=2;if(y=a,typeof a=="function")hf(a)&&(z=1);else if(typeof a=="string")z=5;else e:switch(a){case d:return fs(p.children,w,C,l);case f:z=8,w|=8;break;case m:return a=bi(12,p,l,w|2),a.elementType=m,a.lanes=C,a;case _:return a=bi(13,p,l,w),a.elementType=_,a.lanes=C,a;case v:return a=bi(19,p,l,w),a.elementType=v,a.lanes=C,a;case E:return Cc(p,w,C,l);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case g:z=10;break e;case x:z=9;break e;case M:z=11;break e;case S:z=14;break e;case b:z=16,y=null;break e}throw Error(o(130,a==null?a:typeof a,""))}return l=bi(z,p,l,w),l.elementType=a,l.type=y,l.lanes=C,l}function fs(a,l,p,y){return a=bi(7,a,y,l),a.lanes=p,a}function Cc(a,l,p,y){return a=bi(22,a,y,l),a.elementType=E,a.lanes=p,a.stateNode={},a}function df(a,l,p){return a=bi(6,a,null,l),a.lanes=p,a}function ff(a,l,p){return l=bi(4,a.children!==null?a.children:[],a.key,l),l.lanes=p,l.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},l}function LS(a,l,p,y,w){this.tag=l,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=rt,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=hd(0),this.expirationTimes=hd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hd(0),this.identifierPrefix=y,this.onRecoverableError=w,Je&&(this.mutableSourceEagerHydrationData=null)}function g0(a,l,p,y,w,C,z,K,pe){return a=new LS(a,l,p,K,pe),l===1?(l=1,C===!0&&(l|=8)):l=0,C=bi(3,null,null,l),a.current=C,C.stateNode=a,C.memoizedState={element:y,isDehydrated:p,cache:null,transitions:null},Sd(C),a}function x0(a){if(!a)return mt;a=a._reactInternals;e:{if(R(a)!==a||a.tag!==1)throw Error(o(170));var l=a;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(Rt(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(o(171))}if(a.tag===1){var p=a.type;if(Rt(p))return nt(a,p,l)}return l}function v0(a){var l=a._reactInternals;if(l===void 0)throw typeof a.render=="function"?Error(o(188)):(a=Object.keys(a).join(","),Error(o(268,a)));return a=V(l),a===null?null:a.stateNode}function y0(a,l){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var p=a.retryLane;a.retryLane=p!==0&&p<l?p:l}}function pf(a,l){y0(a,l),(a=a.alternate)&&y0(a,l)}function DS(a){return a=V(a),a===null?null:a.stateNode}function NS(){return null}return t.attemptContinuousHydration=function(a){if(a.tag===13){var l=zn();Mi(a,134217728,l),pf(a,134217728)}},t.attemptHydrationAtCurrentPriority=function(a){if(a.tag===13){var l=zn(),p=Or(a);Mi(a,p,l),pf(a,p)}},t.attemptSynchronousHydration=function(a){switch(a.tag){case 3:var l=a.stateNode;if(l.current.memoizedState.isDehydrated){var p=Yn(l.pendingLanes);p!==0&&(dd(l,p|1),Zn(l,yn()),(At&6)===0&&(mo(),qi()))}break;case 13:var y=zn();a0(function(){return Mi(a,1,y)}),pf(a,1)}},t.batchedUpdates=function(a,l){var p=At;At|=1;try{return a(l)}finally{At=p,At===0&&(mo(),Vl&&qi())}},t.createComponentSelector=function(a){return{$$typeof:fc,value:a}},t.createContainer=function(a,l,p,y,w,C,z){return g0(a,l,!1,null,p,y,w,C,z)},t.createHasPseudoClassSelector=function(a){return{$$typeof:pc,value:a}},t.createHydrationContainer=function(a,l,p,y,w,C,z,K,pe){return a=g0(p,y,!0,a,w,C,z,K,pe),a.context=x0(null),p=a.current,y=zn(),w=Or(p),C=dr(y,w),C.callback=l??null,Dr(p,C),a.current.lanes=w,ua(a,w,y),Zn(a,y),a},t.createPortal=function(a,l,p){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:h,key:y==null?null:""+y,children:a,containerInfo:l,implementation:p}},t.createRoleSelector=function(a){return{$$typeof:mc,value:a}},t.createTestNameSelector=function(a){return{$$typeof:gc,value:a}},t.createTextSelector=function(a){return{$$typeof:xc,value:a}},t.deferredUpdates=function(a){var l=Bt,p=sn.transition;try{return sn.transition=null,Bt=16,a()}finally{Bt=l,sn.transition=p}},t.discreteUpdates=function(a,l,p,y,w){var C=Bt,z=sn.transition;try{return sn.transition=null,Bt=1,a(l,p,y,w)}finally{Bt=C,sn.transition=z,At===0&&mo()}},t.findAllNodes=$d,t.findBoundingRects=function(a,l){if(!Be)throw Error(o(363));l=$d(a,l),a=[];for(var p=0;p<l.length;p++)a.push(Ce(l[p]));for(l=a.length-1;0<l;l--){p=a[l];for(var y=p.x,w=y+p.width,C=p.y,z=C+p.height,K=l-1;0<=K;K--)if(l!==K){var pe=a[K],Le=pe.x,et=Le+pe.width,St=pe.y,ft=St+pe.height;if(y>=Le&&C>=St&&w<=et&&z<=ft){a.splice(l,1);break}else if(y!==Le||p.width!==pe.width||ft<C||St>z){if(!(C!==St||p.height!==pe.height||et<y||Le>w)){Le>y&&(pe.width+=Le-y,pe.x=y),et<w&&(pe.width=w-Le),a.splice(l,1);break}}else{St>C&&(pe.height+=St-C,pe.y=C),ft<z&&(pe.height=z-St),a.splice(l,1);break}}}return a},t.findHostInstance=v0,t.findHostInstanceWithNoPortals=function(a){return a=L(a),a=a!==null?j(a):null,a===null?null:a.stateNode},t.findHostInstanceWithWarning=function(a){return v0(a)},t.flushControlled=function(a){var l=At;At|=1;var p=sn.transition,y=Bt;try{sn.transition=null,Bt=1,a()}finally{Bt=y,sn.transition=p,At=l,At===0&&(mo(),qi())}},t.flushPassiveEffects=ds,t.flushSync=a0,t.focusWithin=function(a,l){if(!Be)throw Error(o(363));for(a=Jd(a),l=r0(a,l),l=Array.from(l),a=0;a<l.length;){var p=l[a++];if(!I(p)){if(p.tag===5&&le(p.stateNode))return!0;for(p=p.child;p!==null;)l.push(p),p=p.sibling}}return!1},t.getCurrentUpdatePriority=function(){return Bt},t.getFindAllNodesFailureDescription=function(a,l){if(!Be)throw Error(o(363));var p=0,y=[];a=[Jd(a),0];for(var w=0;w<a.length;){var C=a[w++],z=a[w++],K=l[z];if((C.tag!==5||!I(C))&&(Kd(C,K)&&(y.push(Qd(K)),z++,z>p&&(p=z)),z<l.length))for(C=C.child;C!==null;)a.push(C,z),C=C.sibling}if(p<l.length){for(a=[];p<l.length;p++)a.push(Qd(l[p]));return`findAllNodes was able to match part of the selector:
4056  `+(y.join(" > ")+`
4057
4058No matching component was found for:
4059  `)+a.join(" > ")}return null},t.getPublicRootInstance=function(a){return a=a.current,a.child?a.child.tag===5?q(a.child.stateNode):a.child.stateNode:null},t.injectIntoDevTools=function(a){if(a={bundleType:a.bundleType,version:a.version,rendererPackageName:a.rendererPackageName,rendererConfig:a.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:c.ReactCurrentDispatcher,findHostInstanceByFiber:DS,findFiberByHostInstance:a.findFiberByHostInstance||NS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")a=!1;else{var l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(l.isDisabled||!l.supportsFiber)a=!0;else{try{zl=l.inject(a),Xi=l}catch{}a=!!l.checkDCE}}return a},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(a,l,p,y){if(!Be)throw Error(o(363));a=$d(a,l);var w=me(a,p,y).disconnect;return{disconnect:function(){w()}}},t.registerMutableSourceForHydration=function(a,l){var p=l._getVersion;p=p(l._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[l,p]:a.mutableSourceEagerHydrationData.push(l,p)},t.runWithPriority=function(a,l){var p=Bt;try{return Bt=a,l()}finally{Bt=p}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(a,l,p,y){var w=l.current,C=zn(),z=Or(w);return p=x0(p),l.context===null?l.context=p:l.pendingContext=p,l=dr(C,z),l.payload={element:a},y=y===void 0?null:y,y!==null&&(l.callback=y),Dr(w,l),a=Mi(w,z,C),a!==null&&jl(a,w,z),z},t}),cp}var tv;function wR(){return tv||(tv=1,op.exports=bR()),op.exports}var ER=wR();const TR=FS(ER);var nv=A_();const Bm={},AR=r=>{Object.assign(Bm,r)};function CR(r,e){function t(d,{args:f=[],attach:m,...g},x){let M=`${d[0].toUpperCase()}${d.slice(1)}`,_;if(d==="primitive"){if(g.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const v=g.object;_=ko(v,{type:d,root:x,attach:m,primitive:!0})}else{const v=Bm[M];if(!v)throw new Error(`R3F: ${M} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(f))throw new Error("R3F: The args prop must be an array!");_=ko(new v(...f),{type:d,root:x,attach:m,memoizedProps:{args:f}})}return _.__r3f.attach===void 0&&(_.isBufferGeometry?_.__r3f.attach="geometry":_.isMaterial&&(_.__r3f.attach="material")),M!=="inject"&&dp(_,g),_}function n(d,f){let m=!1;if(f){var g,x;(g=f.__r3f)!=null&&g.attach?hp(d,f,f.__r3f.attach):f.isObject3D&&d.isObject3D&&(d.add(f),m=!0),m||(x=d.__r3f)==null||x.objects.push(f),f.__r3f||ko(f,{}),f.__r3f.parent=d,Wp(f),zo(f)}}function i(d,f,m){let g=!1;if(f){var x,M;if((x=f.__r3f)!=null&&x.attach)hp(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){f.parent=d,f.dispatchEvent({type:"added"}),d.dispatchEvent({type:"childadded",child:f});const _=d.children.filter(S=>S!==f),v=_.indexOf(m);d.children=[..._.slice(0,v),f,..._.slice(v)],g=!0}g||(M=d.__r3f)==null||M.objects.push(f),f.__r3f||ko(f,{}),f.__r3f.parent=d,Wp(f),zo(f)}}function s(d,f,m=!1){d&&[...d].forEach(g=>o(f,g,m))}function o(d,f,m){if(f){var g,x,M;if(f.__r3f&&(f.__r3f.parent=null),(g=d.__r3f)!=null&&g.objects&&(d.__r3f.objects=d.__r3f.objects.filter(E=>E!==f)),(x=f.__r3f)!=null&&x.attach)av(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){var _;d.remove(f),(_=f.__r3f)!=null&&_.root&&UR(Au(f),f)}const S=(M=f.__r3f)==null?void 0:M.primitive,b=!S&&(m===void 0?f.dispose!==null:m);if(!S){var v;s((v=f.__r3f)==null?void 0:v.objects,f,b),s(f.children,f,b)}if(delete f.__r3f,b&&f.dispose&&f.type!=="Scene"){const E=()=>{try{f.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?nv.unstable_scheduleCallback(nv.unstable_IdlePriority,E):E()}zo(d)}}function c(d,f,m,g){var x;const M=(x=d.__r3f)==null?void 0:x.parent;if(!M)return;const _=t(f,m,d.__r3f.root);if(d.children){for(const v of d.children)v.__r3f&&n(_,v);d.children=d.children.filter(v=>!v.__r3f)}d.__r3f.objects.forEach(v=>n(_,v)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||o(M,d),_.parent&&(_.__r3f.autoRemovedBeforeAppend=!0),n(M,_),_.raycast&&_.__r3f.eventCount&&Au(_).getState().internal.interaction.push(_),[g,g.alternate].forEach(v=>{v!==null&&(v.stateNode=_,v.ref&&(typeof v.ref=="function"?v.ref(_):v.ref.current=_))})}const u=()=>{};return{reconciler:TR({createInstance:t,removeChild:o,appendChild:n,appendInitialChild:n,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,f)=>{if(!f)return;const m=d.getState().scene;m.__r3f&&(m.__r3f.root=d,n(m,f))},removeChildFromContainer:(d,f)=>{f&&o(d.getState().scene,f)},insertInContainerBefore:(d,f,m)=>{if(!f||!m)return;const g=d.getState().scene;g.__r3f&&i(g,f,m)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var f;return!!((f=d?.__r3f)!=null?f:{}).handlers},prepareUpdate(d,f,m,g){var x;if(((x=d?.__r3f)!=null?x:{}).primitive&&g.object&&g.object!==d)return[!0];{const{args:_=[],children:v,...S}=g,{args:b=[],children:E,...P}=m;if(!Array.isArray(_))throw new Error("R3F: the args prop must be an array!");if(_.some((N,A)=>N!==b[A]))return[!0];const D=N_(d,S,P,!0);return D.changes.length?[!1,D]:null}},commitUpdate(d,[f,m],g,x,M,_){f?c(d,g,M,_):dp(d,m)},commitMount(d,f,m,g){var x;const M=(x=d.__r3f)!=null?x:{};d.raycast&&M.handlers&&M.eventCount&&Au(d).getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>ko(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var f;const{attach:m,parent:g}=(f=d.__r3f)!=null?f:{};m&&g&&av(g,d,m),d.isObject3D&&(d.visible=!1),zo(d)},unhideInstance(d,f){var m;const{attach:g,parent:x}=(m=d.__r3f)!=null?m:{};g&&x&&hp(x,d,g),(d.isObject3D&&f.visible==null||f.visible)&&(d.visible=!0),zo(d)},createTextInstance:u,hideTextInstance:u,unhideTextInstance:u,getCurrentEventPriority:()=>e?e():Wo.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&Yt.fun(performance.now)?performance.now:Yt.fun(Date.now)?Date.now:()=>0,scheduleTimeout:Yt.fun(setTimeout)?setTimeout:void 0,cancelTimeout:Yt.fun(clearTimeout)?clearTimeout:void 0}),applyProps:dp}}var iv,rv;const up=r=>"colorSpace"in r||"outputColorSpace"in r,C_=()=>{var r;return(r=Bm.ColorManagement)!=null?r:null},R_=r=>r&&r.isOrthographicCamera,RR=r=>r&&r.hasOwnProperty("current"),Pl=typeof window<"u"&&((iv=window.document)!=null&&iv.createElement||((rv=window.navigator)==null?void 0:rv.product)==="ReactNative")?ee.useLayoutEffect:ee.useEffect;function I_(r){const e=ee.useRef(r);return Pl(()=>{e.current=r},[r]),e}function IR({set:r}){return Pl(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}class P_ extends ee.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}P_.getDerivedStateFromError=()=>({error:!0});const L_="__default",sv=new Map,PR=r=>r&&!!r.memoized&&!!r.changes;function D_(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}const Va=r=>{var e;return(e=r.__r3f)==null?void 0:e.root.getState()};function Au(r){let e=r.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const Yt={obj:r=>r===Object(r)&&!Yt.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(Yt.str(r)||Yt.num(r)||Yt.boo(r))return r===e;const s=Yt.obj(r);if(s&&n==="reference")return r===e;const o=Yt.arr(r);if(o&&t==="reference")return r===e;if((o||s)&&r===e)return!0;let c;for(c in r)if(!(c in e))return!1;if(s&&t==="shallow"&&n==="shallow"){for(c in i?e:r)if(!Yt.equ(r[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:r)if(r[c]!==e[c])return!1;if(Yt.und(c)){if(o&&r.length===0&&e.length===0||s&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function LR(r){r.dispose&&r.type!=="Scene"&&r.dispose();for(const e in r)e.dispose==null||e.dispose(),delete r[e]}function ko(r,e){const t=r;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},r}function Hp(r,e){let t=r;if(e.includes("-")){const n=e.split("-"),i=n.pop();return t=n.reduce((s,o)=>s[o],r),{target:t,key:i}}else return{target:t,key:e}}const ov=/-\d+$/;function hp(r,e,t){if(Yt.str(t)){if(ov.test(t)){const s=t.replace(ov,""),{target:o,key:c}=Hp(r,s);Array.isArray(o[c])||(o[c]=[])}const{target:n,key:i}=Hp(r,t);e.__r3f.previousAttach=n[i],n[i]=e}else e.__r3f.previousAttach=t(r,e)}function av(r,e,t){var n,i;if(Yt.str(t)){const{target:s,key:o}=Hp(r,t),c=e.__r3f.previousAttach;c===void 0?delete s[o]:s[o]=c}else(n=e.__r3f)==null||n.previousAttach==null||n.previousAttach(r,e);(i=e.__r3f)==null||delete i.previousAttach}function N_(r,{children:e,key:t,ref:n,...i},{children:s,key:o,ref:c,...u}={},h=!1){const d=r.__r3f,f=Object.entries(i),m=[];if(h){const x=Object.keys(u);for(let M=0;M<x.length;M++)i.hasOwnProperty(x[M])||f.unshift([x[M],L_+"remove"])}f.forEach(([x,M])=>{var _;if((_=r.__r3f)!=null&&_.primitive&&x==="object"||Yt.equ(M,u[x]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(x))return m.push([x,M,!0,[]]);let v=[];x.includes("-")&&(v=x.split("-")),m.push([x,M,!1,v]);for(const S in i){const b=i[S];S.startsWith(`${x}-`)&&m.push([S,b,!1,S.split("-")])}});const g={...i};return d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.args&&(g.args=d.memoizedProps.args),d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.attach&&(g.attach=d.memoizedProps.attach),{memoized:g,changes:m}}function dp(r,e){var t;const n=r.__r3f,i=n?.root,s=i==null||i.getState==null?void 0:i.getState(),{memoized:o,changes:c}=PR(e)?e:N_(r,e),u=n?.eventCount;r.__r3f&&(r.__r3f.memoizedProps=o);for(let m=0;m<c.length;m++){let[g,x,M,_]=c[m];if(up(r)){const E="srgb",P="srgb-linear";g==="encoding"?(g="colorSpace",x=x===3001?E:P):g==="outputEncoding"&&(g="outputColorSpace",x=x===3001?E:P)}let v=r,S=v[g];if(_.length&&(S=_.reduce((b,E)=>b[E],r),!(S&&S.set))){const[b,...E]=_.reverse();v=E.reverse().reduce((P,D)=>P[D],r),g=b}if(x===L_+"remove")if(v.constructor){let b=sv.get(v.constructor);b||(b=new v.constructor,sv.set(v.constructor,b)),x=b[g]}else x=0;if(M&&n)x?n.handlers[g]=x:delete n.handlers[g],n.eventCount=Object.keys(n.handlers).length;else if(S&&S.set&&(S.copy||S instanceof Bs)){if(Array.isArray(x))S.fromArray?S.fromArray(x):S.set(...x);else if(S.copy&&x&&x.constructor&&S.constructor===x.constructor)S.copy(x);else if(x!==void 0){var h;const b=(h=S)==null?void 0:h.isColor;!b&&S.setScalar?S.setScalar(x):S instanceof Bs&&x instanceof Bs?S.mask=x.mask:S.set(x),!C_()&&s&&!s.linear&&b&&S.convertSRGBToLinear()}}else{var d;if(v[g]=x,(d=v[g])!=null&&d.isTexture&&v[g].format===On&&v[g].type===Hn&&s){const b=v[g];up(b)&&up(s.gl)?b.colorSpace=s.gl.outputColorSpace:b.encoding=s.gl.outputEncoding}}zo(r)}if(n&&n.parent&&r.raycast&&u!==n.eventCount){const m=Au(r).getState().internal,g=m.interaction.indexOf(r);g>-1&&m.interaction.splice(g,1),n.eventCount&&m.interaction.push(r)}return!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(t=r.__r3f)!=null&&t.parent&&Wp(r),r}function zo(r){var e,t;const n=(e=r.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();n&&n.internal.frames===0&&n.invalidate()}function Wp(r){r.onUpdate==null||r.onUpdate(r)}function DR(r,e){r.manual||(R_(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix(),r.updateMatrixWorld())}function Su(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function NR(){var r;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Wo.DefaultEventPriority;switch((r=e.event)==null?void 0:r.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Wo.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Wo.ContinuousEventPriority;default:return Wo.DefaultEventPriority}}function U_(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function UR(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{U_(t.capturedMap,e,n,i)})}function OR(r){function e(u){const{internal:h}=r.getState(),d=u.offsetX-h.initialClick[0],f=u.offsetY-h.initialClick[1];return Math.round(Math.sqrt(d*d+f*f))}function t(u){return u.filter(h=>["Move","Over","Enter","Out","Leave"].some(d=>{var f;return(f=h.__r3f)==null?void 0:f.handlers["onPointer"+d]}))}function n(u,h){const d=r.getState(),f=new Set,m=[],g=h?h(d.internal.interaction):d.internal.interaction;for(let v=0;v<g.length;v++){const S=Va(g[v]);S&&(S.raycaster.camera=void 0)}d.previousRoot||d.events.compute==null||d.events.compute(u,d);function x(v){const S=Va(v);if(!S||!S.events.enabled||S.raycaster.camera===null)return[];if(S.raycaster.camera===void 0){var b;S.events.compute==null||S.events.compute(u,S,(b=S.previousRoot)==null?void 0:b.getState()),S.raycaster.camera===void 0&&(S.raycaster.camera=null)}return S.raycaster.camera?S.raycaster.intersectObject(v,!0):[]}let M=g.flatMap(x).sort((v,S)=>{const b=Va(v.object),E=Va(S.object);return!b||!E?v.distance-S.distance:E.events.priority-b.events.priority||v.distance-S.distance}).filter(v=>{const S=Su(v);return f.has(S)?!1:(f.add(S),!0)});d.events.filter&&(M=d.events.filter(M,d));for(const v of M){let S=v.object;for(;S;){var _;(_=S.__r3f)!=null&&_.eventCount&&m.push({...v,eventObject:S}),S=S.parent}}if("pointerId"in u&&d.internal.capturedMap.has(u.pointerId))for(let v of d.internal.capturedMap.get(u.pointerId).values())f.has(Su(v.intersection))||m.push(v.intersection);return m}function i(u,h,d,f){const m=r.getState();if(u.length){const g={stopped:!1};for(const x of u){const M=Va(x.object)||m,{raycaster:_,pointer:v,camera:S,internal:b}=M,E=new F(v.x,v.y,0).unproject(S),P=B=>{var L,V;return(L=(V=b.capturedMap.get(B))==null?void 0:V.has(x.eventObject))!=null?L:!1},D=B=>{const L={intersection:x,target:h.target};b.capturedMap.has(B)?b.capturedMap.get(B).set(x.eventObject,L):b.capturedMap.set(B,new Map([[x.eventObject,L]])),h.target.setPointerCapture(B)},N=B=>{const L=b.capturedMap.get(B);L&&U_(b.capturedMap,x.eventObject,L,B)};let A={};for(let B in h){let L=h[B];typeof L!="function"&&(A[B]=L)}let R={...x,...A,pointer:v,intersections:u,stopped:g.stopped,delta:d,unprojectedPoint:E,ray:_.ray,camera:S,stopPropagation(){const B="pointerId"in h&&b.capturedMap.get(h.pointerId);if((!B||B.has(x.eventObject))&&(R.stopped=g.stopped=!0,b.hovered.size&&Array.from(b.hovered.values()).find(L=>L.eventObject===x.eventObject))){const L=u.slice(0,u.indexOf(x));s([...L,x])}},target:{hasPointerCapture:P,setPointerCapture:D,releasePointerCapture:N},currentTarget:{hasPointerCapture:P,setPointerCapture:D,releasePointerCapture:N},nativeEvent:h};if(f(R),g.stopped===!0)break}}return u}function s(u){const{internal:h}=r.getState();for(const d of h.hovered.values())if(!u.length||!u.find(f=>f.object===d.object&&f.index===d.index&&f.instanceId===d.instanceId)){const m=d.eventObject.__r3f,g=m?.handlers;if(h.hovered.delete(Su(d)),m!=null&&m.eventCount){const x={...d,intersections:u};g.onPointerOut==null||g.onPointerOut(x),g.onPointerLeave==null||g.onPointerLeave(x)}}}function o(u,h){for(let d=0;d<h.length;d++){const f=h[d].__r3f;f==null||f.handlers.onPointerMissed==null||f.handlers.onPointerMissed(u)}}function c(u){switch(u){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return h=>{const{internal:d}=r.getState();"pointerId"in h&&d.capturedMap.has(h.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(h.pointerId)&&(d.capturedMap.delete(h.pointerId),s([]))})}}return function(d){const{onPointerMissed:f,internal:m}=r.getState();m.lastEvent.current=d;const g=u==="onPointerMove",x=u==="onClick"||u==="onContextMenu"||u==="onDoubleClick",_=n(d,g?t:void 0),v=x?e(d):0;u==="onPointerDown"&&(m.initialClick=[d.offsetX,d.offsetY],m.initialHits=_.map(b=>b.eventObject)),x&&!_.length&&v<=2&&(o(d,m.interaction),f&&f(d)),g&&s(_);function S(b){const E=b.eventObject,P=E.__r3f,D=P?.handlers;if(P!=null&&P.eventCount)if(g){if(D.onPointerOver||D.onPointerEnter||D.onPointerOut||D.onPointerLeave){const N=Su(b),A=m.hovered.get(N);A?A.stopped&&b.stopPropagation():(m.hovered.set(N,b),D.onPointerOver==null||D.onPointerOver(b),D.onPointerEnter==null||D.onPointerEnter(b))}D.onPointerMove==null||D.onPointerMove(b)}else{const N=D[u];N?(!x||m.initialHits.includes(E))&&(o(d,m.interaction.filter(A=>!m.initialHits.includes(A))),N(b)):x&&m.initialHits.includes(E)&&o(d,m.interaction.filter(A=>!m.initialHits.includes(A)))}}i(_,d,v,S)}}return{handlePointer:c}}const O_=r=>!!(r!=null&&r.render),F_=ee.createContext(null),FR=(r,e)=>{const t=SR((c,u)=>{const h=new F,d=new F,f=new F;function m(v=u().camera,S=d,b=u().size){const{width:E,height:P,top:D,left:N}=b,A=E/P;S.isVector3?f.copy(S):f.set(...S);const R=v.getWorldPosition(h).distanceTo(f);if(R_(v))return{width:E/v.zoom,height:P/v.zoom,top:D,left:N,factor:1,distance:R,aspect:A};{const B=v.fov*Math.PI/180,L=2*Math.tan(B/2)*R,V=L*(E/P);return{width:V,height:L,top:D,left:N,factor:E/V,distance:R,aspect:A}}}let g;const x=v=>c(S=>({performance:{...S.performance,current:v}})),M=new ge;return{set:c,get:u,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(v=1)=>r(u(),v),advance:(v,S)=>e(v,S,u()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new v_,pointer:M,mouse:M,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const v=u();g&&clearTimeout(g),v.performance.current!==v.performance.min&&x(v.performance.min),g=setTimeout(()=>x(u().performance.max),v.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:v=>c(S=>({...S,events:{...S.events,...v}})),setSize:(v,S,b,E,P)=>{const D=u().camera,N={width:v,height:S,top:E||0,left:P||0,updateStyle:b};c(A=>({size:N,viewport:{...A.viewport,...m(D,d,N)}}))},setDpr:v=>c(S=>{const b=D_(v);return{viewport:{...S.viewport,dpr:b,initialDpr:S.viewport.initialDpr||b}}}),setFrameloop:(v="always")=>{const S=u().clock;S.stop(),S.elapsedTime=0,v!=="never"&&(S.start(),S.elapsedTime=0),c(()=>({frameloop:v}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:ee.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(v,S,b)=>{const E=u().internal;return E.priority=E.priority+(S>0?1:0),E.subscribers.push({ref:v,priority:S,store:b}),E.subscribers=E.subscribers.sort((P,D)=>P.priority-D.priority),()=>{const P=u().internal;P!=null&&P.subscribers&&(P.priority=P.priority-(S>0?1:0),P.subscribers=P.subscribers.filter(D=>D.ref!==v))}}}}}),n=t.getState();let i=n.size,s=n.viewport.dpr,o=n.camera;return t.subscribe(()=>{const{camera:c,size:u,viewport:h,gl:d,set:f}=t.getState();if(u.width!==i.width||u.height!==i.height||h.dpr!==s){var m;i=u,s=h.dpr,DR(c,u),d.setPixelRatio(h.dpr);const g=(m=u.updateStyle)!=null?m:typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(u.width,u.height,g)}c!==o&&(o=c,f(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>r(c)),t};let Mu,BR=new Set,kR=new Set,zR=new Set;function fp(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function Ga(r,e){switch(r){case"before":return fp(BR,e);case"after":return fp(kR,e);case"tail":return fp(zR,e)}}let pp,mp;function gp(r,e,t){let n=e.clock.getDelta();for(e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),pp=e.internal.subscribers,Mu=0;Mu<pp.length;Mu++)mp=pp[Mu],mp.ref.current(mp.store.getState(),n,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}function VR(r){let e=!1,t=!1,n,i,s;function o(h){i=requestAnimationFrame(o),e=!0,n=0,Ga("before",h),t=!0;for(const f of r.values()){var d;s=f.store.getState(),s.internal.active&&(s.frameloop==="always"||s.internal.frames>0)&&!((d=s.gl.xr)!=null&&d.isPresenting)&&(n+=gp(h,s))}if(t=!1,Ga("after",h),n===0)return Ga("tail",h),e=!1,cancelAnimationFrame(i)}function c(h,d=1){var f;if(!h)return r.forEach(m=>c(m.store.getState(),d));(f=h.gl.xr)!=null&&f.isPresenting||!h.internal.active||h.frameloop==="never"||(d>1?h.internal.frames=Math.min(60,h.internal.frames+d):t?h.internal.frames=2:h.internal.frames=1,e||(e=!0,requestAnimationFrame(o)))}function u(h,d=!0,f,m){if(d&&Ga("before",h),f)gp(h,f,m);else for(const g of r.values())gp(h,g.store.getState());d&&Ga("after",h)}return{loop:o,invalidate:c,advance:u}}function B_(){const r=ee.useContext(F_);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function pi(r=t=>t,e){return B_()(r,e)}function Qs(r,e=0){const t=B_(),n=t.getState().internal.subscribe,i=I_(r);return Pl(()=>n(i,e,t),[e,n,t]),null}const ea=new Map,{invalidate:lv,advance:cv}=VR(ea),{reconciler:_h,applyProps:Fo}=CR(ea,NR),Bo={objects:"shallow",strict:!1},GR=(r,e)=>{const t=typeof r=="function"?r(e):r;return O_(t)?t:new T_({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...r})};function HR(r,e){const t=typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement;if(e){const{width:n,height:i,top:s,left:o,updateStyle:c=t}=e;return{width:n,height:i,top:s,left:o,updateStyle:c}}else if(typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:n,height:i,top:s,left:o}=r.parentElement.getBoundingClientRect();return{width:n,height:i,top:s,left:o,updateStyle:t}}else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0,updateStyle:t};return{width:0,height:0,top:0,left:0}}function WR(r){const e=ea.get(r),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=n||FR(lv,cv),o=t||_h.createContainer(s,Wo.ConcurrentRoot,null,!1,null,"",i,null);e||ea.set(r,{fiber:o,store:s});let c,u=!1,h;return{configure(d={}){let{gl:f,size:m,scene:g,events:x,onCreated:M,shadows:_=!1,linear:v=!1,flat:S=!1,legacy:b=!1,orthographic:E=!1,frameloop:P="always",dpr:D=[1,2],performance:N,raycaster:A,camera:R,onPointerMissed:B}=d,L=s.getState(),V=L.gl;L.gl||L.set({gl:V=GR(f,r)});let H=L.raycaster;H||L.set({raycaster:H=new x_});const{params:j,...X}=A||{};if(Yt.equ(X,H,Bo)||Fo(H,{...X}),Yt.equ(j,H.params,Bo)||Fo(H,{params:{...H.params,...j}}),!L.camera||L.camera===h&&!Yt.equ(h,R,Bo)){h=R;const oe=R instanceof Il,ce=oe?R:E?new Gi(0,0,0,0,.1,1e3):new Zt(75,0,.1,1e3);oe||(ce.position.z=5,R&&(Fo(ce,R),("aspect"in R||"left"in R||"right"in R||"bottom"in R||"top"in R)&&(ce.manual=!0,ce.updateProjectionMatrix())),!L.camera&&!(R!=null&&R.rotation)&&ce.lookAt(0,0,0)),L.set({camera:ce}),H.camera=ce}if(!L.scene){let oe;g!=null&&g.isScene?oe=g:(oe=new cm,g&&Fo(oe,g)),L.set({scene:ko(oe)})}if(!L.xr){var q;const oe=(Ae,dt)=>{const vt=s.getState();vt.frameloop!=="never"&&cv(Ae,!0,vt,dt)},ce=()=>{const Ae=s.getState();Ae.gl.xr.enabled=Ae.gl.xr.isPresenting,Ae.gl.xr.setAnimationLoop(Ae.gl.xr.isPresenting?oe:null),Ae.gl.xr.isPresenting||lv(Ae)},ve={connect(){const Ae=s.getState().gl;Ae.xr.addEventListener("sessionstart",ce),Ae.xr.addEventListener("sessionend",ce)},disconnect(){const Ae=s.getState().gl;Ae.xr.removeEventListener("sessionstart",ce),Ae.xr.removeEventListener("sessionend",ce)}};typeof((q=V.xr)==null?void 0:q.addEventListener)=="function"&&ve.connect(),L.set({xr:ve})}if(V.shadowMap){const oe=V.shadowMap.enabled,ce=V.shadowMap.type;if(V.shadowMap.enabled=!!_,Yt.boo(_))V.shadowMap.type=qa;else if(Yt.str(_)){var Y;const ve={basic:Uv,percentage:jo,soft:qa,variance:Ls};V.shadowMap.type=(Y=ve[_])!=null?Y:qa}else Yt.obj(_)&&Object.assign(V.shadowMap,_);(oe!==V.shadowMap.enabled||ce!==V.shadowMap.type)&&(V.shadowMap.needsUpdate=!0)}const J=C_();J&&("enabled"in J?J.enabled=!b:"legacyMode"in J&&(J.legacyMode=b)),u||Fo(V,{outputEncoding:v?3e3:3001,toneMapping:S?Ci:Mh}),L.legacy!==b&&L.set(()=>({legacy:b})),L.linear!==v&&L.set(()=>({linear:v})),L.flat!==S&&L.set(()=>({flat:S})),f&&!Yt.fun(f)&&!O_(f)&&!Yt.equ(f,V,Bo)&&Fo(V,f),x&&!L.events.handlers&&L.set({events:x(s)});const te=HR(r,m);return Yt.equ(te,L.size,Bo)||L.setSize(te.width,te.height,te.updateStyle,te.top,te.left),D&&L.viewport.dpr!==D_(D)&&L.setDpr(D),L.frameloop!==P&&L.setFrameloop(P),L.onPointerMissed||L.set({onPointerMissed:B}),N&&!Yt.equ(N,L.performance,Bo)&&L.set(oe=>({performance:{...oe.performance,...N}})),c=M,u=!0,this},render(d){return u||this.configure(),_h.updateContainer(T.jsx(jR,{store:s,children:d,onCreated:c,rootElement:r}),o,null,()=>{}),s},unmount(){k_(r)}}}function jR({store:r,children:e,onCreated:t,rootElement:n}){return Pl(()=>{const i=r.getState();i.set(s=>({internal:{...s.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),T.jsx(F_.Provider,{value:r,children:e})}function k_(r,e){const t=ea.get(r),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),_h.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var s,o,c,u;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(u=i.gl)!=null&&u.xr&&i.xr.disconnect(),LR(i),ea.delete(r)}catch{}},500)})}}_h.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:ee.version});const xp={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function XR(r){const{handlePointer:e}=OR(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(xp).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{var n;const{set:i,events:s}=r.getState();s.disconnect==null||s.disconnect(),i(o=>({events:{...o.events,connected:t}}
4059)),Object.entries((n=s.handlers)!=null?n:[]).forEach(([o,c])=>{const[u,h]=xp[o];t.addEventListener(u,c,{passive:h})})},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){var i;Object.entries((i=n.handlers)!=null?i:[]).forEach(([s,o])=>{if(n&&n.connected instanceof HTMLElement){const[c]=xp[s];n.connected.removeEventListener(c,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}function uv(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function YR({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,o]=ee.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=ee.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),u=r?typeof r=="number"?r:r.scroll:null,h=r?typeof r=="number"?r:r.resize:null,d=ee.useRef(!1);ee.useEffect(()=>(d.current=!0,()=>{d.current=!1}));const[f,m,g]=ee.useMemo(()=>{const v=()=>{if(!c.current.element)return;const{left:S,top:b,width:E,height:P,bottom:D,right:N,x:A,y:R}=c.current.element.getBoundingClientRect(),B={left:S,top:b,width:E,height:P,bottom:D,right:N,x:A,y:R};c.current.element instanceof HTMLElement&&n&&(B.height=c.current.element.offsetHeight,B.width=c.current.element.offsetWidth),Object.freeze(B),d.current&&!KR(c.current.lastBounds,B)&&o(c.current.lastBounds=B)};return[v,h?uv(v,h):v,u?uv(v,u):v]},[o,n,u,h]);function x(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(v=>v.removeEventListener("scroll",g,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function M(){c.current.element&&(c.current.resizeObserver=new i(g),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(v=>v.addEventListener("scroll",g,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const _=v=>{!v||v===c.current.element||(x(),c.current.element=v,c.current.scrollContainers=z_(v),M())};return ZR(g,!!e),qR(m),ee.useEffect(()=>{x(),M()},[e,g,m]),ee.useEffect(()=>x,[]),[_,s,f]}function qR(r){ee.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[r])}function ZR(r,e){ee.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[r,e])}function z_(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(s=>s==="auto"||s==="scroll")&&e.push(r),[...e,...z_(r.parentElement)]}const JR=["x","y","top","bottom","left","right","width","height"],KR=(r,e)=>JR.every(t=>r[t]===e[t]);var QR=Object.defineProperty,$R=Object.defineProperties,e3=Object.getOwnPropertyDescriptors,hv=Object.getOwnPropertySymbols,t3=Object.prototype.hasOwnProperty,n3=Object.prototype.propertyIsEnumerable,dv=(r,e,t)=>e in r?QR(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,fv=(r,e)=>{for(var t in e||(e={}))t3.call(e,t)&&dv(r,t,e[t]);if(hv)for(var t of hv(e))n3.call(e,t)&&dv(r,t,e[t]);return r},i3=(r,e)=>$R(r,e3(e)),pv,mv;typeof window<"u"&&((pv=window.document)!=null&&pv.createElement||((mv=window.navigator)==null?void 0:mv.product)==="ReactNative")?ee.useLayoutEffect:ee.useEffect;function V_(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=r.child;for(;n;){const i=V_(n,e,t);if(i)return i;n=n.sibling}}function G_(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const gv=console.error;console.error=function(){const r=[...arguments].join("");if(r?.startsWith("Warning:")&&r.includes("useContext")){console.error=gv;return}return gv.apply(this,arguments)};const km=G_(ee.createContext(null));class H_ extends ee.Component{render(){return ee.createElement(km.Provider,{value:this._reactInternals},this.props.children)}}function r3(){const r=ee.useContext(km);if(r===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=ee.useId();return ee.useMemo(()=>{for(const n of[r,r?.alternate]){if(!n)continue;const i=V_(n,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[r,e])}function s3(){const r=r3(),[e]=ee.useState(()=>new Map);e.clear();let t=r;for(;t;){if(t.type&&typeof t.type=="object"){const i=t.type._context===void 0&&t.type.Provider===t.type?t.type:t.type._context;i&&i!==km&&!e.has(i)&&e.set(i,ee.useContext(G_(i)))}t=t.return}return e}function o3(){const r=s3();return ee.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>
vendor: 5,998 bytes, line 4059
4059n=>ee.createElement(e,null,ee.createElement(t.Provider,i3(fv({},n),{value:r.get(t)}))),e=>ee.createElement(H_,fv({},e))),[r])}const a3=ee.forwardRef(function({children:e,fallback:t,resize:n,style:i,gl:s,events:o=XR,eventSource:c,eventPrefix:u,shadows:h,linear:d,flat:f,legacy:m,orthographic:g,frameloop:x,dpr:M,performance:_,raycaster:v,camera:S,scene:b,onPointerMissed:E,onCreated:P,...D},N){ee.useMemo(()=>AR(gR),[]);const A=o3(),[R,B]=YR({scroll:!0,debounce:{scroll:50,resize:0},...n}),L=ee.useRef(null),V=ee.useRef(null);ee.useImperativeHandle(N,()=>L.current);const H=I_(E),[j,X]=ee.useState(!1),[q,Y]=ee.useState(!1);if(j)throw j;if(q)throw q;const J=ee.useRef(null);Pl(()=>{const oe=L.current;B.width>0&&B.height>0&&oe&&(J.current||(J.current=WR(oe)),J.current.configure({gl:s,events:o,shadows:h,linear:d,flat:f,legacy:m,orthographic:g,frameloop:x,dpr:M,performance:_,raycaster:v,camera:S,scene:b,size:B,onPointerMissed:(...ce)=>H.current==null?void 0:H.current(...ce),onCreated:ce=>{ce.events.connect==null||ce.events.connect(c?RR(c)?c.current:c:V.current),u&&ce.setEvents({compute:(ve,Ae)=>{const dt=ve[u+"X"],vt=ve[u+"Y"];Ae.pointer.set(dt/Ae.size.width*2-1,-(vt/Ae.size.height)*2+1),Ae.raycaster.setFromCamera(Ae.pointer,Ae.camera)}}),P?.(ce)}}),J.current.render(T.jsx(A,{children:T.jsx(P_,{set:Y,children:T.jsx(ee.Suspense,{fallback:T.jsx(IR,{set:X}),children:e??null})})})))}),ee.useEffect(()=>{const oe=L.current;if(oe)return()=>k_(oe)},[]);const te=c?"none":"auto";return T.jsx("div",{ref:V,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:te,...i},...D,children:T.jsx("div",{ref:R,style:{width:"100%",height:"100%"},children:T.jsx("canvas",{ref:L,style:{display:"block"},children:t})})})}),l3=ee.forwardRef(function(e,t){return T.jsx(H_,{children:T.jsx(a3,{...e,ref:t})})}),Ai=[{id:"round-60",name:'60" Round Table',category:"tables",width:5,depth:5,height:2.5,color:"#f5f0e8",shape:"cylinder",defaultSeats:8},{id:"round-72",name:'72" Round Table',category:"tables",width:6,depth:6,height:2.5,color:"#f5f0e8",shape:"cylinder",defaultSeats:10},{id:"round-48",name:'48" Round Table',category:"tables",width:4,depth:4,height:2.5,color:"#f5f0e8",shape:"cylinder",defaultSeats:6},{id:"rect-6ft",name:"6' Banquet Table",category:"tables",width:6,depth:2.5,height:2.5,color:"#f5f0e8",shape:"box",defaultSeats:6},{id:"rect-8ft",name:"8' Banquet Table",category:"tables",width:8,depth:2.5,height:2.5,color:"#f5f0e8",shape:"box",defaultSeats:8},{id:"cocktail-30",name:'30" Cocktail Table',category:"tables",width:2.5,depth:2.5,height:3.5,color:"#f5f0e8",shape:"cylinder"},{id:"half-round",name:"Half-Round Table",category:"tables",width:5,depth:2.5,height:2.5,color:"#f5f0e8",shape:"box",defaultSeats:4},{id:"serpentine",name:"Serpentine Table",category:"tables",width:5,depth:2.5,height:2.5,color:"#f5f0e8",shape:"box",defaultSeats:4},{id:"square-36",name:'36" Square Table',category:"tables",width:3,depth:3,height:2.5,color:"#f5f0e8",shape:"box",defaultSeats:4},{id:"oval-6ft",name:"6' Oval Table",category:"tables",width:6,depth:3.5,height:2.5,color:"#f5f0e8",shape:"cylinder",defaultSeats:6},{id:"banquet-chair",name:"Banquet Chair",category:"chairs",width:1.5,depth:1.5,height:3,color:"#8B7355",shape:"chair"},{id:"chiavari-chair",name:"Chiavari Chair",category:"chairs",width:1.33,depth:1.33,height:3,color:"#C4A35A",shape:"chair"},{id:"folding-chair",name:"Folding Chair",category:"chairs",width:1.5,depth:1.5,height:2.75,color:"#888888",shape:"chair"},{id:"ghost-chair",name:"Ghost Chair",category:"chairs",width:1.33,depth:1.5,height:3,color:"#d4e4f7",shape:"chair"},{id:"lounge-chair",name:"Lounge Chair",category:"chairs",width:2.5,depth:2.5,height:2.5,color:"#6B4226",shape:"box"},{id:"bar-stool",name:"Bar Stool",category:"chairs",width:1.25,depth:1.25,height:3.5,color:"#555555",shape:"chair"},{id:"chair-row-10",name:"Chair Row (10)",category:"chairs",width:15,depth:1.5,height:2.75,color:"#888888",shape:"box"},{id:"stage-4x8",name:"4'×8' Stage Section",category:"staging",width:8,depth:4,height:2,color:"#2c2c2c",shape:"box"},{id:"stage-4x4",name:"4'×4' Stage Section",category:"staging",width:4,depth:4,height:2,color:"#2c2c2c",shape:"box"},{id:"dance-floor-12",name:"12'×12' Dance Floor",category:"staging",width:12,depth:12,height:.25,color:"#D4A574",shape:"box"},{id:"dance-floor-16",name:"16'×16' Dance Floor",category:"staging",width:16,depth:16,height:.25,color:"#D4A574",shape:"box"},{id:"podium",name:"Podium / Lectern",category:"staging",width:2,depth:1.5,height:3.75,color:"#5c3a1e",shape:"box"},{id:"riser-1ft",name:"1' Riser",category:"staging",width:8,depth:4,height:1,color:"#333333",shape:"box"},{id:"head-table",name:"Head Table (8')",category:"staging",width:8,depth:2.5,height:2.5,color:"#f5f0e8",shape:"box"},{id:"projector-screen",name:"Projector Screen (8')",category:"av",width:8,depth:.5,height:6,color:"#ffffff",shape:"box"},{id:"speaker-stand",name:"Speaker on Stand",category:"av",width:1.5,depth:1.5,height:5,color:"#111111",shape:"box"},{id:"tv-65",name:'65" TV on Stand',category:"av",width:5,depth:1,height:5.5,color:"#1a1a1a",shape:"box"},{id:"lighting-truss",name:"Lighting Truss (10')",category:"av",width:10,depth:1,height:.5,color:"#aaaaaa",shape:"box"},{id:"dj-booth",name:"DJ Booth",category:"av",width:6,depth:3,height:3,color:"#2a2a2a",shape:"box"},{id:"buffet-8ft",name:"8' Buffet Station",category:"fb",width:8,depth:2.5,height:3,color:"#f5f0e8",shape:"box"},{id:"buffet-6ft",name:"6' Buffet Station",category:"fb",width:6,depth:2.5,height:3,color:"#f5f0e8",shape:"box"},{id:"bar-8ft",name:"8' Bar",category:"fb",width:8,depth:2,height:3.5,color:"#5c3a1e",shape:"box"},{id:"bar-6ft",name:"6' Bar",category:"fb",width:6,depth:2,height:3.5,color:"#5c3a1e",shape:"box"},{id:"beverage-station",name:"Beverage Station",category:"fb",width:4,depth:2,height:3,color:"#f5f0e8",shape:"box"},{id:"cake-table",name:"Cake Table",category:"fb",width:4,depth:4,height:2.5,color:"#ffffff",shape:"cylinder"}
4059,{id:"flower-centerpiece",name:"Floral Centerpiece",category:"decor",width:1,depth:1,height:1.5,color:"#ff69b4",shape:"cylinder"},{id:"arch",name:"Wedding Arch",category:"decor",width:6,depth:1,height:8,color:"#f5f0e8",shape:"box"},{id:"column",name:"Decorative Column",category:"decor",width:1,depth:1,height:5,color:"#e8e0d0",shape:"cylinder"},{id:"drape-10",name:"Pipe & Drape (10')",category:"decor",width:10,depth:.25,height:8,color:"#f5f5f5",shape:"box"},{id:"planter",name:"Planter / Greenery",category:"decor",width:2,depth:2,height:3,color:"#228B22",shape:"cylinder"},{id:"wall-10",name:"Wall Section (10')",category:"architectural",width:10,depth:.5,height:8,color:"#d4cfc7",shape:"box"},{id:"wall-20",name:"Wall Section (20')",category:"architectural",width:20,depth:.5,height:8,color:"#d4cfc7",shape:"box"},{id:"door-single",name:"Single Door",category:"architectural",width:3,depth:.5,height:7,color:"#8B6914",shape:"box"},{id:"door-double",name:"Double Door",category:"architectural",width:6,depth:.5,height:7,color:"#8B6914",shape:"box"},{id:"window",name:"Window",category:"architectural",width:4,depth:.25,height:4,color:"#87CEEB",shape:"box"},{id:"column-struct",name:"Structural Column",category:"architectural",width:1,depth:1,height:10,color:"#c0c0c0",shape:"cylinder"},{id:"stairs-4",name:"Stairs (4-step)",category:"architectural",width:4,depth:4,height:2,color:"#aaaaaa",shape:"box"},{id:"tent-20x20",name:"20'×20' Frame Tent",category:"tents",width:20,depth:20,height:10,color:"#f5f5f5",shape:"box"},{id:"tent-30x30",name:"30'×30' Frame Tent",category:"tents",width:30,depth:30,height:12,color:"#f5f5f5",shape:"box"},{id:"tent-40x60",name:"40'×60' Clear Span",category:"tents",width:60,depth:40,height:15,color:"#f5f5f5",shape:"box"}],W_={tables:"Tables",chairs:"Chairs",staging:"Staging",av:"A/V Equipment",fb:"Food & Beverage",tents:"Tents",decor:"Décor",architectural:"Architectural",outdoor:"Outdoor"},c3={rectangle:{label:"Rectangle",walls:(r,e)=>{const t=r/2,n=e/2;return[[-t,-n],[t,-n],[t,n],[-t,n]]}},"l-shape":{label:"L-Shape",walls:(r,e)=>{const t=r/2,n=e/2;return[[-t,-n],[t,-n],[t,0],[0,0],[0,n],[-t,n]]}},"t-shape":{label:"T-Shape",walls:(r,e)=>{const t=r/2,n=e/2,i=r*.3;return[[-t,-n],[t,-n],[t,-n+e*.35],[i/2,-n+e*.35],[i/2,n],[-i/2,n],[-i/2,-n+e*.35],[-t,-n+e*.35]]}},"u-shape":{label:"U-Shape",walls:(r,e)=>{const t=r/2,n=e/2,i=r*.25;
4059return[[-t,-n],[t,-n],[t,n],[t-i,n],[t-i,-n+e*.35],[-t+i,-n+e*.35],[-t+i,n],[-t,n]]}}},u3={name:"Main Ballroom",width:60,depth:40,ceilingHeight:12,wallColor:"#d4cfc7",floorColor:"#e8e0d0"},xv={layout:{name:"Untitled Layout",room:{...u3},objects:[]},selectedIds:[],cameraMode:"2d",isDragging:!1,toolMode:"select",transformMode:"translate",placingItem:null,snapToGrid:!0,gridSize:1,showGrid:!0,showDimensions:!0,showLabels:!0,undoStack:[],redoStack:[],isDirty:!1};function vv(r,e,t,n){const i=e.width*r.scale,s=e.depth*r.scale,o=.6,c=[];if(e.shape==="cylinder"||e.shape==="circle-table"){const h=i/2+o+t.width/2;for(let d=0;d<n;d++){const f=d/n*Math.PI*2+r.rotation,m=r.position[0]+Math.cos(f)*h,g=r.position[2]+Math.sin(f)*h,x=-(f+Math.PI/2);c.push({position:[m,0,g],rotation:x})}}else{const h=i/2+o+t.depth/2,d=s/2+o+t.depth/2,f=Math.max(1,Math.floor(n*(i/(i+s))/2)),m=Math.max(0,Math.floor((n-f*2)/2));let g=0;for(let x=0;x<f&&g<n;x++){const M=(x+.5)/f,_=r.position[0]-i/2+M*i,v=r.position[2]+d;c.push({position:[_,0,v],rotation:r.rotation+Math.PI}),g++}for(let x=0;x<f&&g<n;x++){const M=(x+.5)/f,_=r.position[0]-i/2+M*i,v=r.position[2]-d;c.push({position:[_,0,v],rotation:r.rotation}),g++}for(let x=0;x<m&&g<n;x++){const M=(x+.5)/Math.max(m,1),_=r.position[0]+h,v=r.position[2]-s/2+M*s;c.push({position:[_,0,v],rotation:r.rotation-Math.PI/2}),g++}for(let x=0;x<m&&g<n;x++){const M=(x+.5)/Math.max(m,1),_=r.position[0]-h,v=r.position[2]-s/2+M*s;c.push({position:[_,0,v],rotation:r.rotation+Math.PI/2}),g++}}return c}let yv=0;function Yo(){return yv++,`obj_${Date.now()}_${yv}`}function Cs(r){return{...r,undoStack:[...r.undoStack.slice(-49),r.layout.objects.map(e=>({...e}))],redoStack:[]}}function h3(r,e){switch(e.type){case"SET_CAMERA_MODE":return{...r,cameraMode:e.mode};case"SET_TOOL_MODE":return{...r,toolMode:e.mode,placingItem:e.mode!=="place"?null:r.placingItem};case"SET_TRANSFORM_MODE":return{...r,transformMode:e.mode};case"SET_PLACING_ITEM":return{...r,placingItem:e.item,toolMode:e.item?"place":"select"};case"SELECT_OBJECT":{if(e.additive){const t=r.selectedIds.includes(e.id);return{...r,selectedIds:t?r.selectedIds.filter(n=>n!==e.id):[...r.selectedIds,e.id]}}return{...r,selectedIds:[e.id]}}case"DESELECT_ALL":return{...r,selectedIds:[]};case"ADD_OBJECT":{const t=Cs(r);return{...t,layout:{...t.layout,objects:[...t.layout.objects,e.object]},selectedIds:[e.object.instanceId],toolMode:"select",placingItem:null,isDirty:!0}}case"ADD_OBJECTS":{const t=Cs(r);return{...t,layout:{...t.layout,objects:[...t.layout.objects,...e.objects]},selectedIds:e.objects.map(n=>n.instanceId),toolMode:"select",placingItem:null,isDirty:!0}}case"ADD_TABLE_WITH_CHAIRS":{const t=Cs(r),n=Ai.find(c=>c.id===e.table.catalogId),i=Ai.find(c=>c.id===e.chairCatalogId),s={...e.table,seatCount:e.seatCount,chairType:e.chairCatalogId},o=[s];return n&&i&&e.seatCount>0&&vv(s,n,i,e.seatCount).forEach(u=>{o.push({instanceId:Yo(),catalogId:e.chairCatalogId,position:u.position,rotation:u.rotation,scale:1,locked:!1,parentTableId:s.instanceId})}),{...t,layout:{...t.layout,objects:[...t.layout.objects,...o]},selectedIds:[s.instanceId],toolMode:"select",placingItem:null,isDirty:!0}}case"REGENERATE_CHAIRS":{const t=r.layout.objects.find(f=>f.instanceId===e.tableInstanceId);if(!t)return r;const n=Ai.find(f=>f.id===t.catalogId),i=t.chairType||"banquet-chair",s=Ai.find(f=>f.id===i),o=t.seatCount??n?.defaultSeats??0;if(!n||!s||o<=0)return r;const c=Cs(r),u=c.layout.objects.filter(f=>
4059f.parentTableId!==e.tableInstanceId),d=vv(t,n,s,o).map(f=>({instanceId:Yo(),catalogId:i,position:f.position,rotation:f.rotation,scale:1,locked:!1,parentTableId:e.tableInstanceId}));return{...c,layout:{...c.layout,objects:[...u,...d]},isDirty:!0}}case"UPDATE_OBJECT":{const t=r.layout.objects.find(i=>i.instanceId===e.instanceId);if(!t||t.locked)return r;const n=Cs(r);return{...n,layout:{...n.layout,objects:n.layout.objects.map(i=>i.instanceId===e.instanceId?{...i,...e.updates}:i)},isDirty:!0}}case"DELETE_SELECTED":{if(r.selectedIds.length===0)return r;const t=Cs(r),n=new Set(r.selectedIds);return r.selectedIds.forEach(i=>{t.layout.objects.forEach(s=>{s.parentTableId===i&&n.add(s.instanceId)})}),{...t,layout:{...t.layout,objects:t.layout.objects.filter(i=>!n.has(i.instanceId))},selectedIds:[],isDirty:!0}}case"DUPLICATE_SELECTED":{if(r.selectedIds.length===0)return r;const t=Cs(r),i=t.layout.objects.filter(s=>r.selectedIds.includes(s.instanceId)).map(s=>({...s,instanceId:Yo(),position:[s.position[0]+2,s.position[1],s.position[2]+2],label:s.label?`${s.label} (copy)`:void 0}));return{...t,layout:{...t.layout,objects:[...t.layout.objects,...i]},selectedIds:i.map(s=>s.instanceId),isDirty:!0}}case"TOGGLE_LOCK":return{...r,layout:{...r.layout,objects:r.layout.objects.map(t=>t.instanceId===e.instanceId?{...t,locked:!t.locked}:t)},isDirty:!0};case"UPDATE_ROOM":return{...r,layout:{...r.layout,room:{...r.layout.room,...e.updates}},isDirty:!0};case"SET_LAYOUT":return{...r,layout:e.layout,selectedIds:[],undoStack:[],redoStack:[],isDirty:!1};case"SET_LAYOUT_NAME":return{...r,layout:{...r.layout,name:e.name},isDirty:!0};case"TOGGLE_SNAP":return{...r,snapToGrid:!r.snapToGrid};case"SET_GRID_SIZE":return{...r,gridSize:e.size};case"TOGGLE_GRID":return{...r,showGrid:!r.showGrid};case"TOGGLE_DIMENSIONS":return{...r,showDimensions:!r.showDimensions};case"TOGGLE_LABELS":return{...r,showLabels:!r.showLabels};case"UNDO":{if(r.undoStack.length===0)return r;const t=r.undoStack[r.undoStack.length-1];return{...r,undoStack:r.undoStack.slice(0,-1),redoStack:[...r.redoStack,r.layout.objects.map(n=>({...n}))],layout:{...r.layout,objects:t},selectedIds:[],isDirty:!0}}case"REDO":{if(r.redoStack.length===0)return r;const t=r.redoStack[r.redoStack.length-1];return{...r,redoStack:r.redoStack.slice(0,-1),undoStack:[...r.undoStack,r.layout.objects.map(n=>({...n}))],layout:{...r.layout,objects:t},selectedIds:[],isDirty:!0}}case"MARK_SAVED":return{...r,isDirty:!1};case"SET_DRAGGING":return{...r,isDragging:e.dragging};default:return r}}const j_=ee.createContext(null);function nd(){const r=ee.useContext(j_);if(!r)throw new Error("useDesigner must be used within DesignerContext.Provider");return r}const id=YS(),rd="layouts";function X_(){return XS(id,rd)}async function d3(r){const e=Ev.currentUser;
4059if(!e)throw new Error("Must be logged in to save");const t={name:r.name,eventId:r.eventId||null,room:r.room,objects:r.objects.map(Y_),createdBy:e.uid,createdAt:Mp(),updatedAt:Mp()};return(await kS(X_(),t)).id}async function f3(r,e){const t=Xp(id,rd,r);await BS(t,{name:e.name,eventId:e.eventId||null,room:e.room,objects:e.objects.map(Y_),updatedAt:Mp()})}async function p3(r){const e=Xp(id,rd,r),t=await WS(e);if(!t.exists())throw new Error(`Layout ${r} not found`);return x3(t.id,t.data())}async function m3(){const r=Ev.currentUser;if(!r)return[];const e=zS(X_(),GS("createdBy","==",r.uid),VS("updatedAt","desc"));return(await HS(e)).docs.map(n=>{const i=n.data();return{id:n.id,name:i.name||"Untitled",roomName:i.room?.name||"",objectCount:i.objects?.length||0,updatedAt:i.updatedAt instanceof Sp?i.updatedAt.toDate().toISOString():new Date().toISOString(),createdBy:i.createdBy||""}})}async function g3(r){await jS(Xp(id,rd,r))}function Y_(r){return{instanceId:r.instanceId,catalogId:r.catalogId,position:r.position,rotation:r.rotation,scale:r.scale,label:r.label||null,colorOverride:r.colorOverride||null,locked:r.locked,layer:r.layer||null,parentTableId:r.parentTableId||null,linenColor:r.linenColor||null,showPlaceSettings:r.showPlaceSettings||!1,seatCount:r.seatCount??null,chairType:r.chairType||null}}function x3(r,e){return{id:r,name:e.name||"Untitled",eventId:e.eventId||void 0,room:e.room,objects:(e.objects||[]).map(t=>({instanceId:t.instanceId,catalogId:t.catalogId,position:t.position,rotation:t.rotation||0,scale:t.scale||1,label:t.label||void 0,colorOverride:t.colorOverride||void 0,locked:t.locked||!1,layer:t.layer||void 0,parentTableId:t.parentTableId||void 0,linenColor:t.linenColor||void 0,showPlaceSettings:t.showPlaceSettings||!1,seatCount:t.seatCount??void 0,chairType:t.chairType||void 0})),createdAt:e.createdAt instanceof Sp?e.createdAt.toDate().toISOString():void 0,updatedAt:e.updatedAt instanceof Sp?e.updatedAt.toDate().toISOString():void 0,createdBy:e.createdBy||void 0}}const Ll=new F,zm=new F,v3=new F,_v=new ge;function y3(r,e,t){const n=Ll.setFromMatrixPosition(r.matrixWorld);n.project(e);const i=t.width/2,s=t.height/2;return[n.x*i+i,-(n.y*s)+s]}function _3(r,e){const t=Ll.setFromMatrixPosition(r.matrixWorld),n=zm.setFromMatrixPosition(e.matrixWorld),i=t.sub(n),s=e.getWorldDirection(v3);return i.angleTo(s)>Math.PI/2}function S3(r,e,t,n){const i=Ll.setFromMatrixPosition(r.matrixWorld),s=i.clone();s.project(e),_v.set(s.x,s.y),t.setFromCamera(_v,e);const o=t.intersectObjects(n,!0);if(o.length){const c=o[0].distance;return i.distanceTo(t.ray.origin)<c}return!0}function M3(r,e){if(e instanceof Gi)return e.zoom;if(e instanceof Zt){const t=Ll.setFromMatrixPosition(r.matrixWorld),n=zm.setFromMatrixPosition(e.matrixWorld),i=e.fov*Math.PI/180,s=t.distanceTo(n);return 1/(2*Math.tan(i/2)*s)}else return 1}function b3(r,e,t){if(e instanceof Zt||e instanceof Gi){const n=Ll.setFromMatrixPosition(r.matrixWorld),i=zm.setFromMatrixPosition(e.matrixWorld),s=n.distanceTo(i),o=(t[1]-t[0])/(e.far-e.near),c=t[1]-o*e.far;return Math.round(o*s+c)}}const jp=r=>Math.abs(r)<1e-10?0:r;function q_(r,e,t=""){let n="matrix3d(";for(let i=0;i!==16;i++)n+=jp(e[i]*r.elements[i])+(i!==15?",":")");return t+n}const w3=(r=>e=>q_(e,r))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),E3=(r=>(e,t)=>q_(e,r(t),"translate(-50%,-50%)"))(r=>[1/r,1/r,1/r,1,-1/r,-1/r,-1/r,-1,1/r,1/r,1/r,1,1,1,1,1]);function T3(r){return r&&typeof r=="object"&&"current"in r}const ks=ee.forwardRef(({children:r,eps:e=.001,style:t,className:n,prepend:i,center:s,fullscreen:o,portal:c,distanceFactor:u,sprite:h=!1,transform:d=!1,occlude:f,onOcclude:m,castShadow:g,receiveShadow:x,material:M,geometry:_,zIndexRange:v=[16777271,0],calculatePosition:S=y3,as:b="div",wrapperClass:E,pointerEvents:P="auto",...D},N)=>{const{gl:A,camera:R,scene:B,size:L,raycaster:V,events:H,viewport:j}=pi(),[X]=ee.useState(()=>document.createElement(b)),q=ee.useRef(),Y=ee.useRef(null),J=ee.useRef(0),te=ee.useRef([0,0]),oe=ee.useRef(null),ce=ee.useRef(null),ve=c?.current||H.connected||A.domElement.parentNode,Ae=ee.useRef(null),dt=ee.useRef(!1),vt=ee.useMemo(()=>f&&f!=="blending"||Array.isArray(f)&&f.length&&T3(f[0]),[f]);ee.useLayoutEffect(()=>{const He=A.domElement;f&&f==="blending"?(He.style.zIndex=`${Math.floor(v[0]/2)}`,He.style.position="absolute",He.style.pointerEvents="none"):(He.style.zIndex=null,He.style.position=null,He.style.pointerEvents=null)},[f]),ee.useLayoutEffect(()=>{if(Y.current){const He=q.current=qS.createRoot(X);if(B.updateMatrixWorld(),d)X.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const De=S(Y.current,R,L);X.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${De[0]}px,${De[1]}px,0);transform-origin:0 0;`}return ve&&(i?ve.prepend(X):ve.appendChild(X)),()=>{ve&&ve.removeChild(X),He.unmount()}}},[ve,d]),ee.useLayoutEffect(()=>{E&&(X.className=E)},[E]);const he=ee.useMemo(()=>d?{position:"absolute",top:0,left:0,width:L.width,height:L.height,transformStyle:"preserve-3d",pointerEvents:"none"}
vendor: 5,597 bytes, lines 4059-4096
4059:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...o&&{top:-L.height/2,left:-L.width/2,width:L.width,height:L.height},...t},[t,s,o,L,d]),we=ee.useMemo(()=>({position:"absolute",pointerEvents:P}),[P]);ee.useLayoutEffect(()=>{if(dt.current=!1,d){var He;(He=q.current)==null||He.render(ee.createElement("div",{ref:oe,style:he},ee.createElement("div",{ref:ce,style:we},ee.createElement("div",{ref:N,className:n,style:t,children:r}))))}else{var De;(De=q.current)==null||De.render(ee.createElement("div",{ref:N,style:he,className:n,children:r}))}});const Ee=ee.useRef(!0);Qs(He=>{if(Y.current){R.updateMatrixWorld(),Y.current.updateWorldMatrix(!0,!1);const De=d?te.current:S(Y.current,R,L);if(d||Math.abs(J.current-R.zoom)>e||Math.abs(te.current[0]-De[0])>e||Math.abs(te.current[1]-De[1])>e){const _t=_3(Y.current,R);let Je=!1;vt&&(Array.isArray(f)?Je=f.map(Ie=>Ie.current):f!=="blending"&&(Je=[B]));const xe=Ee.current;if(Je){const Ie=S3(Y.current,R,V,Je);Ee.current=Ie&&!_t}else Ee.current=!_t;xe!==Ee.current&&(m?m(!Ee.current):X.style.display=Ee.current?"block":"none");const _e=Math.floor(v[0]/2),ye=f?vt?[v[0],_e]:[_e-1,0]:v;if(X.style.zIndex=`${b3(Y.current,R,ye)}`,d){const[Ie,k]=[L.width/2,L.height/2],tt=R.projectionMatrix.elements[5]*k,{isOrthographicCamera:Be,top:at,left:Ce,bottom:O,right:I}=R,Z=w3(R.matrixWorldInverse),le=Be?`scale(${tt})translate(${jp(-(I+Ce)/2)}px,${jp((at+O)/2)}px)`:`translateZ(${tt}px)`;let me=Y.current.matrixWorld;h&&(me=R.matrixWorldInverse.clone().transpose().copyPosition(me).scale(Y.current.scale),me.elements[3]=me.elements[7]=me.elements[11]=0,me.elements[15]=1),X.style.width=L.width+"px",X.style.height=L.height+"px",X.style.perspective=Be?"":`${tt}px`,oe.current&&ce.current&&(oe.current.style.transform=`${le}${Z}translate(${Ie}px,${k}px)`,ce.current.style.transform=E3(me,1/((u||10)/400)))}else{const Ie=u===void 0?1:M3(Y.current,R)*u;X.style.transform=`translate3d(${De[0]}px,${De[1]}px,0) scale(${Ie})`}te.current=De,J.current=R.zoom}}if(!vt&&Ae.current&&!dt.current)if(d){if(oe.current){const De=oe.current.children[0];if(De!=null&&De.clientWidth&&De!=null&&De.clientHeight){const{isOrthographicCamera:_t}=R;if(_t||_)D.scale&&(Array.isArray(D.scale)?D.scale instanceof F?Ae.current.scale.copy(D.scale.clone().divideScalar(1)):Ae.current.scale.set(1/D.scale[0],1/D.scale[1],1/D.scale[2]):Ae.current.scale.setScalar(1/D.scale));else{const Je=(u||10)/400,xe=De.clientWidth*Je,_e=De.clientHeight*Je;Ae.current.scale.set(xe,_e,1)}dt.current=!0}}}else{const De=X.children[0];if(De!=null&&De.clientWidth&&De!=null&&De.clientHeight){const _t=1/j.factor,Je=De.clientWidth*_t,xe=De.clientHeight*_t;Ae.current.scale.set(Je,xe,1),dt.current=!0}Ae.current.lookAt(He.camera.position)}});const rt=ee.useMemo(()=>({vertexShader:d?void 0:`
4060          /*
4061            This shader is from the THREE's SpriteMaterial.
4062            We need to turn the backing plane into a Sprite
4063            (make it always face the camera) if "transfrom"
4064            is false.
4065          */
4066          #include <common>
4067
4068          void main() {
4069            vec2 center = vec2(0., 1.);
4070            float rotation = 0.0;
4071
4072            // This is somewhat arbitrary, but it seems to work well
4073            // Need to figure out how to derive this dynamically if it even matters
4074            float size = 0.03;
4075
4076            vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
4077            vec2 scale;
4078            scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
4079            scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
4080
4081            bool isPerspective = isPerspectiveMatrix( projectionMatrix );
4082            if ( isPerspective ) scale *= - mvPosition.z;
4083
4084            vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
4085            vec2 rotatedPosition;
4086            rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
4087            rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
4088            mvPosition.xy += rotatedPosition;
4089
4090            gl_Position = projectionMatrix * mvPosition;
4091          }
4092      `,fragmentShader:`
4093        void main() {
4094          gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
4095        }
4096      `}),[d]);return ee.createElement("group",sl({},D,{ref:Y}),f&&!vt&&ee.createElement("mesh",{castShadow:g,receiveShadow:x,ref:Ae},_||ee.createElement("planeGeometry",null),M||ee.createElement("shaderMaterial",{side:hn,vertexShader:rt.vertexShader,fragmentShader:rt.fragmentShader})))});var A3=Object.defineProperty,C3=(r,e,t)=>e in r?A3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,R3=(r,e,t)=>(C3(r,e+"",t),t);class I3{constructor(){R3(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}var P3=Object.defineProperty,L3=(r,e,t)=>e in r?P3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pt=(r,e,t)=>(L3(r,typeof e!="symbol"?e+"":e,t),t);
4096const bu=new qs,Sv=new Bi,D3=Math.cos(70*(Math.PI/180)),Mv=(r,e)=>(r%e+e)%e;class N3 extends I3{constructor(e,t){super(),pt(this,"object"),pt(this,"domElement"),pt(this,"enabled",!0),pt(this,"target",new F),pt(this,"minDistance",0),pt(this,"maxDistance",1/0),pt(this,"minZoom",0),pt(this,"maxZoom",1/0),pt(this,"minPolarAngle",0),pt(this,"maxPolarAngle",Math.PI),pt(this,"minAzimuthAngle",-1/0),pt(this,"maxAzimuthAngle",1/0),pt(this,"enableDamping",!1),pt(this,"dampingFactor",.05),pt(this,"enableZoom",!0),pt(this,"zoomSpeed",1),pt(this,"enableRotate",!0),pt(this,"rotateSpeed",1),pt(this,"enablePan",!0),pt(this,"panSpeed",1),pt(this,"screenSpacePanning",!0),pt(this,"keyPanSpeed",7),pt(this,"zoomToCursor",!1),pt(this,"autoRotate",!1),pt(this,"autoRotateSpeed",2),pt(this,"reverseOrbit",!1),pt(this,"reverseHorizontalOrbit",!1),pt(this,"reverseVerticalOrbit",!1),pt(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),pt(this,"mouseButtons",{LEFT:hi.ROTATE,MIDDLE:hi.DOLLY,RIGHT:hi.PAN}),pt(this,"touches",{ONE:Fi.ROTATE,TWO:Fi.DOLLY_PAN}),pt(this,"target0"),pt(this,"position0"),pt(this,"zoom0"),pt(this,"_domElementKeyEvents",null),pt(this,"getPolarAngle"),pt(this,"getAzimuthalAngle"),pt(this,"setPolarAngle"),pt(this,"setAzimuthalAngle"),pt(this,"getDistance"),pt(this,"getZoomScale"),pt(this,"listenToKeyEvents"),pt(this,"stopListenToKeyEvents"),pt(this,"saveState"),pt(this,"reset"),pt(this,"update"),pt(this,"connect"),pt(this,"dispose"),pt(this,"dollyIn"),pt(this,"dollyOut"),pt(this,"getScale"),pt(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>d.phi,this.getAzimuthalAngle=()=>d.theta,this.setPolarAngle=G=>{let se=Mv(G,2*Math.PI),Pe=d.phi;Pe<0&&(Pe+=2*Math.PI),se<0&&(se+=2*Math.PI);let W=Math.abs(se-Pe);2*Math.PI-W<W&&(se<Pe?se+=2*Math.PI:Pe+=2*Math.PI),f.phi=se-Pe,n.update()},this.setAzimuthalAngle=G=>{let se=Mv(G,2*Math.PI),Pe=d.theta;Pe<0&&(Pe+=2*Math.PI),se<0&&(se+=2*Math.PI);let W=Math.abs(se-Pe);2*Math.PI-W<W&&(se<Pe?se+=2*Math.PI:Pe+=2*Math.PI),f.theta=se-Pe,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=G=>{G.addEventListener("keydown",de),this._domElementKeyEvents=G},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",de),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),u=c.NONE},this.update=(()=>{const G=new F,se=new F(0,1,0),Pe=new wn().setFromUnitVectors(e.up,se),W=Pe.clone().invert(),Se=new F,be=new wn,Ve=2*Math.PI;return function(){const fe=n.object.position;Pe.setFromUnitVectors(e.up,se),W.copy(Pe).invert(),G.copy(fe).sub(n.target),G.applyQuaternion(Pe),d.setFromVector3(G),n.autoRotate&&u===c.NONE&&j(V()),n.enableDamping?(d.theta+=f.theta*n.dampingFactor,d.phi+=f.phi*n.dampingFactor):(d.theta+=f.theta,d.phi+=f.phi);let We=n.minAzimuthAngle,ct=n.maxAzimuthAngle;isFinite(We)&&isFinite(ct)&&(We<-Math.PI?We+=Ve:We>Math.PI&&(We-=Ve),ct<-Math.PI?ct+=Ve:ct>Math.PI&&(ct-=Ve),We<=ct?d.theta=Math.max(We,Math.min(ct,d.theta)):d.theta=d.theta>(We+ct)/2?Math.max(We,d.theta):Math.min(ct,d.theta)),d.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,d.phi)),d.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(g,n.dampingFactor):n.target.add(g),n.zoomToCursor&&R||n.object.isOrthographicCamera?d.radius=Ae(d.radius):d.radius=Ae(d.radius*m),G.setFromSpherical(d),G.applyQuaternion(W),fe.copy(n.target).add(G),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(f.theta*=1-n.dampingFactor,f.phi*=1-n.dampingFactor,g.multiplyScalar(1-n.dampingFactor)):(f.set(0,0,0),g.set(0,0,0));let Pt=!1;if(n.zoomToCursor&&R){let Ct=null;if(n.object instanceof Zt&&n.object.isPerspectiveCamera){const xn=G.length();Ct=Ae(xn*m);const Tn=xn-Ct;n.object.position.addScaledVector(N,Tn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const xn=new F(A.x,A.y,0);xn.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Pt=!0;const Tn=new F(A.x,A.y,0);Tn.unproject(n.object),n.object.position.sub(Tn).add(xn),n.object.updateMatrixWorld(),Ct=G.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Ct!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Ct).add(n.object.position):(bu.origin.copy(n.object.position),bu.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(bu.direction))<D3?e.lookAt(n.target):(Sv.setFromNormalAndCoplanarPoint(n.object.up,n.target),bu.intersectPlane(Sv,n.target))))}else n.object instanceof Gi&&n.object.isOrthographicCamera&&(Pt=m!==1,Pt&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix()));return m=1,R=!1,Pt||Se.distanceToSquared(n.object.position)>h||8*(1-be.dot(n.object.quaternion))>h?(n.dispatchEvent(i),Se.copy(n.object.position),be.copy(n.object.quaternion),Pt=!1,!0):!1}})(),this.connect=G=>{n.domElement=G,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",it),n.domElement.addEventListener("pointerdown",Ce),n.domElement.addEventListener("pointercancel",I),n.domElement.addEventListener("wheel",me)},this.dispose=()=>{var G,se,Pe,W,Se,be;n.domElement&&(n.domElement.style.touchAction="auto"),(G=n.domElement)==null||G.removeEventListener("contextmenu",it),(se=n.domElement)==null||se.removeEventListener("pointerdown",Ce),(Pe=n.domElement)==null||Pe.removeEventListener("pointercancel",I),(W=n.domElement)==null||W.removeEventListener("wheel",me),(Se=n.domElement)==null||Se.ownerDocument.removeEventListener("pointermove",O),(be=n.domElement)==null||be.ownerDocument.removeEventListener("pointerup",I),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",de)};const n=this,i={type:"change"},s={type:"start"},o={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=c.NONE;const h=1e-6,d=new Bp,f=new Bp;let m=1;
4096const g=new F,x=new ge,M=new ge,_=new ge,v=new ge,S=new ge,b=new ge,E=new ge,P=new ge,D=new ge,N=new F,A=new ge;let R=!1;const B=[],L={};function V(){return 2*Math.PI/60/60*n.autoRotateSpeed}function H(){return Math.pow(.95,n.zoomSpeed)}function j(G){n.reverseOrbit||n.reverseHorizontalOrbit?f.theta+=G:f.theta-=G}function X(G){n.reverseOrbit||n.reverseVerticalOrbit?f.phi+=G:f.phi-=G}const q=(()=>{const G=new F;return function(Pe,W){G.setFromMatrixColumn(W,0),G.multiplyScalar(-Pe),g.add(G)}})(),Y=(()=>{const G=new F;return function(Pe,W){n.screenSpacePanning===!0?G.setFromMatrixColumn(W,1):(G.setFromMatrixColumn(W,0),G.crossVectors(n.object.up,G)),G.multiplyScalar(Pe),g.add(G)}})(),J=(()=>{const G=new F;return function(Pe,W){const Se=n.domElement;if(Se&&n.object instanceof Zt&&n.object.isPerspectiveCamera){const be=n.object.position;G.copy(be).sub(n.target);let Ve=G.length();Ve*=Math.tan(n.object.fov/2*Math.PI/180),q(2*Pe*Ve/Se.clientHeight,n.object.matrix),Y(2*W*Ve/Se.clientHeight,n.object.matrix)}else Se&&n.object instanceof Gi&&n.object.isOrthographicCamera?(q(Pe*(n.object.right-n.object.left)/n.object.zoom/Se.clientWidth,n.object.matrix),Y(W*(n.object.top-n.object.bottom)/n.object.zoom/Se.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function te(G){n.object instanceof Zt&&n.object.isPerspectiveCamera||n.object instanceof Gi&&n.object.isOrthographicCamera?m=G:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function oe(G){te(m/G)}function ce(G){te(m*G)}function ve(G){if(!n.zoomToCursor||!n.domElement)return;R=!0;const se=n.domElement.getBoundingClientRect(),Pe=G.clientX-se.left,W=G.clientY-se.top,Se=se.width,be=se.height;A.x=Pe/Se*2-1,A.y=-(W/be)*2+1,N.set(A.x,A.y,1).unproject(n.object).sub(n.object.position).normalize()}function Ae(G){return Math.max(n.minDistance,Math.min(n.maxDistance,G))}function dt(G){x.set(G.clientX,G.clientY)}function vt(G){ve(G),E.set(G.clientX,G.clientY)}function he(G){v.set(G.clientX,G.clientY)}function we(G){M.set(G.clientX,G.clientY),_.subVectors(M,x).multiplyScalar(n.rotateSpeed);const se=n.domElement;se&&(j(2*Math.PI*_.x/se.clientHeight),X(2*Math.PI*_.y/se.clientHeight)),x.copy(M),n.update()}function Ee(G){P.set(G.clientX,G.clientY),D.subVectors(P,E),D.y>0?oe(H()):D.y<0&&ce(H()),E.copy(P),n.update()}function rt(G){S.set(G.clientX,G.clientY),b.subVectors(S,v).multiplyScalar(n.panSpeed),J(b.x,b.y),v.copy(S),n.update()}function He(G){ve(G),G.deltaY<0?ce(H()):G.deltaY>0&&oe(H()),n.update()}function De(G){let se=!1;switch(G.code){case n.keys.UP:J(0,n.keyPanSpeed),se=!0;break;case n.keys.BOTTOM:J(0,-n.keyPanSpeed),se=!0;break;case n.keys.LEFT:J(n.keyPanSpeed,0),se=!0;break;case n.keys.RIGHT:J(-n.keyPanSpeed,0),se=!0;break}se&&(G.preventDefault(),n.update())}function _t(){if(B.length==1)x.set(B[0].pageX,B[0].pageY);else{const G=.5*(B[0].pageX+B[1].pageX),se=.5*(B[0].pageY+B[1].pageY);x.set(G,se)}}function Je(){if(B.length==1)v.set(B[0].pageX,B[0].pageY);else{const G=.5*(B[0].pageX+B[1].pageX),se=.5*(B[0].pageY+B[1].pageY);
4096v.set(G,se)}}function xe(){const G=B[0].pageX-B[1].pageX,se=B[0].pageY-B[1].pageY,Pe=Math.sqrt(G*G+se*se);E.set(0,Pe)}function _e(){n.enableZoom&&xe(),n.enablePan&&Je()}function ye(){n.enableZoom&&xe(),n.enableRotate&&_t()}function Ie(G){if(B.length==1)M.set(G.pageX,G.pageY);else{const Pe=$e(G),W=.5*(G.pageX+Pe.x),Se=.5*(G.pageY+Pe.y);M.set(W,Se)}_.subVectors(M,x).multiplyScalar(n.rotateSpeed);const se=n.domElement;se&&(j(2*Math.PI*_.x/se.clientHeight),X(2*Math.PI*_.y/se.clientHeight)),x.copy(M)}function k(G){if(B.length==1)S.set(G.pageX,G.pageY);else{const se=$e(G),Pe=.5*(G.pageX+se.x),W=.5*(G.pageY+se.y);S.set(Pe,W)}b.subVectors(S,v).multiplyScalar(n.panSpeed),J(b.x,b.y),v.copy(S)}function tt(G){const se=$e(G),Pe=G.pageX-se.x,W=G.pageY-se.y,Se=Math.sqrt(Pe*Pe+W*W);P.set(0,Se),D.set(0,Math.pow(P.y/E.y,n.zoomSpeed)),oe(D.y),E.copy(P)}function Be(G){n.enableZoom&&tt(G),n.enablePan&&k(G)}function at(G){n.enableZoom&&tt(G),n.enableRotate&&Ie(G)}function Ce(G){var se,Pe;n.enabled!==!1&&(B.length===0&&((se=n.domElement)==null||se.ownerDocument.addEventListener("pointermove",O),(Pe=n.domElement)==null||Pe.ownerDocument.addEventListener("pointerup",I)),ht(G),G.pointerType==="touch"?Qe(G):Z(G))}function O(G){n.enabled!==!1&&(G.pointerType==="touch"?Ne(G):le(G))}function I(G){var se,Pe,W;Me(G),B.length===0&&((se=n.domElement)==null||se.releasePointerCapture(G.pointerId),(Pe=n.domElement)==null||Pe.ownerDocument.removeEventListener("pointermove",O),(W=n.domElement)==null||W.ownerDocument.removeEventListener("pointerup",I)),n.dispatchEvent(o),u=c.NONE}function Z(G){let se;switch(G.button){case 0:se=n.mouseButtons.LEFT;break;case 1:se=n.mouseButtons.MIDDLE;break;case 2:se=n.mouseButtons.RIGHT;break;default:se=-1}switch(se){case hi.DOLLY:if(n.enableZoom===!1)return;vt(G),u=c.DOLLY;break;case hi.ROTATE:if(G.ctrlKey||G.metaKey||G.shiftKey){if(n.enablePan===!1)return;he(G),u=c.PAN}else{if(n.enableRotate===!1)return;dt(G),u=c.ROTATE}break;case hi.PAN:if(G.ctrlKey||G.metaKey||G.shiftKey){if(n.enableRotate===!1)return;dt(G),u=c.ROTATE}else{if(n.enablePan===!1)return;he(G),u=c.PAN}break;default:u=c.NONE}u!==c.NONE&&n.dispatchEvent(s)}function le(G){if(n.enabled!==!1)switch(u){case c.ROTATE:if(n.enableRotate===!1)return;we(G);break;case c.DOLLY:if(n.enableZoom===!1)return;Ee(G);break;case c.PAN:if(n.enablePan===!1)return;rt(G);break}}function me(G){n.enabled===!1||n.enableZoom===!1||u!==c.NONE&&u!==c.ROTATE||(G.preventDefault(),n.dispatchEvent(s),He(G),n.dispatchEvent(o))}function de(G){n.enabled===!1||n.enablePan===!1||De(G)}function Qe(G){switch(Re(G),B.length){case 1:switch(n.touches.ONE){case Fi.ROTATE:if(n.enableRotate===!1)return;_t(),u=c.TOUCH_ROTATE;break;case Fi.PAN:if(n.enablePan===!1)return;Je(),u=c.TOUCH_PAN;break;default:u=c.NONE}break;case 2:switch(n.touches.TWO){case Fi.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;_e(),u=c.TOUCH_DOLLY_PAN;break;case Fi.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ye(),u=c.TOUCH_DOLLY_ROTATE;break;default:u=c.NONE}break;default:u=c.NONE}u!==c.NONE&&n.dispatchEvent(s)}function Ne(G){switch(Re(G),u){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;Ie(G),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;k(G),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Be(G),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;at(G),n.update();break;default:u=c.NONE}}function it(G){n.enabled!==!1&&G.preventDefault()}function ht(G){B.push(G)}function Me(G){delete L[G.pointerId];for(let se=0;se<B.length;se++)if(B[se].pointerId==G.pointerId){B.splice(se,1);return}}function Re(G){let se=L[G.pointerId];se===void 0&&(se=new ge,L[G.pointerId]=se),se.set(G.pageX,G.pageY)}function $e(G){const se=G.pointerId===B[0].pointerId?B[1]:B[0];return L[se.pointerId]}this.dollyIn=(G=H())=>{ce(G),n.update()},this.dollyOut=(G=H())=>{oe(G),n.update()},this.getScale=()=>m,this.setScale=G=>{te(G),n.update()},this.getZoomScale=()=>H(),t!==void 0&&this.connect(t),this.update()}}function Z_(r,e,t){const n=pi(m=>m.size),i=pi(m=>m.viewport),s=typeof r=="number"?r:n.width*i.dpr,o=n.height*i.dpr,c=(typeof r=="number"?t:r)||{},{samples:u=0,depth:h,...d}=c,f=ee.useMemo(()=>{const m=new ni(s,o,{minFilter:Xt,magFilter:Xt,type:Hi,...d});return h&&(m.depthTexture=new js(s,o,Un)),m.samples=u,m},[]);return ee.useLayoutEffect(()=>{f.setSize(s,o),u&&(f.samples=u)},[u,f,s,o]),ee.useEffect(()=>()=>f.dispose(),[]),f}const U3=r=>typeof r=="function",O3=ee.forwardRef(({envMap:r,resolution:e=256,frames:t=1/0,children:n,makeDefault:i,...s},o)=>{const c=pi(({set:_})=>_),u=pi(({camera:_})=>_),h=pi(({size:_})=>_),d=ee.useRef(null);ee.useImperativeHandle(o,()=>d.current,[]);const f=ee.useRef(null),m=Z_(e);ee.useLayoutEffect(()=>{s.manual||d.current.updateProjectionMatrix()},[h,s]),ee.useLayoutEffect(()=>{d.current.updateProjectionMatrix()}),ee.useLayoutEffect(()=>{if(i){const _=u;return c(()=>({camera:d.current})),()=>c(()=>({camera:_}))}},[d,i,c]);let g=0,x=null;const M=U3(n);return Qs(_=>{M&&(t===1/0||g<t)&&(f.current.visible=!1,_.gl.setRenderTarget(m),x=_.scene.background,r&&(_.scene.background=r),_.gl.render(_.scene,d.current),_.scene.background=x,_.gl.setRenderTarget(null),f.current.visible=!0,g++)}),ee.createElement(ee.Fragment,null,ee.createElement("orthographicCamera",sl({left:h.width/-2,right:h.width/2,top:h.height/2,bottom:h.height/-2,ref:d},s),!M&&n),ee.createElement("group",{ref:f},M&&n(m.texture)))}),F3=r=>typeof r=="function",B3=ee.forwardRef(({envMap:r,resolution:e=256,frames:t=1/0,makeDefault:n,children:i,...s},o)=>{const c=pi(({set:_})=>_),u=pi(({camera:_})=>_),h=pi(({size:_})=>_),d=ee.useRef(null);ee.useImperativeHandle(o,()=>d.current,[]);const f=ee.useRef(null),m=Z_(e);ee.useLayoutEffect(()=>{s.manual||(d.current.aspect=h.width/h.height)},[h,s]),ee.useLayoutEffect(()=>{d.current.updateProjectionMatrix()});let g=0,x=null;const M=F3(i);return Qs(_=>{M&&(t===1/0||g<t)&&(f.current.visible=!1,_.gl.setRenderTarget(m),x=_.scene.background,r&&(_.scene.background=r),_.gl.render(_.scene,d.current),_.scene.background=x,_.gl.setRenderTarget(null),f.current.visible=!0,g++)}),ee.useLayoutEffect(()=>{if(n){const _=u;return c(()=>({camera:d.current})),()=>c(()=>({camera:_}))}},[d,n,c]),ee.createElement(ee.Fragment,null,ee.createElement("perspectiveCamera",sl({ref:d},s),!M&&i),ee.createElement("group",{ref:f},M&&i(m.texture)))}),bv=new Bi(new F(0,1,0),0),vp=new F;function k3({obj:r}){const{state:e,dispatch:t,orbitControlsRef:n,pointerHitRef:i}=nd(),s=ee.useRef(null),[o,c]=ee.useState(!1),u=ee.useRef(null),h=ee.useRef(!1),d=ee.useMemo(()=>Ai.find(j=>j.id===r.catalogId),[r.catalogId]),f=e.selectedIds.includes(r.instanceId),m=e.cameraMode==="2d",g=r.colorOverride||d?.color||"#cccccc",x=ee.useCallback(j=>
4096e.snapToGrid?Math.round(j/e.gridSize)*e.gridSize:j,[e.snapToGrid,e.gridSize]),M=ee.useCallback(j=>{if(e.toolMode!=="select"||r.locked)return;j.stopPropagation(),i&&(i.current=!0),n?.current&&(n.current.enabled=!1);const X=j.nativeEvent?.shiftKey||!1;t({type:"SELECT_OBJECT",id:r.instanceId,additive:X});const q=j.ray,Y=new F;q.intersectPlane(bv,Y),u.current={objStart:[r.position[0],r.position[1],r.position[2]],mouseStart:Y.clone()},h.current=!0,t({type:"SET_DRAGGING",dragging:!0});const J=j.nativeEvent?.target;J?.setPointerCapture&&j.nativeEvent?.pointerId!=null&&J.setPointerCapture(j.nativeEvent.pointerId)},[e.toolMode,r.locked,r.instanceId,r.position,t,n,i]),_=ee.useCallback(j=>{if(!h.current||!u.current)return;j.stopPropagation(),j.ray.intersectPlane(bv,vp);const q=vp.x-u.current.mouseStart.x,Y=vp.z-u.current.mouseStart.z;t({type:"UPDATE_OBJECT",instanceId:r.instanceId,updates:{position:[x(u.current.objStart[0]+q),r.position[1],x(u.current.objStart[2]+Y)]}})},[r.instanceId,r.position,x,t]),v=ee.useCallback(j=>{if(!h.current)return;j.stopPropagation(),h.current=!1,u.current=null,t({type:"SET_DRAGGING",dragging:!1}),n?.current&&(n.current.enabled=!0);const X=j.nativeEvent?.target;X?.releasePointerCapture&&j.nativeEvent?.pointerId!=null&&X.releasePointerCapture(j.nativeEvent.pointerId)},[t,n]),S=ee.useCallback(j=>{j.stopPropagation()},[]);if(!d)return null;const b=d.width*r.scale,E=d.height*r.scale,P=d.depth*r.scale;if(m){const j=d.shape==="cylinder"||d.shape==="circle-table",X=.15;return T.jsxs("group",{ref:s,position:[r.position[0],X/2+.02,r.position[2]],rotation:[0,r.rotation,0],onClick:S,onPointerDown:M,onPointerMove:_,onPointerUp:v,onPointerOver:q=>{q.stopPropagation(),c(!0)},onPointerOut:()=>c(!1),children:[T.jsxs("mesh",{children:[j?T.jsx("cylinderGeometry",{args:[b/2,b/2,X,32]}):T.jsx("boxGeometry",{args:[b,X,P]}),T.jsx("meshStandardMaterial",{color:f?"#6ea8fe":o?"#88bbff":g,roughness:.3,metalness:0,emissive:f?"#3b82f6":"#000000",emissiveIntensity:f?.2:0})]}),f&&T.jsxs("mesh",{position:[0,.02,0],children:[j?T.jsx("cylinderGeometry",{args:[b/2+.12,b/2+.12,X+.04,32]}):T.jsx("boxGeometry",{args:[b+.2,X+.04,P+.2]}),T.jsx("meshBasicMaterial",{color:"#3b82f6",wireframe:!0})]}),e.showLabels&&T.jsx(ks,{position:[0,.5,0],center:!0,style:{pointerEvents:"none",userSelect:"none"},zIndexRange:[0,0],children:T.jsx("div",{style:{background:f?"#3b82f6":"rgba(30,30,30,0.85)",color:"#fff",padding:"1px 5px",borderRadius:"3px",fontSize:"9px",whiteSpace:"nowrap",fontFamily:"system-ui, -apple-system, sans-serif",fontWeight:f?600:400,letterSpacing:"0.01em"},children:r.label||d.name})})]})}const A={color:g,emissive:f?"#4488ff":o?"#336699":"#000000",emissiveIntensity:f?.25:o?.12:0,roughness:.55,metalness:.15},B={color:"#555555",roughness:.4,metalness:.35},L=.15,V=.08,H=E-L;return T.jsxs("group",{ref:s,position:[r.position[0],0,r.position[2]],rotation:[0,r.rotation,0],onClick:S,onPointerDown:M,onPointerMove:_,onPointerUp:v,onPointerOver:j=>{j.stopPropagation(),c(!0)},onPointerOut:()=>c(!1),children:[(d.shape==="cylinder"||d.shape==="circle-table")&&(d.category==="tables"?T.jsxs("group",{children:[T.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,E-L/2,0],children:[T.jsx("cylinderGeometry",{args:[b/2,b/2,L,36]}),T.jsx("meshStandardMaterial",{...A})]}),T.jsxs("mesh",{position:[0,E-L-.06,0],children:[T.jsx("cylinderGeometry",{args:[b/2-.15,b/2-.15,.12,36]}),T.jsx("meshStandardMaterial",{color:g,roughness:.6,metalness:.05})]}),b<=3?T.jsxs("group",{children:[T.jsxs("mesh",{castShadow:!0,position:[0,H/2,0],children:[T.jsx("cylinderGeometry",{args:[.15,.2,H,12]}),T.jsx("meshStandardMaterial",{...B})]}),T.jsxs("mesh",{receiveShadow:!0,position:[0,.04,0],children:[T.jsx("cylinderGeometry",{args:[b/3,b/3,.08,24]}),T.jsx("meshStandardMaterial",{...B})]})]}):[0,Math.PI/2,Math.PI,Math.PI*1.5].map((j,X)=>{const q=b/2-.4,Y=Math.cos(j)*q,J=Math.sin(j)*q;return T.jsxs("mesh",{castShadow:!0,position:[Y,H/2,J],children:[T.jsx("cylinderGeometry",{args:[V,V,H,8]}),T.jsx("meshStandardMaterial",{...B})]},X)})]}):T.jsx("group",{children:T.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,E/2,0],children:[T.jsx("cylinderGeometry",{args:[b/2,b/2*.9,E,24]}),T.jsx("meshStandardMaterial",{...A})]})})),d.shape==="chair"&&T.jsxs("group",{children:[[[b*.36,0,P*.36],[-b*.36,0,P*.36],[b*.36,0,-P*.36],[-b*.36,0,-P*.36]].map((j,X)=>{const q=E*.56,J=X>=2?E*.95:q;return T.jsxs("mesh",{castShadow:!0,position:[j[0],J/2,j[2]],children:[T.jsx("cylinderGeometry",{args:[.06,.06,J,8]}),T.jsx("meshStandardMaterial",{...B})]},X)}),T.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,E*.56,0],children:[T.jsx("boxGeometry",{args:[b*.85,.12,P*.85]}),T.jsx("meshStandardMaterial",{...A,roughness:.5})]}),T.jsxs("mesh",{castShadow:!0,position:[0,E*.56+.08,0],children:[T.jsx("boxGeometry",{args:[b*.78,.06,P*.78]}),T.jsx("meshStandardMaterial",{color:g,roughness:.8,metalness:0})]}),T.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,E*.78,-P*.38],children:[T.jsx("boxGeometry",{args:[b*.8,E*.4,.1]}),T.jsx("meshStandardMaterial",{...A,roughness:.5})]}),T.jsxs("mesh",{position:[0,E*.28,-P*.36],children:[T.jsx("boxGeometry",{args:[b*.6,.06,.06]}),T.jsx("meshStandardMaterial",{...B})]})]}),d.shape==="box"&&(d.category==="tables"?T.jsxs("group",{children:[T.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,E-L/2,0],children:[T.jsx("boxGeometry",{args:[b,L,P]}),T.jsx("meshStandardMaterial",{...A})]}),T.jsxs("mesh",{position:[0,E-L-.15,0],children:[T.jsx("boxGeometry",{args:[b-.3,.25,P-.3]}),T.jsx("meshStandardMaterial",{color:g,roughness:.65,metalness:.05,opacity:.9,transparent:!0})]}),[[b/2-.25,H/2,P/2-.25],[-b/2+.25,H/2,P/2-.25],[b/2-.25,H/2,-P/2+.25],[-b/2+.25,H/2,-P/2+.25]].map((j,X)=>T.jsxs("mesh",{castShadow:!0,position:j,children:[T.jsx("boxGeometry",{args:[.18,H,.18]}),T.jsx("meshStandardMaterial",{...B})]},X))]}):d.category==="staging"?T.jsxs("group",{children:[T.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,E-.1,0],children:[T.jsx("boxGeometry",{args:[b,.2,P]}),T.jsx("meshStandardMaterial",{...A})]}),T.jsxs("mesh",{position:[0,(E-.2)/2,0],children:[T.jsx("boxGeometry",{args:[b-.1,E-.2,P-.1]}),T.jsx("meshStandardMaterial",{color:"#1a1a1a",roughness:.9,metalness:0})]}),T.jsxs("mesh",{position:[0,.15,0],children:[T.jsx("boxGeometry",{args:[b*.8,.08,.08]}),T.jsx("meshStandardMaterial",{...B})]})]}):d.category==="av"?T.jsxs("group",{children:[T.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,E*.65,0],children:[T.jsx("boxGeometry",{args:[b,E*.55,P]}),T.jsx("meshStandardMaterial",{...A})]}),(d.id.includes("screen")||d.id.includes("tv"))&&T.jsxs("mesh",{position:[0,E*.65,P/2+.005],children:[T.jsx("planeGeometry",{args:[b*.9,E*.48]}),T.jsx("meshStandardMaterial",{color:"#fafafa",roughness:.3,metalness:0})]}),T.jsxs("mesh",{castShadow:!0,position:[0,E*.2,0],children:[T.jsx("cylinderGeometry",{args:[.12,.15,E*.4,8]}
4096),T.jsx("meshStandardMaterial",{...B})]}),T.jsxs("mesh",{receiveShadow:!0,position:[0,.04,0],children:[T.jsx("boxGeometry",{args:[b*.5,.08,P*.7]}),T.jsx("meshStandardMaterial",{...B})]})]}):d.category==="fb"?T.jsxs("group",{children:[T.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,E-.08,0],children:[T.jsx("boxGeometry",{args:[b,.16,P]}),T.jsx("meshStandardMaterial",{...A})]}),T.jsxs("mesh",{castShadow:!0,position:[0,(E-.16)/2,0],children:[T.jsx("boxGeometry",{args:[b-.05,E-.16,P-.05]}),T.jsx("meshStandardMaterial",{color:g,roughness:.7,metalness:.05})]}),T.jsxs("mesh",{position:[0,E*.45,P/2+.01],children:[T.jsx("planeGeometry",{args:[b*.9,E*.6]}),T.jsx("meshStandardMaterial",{color:g,roughness:.5,metalness:.1})]})]}):d.category==="tents"?T.jsxs("group",{children:[T.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,E*.75,0],children:[T.jsx("boxGeometry",{args:[b,E*.05,P]}),T.jsx("meshStandardMaterial",{color:"#f0f0f0",roughness:.6,metalness:0,side:hn})]}),T.jsxs("mesh",{position:[b/2,E*.375,0],children:[T.jsx("planeGeometry",{args:[P,E*.75]}),T.jsx("meshStandardMaterial",{color:"#ffffff",roughness:.5,transparent:!0,opacity:.3,side:hn})]}),T.jsxs("mesh",{position:[-b/2,E*.375,0],rotation:[0,Math.PI,0],children:[T.jsx("planeGeometry",{args:[P,E*.75]}),T.jsx("meshStandardMaterial",{color:"#ffffff",roughness:.5,transparent:!0,opacity:.3,side:hn})]}),[[b/2-.2,E*.375,P/2-.2],[-b/2+.2,E*.375,P/2-.2],[b/2-.2,E*.375,-P/2+.2],[-b/2+.2,E*.375,-P/2+.2]].map((j,X)=>T.jsxs("mesh",{castShadow:!0,position:j,children:[T.jsx("cylinderGeometry",{args:[.1,.1,E*.75,8]}),T.jsx("meshStandardMaterial",{...B})]},X))]}):d.category==="architectural"?T.jsxs("group",{children:[T.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,E/2,0],children:[T.jsx("boxGeometry",{args:[b,E,P]}),T.jsx("meshStandardMaterial",{...A})]}),d.id.includes("door")&&T.jsxs("mesh",{position:[0,E*.35,P/2+.01],children:[T.jsx("planeGeometry",{args:[b*.7,E*.8]}),T.jsx("meshStandardMaterial",{color:"#3a2510",roughness:.7,metalness:.1})]}),d.id.includes("window")&&T.jsxs("mesh",{position:[0,E/2,P/2+.01],children:[T.jsx("planeGeometry",{args:[b*.85,E*.85]}),T.jsx("meshStandardMaterial",{color:"#a4d4f0",roughness:.1,metalness:.3,transparent:!0,opacity:.5})]})]}):d.category==="decor"?T.jsx("group",{children:T.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,E/2,0],children:[T.jsx("boxGeometry",{args:[b,E,P]}),T.jsx("meshStandardMaterial",{...A,transparent:!0,opacity:.85})]})}):T.jsx("group",{children:T.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,E/2,0],children:[T.jsx("boxGeometry",{args:[b,E,P]}),T.jsx("meshStandardMaterial",{...A})]})})),d.shape==="custom"&&T.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,E/2,0],children:[T.jsx("boxGeometry",{args:[b,E,P]}),T.jsx("meshStandardMaterial",{...A})]}),d.category==="tables"&&r.linenColor&&(d.shape==="cylinder"||d.shape==="circle-table"?T.jsxs("group",{children:[T.jsxs("mesh",{position:[0,E+.01,0],children:[T.jsx("cylinderGeometry",{args:[b/2+.3,b/2+.3,.02,36]}),T.jsx("meshStandardMaterial",{color:r.linenColor,roughness:.85,metalness:0})]}),T.jsxs("mesh",{position:[0,E-.5,0],children:[T.jsx("cylinderGeometry",{args:[b/2+.32,b/2+.28,1,36,1,!0]}),T.jsx("meshStandardMaterial",{color:r.linenColor,roughness:.85,metalness:0,side:hn})]})]}):T.jsxs("group",{children:[T.jsxs("mesh",{position:[0,E+.01,0],children:[T.jsx("boxGeometry",{args:[b+.5,.02,P+.5]}),T.jsx("meshStandardMaterial",{color:r.linenColor,roughness:.85,metalness:0})]}),T.jsxs("mesh",{position:[0,E-.4,P/2+.26],children:[T.jsx("planeGeometry",{args:[b+.5,.8]}),T.jsx("meshStandardMaterial",{color:r.linenColor,roughness:.85,metalness:0,side:hn})]}),T.jsxs("mesh",{position:[0,E-.4,-P/2-.26],children:[T.jsx("planeGeometry",{args:[b+.5,.8]}),T.jsx("meshStandardMaterial",{color:r.linenColor,roughness:.85,metalness:0,side:hn})]})]})),d.category==="tables"&&r.showPlaceSettings&&T.jsx(z3,{w:b,d:P,h:E,seatCount:r.seatCount??d.defaultSeats??0,isRound:d.shape==="cylinder"||d.shape==="circle-table",linenColor:r.linenColor}),f&&T.jsxs("mesh",{position:[0,E/2,0],children:[d.shape==="cylinder"||d.shape==="circle-table"?T.jsx("cylinderGeometry",{args:[b/2+.08,b/2+.08,E+.08,32]}):T.jsx("boxGeometry",{args:[b+.15,E+.15,P+.15]}),T.jsx("meshBasicMaterial",{color:"#4488ff",wireframe:!0,transparent:!0,opacity:.4})]}),r.locked&&T.jsx(ks,{position:[0,E+.5,0],center:!0,style:{pointerEvents:"none"},children:T.jsx("div",{style:{fontSize:"14px",opacity:.7},children:"🔒"})}),e.showLabels&&T.jsx(ks,{position:[0,E+.3,0],center:!0,style:{pointerEvents:"none",userSelect:"none"},zIndexRange:[0,0],children:T.jsx("div",{style:{background:f?"#3b82f6":"rgba(30,30,30,0.85)",color:"#fff",padding:"1px 5px",borderRadius:"3px",fontSize:"9px",whiteSpace:"nowrap",fontFamily:"system-ui, -apple-system, sans-serif",fontWeight:f?600:400},children:r.label||d.name})})]})}function z3({w:r,d:e,h:t,seatCount:n,isRound:i,linenColor:s}){const o=ee.useMemo(()=>{const f=[];if(n<=0)return f;if(i){const m=r/2-.6;for(let g=0;g<n;g++){const x=g/n*Math.PI*2,M=Math.cos(x)*m,_=Math.sin(x)*m;f.push({px:M,pz:_,angle:x+Math.PI})}}else{const x=r-1.2,M=e-.6*2,_=Math.max(1,Math.floor(n*(r/(r+e))/2)),v=Math.max(0,Math.floor((n-_*2)/2));let S=0;for(let b=0;b<_&&S<n;b++){const E=(b+.5)/_;f.push({px:-x/2+E*x,pz:e/2-.6,angle:Math.PI}),S++}for(let b=0;b<_&&S<n;b++){const E=(b+.5)/_;f.push({px:-x/2+E*x,pz:-(e/2-.6),angle:0}),S++}for(let b=0;b<v&&S<n;b++){const E=(b+.5)/Math.max(v,1);f.push({px:r/2-.6,pz:-M/2+E*M,angle:-Math.PI/2}),S++}for(let b=0;b<v&&S<n;b++){const E=(b+.5)/Math.max(v,1);f.push({px:-(r/2-.6),pz:-M/2+E*M,angle:Math.PI/2}),S++}}return f},[r,e,n,i]),c="#f5f5f0",u="#c0c0c0",h="#d4e8f7",d=s||"#ffffff";return T.jsx("group",{position:[0,t+.02,0],children:o.map((f,m)=>T.jsxs("group",{position:[f.px,0,f.pz],rotation:[0,f.angle,0],children:[T.jsxs("mesh",{position:[0,.01,0],rotation:[-Math.PI/2,0,0],children:[T.jsx("circleGeometry",{args:[.45,24]}),T.jsx("meshStandardMaterial",{color:c,roughness:.3,metalness:.05})]}),T.jsxs("mesh",{position:[0,.015,0],rotation:[-Math.PI/2,0,0],children:[T.jsx("ringGeometry",{args:[.38,.45,24]}),T.jsx("meshStandardMaterial",{color:"#e8e8e0",roughness:.2,metalness:.1})]}),T.jsxs("mesh",{position:[0,.03,.02],children:[T.jsx("boxGeometry",{args:[.3,.04,.4]}),T.jsx("meshStandardMaterial",{color:d,roughness:.8,metalness:0})]}),T.jsxs("mesh",{position:[-.55,.01,0],children:[T.jsx("boxGeometry",{args:[.04,.02,.55]}),T.jsx("meshStandardMaterial",{color:u,roughness:.15,metalness:.7})]}),[-.03,-.01,.01,.03].map((g,x)=>T.jsxs("mesh",{position:[-.55+g,.01,-.32],children:[T.jsx("boxGeometry",{args:[.012,.015,.1]}),T.jsx("meshStandardMaterial",{color:u,roughness:.15,metalness:.7})]},`ft${x}`)),T.jsxs("mesh",{position:[.55,.01,0],children:[T.jsx("boxGeometry",{args:[.04,.02,.55]}),T.jsx("meshStandardMaterial",{color:u,roughness:.15,metalness:.7})]}),T.jsxs("mesh",{position:[.65,.01,0],children:[T.jsx("boxGeometry",{args:[.035,.018,.5]}),T.jsx("meshStandardMaterial",{color:u,roughness:.15,metalness:.7})]}),T.jsxs("mesh",{position:[.65,.015,-.28],rotation:[-Math.PI/2,0,0],children:[T.jsx("circleGeometry",{args:[.04,12]}),T.jsx("meshStandardMaterial",{color:u,roughness:.15,metalness:.7})]}),T.jsxs("mesh",{position:[.3,.2,-.45],children:[T.jsx("cylinderGeometry",{args:[.12,.1,.35,12]}),T.jsx("meshStandardMaterial",{color:h,roughness:.05,metalness:.1,transparent:!0,opacity:.5})]}),T.jsxs("mesh",{position:[.3,.38,-.45],children:[T.jsx("cylinderGeometry",{args:[.13,.12,.02,12]}),T.jsx("meshStandardMaterial",{color:h,roughness:.05,metalness:.2,transparent:!0,opacity:.6})]}),T.jsxs("mesh",{position:[.55,.1,-.5],children:[T.jsx("cylinderGeometry",{args:[.04,.06,.08,8]}),T.jsx("meshStandardMaterial",{color:u,roughness:.1,metalness:.3,transparent:!0,opacity:.6})]}),T.jsxs("mesh",{position:[.55,.18,-.5],children:[T.jsx("cylinderGeometry",{args:[.015,.015,.12,6]}),T.jsx("meshStandardMaterial",{color:h,roughness:.05,metalness:.15,transparent:!0,opacity:.5})]}),T.jsxs("mesh",{position:[.55,.32,-.5],children:[T.jsx("cylinderGeometry",{args:[.02,.1,.2,12]}),T.jsx("meshStandardMaterial",{color:h,roughness:.05,metalness:.1,transparent:!0,opacity:.4})]}),T.jsxs("mesh",{position:[-.4,.01,-.45],rotation:[-Math.PI/2,0,0],children:[T.jsx("circleGeometry",{args:[.22,16]}),T.jsx("meshStandardMaterial",{color:c,roughness:.3,metalness:.05})]})]},m))})}const Vm=new Bi(new F(0,1,0),0);function V3(){const{state:r,dispatch:e,orbitControlsRef:t}=nd(),{room:n,objects:i}=r.layout,s=ee.useRef(null),o=ee.useRef(null),c=t??{current:null},{gl:u,set:h,size:d,invalidate:f}=pi(),m=n.width/2,g=n.depth/2,x=ee.useMemo(()=>new Zt,[]);ee.useEffect(()=>{const v=new N3(x,u.domElement);return v.enableDamping=!0,v.dampingFactor=.1,v.minDistance=5,v.maxDistance=500,
4096c.current=v,v.addEventListener("change",()=>f()),()=>{v.dispose(),c.current=null}},[u,f,x]),ee.useEffect(()=>{const v=c.current;if(v){if(r.cameraMode==="2d"&&o.current){const S=o.current,b=Math.max(n.width,n.depth);S.position.set(0,b*1.5,.001),S.up.set(0,0,-1),S.lookAt(0,0,0),S.zoom=Math.min(d.width,d.height)/b*.65,S.updateProjectionMatrix(),v.object=S,v.target.set(0,0,0),v.enableRotate=!1,v.maxPolarAngle=.01,v.minPolarAngle=0,v.mouseButtons={LEFT:hi.PAN,MIDDLE:hi.DOLLY,RIGHT:hi.PAN},v.touches={ONE:Fi.PAN,TWO:Fi.DOLLY_PAN},v.update(),h({camera:S})}else if(r.cameraMode==="3d"&&s.current){const S=s.current;S.position.set(n.width*.6,n.width*.5,n.depth*.8),S.up.set(0,1,0),S.lookAt(0,0,0),S.updateProjectionMatrix(),v.object=S,v.target.set(0,0,0),v.enableRotate=!0,v.maxPolarAngle=Math.PI/2-.05,v.minPolarAngle=.1,v.mouseButtons={LEFT:hi.ROTATE,MIDDLE:hi.DOLLY,RIGHT:hi.PAN},v.touches={ONE:Fi.ROTATE,TWO:Fi.DOLLY_PAN},v.update(),h({camera:S})}}},[r.cameraMode,n.width,n.depth,h,d]),Qs(()=>{const v=c.current;v&&v.enabled&&v.update()}),ee.useEffect(()=>{c.current&&(c.current.enabled=!r.isDragging)},[r.isDragging]);const M=ee.useCallback(v=>r.snapToGrid?Math.round(v/r.gridSize)*r.gridSize:v,[r.snapToGrid,r.gridSize]),_=ee.useCallback(v=>{if(v.stopPropagation(),r.placingItem){const S=v.point,b=r.placingItem,E=b.category==="tables"&&b.defaultSeats,P={instanceId:Yo(),catalogId:b.id,position:[M(S.x),0,M(S.z)],rotation:0,scale:1,locked:!1};e(E?{type:"ADD_TABLE_WITH_CHAIRS",table:{...P,seatCount:b.defaultSeats,chairType:"banquet-chair"},chairCatalogId:"banquet-chair",seatCount:b.defaultSeats||0}:{type:"ADD_OBJECT",object:P})}else e({type:"DESELECT_ALL"})},[r.placingItem,M,e]);return T.jsxs(T.Fragment,{children:[T.jsx(B3,{ref:s,fov:50,position:[n.width*.6,n.width*.5,n.depth*.8],near:.1,far:1e3}),T.jsx(O3,{ref:o,makeDefault:!0,position:[0,200,.001],near:.1,far:1e3,zoom:12}),T.jsx("ambientLight",{intensity:.7}),T.jsx("directionalLight",{position:[n.width*.5,n.ceilingHeight*2,n.depth*.3],intensity:.7,castShadow:!0,"shadow-mapSize-width":2048,"shadow-mapSize-height":2048,"shadow-camera-left":-m-10,"shadow-camera-right":m+10,"shadow-camera-top":g+10,"shadow-camera-bottom":-g-10}),T.jsx("directionalLight",{position:[-n.width*.3,n.ceilingHeight,-n.depth*.4],intensity:.25}),T.jsx("hemisphereLight",{args:["#f0f0ff","#e0d8c8",.35]}),r.cameraMode==="2d"&&r.toolMode==="draw-wall"?T.jsx(q3,{room:n,snap:M,gridSize:r.gridSize}):T.jsxs(T.Fragment,{children:[r.showGrid&&T.jsx(G3,{width:n.width,depth:n.depth,cellSize:r.gridSize,is2D:r.cameraMode==="2d",customWalls:n.customWalls},n.customWalls?JSON.stringify(n.customWalls):`rect-${n.width}-${n.depth}`),T.jsx(H3,{room:n,is2D:r.cameraMode==="2d",onClick:_}),T.jsx(W3,{room:n,is2D:r.cameraMode==="2d"}),r.showDimensions&&r.cameraMode==="2d"&&T.jsxs(T.Fragment,{children:[T.jsx(ks,{position:[0,.1,g+1.5],center:!0,style:{pointerEvents:"none"},zIndexRange:[0,0],children:T.jsxs("div",{style:{fontSize:"11px",color:"#666",fontFamily:"system-ui, sans-serif",fontWeight:500,background:"rgba(255,255,255,0.8)",padding:"1px 4px",borderRadius:"2px"},children:[n.width,"'"]})}),T.jsx(ks,{position:[m+1.5,.1,0],center:!0,style:{pointerEvents:"none"},zIndexRange:[0,0],children:T.jsxs("div",{style:{fontSize:"11px",color:"#666",fontFamily:"system-ui, sans-serif",fontWeight:500,background:"rgba(255,255,255,0.8)",padding:"1px 4px",borderRadius:"2px"},children:[n.depth,"'"]})})]}),r.cameraMode==="3d"&&T.jsx(j3,{room:n}),i.map(v=>T.jsx(k3,{obj:v},v.instanceId)),r.cameraMode==="2d"&&r.toolMode==="select"&&n.customWalls&&n.customWalls.length>=3&&T.jsx(Z3,{room:n,snap:M}),r.placingItem&&T.jsx(J3,{item:r.placingItem,snap:M,is2D:r.cameraMode==="2d"})]})]})}function wv(r,e,t,n,i){const s=i.length,o=[];for(let h=0;h<s;h++){const[d,f]=i[h],[m,g]=i[(h+1)%s],x=m-d,M=g-f,_=t-r,v=n-e,S=_*M-v*x;if(Math.abs(S)<1e-12)continue;const b=((d-r)*M-(f-e)*x)/S,E=((d-r)*v-(f-e)*_)/S;E>=-1e-9&&E<=1+1e-9&&b>=-1e-9&&b<=1+1e-9&&o.push(Math.max(0,Math.min(1,b)))}if(yp(r,e,i)&&o.push(0),yp(t,n,i)&&o.push(1),o.length<2)return[];o.sort((h,d)=>h-d);const c=[o[0]];for(let h=1;h<o.length;h++)o[h]-c[c.length-1]>1e-9&&c.push(o[h]);const u=[];for(let h=0;h<c.length-1;h++){const d=c[h],f=c[h+1],m=r+(t-r)*(d+f)/2,g=e+(n-e)*(d+f)/2;yp(m,g,i)&&u.push([r+(t-r)*d,e+(n-e)*d,r+(t-r)*f,e+(n-e)*f])}return u}function yp(r,e,t){let n=!1;const i=t.length;for(let s=0,o=i-1;s<i;o=s++){const[c,u]=t[s],[h,d]=t[o];u>e!=d>e&&r<(h-c)*(e-u)/(d-u)+c&&(n=!n)}return n}function G3({width:r,depth:e,cellSize:t,is2D:n,customWalls:i}){const s=ee.useRef(null),o=ee.useRef(null),c=i?JSON.stringify(i):"",{minorGeo:u,majorGeo:h}=ee.useMemo(()=>{const m=r/2,g=e/2,x=i&&i.length>=3?i:[[-m,-g],[m,-g],[m,g],[-m,g]],M=t*5,_=[],v=[];for(let E=-m;E<=m+.001;E+=t){const P=Math.round(E*1e3)/1e3,N=Math.abs(P%M)<.01||Math.abs(P%M-M)<.01?v:_,A=wv(P,-g,P,g,x);for(const[R,B,L,V]of A)N.push(R,0,B,L,0,V)}for(let E=-g;E<=g+.001;E+=t){const P=Math.round(E*1e3)/1e3,N=Math.abs(P%M)<.01||Math.abs(P%M-M)<.01?v:_,A=wv(-m,P,m,P,x);for(const[R,B,L,V]of A)N.push(R,0,B,L,0,V)}const S=new xt;S.setAttribute("position",new qe(_,3));const b=new xt;return b.setAttribute("position",new qe(v,3)),{minorGeo:S,majorGeo:b}},[r,e,t,c]);ee.useEffect(()=>()=>{u.dispose(),h.dispose()},[u,h]);
4096const d=n?"#d8d8d8":"#c0c0c0",f=n?"#b0b0b0":"#999999";return T.jsxs("group",{position:[0,.005,0],children:[T.jsx("lineSegments",{ref:s,geometry:u,children:T.jsx("lineBasicMaterial",{color:d,transparent:!0,opacity:n?.6:.4})}),T.jsx("lineSegments",{ref:o,geometry:h,children:T.jsx("lineBasicMaterial",{color:f,transparent:!0,opacity:n?.8:.55})})]})}function Gm(r){if(r.customWalls&&r.customWalls.length>=3)return r.customWalls;const e=r.width/2,t=r.depth/2;return[[-e,-t],[e,-t],[e,t],[-e,t]]}function H3({room:r,is2D:e,onClick:t}){const n=ee.useMemo(()=>{const i=Gm(r),s=new Ar;s.moveTo(i[0][0],-i[0][1]);for(let o=1;o<i.length;o++)s.lineTo(i[o][0],-i[o][1]);return s.closePath(),new ra(s)},[r.width,r.depth,r.customWalls]);return ee.useEffect(()=>()=>{n.dispose()},[n]),T.jsx("mesh",{geometry:n,rotation:[-Math.PI/2,0,0],position:[0,0,0],receiveShadow:!0,onClick:t,children:T.jsx("meshStandardMaterial",{color:e?"#f8f6f2":r.floorColor,roughness:.8,metalness:0,side:hn})})}function W3({room:r,is2D:e}){const t=ee.useMemo(()=>{const n=Gm(r),i=[];for(let o=0;o<n.length;o++){const c=n[o],u=n[(o+1)%n.length];i.push(c[0],0,c[1],u[0],0,u[1])}const s=new xt;return s.setAttribute("position",new qe(i,3)),s},[r.width,r.depth,r.customWalls]);return ee.useEffect(()=>()=>{t.dispose()},[t]),T.jsx("lineSegments",{position:[0,.03,0],geometry:t,children:T.jsx("lineBasicMaterial",{color:e?"#333333":"#666666",linewidth:2})})}function j3({room:r}){const e=ee.useMemo(()=>{const t=Gm(r),n=r.ceilingHeight,i=[];for(let s=0;s<t.length;s++){const o=t[s],c=t[(s+1)%t.length],u=c[0]-o[0],h=c[1]-o[1],d=Math.sqrt(u*u+h*h);if(d<.01)continue;const f=new Float32Array([o[0],0,o[1],c[0],0,c[1],c[0],n,c[1],o[0],n,o[1]]),m=[0,1,2,0,2,3],g=-h/d,x=u/d,M=new Float32Array([g,0,x,g,0,x,g,0,x,g,0,x]),_=new xt;_.setAttribute("position",new qe(f,3)),_.setAttribute("normal",new qe(M,3)),_.setIndex(m);const S=x>.3||g>.3?.15:1;i.push({geo:_,opacity:S})}return i},[r.width,r.depth,r.customWalls,r.ceilingHeight]);return ee.useEffect(()=>()=>{e.forEach(t=>t.geo.dispose())},[e]),T.jsx("group",{children:e.map((t,n)=>T.jsx("mesh",{geometry:t.geo,receiveShadow:t.opacity>.5,children:T.jsx("meshStandardMaterial",{color:r.wallColor,roughness:.9,side:hn,transparent:t.opacity<1,opacity:t.opacity})},n))})}const X3=2,_p=15;function Y3(r,e){const t=e[0]-r[0],n=e[1]-r[1],i=Math.abs(Math.atan2(n,t))*(180/Math.PI);return i<_p||i>180-_p?[e[0],r[1]]:Math.abs(i-90)<_p?[r[0],e[1]]:e}function q3({room:r,snap:e,gridSize:t}){const{dispatch:n}=nd(),{raycaster:i,camera:s,pointer:o}=pi(),[c,u]=ee.useState([]),[h,d]=ee.useState([0,0]),[f,m]=ee.useState(!1);ee.useEffect(()=>{const N=R=>{R.key==="Shift"&&m(!0)},A=R=>{R.key==="Shift"&&m(!1)};return window.addEventListener("keydown",N),window.addEventListener("keyup",A),()=>{window.removeEventListener("keydown",N),window.removeEventListener("keyup",A)}},[]),Qs(()=>{i.setFromCamera(o,s);const N=new F;i.ray.intersectPlane(Vm,N)&&d([e(N.x),e(N.z)])});const g=c.length>0&&!f?Y3(c[c.length-1],h):h,x=c.length>=3&&Math.hypot(g[0]-c[0][0],g[1]-c[0][1])<X3,M=ee.useCallback(N=>{if(N.length<3)return;let A=1/0,R=-1/0,B=1/0,L=-1/0;for(const[Y,J]of N)A=Math.min(A,Y),R=Math.max(R,Y),B=Math.min(B,J),L=Math.max(L,J);const V=Math.max(10,R-A),H=Math.max(10,L-B),j=(A+R)/2,X=(B+L)/2,q=N.map(([Y,J])=>[Y-j,J-X]);n({type:"UPDATE_ROOM",updates:{customWalls:q,width:V,depth:H}}),n({type:"SET_TOOL_MODE",mode:"select"})},[n]),_=ee.useCallback(N=>{if(N.stopPropagation(),x){M(c);return}u(A=>[...A,g])},[c,x,M,g]);ee.useEffect(()=>{const N=A=>{A.key==="Enter"&&c.length>=3?M(c):A.key==="Escape"?(u([]),n({type:"SET_TOOL_MODE",mode:"select"})):A.key==="Backspace"&&c.length>0&&(A.preventDefault(),u(R=>R.slice(0,-1)))};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[c,M,n]);const v=ee.useMemo(()=>{const N=[];for(let A=0;A<c.length-1;A++)N.push(c[A][0],.08,c[A][1]),N.push(c[A+1][0],.08,c[A+1][1]);return N},[c]),S=ee.useMemo(()=>{if(c.length===0)return[];const N=c[c.length-1],A=x?c[0]:g;return[N[0],.08,N[1],A[0],.08,A[1]]},[c,g,x]),b=ee.useMemo(()=>c.length<2||x?[]:[g[0],.08,g[1],c[0][0],.08,c[0][1]],[c,g,x]),E=ee.useMemo(()=>
4096{if(c.length<2)return null;const N=[...c,x?c[0]:g],A=new Ar;A.moveTo(N[0][0],-N[0][1]);for(let R=1;R<N.length;R++)A.lineTo(N[R][0],-N[R][1]);return A.closePath(),new ra(A)},[c,g,x]);ee.useEffect(()=>()=>{E?.dispose()},[E]);const P=ee.useMemo(()=>{const N=[],A=[...c];c.length>0&&A.push(x?c[0]:g);for(let R=0;R<A.length-1;R++){const[B,L]=A[R],[V,H]=A[R+1],j=Math.hypot(V-B,H-L);j<.5||N.push({pos:[(B+V)/2,(L+H)/2],len:j})}return N},[c,g,x]),D=ee.useMemo(()=>{const A=t,R=[];for(let L=-100;L<=100;L+=A)R.push(L,0,-100,L,0,100);for(let L=-100;L<=100;L+=A)R.push(-100,0,L,100,0,L);const B=new xt;return B.setAttribute("position",new qe(R,3)),B},[t]);return ee.useEffect(()=>()=>{D.dispose()},[D]),T.jsxs("group",{children:[T.jsx("lineSegments",{position:[0,.001,0],geometry:D,children:T.jsx("lineBasicMaterial",{color:"#e0e0e0",transparent:!0,opacity:.4})}),T.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,.01,0],onClick:_,children:[T.jsx("planeGeometry",{args:[500,500]}),T.jsx("meshBasicMaterial",{visible:!1})]}),E&&T.jsx("mesh",{geometry:E,rotation:[-Math.PI/2,0,0],position:[0,.02,0],children:T.jsx("meshBasicMaterial",{color:"#3b82f6",transparent:!0,opacity:.08,side:hn})}),v.length>0&&T.jsxs("lineSegments",{children:[T.jsx("bufferGeometry",{children:T.jsx("bufferAttribute",{attach:"attributes-position",count:v.length/3,array:new Float32Array(v),itemSize:3})}),T.jsx("lineBasicMaterial",{color:"#2563eb",linewidth:2})]}),S.length>0&&T.jsxs("lineSegments",{children:[T.jsx("bufferGeometry",{children:T.jsx("bufferAttribute",{attach:"attributes-position",count:S.length/3,array:new Float32Array(S),itemSize:3})}),T.jsx("lineBasicMaterial",{color:x?"#22c55e":"#2563eb",linewidth:1,transparent:!0,opacity:.7})]}),b.length>0&&T.jsxs("lineSegments",{children:[T.jsx("bufferGeometry",{children:T.jsx("bufferAttribute",{attach:"attributes-position",count:b.length/3,array:new Float32Array(b),itemSize:3})}),T.jsx("lineBasicMaterial",{color:"#93c5fd",linewidth:1,transparent:!0,opacity:.35})]}),c.map((N,A)=>T.jsxs("mesh",{position:[N[0],.09,N[1]],rotation:[-Math.PI/2,0,0],children:[T.jsx("circleGeometry",{args:[A===0?x?1.2:.55:.45,20]}),T.jsx("meshBasicMaterial",{color:A===0&&x?"#22c55e":"#2563eb",transparent:!0,opacity:A===0&&x?.6:.9})]},A)),T.jsxs("mesh",{position:[g[0],.09,g[1]],rotation:[-Math.PI/2,0,0],children:[T.jsx("ringGeometry",{args:[.3,.5,20]}),T.jsx("meshBasicMaterial",{color:x?"#22c55e":"#2563eb",transparent:!0,opacity:.7})]}),P.map((N,A)=>T.jsx(ks,{position:[N.pos[0],.1,N.pos[1]],center:!0,style:{pointerEvents:"none"},zIndexRange:[0,0],children:T.jsxs("div",{style:{fontSize:"10px",color:"#1d4ed8",fontFamily:"system-ui, sans-serif",fontWeight:600,background:"rgba(255,255,255,0.85)",padding:"1px 4px",borderRadius:"2px",whiteSpace:"nowrap"},children:[Math.round(N.len),"'"]})},A)),T.jsx(ks,{position:[g[0]+3,.1,g[1]-1.5],center:!0,style:{pointerEvents:"none"},zIndexRange:[0,0],children:T.jsx("div",{style:{fontSize:"11px",color:"#475569",fontFamily:"system-ui, sans-serif",fontWeight:500,background:"rgba(255,255,255,0.92)",padding:"3px 8px",borderRadius:"4px",whiteSpace:"nowrap",border:"1px solid #cbd5e1",boxShadow:"0 1px 3px rgba(0,0,0,0.08)"},children:c.length===0?"Click to place first corner":x?"✔ Click to close shape":`${c.length} pts · click to add · Shift = freeform · Enter = close`})})]})}function Z3({room:r,snap:e}){const{dispatch:t,orbitControlsRef:n}=nd(),i=r.customWalls,[s,o]=ee.useState(null),{raycaster:c,camera:u,pointer:h}=pi();return Qs(()=>{if(s===null)return;c.setFromCamera(h,u);const d=new F;if(c.ray.intersectPlane(Vm,d)){const f=e(d.x),m=e(d.z),g=i.map((x,M)=>M===s?[f,m]:[...x]);t({type:"UPDATE_ROOM",updates:{customWalls:g}})}}),ee.useEffect(()=>{if(s===null)return;const d=()=>{o(null),n?.current&&(n.current.enabled=!0)};return window.addEventListener("pointerup",d),()=>window.removeEventListener("pointerup",d)},[s,n]),T.jsx("group",{children:i.map((d,f)=>T.jsxs("mesh",{position:[d[0],.12,d[1]],rotation:[-Math.PI/2,0,0],onPointerDown:m=>{m.stopPropagation(),o(f),n?.current&&(n.current.enabled=!1)},children:[T.jsx("circleGeometry",{args:[.6,16]}),T.jsx("meshBasicMaterial",{color:s===f?"#f97316":"#3b82f6",transparent:!0,opacity:.7})]},f))})}function J3({item:r,snap:e,is2D:t}){const n=ee.useRef(null),{raycaster:i,camera:s,pointer:o}=pi();Qs(()=>
4096{if(!n.current)return;i.setFromCamera(o,s);const h=new F;if(i.ray.intersectPlane(Vm,h)){const d=t?.1:r.height/2;n.current.position.set(e(h.x),d,e(h.z))}});const c=r.shape==="cylinder"||r.shape==="circle-table",u=t?.15:r.height;return T.jsxs("mesh",{ref:n,children:[c?T.jsx("cylinderGeometry",{args:[r.width/2,r.width/2,u,32]}):T.jsx("boxGeometry",{args:[r.width,u,r.depth]}),T.jsx("meshStandardMaterial",{color:"#3b82f6",transparent:!0,opacity:.35,depthWrite:!1})]})}const K3={tables:Lv,chairs:EM,staging:wM,av:IM,fb:mM,tents:PM,decor:CM,architectural:pM,outdoor:LM},Q3=Ai.filter(r=>r.category==="chairs"&&r.shape==="chair");function gI(){const{t:r}=ZS(),{user:e}=JS(),{toast:t}=KS();QS([{label:"Hub",path:"/"},{label:"Room Designer",path:"/room-designer"}]);const[n,i]=ee.useReducer(h3,xv),s=ee.useRef(null),o=ee.useRef(!1),c=ee.useMemo(()=>({state:n,dispatch:i,orbitControlsRef:s,pointerHitRef:o}),[n]),[u,h]=ee.useState(!1),[d,f]=ee.useState(!1),[m,g]=ee.useState([]),[x,M]=ee.useState(!1),[_,v]=ee.useState(null),S=ee.useRef(null);ee.useEffect(()=>{const L=V=>{const H=V.target?.tagName;if(H==="INPUT"||H==="TEXTAREA"||H==="SELECT")return;const j=V.ctrlKey||V.metaKey;V.key==="Delete"||V.key==="Backspace"?(V.preventDefault(),i({type:"DELETE_SELECTED"})):j&&V.key==="z"&&!V.shiftKey?(V.preventDefault(),i({type:"UNDO"})):j&&(V.key==="y"||V.key==="z"&&V.shiftKey)?(V.preventDefault(),i({type:"REDO"})):j&&V.key==="d"?(V.preventDefault(),i({type:"DUPLICATE_SELECTED"})):j&&V.key==="s"?(V.preventDefault(),P()):V.key==="Escape"?(i({type:"SET_PLACING_ITEM",item:null}),i({type:"DESELECT_ALL"})):V.key==="g"?i({type:"TOGGLE_GRID"}):V.key==="r"&&n.selectedIds.length>0&&n.selectedIds.forEach(X=>{const q=n.layout.objects.find(Y=>Y.instanceId===X);q&&!q.locked&&i({type:"UPDATE_OBJECT",instanceId:X,updates:{rotation:q.rotation+Math.PI/4}})})};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[n.selectedIds,n.layout.objects]);const b=ee.useMemo(()=>n.selectedIds.length!==1?null:n.layout.objects.find(L=>L.instanceId===n.selectedIds[0])||null,[n.selectedIds,n.layout.objects]),E=ee.useMemo(()=>b&&Ai.find(L=>L.id===b.catalogId)||null,[b]),P=ee.useCallback(async()=>{if(!u){h(!0);try{if(n.layout.id)await f3(n.layout.id,n.layout);else{const L=await d3(n.layout);i({type:"SET_LAYOUT",layout:{...n.layout,id:L}})}i({type:"MARK_SAVED"}),t({title:"Layout saved",description:n.layout.name})}catch(L){t({title:"Save failed",description:L.message,variant:"destructive"})}finally{h(!1)}}},[n.layout,u,t]),D=ee.useCallback(async()=>{f(!0),M(!0);try{const L=await m3();g(L)}catch(L){t({title:"Failed to load layouts",description:L.message,variant:"destructive"})}finally{M(!1)}},[t]),N=ee.useCallback(async L=>{try{const V=await p3(L);i({type:"SET_LAYOUT",layout:V}),f(!1),t({title:"Layout loaded",description:V.name})}catch(V){t({title:"Failed to load",description:V.message,variant:"destructive"})}},[t]),A=ee.useCallback(async L=>{try{await g3(L),g(V=>V.filter(H=>H.id!==L)),t({title:"Layout deleted"})}catch(V){t({title:"Delete failed",description:V.message,variant:"destructive"})}},[t]),R=ee.useCallback(L=>{L.preventDefault(),L.dataTransfer.dropEffect="copy"},[]),B=ee.useCallback(L=>{L.preventDefault();const V=L.dataTransfer.getData("text/plain"),H=Ai.find(ce=>ce.id===V);if(!H||!S.current)return;const j=S.current.getBoundingClientRect(),X=(L.clientX-j.left)/j.width,q=(L.clientY-j.top)/j.height;n.layout.room.width/2,n.layout.room.depth/2;const Y=(X-.5)*n.layout.room.width*1.3,J=(q-.5)*n.layout.room.depth*1.3,te=n.snapToGri
4096d?ce=>Math.round(ce/n.gridSize)*n.gridSize:ce=>ce;if(H.category==="tables"&&H.defaultSeats){const ce={instanceId:Yo(),catalogId:H.id,position:[te(Y),0,te(J)],rotation:0,scale:1,locked:!1,seatCount:H.defaultSeats,chairType:"banquet-chair"};i({type:"ADD_TABLE_WITH_CHAIRS",table:ce,chairCatalogId:"banquet-chair",seatCount:H.defaultSeats||0})}else{const ce={instanceId:Yo(),catalogId:H.id,position:[te(Y),0,te(J)],rotation:0,scale:1,locked:!1};i({type:"ADD_OBJECT",object:ce})}v(null)},[n.layout.room,n.snapToGrid,n.gridSize]);return T.jsx(j_.Provider,{value:c,children:T.jsxs("div",{className:"flex flex-col h-[calc(100vh-4rem)] overflow-hidden bg-background",children:[T.jsxs("div",{className:"flex items-center gap-2 px-3 h-11 border-b shrink-0 bg-background/95 backdrop-blur",children:[T.jsx(Ti,{value:n.layout.name,onChange:L=>i({type:"SET_LAYOUT_NAME",name:L.target.value}),className:"w-44 h-7 text-xs font-medium border-transparent hover:border-input focus:border-input transition-colors"}),T.jsx("div",{className:"w-px h-5 bg-border"}),T.jsxs("div",{className:"flex rounded-lg border bg-muted/40 p-0.5 gap-0.5",children:[T.jsxs("button",{className:`flex items-center gap-1.5 px-3 h-7 rounded-md text-xs font-medium transition-all ${n.cameraMode==="2d"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"}`,onClick:()=>i({type:"SET_CAMERA_MODE",mode:"2d"}),children:[T.jsx($S,{className:"h-3.5 w-3.5"}),"Design"]}),T.jsxs("button",{className:`flex items-center gap-1.5 px-3 h-7 rounded-md text-xs font-medium transition-all ${n.cameraMode==="3d"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"}`,onClick:()=>i({type:"SET_CAMERA_MODE",mode:"3d"}),children:[T.jsx(eM,{className:"h-3.5 w-3.5"}),"3D Preview"]})]}),T.jsx("div",{className:"w-px h-5 bg-border"}),T.jsx(Rs,{icon:tM,tip:`Grid (${n.snapToGrid?"On":"Off"}
4096)`,active:n.snapToGrid,onClick:()=>i({type:"TOGGLE_SNAP"})}),T.jsx(Rs,{icon:SM,tip:"Labels",active:n.showLabels,onClick:()=>i({type:"TOGGLE_LABELS"})}),T.jsx("div",{className:"w-px h-5 bg-border"}),T.jsx(Rs,{icon:MM,tip:"Undo (Ctrl+Z)",disabled:n.undoStack.length===0,onClick:()=>i({type:"UNDO"})}),T.jsx(Rs,{icon:bM,tip:"Redo (Ctrl+Y)",disabled:n.redoStack.length===0,onClick:()=>i({type:"REDO"})}),T.jsx("div",{className:"w-px h-5 bg-border"}),T.jsx(Rs,{icon:Tv,tip:"Duplicate (Ctrl+D)",disabled:n.selectedIds.length===0,onClick:()=>i({type:"DUPLICATE_SELECTED"})}),T.jsx(Rs,{icon:Pv,tip:"Rotate 45° (R)",disabled:n.selectedIds.length===0,onClick:()=>{n.selectedIds.forEach(L=>{const V=n.layout.objects.find(H=>H.instanceId===L);V&&!V.locked&&i({type:"UPDATE_OBJECT",instanceId:L,updates:{rotation:V.rotation+Math.PI/4}})})}}),T.jsx(Rs,{icon:bp,tip:"Delete (Del)",disabled:n.selectedIds.length===0,onClick:()=>i({type:"DELETE_SELECTED"})}),T.jsx("div",{className:"flex-1"}),T.jsxs("span",{className:"text-[10px] text-muted-foreground mr-1",children:[n.layout.objects.length," ",n.layout.objects.length===1?"object":"objects",n.isDirty&&T.jsx("span",{className:"text-amber-500 ml-1.5",children:"· Unsaved"})]}),T.jsxs(Er,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1.5 px-2.5",onClick:D,children:[T.jsx(nM,{className:"h-3 w-3"}),"Open"]}),T.jsxs(Er,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1.5 px-2.5",onClick:()=>{i({type:"SET_LAYOUT",layout:{...xv.layout,name:"New Layout"}})},children:[T.jsx(AM,{className:"h-3 w-3"}),"New"]}),T.jsxs(Er,{size:"sm",variant:n.isDirty?"default":"outline",className:"h-7 text-xs gap-1.5 px-3",onClick:P,disabled:u,children:[u?T.jsx(mf,{className:"h-3 w-3 animate-spin"}):T.jsx(iM,{className:"h-3 w-3"}),"Save"]})]}),T.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[T.jsx(eI,{state:n,dispatch:i}),T.jsxs("div",{ref:S,className:"flex-1 relative",onDragOver:R,onDrop:B,children:[n.placingItem&&T.jsxs("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-10 flex items-center gap-2 bg-blue-600 text-white px-4 py-1.5 rounded-full shadow-lg text-xs font-medium",children:[T.jsx("div",{className:"w-2 h-2 rounded-full bg-white/60 animate-pulse"}),"Click to place: ",n.placingItem.name,T.jsx("button",{className:"ml-1 opacity-70 hover:opacity-100 text-[10px] underline",onClick:()=>i({type:"SET_PLACING_ITEM",item:null}),children:"Cancel"})]}),_&&T.jsxs("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-10 flex items-center gap-2 bg-green-600 text-white px-4 py-1.5 rounded-full shadow-lg text-xs font-medium",children:[T.jsx("div",{className:"w-2 h-2 rounded-full bg-white/60 animate-pulse"}),"Drop to place: ",_.name]}),T.jsx(ee.Suspense,{fallback:T.jsxs("div",{className:"flex items-center justify-center h-full bg-gray-50 dark:bg-gray-900",children:[T.jsx(mf,{className:"h-6 w-6 animate-spin text-muted-foreground"}),T.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading 3D engine..."})]}),children:T.jsx(l3,{shadows:!0,dpr:[1,2],gl:{antialias:!0,toneMapping:3},className:"bg-gray-50 dark:bg-gray-900",style:{cursor:n.placingItem?"crosshair":n.isDragging?"grabbing":"default"},onPointerMissed:()=>{if(o.current){o.current=!1;return}i({type:"DESELECT_ALL"}),i({type:"SET_PLACING_ITEM",item:null})},children:T.jsx(V3,{})})}),T.jsxs("div",{className:"absolute bottom-2 left-2 text-[10px] text-muted-foreground bg-background/70 backdrop-blur-sm px-2 py-0.5 rounded",children:[n.layout.room.name," · ",n.layout.room.width,"' × ",n.layout.room.depth,"'",n.cameraMode==="2d"&&" · Scroll to zoom · Right-drag to pan · Drag items from catalog"]})]}),T.jsx(tI,{state:n,dispatch:i,selectedObject:b,catalogItem:E})]}),T.jsx(rM,{open:d,onOpenChange:f,children:T.jsxs(sM,{className:"max-w-md",children:[T.jsx(oM,{children:T.jsx(aM,{children:"Open Layout"})}),x?T.jsxs("div",{className:"flex items-center justify-center py-8",children:[T.jsx(mf,{className:"h-5 w-5 animate-spin text-muted-foreground"}),T.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading..."})]}):m.length===0?T.jsx("div",{className:"text-center py-8 text-sm text-muted-foreground",children:"No saved layouts yet. Create one and click Save."}):T.jsx("div",{className:"space-y-1 max-h-80 overflow-y-auto",children:m.map(L=>T.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md hover:bg-muted/50 group",children:[T.jsxs("div",{className:"flex-1 min-w-0 cursor-pointer",onClick:()=>N(L.id),children:[T.jsx("div",{className:"text-sm font-medium truncate",children:L.name}),T.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[L.roomName," · ",L.objectCount," objects · ",new Date(L.updatedAt).toLocaleDateString()]})]}),T.jsx(Er,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 opacity-0 group-hover:opacity-100",onClick:()=>A(L.id),children:T.jsx(bp,{className:"h-3 w-3 text-destructive"})})]},L.id))})]})})]})})}function Rs({icon:r,tip:e,active:t,disabled:n,onClick:i}){return T.jsxs(lM,{children:[T.jsx(cM,{asChild:!0,children:T.jsx("button",{className:`inline-flex items-center justify-center h-7 w-7 rounded-md transition-colors
4097            ${t?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"}
4098            ${n?"opacity-30 pointer-events-none":""}`,onClick:i,disabled:n,children:T.jsx(r,{className:"h-3.5 w-3.5"})})}),T.jsx(uM,{side:"bottom",className:"text-[10px]",children:e})]})}function $3({item:r,active:e}){const t=e?"#3b82f6":r.color,n=e?"#2563eb":"#888",i=1,s=22;if(r.shape==="cylinder"||r.shape==="circle-table")return T.jsxs("svg",{width:s,height:s,viewBox:"0 0 22 22",className:"shrink-0",children:[T.jsx("ellipse",{cx:"11",cy:"11",rx:"9",ry:"9",fill:t,stroke:n,strokeWidth:i}),T.jsx("line",{x1:"11",y1:"4",x2:"11",y2:"18",stroke:n,strokeWidth:.5,opacity:.4}),T.jsx("line",{x1:"4",y1:"11",x2:"18",y2:"11",stroke:n,strokeWidth:.5,opacity:.4})]});if(r.shape==="chair")return T.jsxs("svg",{width:s,height:s,viewBox:"0 0 22 22",className:"shrink-0",children:[T.jsx("rect",{x:"4",y:"10",width:"14",height:"4",rx:"1",fill:t,stroke:n,strokeWidth:i}),T.jsx("rect",{x:"4",y:"3",width:"14",height:"7",rx:"2",fill:t,stroke:n,strokeWidth:i,opacity:.8}),T.jsx("line",{x1:"6",y1:"14",x2:"6",y2:"20",stroke:n,strokeWidth:1.2}),T.jsx("line",{x1:"16",y1:"14",x2:"16",y2:"20",stroke:n,strokeWidth:1.2})]});if(r.category==="staging")return T.jsxs("svg",{width:s,height:s,viewBox:"0 0 22 22",className:"shrink-0",children:[T.jsx("rect",{x:"2",y:"6",width:"18",height:"8",rx:"1",fill:t,stroke:n,strokeWidth:i}),T.jsx("line",{x1:"2",y1:"10",x2:"20",y2:"10",stroke:n,strokeWidth:.5,opacity:.35}),T.jsx("rect",{x:"4",y:"14",width:"2",height:"5",rx:"0.5",fill:n,opacity:.5}),T.jsx("rect",{x:"16",y:"14",width:"2",height:"5",rx:"0.5",fill:n,opacity:.5})]});if(r.category==="av")return T.jsxs("svg",{width:s,height:s,viewBox:"0 0 22 22",className:"shrink-0",children:[T.jsx("rect",{x:"3",y:"3",width:"16",height:"12",rx:"1.5",fill:t,stroke:n,strokeWidth:i}),T.jsx("rect",{x:"5",y:"5",width:"12",height:"8",rx:"0.5",fill:"white",opacity:.15}),T.jsx("rect",{x:"9",y:"15",width:"4",height:"3",rx:"0.5",fill:n,opacity:.5}
4098),T.jsx("rect",{x:"7",y:"18",width:"8",height:"1.5",rx:"0.5",fill:n,opacity:.4})]});if(r.category==="fb")return T.jsxs("svg",{width:s,height:s,viewBox:"0 0 22 22",className:"shrink-0",children:[T.jsx("rect",{x:"2",y:"9",width:"18",height:"6",rx:"1",fill:t,stroke:n,strokeWidth:i}),T.jsx("circle",{cx:"7",cy:"7",r:"2",fill:n,opacity:.3}),T.jsx("circle",{cx:"15",cy:"7",r:"2",fill:n,opacity:.3}),T.jsx("circle",{cx:"11",cy:"6",r:"2.5",fill:n,opacity:.25}),T.jsx("line",{x1:"5",y1:"15",x2:"5",y2:"20",stroke:n,strokeWidth:1}),T.jsx("line",{x1:"17",y1:"15",x2:"17",y2:"20",stroke:n,strokeWidth:1})]});if(r.category==="decor")return r.id.includes("flower")||r.id.includes("planter")?T.jsxs("svg",{width:s,height:s,viewBox:"0 0 22 22",className:"shrink-0",children:[T.jsx("path",{d:"M7 14 L15 14 L14 20 L8 20 Z",fill:n,opacity:.4}),T.jsx("line",{x1:"11",y1:"14",x2:"11",y2:"5",stroke:"#228B22",strokeWidth:1}),T.jsx("circle",{cx:"11",cy:"4",r:"2.5",fill:t,stroke:n,strokeWidth:.5}),T.jsx("line",{x1:"8",y1:"14",x2:"6",y2:"7",stroke:"#228B22",strokeWidth:.8}),T.jsx("circle",{cx:"6",cy:"6",r:"1.8",fill:t,stroke:n,strokeWidth:.5,opacity:.8}),T.jsx("line",{x1:"14",y1:"14",x2:"16",y2:"8",stroke:"#228B22",strokeWidth:.8}),T.jsx("circle",{cx:"16",cy:"7",r:"1.8",fill:t,stroke:n,strokeWidth:.5,opacity:.8})]}):T.jsxs("svg",{width:s,height:s,viewBox:"0 0 22 22",className:"shrink-0",children:[T.jsx("rect",{x:"3",y:"2",width:"16",height:"18",rx:"2",fill:t,stroke:n,strokeWidth:i,opacity:.8}),T.jsx("line",{x1:"7",y1:"2",x2:"7",y2:"20",stroke:n,strokeWidth:.4,opacity:.3}),T.jsx("line",{x1:"11",y1:"2",x2:"11",y2:"20",stroke:n,strokeWidth:.4,opacity:.3}),T.jsx("line",{x1:"15",y1:"2",x2:"15",y2:"20",stroke:n,strokeWidth:.4,opacity:.3})]});if(r.category==="architectural")return r.id.includes("door")?T.jsxs("svg",{width:s,height:s,viewBox:"0 0 22 22",className:"shrink-0",children:[T.jsx("rect",{x:"4",y:"2",width:"14",height:"18",rx:"1",fill:t,stroke:n,strokeWidth:i}),T.jsx("rect",{x:"6",y:"4",width:"10",height:"14",rx:"0.5",fill:"white",opacity:.15}),T.jsx("circle",{cx:"14",cy:"12",r:"1",fill:n,opacity:.6})]}):r.id.includes("window")?T.jsxs("svg",{width:s,height:s,viewBox:"0 0 22 22",className:"shrink-0",children:[T.jsx("rect",{x:"3",y:"4",width:"16",height:"14",rx:"1",fill:t,stroke:n,strokeWidth:i}),T.jsx("line",{x1:"11",y1:"4",x2:"11",y2:"18",stroke:n,strokeWidth:.8}),T.jsx("line",{x1:"3",y1:"11",x2:"19",y2:"11",stroke:n,strokeWidth:.8})]}):r.id.includes("stairs")?T.jsxs("svg",{width:s,height:s,viewBox:"0 0 22 22",className:"shrink-0",children:[T.jsx("rect",{x:"2",y:"16",width:"18",height:"3",fill:t,stroke:n,strokeWidth:i}),T.jsx("rect",{x:"5",y:"12",width:"15",height:"3",fill:t,stroke:n,strokeWidth:i}),T.jsx("rect",{x:"8",y:"8",width:"12",height:"3",fill:t,stroke:n,strokeWidth:i}),T.jsx("rect",{x:"11",y:"4",width:"9",height:"3",fill:t,stroke:n,strokeWidth:i})]}):T.jsxs("svg",{width:s,height:s,viewBox:"0 0 22 22",className:"shrink-0",children:[T.jsx("rect",{x:"3",y:"4",width:"16",height:"14",rx:"1",fill:t,stroke:n,strokeWidth:i}),T.jsx("line",{x1:"3",y1:"8",x2:"19",y2:"8",stroke:n,strokeWidth:.4,opacity:.3}),T.jsx("line",{x1:"3",y1:"12",x2:"19",y2:"12",stroke:n,strokeWidth:.4,opacity:.3}),T.jsx("line",{x1:"3",y1:"16",x2:"19",y2:"16",stroke:n,strokeWidth:.4,opacity:.3})]});if(r.category==="tents")return T.jsxs("svg",{width:s,height:s,viewBox:"0 0 22 22",className:"shrink-0",children:[T.jsx("path",{d:"M2 18 L11 4 L20 18 Z",fill:t,stroke:n,strokeWidth:i}),T.jsx("line",{x1:"11",y1:"4",x2:"11",y2:"18",stroke:n,strokeWidth:.5,opacity:.3}),T.jsx("line",{x1:"1",y1:"18",x2:"21",y2:"18",stroke:n,strokeWidth:.8})]});const o=r.width/Math.max(r.depth,.1),c=Math.min(16,Math.max(8,10*Math.min(o,2))),u=Math.min(16,Math.max(6,10/Math.max(o,.5)));return T.jsx("svg",{width:s,height:s,viewBox:"0 0 22 22",className:"shrink-0",children:T.jsx("rect",{x:(22-c)/2,y:(22-u)/2,width:c,height:u,rx:"1",fill:t,stroke:n,strokeWidth:i})})}function eI({state:r,dispatch:e}){const[t,n]=ee.useState(""),[i,s]=ee.useState(new Set(["tables","chairs"])),o=h=>s(d=>{const f=new Set(d);return f.has(h)?f.delete(h):f.add(h),f}),c=ee.useMemo(()=>
4098{if(!t.trim())return Ai;const h=t.toLowerCase();return Ai.filter(d=>d.name.toLowerCase().includes(h)||d.category.includes(h))},[t]),u=ee.useMemo(()=>{const h={};return c.forEach(d=>{(h[d.category]??=[]).push(d)}),h},[c]);return T.jsxs("div",{className:"w-56 border-r flex flex-col shrink-0 overflow-hidden bg-background",children:[T.jsx("div",{className:"p-2 pb-1.5",children:T.jsxs("div",{className:"relative",children:[T.jsx(hM,{className:"absolute left-2 top-[7px] h-3.5 w-3.5 text-muted-foreground"}),T.jsx(Ti,{placeholder:"Search...",value:t,onChange:h=>n(h.target.value),className:"h-7 pl-7 text-xs"})]})}),T.jsx("div",{className:"px-2.5 pb-1.5",children:T.jsx("div",{className:"text-[9px] text-muted-foreground/60 italic",children:"Drag items to canvas or click to place"})}),T.jsx("div",{className:"flex-1 overflow-y-auto pb-2",children:Object.entries(u).map(([h,d])=>{const f=K3[h]||Lv,m=i.has(h);return T.jsxs("div",{children:[T.jsxs("button",{className:"flex items-center gap-1.5 w-full px-2.5 py-1.5 text-xs font-medium hover:bg-muted/50 transition-colors",onClick:()=>o(h),children:[m?T.jsx(dM,{className:"h-3 w-3 text-muted-foreground shrink-0"}):T.jsx(fM,{className:"h-3 w-3 text-muted-foreground shrink-0"}),T.jsx(f,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),T.jsx("span",{className:"truncate",children:W_[h]}),T.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground/60",children:d.length})]}),m&&d.map(g=>T.jsxs("button",{draggable:!0,onDragStart:x=>{x.dataTransfer.setData("text/plain",g.id),x.dataTransfer.effectAllowed="copy"},className:`flex items-center gap-2 w-full pl-7 pr-2.5 py-1.5 text-[11px] transition-colors cursor-grab active:cursor-grabbing
4099                    ${r.placingItem?.id===g.id?"bg-blue-50 dark:bg-blue-950/30 text-blue-600 dark:text-blue-400 font-medium":"text-foreground/75 hover:bg-muted/40"}`,onClick:()=>e({type:"SET_PLACING_ITEM",item:g}),children:[T.jsx($3,{item:g,active:r.placingItem?.id===g.id}),T.jsx("span",{className:"truncate",children:gM(g.name,t)}),T.jsxs("span",{className:"ml-auto text-[9px] text-muted-foreground/50 shrink-0 tabular-nums",children:[g.width,"×",g.depth]})]},g.id))]},h)})})]})}function tI({state:r,dispatch:e,selectedObject:t,catalogItem:n}){const i=t&&n;return T.jsx("div",{className:"w-64 border-l flex flex-col shrink-0 overflow-hidden bg-background",children:i?T.jsx(nI,{state:r,dispatch:e,obj:t,cat:n}):T.jsx(iI,{state:r,dispatch:e})})}function nI({state:r,dispatch:e,obj:t,cat:n}){const i=u=>e({type:"UPDATE_OBJECT",instanceId:t.instanceId,updates:u}),s=n.category==="tables";s&&(t.seatCount??n.defaultSeats??0)>0;const o=t.seatCount??n.defaultSeats??0,c=t.chairType||"banquet-chair";return T.jsxs("div",{className:"flex-1 overflow-y-auto",children:[T.jsxs("div",{className:"px-3 py-2.5 border-b bg-muted/30",children:[T.jsx("div",{className:"text-xs font-semibold",children:n.name}),T.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:[W_[n.category]," · ",n.width,"' × ",n.depth,"' × ",n.height,"'",n.defaultSeats?` · ${n.defaultSeats} seats`:""]})]}),T.jsxs("div",{className:"px-3 py-2.5 space-y-3",children:[T.jsx(Nn,{label:"Label",children:T.jsx(Ti,{value:t.label||"",onChange:u=>i({label:u.target.value||void 0}),placeholder:n.name,className:"h-7 text-xs"})}),T.jsx(Nn,{label:"Position",children:T.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[T.jsxs("div",{className:"relative",children:[T.jsx("span",{className:"absolute left-2 top-1.5 text-[9px] text-muted-foreground",children:"X"}),T.jsx(Ti,{type:"number",step:r.gridSize,value:Math.round(t.position[0]*10)/10,onChange:u=>i({position:[parseFloat(u.target.value)||0,t.position[1],t.position[2]]}),className:"h-7 text-xs pl-6 tabular-nums"})]}),T.jsxs("div",{className:"relative",children:[T.jsx("span",{className:"absolute left-2 top-1.5 text-[9px] text-muted-foreground",children:"Z"}),T.jsx(Ti,{type:"number",step:r.gridSize,value:Math.round(t.position[2]*10)/10,onChange:u=>i({position:[t.position[0],t.position[1],parseFloat(u.target.value)||0]}),className:"h-7 text-xs pl-6 tabular-nums"})]})]})}),T.jsx(Nn,{label:"Rotation",children:T.jsxs("div",{className:"flex items-center gap-1.5",children:[T.jsx(Ti,{type:"number",step:15,value:Math.round(t.rotation*180/Math.PI),onChange:u=>i({rotation:(parseFloat(u.target.value)||0)*Math.PI/180}),className:"h-7 text-xs flex-1 tabular-nums"}),T.jsx("span",{className:"text-[10px] text-muted-foreground",children:"°"}),T.jsx("button",{className:"h-7 w-7 rounded-md border flex items-center justify-center hover:bg-muted",onClick:()=>i({rotation:t.rotation+Math.PI/4}),children:T.jsx(Pv,{className:"h-3 w-3"})}),T.jsx("button",{className:"h-7 w-7 rounded-md border flex items-center justify-center hover:bg-muted",onClick:()=>i({rotation:t.rotation-Math.PI/4}),children:T.jsx(xM,{className:"h-3 w-3"})})]})}),T.jsx(Nn,{label:"Color",children:T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("input",{type:"color",value:t.colorOverride||n.color,onChange:u=>i({colorOverride:u.target.value}),className:"w-7 h-7 rounded border cursor-pointer p-0.5"}),T.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:t.colorOverride||n.color}),t.colorOverride&&T.jsx("button",{className:"text-[10px] text-blue-500 hover:underline ml-auto",onClick:()=>i({colorOverride:void 0}),children:"Reset"})]})}),T.jsx(Nn,{label:"Scale",children:T.jsx(Ti,{type:"number",step:.1,min:.
40991,max:5,value:t.scale,onChange:u=>i({scale:Math.max(.1,Math.min(5,parseFloat(u.target.value)||1))}),className:"h-7 text-xs tabular-nums"})}),s&&T.jsxs(T.Fragment,{children:[T.jsx(Ya,{}),T.jsx(Nn,{label:"Chairs",children:T.jsxs("div",{className:"flex items-center gap-1.5",children:[T.jsx("button",{className:"h-7 w-7 rounded-md border flex items-center justify-center hover:bg-muted",onClick:()=>{const u=Math.max(0,o-1);i({seatCount:u}),setTimeout(()=>e({type:"REGENERATE_CHAIRS",tableInstanceId:t.instanceId}),0)},children:T.jsx(TM,{className:"h-3 w-3"})}),T.jsx(Ti,{type:"number",min:0,max:20,value:o,onChange:u=>{const h=Math.max(0,Math.min(20,parseInt(u.target.value)||0));i({seatCount:h}),setTimeout(()=>e({type:"REGENERATE_CHAIRS",tableInstanceId:t.instanceId}),0)},className:"h-7 text-xs text-center tabular-nums flex-1"}),T.jsx("button",{className:"h-7 w-7 rounded-md border flex items-center justify-center hover:bg-muted",onClick:()=>{const u=Math.min(20,o+1);i({seatCount:u}),setTimeout(()=>e({type:"REGENERATE_CHAIRS",tableInstanceId:t.instanceId}),0)},children:T.jsx(vM,{className:"h-3 w-3"})})]})}),T.jsx(Nn,{label:"Chair Type",children:T.jsxs(Av,{value:c,onValueChange:u=>{i({chairType:u}),setTimeout(()=>e({type:"REGENERATE_CHAIRS",tableInstanceId:t.instanceId}),0)},children:[T.jsx(Cv,{className:"h-7 text-xs",children:T.jsx(Rv,{})}),T.jsx(Iv,{children:Q3.map(u=>T.jsx(Ha,{value:u.id,children:u.name},u.id))})]})}),T.jsx(Nn,{label:"Table Linen",children:T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsx("input",{type:"color",value:t.linenColor||"#ffffff",onChange:u=>i({linenColor:u.target.value}),className:"w-7 h-7 rounded border cursor-pointer p-0.5"}),T.jsx("span",{className:"text-[10px] text-muted-foreground",children:t.linenColor?"Applied":"None"}),t.linenColor?T.jsx("button",{className:"text-[10px] text-blue-500 hover:underline ml-auto",onClick:()=>i({linenColor:void 0}),children:"Remove"}):T.jsx("button",{className:"text-[10px] text-blue-500 hover:underline ml-auto",onClick:()=>i({linenColor:"#ffffff"}),children:"Add"})]})}),T.jsx(Nn,{label:"Place Settings",children:T.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[T.jsx("input",{type:"checkbox",checked:t.showPlaceSettings||!1,onChange:u=>i({showPlaceSettings:u.target.checked}),className:"rounded border"}),T.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Show plates & silverware"})]})})]})]}),T.jsxs("div",{className:"px-3 pb-3 space-y-1.5",children:[T.jsx(Ya,{className:"mb-2"}),T.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[T.jsxs(Er,{size:"sm",variant:"outline",className:"h-7 text-[11px] gap-1",onClick:()=>e({type:"TOGGLE_LOCK",instanceId:t.instanceId}),children:[t.locked?T.jsx(yM,{className:"h-3 w-3"}):T.jsx(RM,{className:"h-3 w-3"}),t.locked?"Unlock":"Lock"]}),T.jsxs(Er,{size:"sm",variant:"outline",className:"h-7 text-[11px] gap-1",onClick:()=>e({type:"DUPLICATE_SELECTED"}),children:[T.jsx(Tv,{className:"h-3 w-3"})," Duplicate"]})]}),T.jsxs(Er,{size:"sm",variant:"ghost",className:"h-7 text-[11px] gap-1 w-full text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>e({type:"DELETE_SELECTED"}),children:[T.jsx(bp,{className:"h-3 w-3"})," Delete"]})]})]})}function iI({state:r,dispatch:e}){const{room:t}=r.layout,n=o=>e({type:"UPDATE_ROOM",updates:o}),i=r.layout.objects.filter(o=>Ai.find(c=>c.id===o.catalogId)?.category==="tables"),s=i.reduce((o,c)=>{const u=Ai.find(h=>h.id===c.catalogId);return o+(c.seatCount??u?.defaultSeats??0)},0);return T.jsxs("div",{className:"flex-1 overflow-y-auto",children:[T.jsxs("div",{className:"px-3 py-2.5 border-b bg-muted/30",children:[T.jsx("div",{className:"text-xs font-semibold",children:"Room Settings"}),T.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:[t.width*t.depth," sq ft · ",r.layout.objects.length," objects"]})]}),T.jsxs("div",{className:"px-3 py-2.5 space-y-3",children:[T.jsx(Nn,{label:"Room Name",children:T.jsx(Ti,{value:t.name,onChange:o=>n({name:o.target.value}),className:"h-7 text-xs"})}),T.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[T.jsx(Nn,{label:"Width (ft)",children:T.jsx(Ti,{type:"number",min:10,max:500,value:t.width,onChange:o=>n({width:Math.max(10,parseInt(o.target.value)||60)}),className:"h-7 text-xs tabular-nums"})}),T.jsx(Nn,{label:"Depth (ft)",children:T.jsx(Ti,{type:"number",min:10,max:500,value:t.depth,onChange:o=>n({depth:Math.max(10,parseInt(o.target.value)||40)}),className:"h-7 text-xs tabular-nums"})})]}),T.jsx(Nn,{label:"Ceiling (ft)",children:T.jsx(Ti,{type:"number",min:8,max:50,value:t.ceilingHeight,onChange:o=>n({ceilingHeight:Math.max(8,parseInt(o.target.value)||12)}),className:"h-7 text-xs tabular-nums"})}),T.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[T.jsx(Nn,{label:"Wall Color",children:T.jsx("input",{type:"color",value:t.wallColor,onChange:o=>n({wallColor:o.target.value}),className:"w-full h-7 rounded border cursor-pointer p-0.5"})}),T.jsx(Nn,{label:"Floor Color",children:T.jsx("input",{type:"color",value:t.floorColor,onChange:o=>n({floorColor:o.target.value}),className:"w-full h-7 rounded border cursor-pointer p-0.5"})})]}),T.jsx(Ya,{}),T.jsxs("div",{className:"space-y-1.5",children:[T.jsx("div",{className:"text-[10px] font-medium text-muted-foreground",children:"Room Shape"}),T.jsx("div",{className:"grid grid-cols-2 gap-1",children:Object.entries(c3).map(([o,c])=>{const u=o==="rectangle"?!t.customWalls||t.customWalls.length===0:t.customWalls&&JSON.stringify(t.customWalls)===JSON.stringify(c.walls(t.width,t.depth));return T.jsx(Er,{variant:u?"default":"outline",size:"sm",className:"h-7 text-[10px]",onClick:()=>{n(o==="rectangle"?{customWalls:void 0}:{customWalls:c.walls(t.width,t.depth)})},children:c.label},o)})}),T.jsxs(Er,{variant:r.toolMode==="draw-wall"?"default":"outline",size:"sm",className:"w-full h-7 text-[10px] gap-1",onClick:()=>{r.cameraMode!=="2d"&&e({type:"SET_CAMERA_MODE",mode:"2d"}),e({type:"SET_TOOL_MODE",mode:r.toolMode==="draw-wall"?"select":"draw-wall"})},children:[T.jsx(_M,{className:"h-3 w-3"}),r.toolMode==="draw-wall"?"Drawing... (Esc to cancel)":"Draw Custom Room"]}),t.customWalls&&t.customWalls.length>=3&&T.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[t.customWalls.length," vertices · Custom polygon · drag vertices to adjust"]})]}),T.jsx(Ya,{}),T.jsx(Nn,{label:"Grid",children:T.jsxs(Av,{value:String(r.gridSize),onValueChange:o=>e({type:"SET_GRID_SIZE",size:parseFloat(o)}),children:[T.jsx(Cv,{className:"h-7 text-xs",children:T.jsx(Rv,{})}),T.jsxs(Iv,{children:[T.jsx(Ha,{value:"0.5",children:"0.5 ft"}),T.jsx(Ha,{value:"1",children:"1 ft"}),T.jsx(Ha,{value:"2",children:"2 ft"}),T.jsx(Ha,{value:"5",children:"5 ft"})]})]})}),T.jsx(Ya,{}),T.jsxs("div",{className:"space-y-1",children:[T.jsx("div",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wider",children:"Summary"}),T.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-0.5 text-[11px]",children:[T.jsx("span",{className:"text-muted-foreground",children:"Tables"}),T.jsx("span",{className:"text-right tabular-nums",children:i.length}),T.jsx("span",{className:"text-muted-foreground",children:"Est. seats"}),T.jsx("span",{className:"text-right tabular-nums",children:s}),T.jsx("span",{className:"text-muted-foreground",children:"Total objects"}),T.jsx("span",{className:"text-right tabular-nums",children:r.layout.objects.length}),T.jsx("span",{className:"text-muted-foreground",children:"Room area"}),T.jsxs("span",{className:"text-right tabular-nums",children:[(t.width*t.depth).toLocaleStr
4099ing()," ft²"]})]})]})]})]})}function Nn({label:r,children:e}){return T.jsxs("div",{className:"space-y-1",children:[T.jsx("div",{className:"text-[10px] font-medium text-muted-foreground",children:r}),e]})}export{gI as default};

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