@shopware-ag/dive 1.19.0 → 1.19.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dive.cjs +224 -219
- package/build/dive.cjs.map +1 -1
- package/build/dive.js +233 -21947
- package/build/dive.js.map +1 -1
- package/build/dive.mjs +26111 -0
- package/build/dive.mjs.map +1 -0
- package/build/src/ar/AR.d.ts +37 -14
- package/build/src/ar/arquicklook/ARQuickLook.d.ts +5 -6
- package/build/src/ar/sceneviewer/SceneViewer.d.ts +42 -6
- package/build/src/com/actions/scene/launchar.d.ts +5 -2
- package/build/src/converter/Converter.d.ts +21 -0
- package/build/src/dive.d.ts +2 -2
- package/build/src/exporter/Exporter.d.ts +11 -0
- package/build/src/helper/applyMixins/applyMixins.d.ts +22 -6
- package/build/src/info/Info.d.ts +37 -13
- package/build/src/interface/Movable.d.ts +5 -5
- package/build/src/interface/Selectable.d.ts +4 -4
- package/build/src/loader/Loader.d.ts +11 -0
- package/build/src/model/Model.d.ts +2 -2
- package/build/src/node/Node.d.ts +3 -3
- package/build/src/scene/root/Root.d.ts +1 -1
- package/build/src/types/ExporterOptions.d.ts +15 -0
- package/build/src/types/FileTypes.d.ts +27 -0
- package/build/src/types/index.d.ts +4 -0
- package/build/src/types/info/index.d.ts +66 -0
- package/package.json +16 -1
- package/src/ar/AR.ts +72 -69
- package/src/ar/__test__/AR.test.ts +194 -105
- package/src/ar/arquicklook/ARQuickLook.ts +32 -72
- package/src/ar/arquicklook/__test__/ARQuickLook.test.ts +89 -38
- package/src/ar/sceneviewer/SceneViewer.ts +96 -51
- package/src/ar/sceneviewer/__test__/SceneViewer.test.ts +144 -47
- package/src/ar/webxr/WebXR.ts +5 -4
- package/src/com/Communication.ts +5 -7
- package/src/com/__test__/Communication.test.ts +9 -3
- package/src/com/actions/scene/launchar.ts +2 -2
- package/src/converter/Converter.ts +117 -0
- package/src/dive.ts +3 -3
- package/src/exporter/Exporter.ts +75 -0
- package/src/helper/applyMixins/applyMixins.ts +59 -7
- package/src/info/Info.ts +99 -75
- package/src/info/__test__/Info.test.ts +162 -154
- package/src/interface/Movable.ts +5 -5
- package/src/interface/Selectable.ts +4 -4
- package/src/loader/Loader.ts +48 -0
- package/src/model/Model.ts +10 -5
- package/src/model/__test__/Model.test.ts +4 -11
- package/src/node/Node.ts +7 -5
- package/src/scene/root/Root.ts +4 -4
- package/src/scene/root/__test__/Root.test.ts +4 -4
- package/src/types/ExporterOptions.ts +14 -0
- package/src/types/FileTypes.ts +37 -0
- package/src/types/index.ts +26 -0
- package/src/types/info/index.ts +76 -0
- package/build/src/exporters/usdz/USDZExporter.d.ts +0 -15
- package/build/src/loadingmanager/LoadingManager.d.ts +0 -14
- package/src/exporters/usdz/USDZExporter.ts +0 -21
- package/src/exporters/usdz/__test__/USDZExporter.test.ts +0 -57
- package/src/loadingmanager/LoadingManager.ts +0 -50
- package/src/loadingmanager/__test__/LoadingManager.test.ts +0 -27
package/build/dive.cjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2010-2023 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
|
-
*/const Vu="163",Ps={ROTATE:0,DOLLY:1,PAN:2},Ls={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},NE=0,bp=1,FE=2,Fg=1,Bg=2,sr=3,Fi=0,Vn=1,yi=2,Nr=0,ro=1,Tp=2,Ap=3,wp=4,BE=5,os=100,zE=101,kE=102,HE=103,GE=104,VE=200,WE=201,XE=202,YE=203,xu=204,yu=205,jE=206,qE=207,KE=208,ZE=209,$E=210,JE=211,QE=212,eb=213,tb=214,nb=0,ib=1,rb=2,Jc=3,sb=4,ob=5,ab=6,cb=7,zg=0,lb=1,hb=2,lr=0,ub=1,fb=2,db=3,pb=4,mb=5,gb=6,_b=7,Rp="attached",vb="detached",kg=300,co=301,lo=302,Su=303,Mu=304,ll=306,ho=1e3,Dr=1001,Qc=1002,Nn=1003,Hg=1004,ra=1005,Hn=1006,jc=1007,or=1008,Fr=1009,xb=1010,yb=1011,Gg=1012,Vg=1013,uo=1014,Oi=1015,el=1016,Wg=1017,Xg=1018,xa=1020,Sb=35902,Mb=1021,Eb=1022,Ei=1023,bb=1024,Tb=1025,so=1026,ma=1027,Yg=1028,jg=1029,Ab=1030,qg=1031,Kg=1033,wh=33776,Rh=33777,Ch=33778,Ph=33779,Cp=35840,Pp=35841,Lp=35842,Ip=35843,Zg=36196,Dp=37492,Up=37496,Op=37808,Np=37809,Fp=37810,Bp=37811,zp=37812,kp=37813,Hp=37814,Gp=37815,Vp=37816,Wp=37817,Xp=37818,Yp=37819,jp=37820,qp=37821,Lh=36492,Kp=36494,Zp=36495,wb=36283,$p=36284,Jp=36285,Qp=36286,ga=2300,fo=2301,Ih=2302,em=2400,tm=2401,nm=2402,Rb=2500,Cb=0,$g=1,Eu=2,Pb=3200,Lb=3201,Jg=0,Ib=1,Ir="",mn="srgb",gn="srgb-linear",Wu="display-p3",hl="display-p3-linear",tl="linear",Gt="srgb",nl="rec709",il="p3",Is=7680,im=519,Db=512,Ub=513,Ob=514,Qg=515,Nb=516,Fb=517,Bb=518,zb=519,bu=35044,rm="300 es",ar=2e3,rl=2001;class fs{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 o=i.indexOf(t);o!==-1&&i.splice(o,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 o=0,c=i.length;o<c;o++)i[o].call(this,e);e.target=null}}}const bn=["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","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let sm=1234567;const ua=Math.PI/180,po=180/Math.PI;function bi(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(bn[s&255]+bn[s>>8&255]+bn[s>>16&255]+bn[s>>24&255]+"-"+bn[e&255]+bn[e>>8&255]+"-"+bn[e>>16&15|64]+bn[e>>24&255]+"-"+bn[t&63|128]+bn[t>>8&255]+"-"+bn[t>>16&255]+bn[t>>24&255]+bn[n&255]+bn[n>>8&255]+bn[n>>16&255]+bn[n>>24&255]).toLowerCase()}function xn(s,e,t){return Math.max(e,Math.min(t,s))}function Xu(s,e){return(s%e+e)%e}function kb(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function Hb(s,e,t){return s!==e?(t-s)/(e-s):0}function fa(s,e,t){return(1-t)*s+t*e}function Gb(s,e,t,n){return fa(s,e,1-Math.exp(-t*n))}function Vb(s,e=1){return e-Math.abs(Xu(s,e*2)-e)}function Wb(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function Xb(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function Yb(s,e){return s+Math.floor(Math.random()*(e-s+1))}function jb(s,e){return s+Math.random()*(e-s)}function qb(s){return s*(.5-Math.random())}function Kb(s){s!==void 0&&(sm=s);let e=sm+=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 Zb(s){return s*ua}function $b(s){return s*po}function Jb(s){return(s&s-1)===0&&s!==0}function Qb(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function eT(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function tT(s,e,t,n,i){const o=Math.cos,c=Math.sin,l=o(t/2),u=c(t/2),f=o((e+n)/2),d=c((e+n)/2),p=o((e-n)/2),m=c((e-n)/2),v=o((n-e)/2),S=c((n-e)/2);switch(i){case"XYX":s.set(l*d,u*p,u*m,l*f);break;case"YZY":s.set(u*m,l*d,u*p,l*f);break;case"ZXZ":s.set(u*p,u*m,l*d,l*f);break;case"XZX":s.set(l*d,u*S,u*v,l*f);break;case"YXY":s.set(u*v,l*d,u*S,l*f);break;case"ZYZ":s.set(u*S,u*v,l*d,l*f);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Si(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function Lt(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}const Bi={DEG2RAD:ua,RAD2DEG:po,generateUUID:bi,clamp:xn,euclideanModulo:Xu,mapLinear:kb,inverseLerp:Hb,lerp:fa,damp:Gb,pingpong:Vb,smoothstep:Wb,smootherstep:Xb,randInt:Yb,randFloat:jb,randFloatSpread:qb,seededRandom:Kb,degToRad:Zb,radToDeg:$b,isPowerOfTwo:Jb,ceilPowerOfTwo:Qb,floorPowerOfTwo:eT,setQuaternionFromProperEuler:tT,normalize:Lt,denormalize:Si};class Ie{constructor(e=0,t=0){Ie.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}sub(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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=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(xn(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),o=this.x-e.x,c=this.y-e.y;return this.x=o*n-c*i+e.x,this.y=o*i+c*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class lt{constructor(e,t,n,i,o,c,l,u,f){lt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,o,c,l,u,f)}set(e,t,n,i,o,c,l,u,f){const d=this.elements;return d[0]=e,d[1]=i,d[2]=l,d[3]=t,d[4]=o,d[5]=u,d[6]=n,d[7]=c,d[8]=f,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,o=this.elements,c=n[0],l=n[3],u=n[6],f=n[1],d=n[4],p=n[7],m=n[2],v=n[5],S=n[8],b=i[0],x=i[3],_=i[6],R=i[1],E=i[4],L=i[7],B=i[2],N=i[5],D=i[8];return o[0]=c*b+l*R+u*B,o[3]=c*x+l*E+u*N,o[6]=c*_+l*L+u*D,o[1]=f*b+d*R+p*B,o[4]=f*x+d*E+p*N,o[7]=f*_+d*L+p*D,o[2]=m*b+v*R+S*B,o[5]=m*x+v*E+S*N,o[8]=m*_+v*L+S*D,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],c=e[4],l=e[5],u=e[6],f=e[7],d=e[8];return t*c*d-t*l*f-n*o*d+n*l*u+i*o*f-i*c*u}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],c=e[4],l=e[5],u=e[6],f=e[7],d=e[8],p=d*c-l*f,m=l*u-d*o,v=f*o-c*u,S=t*p+n*m+i*v;if(S===0)return this.set(0,0,0,0,0,0,0,0,0);const b=1/S;return e[0]=p*b,e[1]=(i*f-d*n)*b,e[2]=(l*n-i*c)*b,e[3]=m*b,e[4]=(d*t-i*u)*b,e[5]=(i*o-l*t)*b,e[6]=v*b,e[7]=(n*u-f*t)*b,e[8]=(c*t-n*o)*b,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,o,c,l){const u=Math.cos(o),f=Math.sin(o);return this.set(n*u,n*f,-n*(u*c+f*l)+c+e,-i*f,i*u,-i*(-f*c+u*l)+l+t,0,0,1),this}scale(e,t){return this.premultiply(Dh.makeScale(e,t)),this}rotate(e){return this.premultiply(Dh.makeRotation(-e)),this}translate(e,t){return this.premultiply(Dh.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 Dh=new lt;function e_(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}function _a(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function nT(){const s=_a("canvas");return s.style.display="block",s}const om={};function t_(s){s in om||(om[s]=!0,console.warn(s))}const am=new lt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),cm=new lt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),uc={[gn]:{transfer:tl,primaries:nl,toReference:s=>s,fromReference:s=>s},[mn]:{transfer:Gt,primaries:nl,toReference:s=>s.convertSRGBToLinear(),fromReference:s=>s.convertLinearToSRGB()},[hl]:{transfer:tl,primaries:il,toReference:s=>s.applyMatrix3(cm),fromReference:s=>s.applyMatrix3(am)},[Wu]:{transfer:Gt,primaries:il,toReference:s=>s.convertSRGBToLinear().applyMatrix3(cm),fromReference:s=>s.applyMatrix3(am).convertLinearToSRGB()}},iT=new Set([gn,hl]),Ct={enabled:!0,_workingColorSpace:gn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(s){if(!iT.has(s))throw new Error(`Unsupported working color space, "${s}".`);this._workingColorSpace=s},convert:function(s,e,t){if(this.enabled===!1||e===t||!e||!t)return s;const n=uc[e].toReference,i=uc[t].fromReference;return i(n(s))},fromWorkingColorSpace:function(s,e){return this.convert(s,this._workingColorSpace,e)},toWorkingColorSpace:function(s,e){return this.convert(s,e,this._workingColorSpace)},getPrimaries:function(s){return uc[s].primaries},getTransfer:function(s){return s===Ir?tl:uc[s].transfer}};function oo(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function Uh(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}let Ds;class rT{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Ds===void 0&&(Ds=_a("canvas")),Ds.width=e.width,Ds.height=e.height;const n=Ds.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Ds}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=_a("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),o=i.data;for(let c=0;c<o.length;c++)o[c]=oo(o[c]/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(oo(t[n]/255)*255):t[n]=oo(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let sT=0;class n_{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:sT++}),this.uuid=bi(),this.data=e,this.dataReady=!0,this.version=0}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 o;if(Array.isArray(i)){o=[];for(let c=0,l=i.length;c<l;c++)i[c].isDataTexture?o.push(Oh(i[c].image)):o.push(Oh(i[c]))}else o=Oh(i);n.url=o}return t||(e.images[this.uuid]=n),n}}function Oh(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?rT.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let oT=0;class an extends fs{constructor(e=an.DEFAULT_IMAGE,t=an.DEFAULT_MAPPING,n=Dr,i=Dr,o=Hn,c=or,l=Ei,u=Fr,f=an.DEFAULT_ANISOTROPY,d=Ir){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:oT++}),this.uuid=bi(),this.name="",this.source=new n_(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=o,this.minFilter=c,this.anisotropy=f,this.format=l,this.internalFormat=null,this.type=u,this.offset=new Ie(0,0),this.repeat=new Ie(1,1),this.center=new Ie(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new lt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}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)}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.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,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!==kg)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ho:e.x=e.x-Math.floor(e.x);break;case Dr:e.x=e.x<0?0:1;break;case Qc: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 ho:e.y=e.y-Math.floor(e.y);break;case Dr:e.y=e.y<0?0:1;break;case Qc: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++}}an.DEFAULT_IMAGE=null;an.DEFAULT_MAPPING=kg;an.DEFAULT_ANISOTROPY=1;class Dt{constructor(e=0,t=0,n=0,i=1){Dt.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,o=this.w,c=e.elements;return this.x=c[0]*t+c[4]*n+c[8]*i+c[12]*o,this.y=c[1]*t+c[5]*n+c[9]*i+c[13]*o,this.z=c[2]*t+c[6]*n+c[10]*i+c[14]*o,this.w=c[3]*t+c[7]*n+c[11]*i+c[15]*o,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,o;const u=e.elements,f=u[0],d=u[4],p=u[8],m=u[1],v=u[5],S=u[9],b=u[2],x=u[6],_=u[10];if(Math.abs(d-m)<.01&&Math.abs(p-b)<.01&&Math.abs(S-x)<.01){if(Math.abs(d+m)<.1&&Math.abs(p+b)<.1&&Math.abs(S+x)<.1&&Math.abs(f+v+_-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(f+1)/2,L=(v+1)/2,B=(_+1)/2,N=(d+m)/4,D=(p+b)/4,k=(S+x)/4;return E>L&&E>B?E<.01?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(E),i=N/n,o=D/n):L>B?L<.01?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(L),n=N/i,o=k/i):B<.01?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(B),n=D/o,i=k/o),this.set(n,i,o,t),this}let R=Math.sqrt((x-S)*(x-S)+(p-b)*(p-b)+(m-d)*(m-d));return Math.abs(R)<.001&&(R=1),this.x=(x-S)/R,this.y=(p-b)/R,this.z=(m-d)/R,this.w=Math.acos((f+v+_-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=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 aT extends fs{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Dt(0,0,e,t),this.scissorTest=!1,this.viewport=new Dt(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Hn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},n);const o=new an(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);o.flipY=!1,o.generateMipmaps=n.generateMipmaps,o.internalFormat=n.internalFormat,this.textures=[];const c=n.count;for(let l=0;l<c;l++)this.textures[l]=o.clone(),this.textures[l].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}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,o=this.textures.length;i<o;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){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 n=0,i=e.textures.length;n<i;n++)this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new n_(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class hs extends aT{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class i_ extends an{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=Nn,this.minFilter=Nn,this.wrapR=Dr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class cT extends an{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=Nn,this.minFilter=Nn,this.wrapR=Dr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class rn{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,o,c,l){let u=n[i+0],f=n[i+1],d=n[i+2],p=n[i+3];const m=o[c+0],v=o[c+1],S=o[c+2],b=o[c+3];if(l===0){e[t+0]=u,e[t+1]=f,e[t+2]=d,e[t+3]=p;return}if(l===1){e[t+0]=m,e[t+1]=v,e[t+2]=S,e[t+3]=b;return}if(p!==b||u!==m||f!==v||d!==S){let x=1-l;const _=u*m+f*v+d*S+p*b,R=_>=0?1:-1,E=1-_*_;if(E>Number.EPSILON){const B=Math.sqrt(E),N=Math.atan2(B,_*R);x=Math.sin(x*N)/B,l=Math.sin(l*N)/B}const L=l*R;if(u=u*x+m*L,f=f*x+v*L,d=d*x+S*L,p=p*x+b*L,x===1-l){const B=1/Math.sqrt(u*u+f*f+d*d+p*p);u*=B,f*=B,d*=B,p*=B}}e[t]=u,e[t+1]=f,e[t+2]=d,e[t+3]=p}static multiplyQuaternionsFlat(e,t,n,i,o,c){const l=n[i],u=n[i+1],f=n[i+2],d=n[i+3],p=o[c],m=o[c+1],v=o[c+2],S=o[c+3];return e[t]=l*S+d*p+u*v-f*m,e[t+1]=u*S+d*m+f*p-l*v,e[t+2]=f*S+d*v+l*m-u*p,e[t+3]=d*S-l*p-u*m-f*v,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,o=e._z,c=e._order,l=Math.cos,u=Math.sin,f=l(n/2),d=l(i/2),p=l(o/2),m=u(n/2),v=u(i/2),S=u(o/2);switch(c){case"XYZ":this._x=m*d*p+f*v*S,this._y=f*v*p-m*d*S,this._z=f*d*S+m*v*p,this._w=f*d*p-m*v*S;break;case"YXZ":this._x=m*d*p+f*v*S,this._y=f*v*p-m*d*S,this._z=f*d*S-m*v*p,this._w=f*d*p+m*v*S;break;case"ZXY":this._x=m*d*p-f*v*S,this._y=f*v*p+m*d*S,this._z=f*d*S+m*v*p,this._w=f*d*p-m*v*S;break;case"ZYX":this._x=m*d*p-f*v*S,this._y=f*v*p+m*d*S,this._z=f*d*S-m*v*p,this._w=f*d*p+m*v*S;break;case"YZX":this._x=m*d*p+f*v*S,this._y=f*v*p+m*d*S,this._z=f*d*S-m*v*p,this._w=f*d*p-m*v*S;break;case"XZY":this._x=m*d*p-f*v*S,this._y=f*v*p-m*d*S,this._z=f*d*S+m*v*p,this._w=f*d*p+m*v*S;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+c)}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],o=t[8],c=t[1],l=t[5],u=t[9],f=t[2],d=t[6],p=t[10],m=n+l+p;if(m>0){const v=.5/Math.sqrt(m+1);this._w=.25/v,this._x=(d-u)*v,this._y=(o-f)*v,this._z=(c-i)*v}else if(n>l&&n>p){const v=2*Math.sqrt(1+n-l-p);this._w=(d-u)/v,this._x=.25*v,this._y=(i+c)/v,this._z=(o+f)/v}else if(l>p){const v=2*Math.sqrt(1+l-n-p);this._w=(o-f)/v,this._x=(i+c)/v,this._y=.25*v,this._z=(u+d)/v}else{const v=2*Math.sqrt(1+p-n-l);this._w=(c-i)/v,this._x=(o+f)/v,this._y=(u+d)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(xn(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,o=e._z,c=e._w,l=t._x,u=t._y,f=t._z,d=t._w;return this._x=n*d+c*l+i*f-o*u,this._y=i*d+c*u+o*l-n*f,this._z=o*d+c*f+n*u-i*l,this._w=c*d-n*l-i*u-o*f,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,o=this._z,c=this._w;let l=c*e._w+n*e._x+i*e._y+o*e._z;if(l<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,l=-l):this.copy(e),l>=1)return this._w=c,this._x=n,this._y=i,this._z=o,this;const u=1-l*l;if(u<=Number.EPSILON){const v=1-t;return this._w=v*c+t*this._w,this._x=v*n+t*this._x,this._y=v*i+t*this._y,this._z=v*o+t*this._z,this.normalize(),this}const f=Math.sqrt(u),d=Math.atan2(f,l),p=Math.sin((1-t)*d)/f,m=Math.sin(t*d)/f;return this._w=c*p+this._w*m,this._x=n*p+this._x*m,this._y=i*p+this._y*m,this._z=o*p+this._z*m,this._onChangeCallback(),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),o=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),o*Math.sin(t),o*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 U{constructor(e=0,t=0,n=0){U.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(lm.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(lm.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*i,this.y=o[1]*t+o[4]*n+o[7]*i,this.z=o[2]*t+o[5]*n+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,o=e.elements,c=1/(o[3]*t+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*i+o[12])*c,this.y=(o[1]*t+o[5]*n+o[9]*i+o[13])*c,this.z=(o[2]*t+o[6]*n+o[10]*i+o[14])*c,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,o=e.x,c=e.y,l=e.z,u=e.w,f=2*(c*i-l*n),d=2*(l*t-o*i),p=2*(o*n-c*t);return this.x=t+u*f+c*p-l*d,this.y=n+u*d+l*f-o*p,this.z=i+u*p+o*d-c*f,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,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i,this.y=o[1]*t+o[5]*n+o[9]*i,this.z=o[2]*t+o[6]*n+o[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=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,o=e.z,c=t.x,l=t.y,u=t.z;return this.x=i*u-o*l,this.y=o*c-n*u,this.z=n*l-i*c,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 Nh.copy(this).projectOnVector(e),this.sub(Nh)}reflect(e){return this.sub(Nh.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(xn(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 Nh=new U,lm=new rn;class Ai{constructor(e=new U(1/0,1/0,1/0),t=new U(-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(_i.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(_i.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=_i.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 o=n.getAttribute("position");if(t===!0&&o!==void 0&&e.isInstancedMesh!==!0)for(let c=0,l=o.count;c<l;c++)e.isMesh===!0?e.getVertexPosition(c,_i):_i.fromBufferAttribute(o,c),_i.applyMatrix4(e.matrixWorld),this.expandByPoint(_i);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),fc.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),fc.copy(n.boundingBox)),fc.applyMatrix4(e.matrixWorld),this.union(fc)}const i=e.children;for(let o=0,c=i.length;o<c;o++)this.expandByObject(i[o],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,_i),_i.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(Wo),dc.subVectors(this.max,Wo),Us.subVectors(e.a,Wo),Os.subVectors(e.b,Wo),Ns.subVectors(e.c,Wo),Mr.subVectors(Os,Us),Er.subVectors(Ns,Os),Kr.subVectors(Us,Ns);let t=[0,-Mr.z,Mr.y,0,-Er.z,Er.y,0,-Kr.z,Kr.y,Mr.z,0,-Mr.x,Er.z,0,-Er.x,Kr.z,0,-Kr.x,-Mr.y,Mr.x,0,-Er.y,Er.x,0,-Kr.y,Kr.x,0];return!Fh(t,Us,Os,Ns,dc)||(t=[1,0,0,0,1,0,0,0,1],!Fh(t,Us,Os,Ns,dc))?!1:(pc.crossVectors(Mr,Er),t=[pc.x,pc.y,pc.z],Fh(t,Us,Os,Ns,dc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,_i).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(_i).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:(Qi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Qi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Qi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Qi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Qi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Qi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Qi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Qi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Qi),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 Qi=[new U,new U,new U,new U,new U,new U,new U,new U],_i=new U,fc=new Ai,Us=new U,Os=new U,Ns=new U,Mr=new U,Er=new U,Kr=new U,Wo=new U,dc=new U,pc=new U,Zr=new U;function Fh(s,e,t,n,i){for(let o=0,c=s.length-3;o<=c;o+=3){Zr.fromArray(s,o);const l=i.x*Math.abs(Zr.x)+i.y*Math.abs(Zr.y)+i.z*Math.abs(Zr.z),u=e.dot(Zr),f=t.dot(Zr),d=n.dot(Zr);if(Math.max(-Math.max(u,f,d),Math.min(u,f,d))>l)return!1}return!0}const lT=new Ai,Xo=new U,Bh=new U;class Hi{constructor(e=new U,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):lT.setFromPoints(e).getCenter(n);let i=0;for(let o=0,c=e.length;o<c;o++)i=Math.max(i,n.distanceToSquared(e[o]));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;Xo.subVectors(e,this.center);const t=Xo.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Xo,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):(Bh.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Xo.copy(e.center).add(Bh)),this.expandByPoint(Xo.copy(e.center).sub(Bh))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const er=new U,zh=new U,mc=new U,br=new U,kh=new U,gc=new U,Hh=new U;class vo{constructor(e=new U,t=new U(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,er)),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=er.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(er.copy(this.origin).addScaledVector(this.direction,t),er.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){zh.copy(e).add(t).multiplyScalar(.5),mc.copy(t).sub(e).normalize(),br.copy(this.origin).sub(zh);const o=e.distanceTo(t)*.5,c=-this.direction.dot(mc),l=br.dot(this.direction),u=-br.dot(mc),f=br.lengthSq(),d=Math.abs(1-c*c);let p,m,v,S;if(d>0)if(p=c*u-l,m=c*l-u,S=o*d,p>=0)if(m>=-S)if(m<=S){const b=1/d;p*=b,m*=b,v=p*(p+c*m+2*l)+m*(c*p+m+2*u)+f}else m=o,p=Math.max(0,-(c*m+l)),v=-p*p+m*(m+2*u)+f;else m=-o,p=Math.max(0,-(c*m+l)),v=-p*p+m*(m+2*u)+f;else m<=-S?(p=Math.max(0,-(-c*o+l)),m=p>0?-o:Math.min(Math.max(-o,-u),o),v=-p*p+m*(m+2*u)+f):m<=S?(p=0,m=Math.min(Math.max(-o,-u),o),v=m*(m+2*u)+f):(p=Math.max(0,-(c*o+l)),m=p>0?o:Math.min(Math.max(-o,-u),o),v=-p*p+m*(m+2*u)+f);else m=c>0?-o:o,p=Math.max(0,-(c*m+l)),v=-p*p+m*(m+2*u)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,p),i&&i.copy(zh).addScaledVector(mc,m),v}intersectSphere(e,t){er.subVectors(e.center,this.origin);const n=er.dot(this.direction),i=er.dot(er)-n*n,o=e.radius*e.radius;if(i>o)return null;const c=Math.sqrt(o-i),l=n-c,u=n+c;return u<0?null:l<0?this.at(u,t):this.at(l,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const 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,o,c,l,u;const f=1/this.direction.x,d=1/this.direction.y,p=1/this.direction.z,m=this.origin;return f>=0?(n=(e.min.x-m.x)*f,i=(e.max.x-m.x)*f):(n=(e.max.x-m.x)*f,i=(e.min.x-m.x)*f),d>=0?(o=(e.min.y-m.y)*d,c=(e.max.y-m.y)*d):(o=(e.max.y-m.y)*d,c=(e.min.y-m.y)*d),n>c||o>i||((o>n||isNaN(n))&&(n=o),(c<i||isNaN(i))&&(i=c),p>=0?(l=(e.min.z-m.z)*p,u=(e.max.z-m.z)*p):(l=(e.max.z-m.z)*p,u=(e.min.z-m.z)*p),n>u||l>i)||((l>n||n!==n)&&(n=l),(u<i||i!==i)&&(i=u),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,er)!==null}intersectTriangle(e,t,n,i,o){kh.subVectors(t,e),gc.subVectors(n,e),Hh.crossVectors(kh,gc);let c=this.direction.dot(Hh),l;if(c>0){if(i)return null;l=1}else if(c<0)l=-1,c=-c;else return null;br.subVectors(this.origin,e);const u=l*this.direction.dot(gc.crossVectors(br,gc));if(u<0)return null;const f=l*this.direction.dot(kh.cross(br));if(f<0||u+f>c)return null;const d=-l*br.dot(Hh);return d<0?null:this.at(d/c,o)}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 $e{constructor(e,t,n,i,o,c,l,u,f,d,p,m,v,S,b,x){$e.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,o,c,l,u,f,d,p,m,v,S,b,x)}set(e,t,n,i,o,c,l,u,f,d,p,m,v,S,b,x){const _=this.elements;return _[0]=e,_[4]=t,_[8]=n,_[12]=i,_[1]=o,_[5]=c,_[9]=l,_[13]=u,_[2]=f,_[6]=d,_[10]=p,_[14]=m,_[3]=v,_[7]=S,_[11]=b,_[15]=x,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 $e().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 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){const t=this.elements,n=e.elements,i=1/Fs.setFromMatrixColumn(e,0).length(),o=1/Fs.setFromMatrixColumn(e,1).length(),c=1/Fs.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]*o,t[5]=n[5]*o,t[6]=n[6]*o,t[7]=0,t[8]=n[8]*c,t[9]=n[9]*c,t[10]=n[10]*c,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,o=e.z,c=Math.cos(n),l=Math.sin(n),u=Math.cos(i),f=Math.sin(i),d=Math.cos(o),p=Math.sin(o);if(e.order==="XYZ"){const m=c*d,v=c*p,S=l*d,b=l*p;t[0]=u*d,t[4]=-u*p,t[8]=f,t[1]=v+S*f,t[5]=m-b*f,t[9]=-l*u,t[2]=b-m*f,t[6]=S+v*f,t[10]=c*u}else if(e.order==="YXZ"){const m=u*d,v=u*p,S=f*d,b=f*p;t[0]=m+b*l,t[4]=S*l-v,t[8]=c*f,t[1]=c*p,t[5]=c*d,t[9]=-l,t[2]=v*l-S,t[6]=b+m*l,t[10]=c*u}else if(e.order==="ZXY"){const m=u*d,v=u*p,S=f*d,b=f*p;t[0]=m-b*l,t[4]=-c*p,t[8]=S+v*l,t[1]=v+S*l,t[5]=c*d,t[9]=b-m*l,t[2]=-c*f,t[6]=l,t[10]=c*u}else if(e.order==="ZYX"){const m=c*d,v=c*p,S=l*d,b=l*p;t[0]=u*d,t[4]=S*f-v,t[8]=m*f+b,t[1]=u*p,t[5]=b*f+m,t[9]=v*f-S,t[2]=-f,t[6]=l*u,t[10]=c*u}else if(e.order==="YZX"){const m=c*u,v=c*f,S=l*u,b=l*f;t[0]=u*d,t[4]=b-m*p,t[8]=S*p+v,t[1]=p,t[5]=c*d,t[9]=-l*d,t[2]=-f*d,t[6]=v*p+S,t[10]=m-b*p}else if(e.order==="XZY"){const m=c*u,v=c*f,S=l*u,b=l*f;t[0]=u*d,t[4]=-p,t[8]=f*d,t[1]=m*p+b,t[5]=c*d,t[9]=v*p-S,t[2]=S*p-v,t[6]=l*d,t[10]=b*p+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(hT,e,uT)}lookAt(e,t,n){const i=this.elements;return Zn.subVectors(e,t),Zn.lengthSq()===0&&(Zn.z=1),Zn.normalize(),Tr.crossVectors(n,Zn),Tr.lengthSq()===0&&(Math.abs(n.z)===1?Zn.x+=1e-4:Zn.z+=1e-4,Zn.normalize(),Tr.crossVectors(n,Zn)),Tr.normalize(),_c.crossVectors(Zn,Tr),i[0]=Tr.x,i[4]=_c.x,i[8]=Zn.x,i[1]=Tr.y,i[5]=_c.y,i[9]=Zn.y,i[2]=Tr.z,i[6]=_c.z,i[10]=Zn.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,o=this.elements,c=n[0],l=n[4],u=n[8],f=n[12],d=n[1],p=n[5],m=n[9],v=n[13],S=n[2],b=n[6],x=n[10],_=n[14],R=n[3],E=n[7],L=n[11],B=n[15],N=i[0],D=i[4],k=i[8],C=i[12],T=i[1],W=i[5],j=i[9],H=i[13],K=i[2],ne=i[6],he=i[10],me=i[14],$=i[3],fe=i[7],pe=i[11],Ee=i[15];return o[0]=c*N+l*T+u*K+f*$,o[4]=c*D+l*W+u*ne+f*fe,o[8]=c*k+l*j+u*he+f*pe,o[12]=c*C+l*H+u*me+f*Ee,o[1]=d*N+p*T+m*K+v*$,o[5]=d*D+p*W+m*ne+v*fe,o[9]=d*k+p*j+m*he+v*pe,o[13]=d*C+p*H+m*me+v*Ee,o[2]=S*N+b*T+x*K+_*$,o[6]=S*D+b*W+x*ne+_*fe,o[10]=S*k+b*j+x*he+_*pe,o[14]=S*C+b*H+x*me+_*Ee,o[3]=R*N+E*T+L*K+B*$,o[7]=R*D+E*W+L*ne+B*fe,o[11]=R*k+E*j+L*he+B*pe,o[15]=R*C+E*H+L*me+B*Ee,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],o=e[12],c=e[1],l=e[5],u=e[9],f=e[13],d=e[2],p=e[6],m=e[10],v=e[14],S=e[3],b=e[7],x=e[11],_=e[15];return S*(+o*u*p-i*f*p-o*l*m+n*f*m+i*l*v-n*u*v)+b*(+t*u*v-t*f*m+o*c*m-i*c*v+i*f*d-o*u*d)+x*(+t*f*p-t*l*v-o*c*p+n*c*v+o*l*d-n*f*d)+_*(-i*l*d-t*u*p+t*l*m+i*c*p-n*c*m+n*u*d)}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],o=e[3],c=e[4],l=e[5],u=e[6],f=e[7],d=e[8],p=e[9],m=e[10],v=e[11],S=e[12],b=e[13],x=e[14],_=e[15],R=p*x*f-b*m*f+b*u*v-l*x*v-p*u*_+l*m*_,E=S*m*f-d*x*f-S*u*v+c*x*v+d*u*_-c*m*_,L=d*b*f-S*p*f+S*l*v-c*b*v-d*l*_+c*p*_,B=S*p*u-d*b*u-S*l*m+c*b*m+d*l*x-c*p*x,N=t*R+n*E+i*L+o*B;if(N===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/N;return e[0]=R*D,e[1]=(b*m*o-p*x*o-b*i*v+n*x*v+p*i*_-n*m*_)*D,e[2]=(l*x*o-b*u*o+b*i*f-n*x*f-l*i*_+n*u*_)*D,e[3]=(p*u*o-l*m*o-p*i*f+n*m*f+l*i*v-n*u*v)*D,e[4]=E*D,e[5]=(d*x*o-S*m*o+S*i*v-t*x*v-d*i*_+t*m*_)*D,e[6]=(S*u*o-c*x*o-S*i*f+t*x*f+c*i*_-t*u*_)*D,e[7]=(c*m*o-d*u*o+d*i*f-t*m*f-c*i*v+t*u*v)*D,e[8]=L*D,e[9]=(S*p*o-d*b*o-S*n*v+t*b*v+d*n*_-t*p*_)*D,e[10]=(c*b*o-S*l*o+S*n*f-t*b*f-c*n*_+t*l*_)*D,e[11]=(d*l*o-c*p*o-d*n*f+t*p*f+c*n*v-t*l*v)*D,e[12]=B*D,e[13]=(d*b*i-S*p*i+S*n*m-t*b*m-d*n*x+t*p*x)*D,e[14]=(S*l*i-c*b*i-S*n*u+t*b*u+c*n*x-t*l*x)*D,e[15]=(c*p*i-d*l*i+d*n*u-t*p*u-c*n*m+t*l*m)*D,this}scale(e){const t=this.elements,n=e.x,i=e.y,o=e.z;return t[0]*=n,t[4]*=i,t[8]*=o,t[1]*=n,t[5]*=i,t[9]*=o,t[2]*=n,t[6]*=i,t[10]*=o,t[3]*=n,t[7]*=i,t[11]*=o,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),o=1-n,c=e.x,l=e.y,u=e.z,f=o*c,d=o*l;return this.set(f*c+n,f*l-i*u,f*u+i*l,0,f*l+i*u,d*l+n,d*u-i*c,0,f*u-i*l,d*u+i*c,o*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,o,c){return this.set(1,n,o,0,e,1,c,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,o=t._x,c=t._y,l=t._z,u=t._w,f=o+o,d=c+c,p=l+l,m=o*f,v=o*d,S=o*p,b=c*d,x=c*p,_=l*p,R=u*f,E=u*d,L=u*p,B=n.x,N=n.y,D=n.z;return i[0]=(1-(b+_))*B,i[1]=(v+L)*B,i[2]=(S-E)*B,i[3]=0,i[4]=(v-L)*N,i[5]=(1-(m+_))*N,i[6]=(x+R)*N,i[7]=0,i[8]=(S+E)*D,i[9]=(x-R)*D,i[10]=(1-(m+b))*D,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;let o=Fs.set(i[0],i[1],i[2]).length();const c=Fs.set(i[4],i[5],i[6]).length(),l=Fs.set(i[8],i[9],i[10]).length();this.determinant()<0&&(o=-o),e.x=i[12],e.y=i[13],e.z=i[14],vi.copy(this);const f=1/o,d=1/c,p=1/l;return vi.elements[0]*=f,vi.elements[1]*=f,vi.elements[2]*=f,vi.elements[4]*=d,vi.elements[5]*=d,vi.elements[6]*=d,vi.elements[8]*=p,vi.elements[9]*=p,vi.elements[10]*=p,t.setFromRotationMatrix(vi),n.x=o,n.y=c,n.z=l,this}makePerspective(e,t,n,i,o,c,l=ar){const u=this.elements,f=2*o/(t-e),d=2*o/(n-i),p=(t+e)/(t-e),m=(n+i)/(n-i);let v,S;if(l===ar)v=-(c+o)/(c-o),S=-2*c*o/(c-o);else if(l===rl)v=-c/(c-o),S=-c*o/(c-o);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return u[0]=f,u[4]=0,u[8]=p,u[12]=0,u[1]=0,u[5]=d,u[9]=m,u[13]=0,u[2]=0,u[6]=0,u[10]=v,u[14]=S,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(e,t,n,i,o,c,l=ar){const u=this.elements,f=1/(t-e),d=1/(n-i),p=1/(c-o),m=(t+e)*f,v=(n+i)*d;let S,b;if(l===ar)S=(c+o)*p,b=-2*p;else if(l===rl)S=o*p,b=-1*p;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return u[0]=2*f,u[4]=0,u[8]=0,u[12]=-m,u[1]=0,u[5]=2*d,u[9]=0,u[13]=-v,u[2]=0,u[6]=0,u[10]=b,u[14]=-S,u[3]=0,u[7]=0,u[11]=0,u[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 Fs=new U,vi=new $e,hT=new U(0,0,0),uT=new U(1,1,1),Tr=new U,_c=new U,Zn=new U,hm=new $e,um=new rn;class Ti{constructor(e=0,t=0,n=0,i=Ti.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,o=i[0],c=i[4],l=i[8],u=i[1],f=i[5],d=i[9],p=i[2],m=i[6],v=i[10];switch(t){case"XYZ":this._y=Math.asin(xn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,v),this._z=Math.atan2(-c,o)):(this._x=Math.atan2(m,f),this._z=0);break;case"YXZ":this._x=Math.asin(-xn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(l,v),this._z=Math.atan2(u,f)):(this._y=Math.atan2(-p,o),this._z=0);break;case"ZXY":this._x=Math.asin(xn(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-p,v),this._z=Math.atan2(-c,f)):(this._y=0,this._z=Math.atan2(u,o));break;case"ZYX":this._y=Math.asin(-xn(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(m,v),this._z=Math.atan2(u,o)):(this._x=0,this._z=Math.atan2(-c,f));break;case"YZX":this._z=Math.asin(xn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-d,f),this._y=Math.atan2(-p,o)):(this._x=0,this._y=Math.atan2(l,v));break;case"XZY":this._z=Math.asin(-xn(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(m,f),this._y=Math.atan2(l,o)):(this._x=Math.atan2(-d,v),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return hm.makeRotationFromQuaternion(e),this.setFromRotationMatrix(hm,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return um.setFromEuler(this),this.setFromQuaternion(um,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}}Ti.DEFAULT_ORDER="XYZ";class Yu{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 fT=0;const fm=new U,Bs=new rn,tr=new $e,vc=new U,Yo=new U,dT=new U,pT=new rn,dm=new U(1,0,0),pm=new U(0,1,0),mm=new U(0,0,1),gm={type:"added"},mT={type:"removed"},zs={type:"childadded",child:null},Gh={type:"childremoved",child:null};class _t extends fs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:fT++}),this.uuid=bi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=_t.DEFAULT_UP.clone();const e=new U,t=new Ti,n=new rn,i=new U(1,1,1);function o(){n.setFromEuler(t,!1)}function c(){t.setFromQuaternion(n,void 0,!1)}t._onChange(o),n._onChange(c),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 $e},normalMatrix:{value:new lt}}),this.matrix=new $e,this.matrixWorld=new $e,this.matrixAutoUpdate=_t.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=_t.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Yu,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}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 Bs.setFromAxisAngle(e,t),this.quaternion.multiply(Bs),this}rotateOnWorldAxis(e,t){return Bs.setFromAxisAngle(e,t),this.quaternion.premultiply(Bs),this}rotateX(e){return this.rotateOnAxis(dm,e)}rotateY(e){return this.rotateOnAxis(pm,e)}rotateZ(e){return this.rotateOnAxis(mm,e)}translateOnAxis(e,t){return fm.copy(e).applyQuaternion(this.quaternion),this.position.add(fm.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(dm,e)}translateY(e){return this.translateOnAxis(pm,e)}translateZ(e){return this.translateOnAxis(mm,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(tr.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?vc.copy(e):vc.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Yo.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?tr.lookAt(Yo,vc,this.up):tr.lookAt(vc,Yo,this.up),this.quaternion.setFromRotationMatrix(tr),i&&(tr.extractRotation(i.matrixWorld),Bs.setFromRotationMatrix(tr),this.quaternion.premultiply(Bs.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(gm),zs.child=e,this.dispatchEvent(zs),zs.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(mT),Gh.child=e,this.dispatchEvent(Gh),Gh.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),tr.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),tr.multiply(e.parent.matrixWorld)),e.applyMatrix4(tr),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(gm),zs.child=e,this.dispatchEvent(zs),zs.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 c=this.children[n].getObjectByProperty(e,t);if(c!==void 0)return c}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let o=0,c=i.length;o<c;o++)i[o].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(Yo,e,dT),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Yo,pT,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),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++){const o=t[n];(o.matrixWorldAutoUpdate===!0||e===!0)&&o.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const i=this.children;for(let o=0,c=i.length;o<c;o++){const l=i[o];l.matrixWorldAutoUpdate===!0&&l.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.6,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),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.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(l=>({boxInitialized:l.boxInitialized,boxMin:l.box.min.toArray(),boxMax:l.box.max.toArray(),sphereInitialized:l.sphereInitialized,sphereRadius:l.sphere.radius,sphereCenter:l.sphere.center.toArray()})),i.maxGeometryCount=this._maxGeometryCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function o(l,u){return l[u.uuid]===void 0&&(l[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=o(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const u=l.shapes;if(Array.isArray(u))for(let f=0,d=u.length;f<d;f++){const p=u[f];o(e.shapes,p)}else o(e.shapes,u)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(o(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const l=[];for(let u=0,f=this.material.length;u<f;u++)l.push(o(e.materials,this.material[u]));i.material=l}else i.material=o(e.materials,this.material);if(this.children.length>0){i.children=[];for(let l=0;l<this.children.length;l++)i.children.push(this.children[l].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let l=0;l<this.animations.length;l++){const u=this.animations[l];i.animations.push(o(e.animations,u))}}if(t){const l=c(e.geometries),u=c(e.materials),f=c(e.textures),d=c(e.images),p=c(e.shapes),m=c(e.skeletons),v=c(e.animations),S=c(e.nodes);l.length>0&&(n.geometries=l),u.length>0&&(n.materials=u),f.length>0&&(n.textures=f),d.length>0&&(n.images=d),p.length>0&&(n.shapes=p),m.length>0&&(n.skeletons=m),v.length>0&&(n.animations=v),S.length>0&&(n.nodes=S)}return n.object=i,n;function c(l){const u=[];for(const f in l){const d=l[f];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),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.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}}_t.DEFAULT_UP=new U(0,1,0);_t.DEFAULT_MATRIX_AUTO_UPDATE=!0;_t.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const xi=new U,nr=new U,Vh=new U,ir=new U,ks=new U,Hs=new U,_m=new U,Wh=new U,Xh=new U,Yh=new U;class Mi{constructor(e=new U,t=new U,n=new U){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),xi.subVectors(e,t),i.cross(xi);const o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,n,i,o){xi.subVectors(i,t),nr.subVectors(n,t),Vh.subVectors(e,t);const c=xi.dot(xi),l=xi.dot(nr),u=xi.dot(Vh),f=nr.dot(nr),d=nr.dot(Vh),p=c*f-l*l;if(p===0)return o.set(0,0,0),null;const m=1/p,v=(f*u-l*d)*m,S=(c*d-l*u)*m;return o.set(1-v-S,S,v)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,ir)===null?!1:ir.x>=0&&ir.y>=0&&ir.x+ir.y<=1}static getInterpolation(e,t,n,i,o,c,l,u){return this.getBarycoord(e,t,n,i,ir)===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(o,ir.x),u.addScaledVector(c,ir.y),u.addScaledVector(l,ir.z),u)}static isFrontFacing(e,t,n,i){return xi.subVectors(n,t),nr.subVectors(e,t),xi.cross(nr).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 xi.subVectors(this.c,this.b),nr.subVectors(this.a,this.b),xi.cross(nr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Mi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Mi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,o){return Mi.getInterpolation(e,this.a,this.b,this.c,t,n,i,o)}containsPoint(e){return Mi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Mi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,o=this.c;let c,l;ks.subVectors(i,n),Hs.subVectors(o,n),Wh.subVectors(e,n);const u=ks.dot(Wh),f=Hs.dot(Wh);if(u<=0&&f<=0)return t.copy(n);Xh.subVectors(e,i);const d=ks.dot(Xh),p=Hs.dot(Xh);if(d>=0&&p<=d)return t.copy(i);const m=u*p-d*f;if(m<=0&&u>=0&&d<=0)return c=u/(u-d),t.copy(n).addScaledVector(ks,c);Yh.subVectors(e,o);const v=ks.dot(Yh),S=Hs.dot(Yh);if(S>=0&&v<=S)return t.copy(o);const b=v*f-u*S;if(b<=0&&f>=0&&S<=0)return l=f/(f-S),t.copy(n).addScaledVector(Hs,l);const x=d*S-v*p;if(x<=0&&p-d>=0&&v-S>=0)return _m.subVectors(o,i),l=(p-d)/(p-d+(v-S)),t.copy(i).addScaledVector(_m,l);const _=1/(x+b+m);return c=b*_,l=m*_,t.copy(n).addScaledVector(ks,c).addScaledVector(Hs,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const r_={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},Ar={h:0,s:0,l:0},xc={h:0,s:0,l:0};function jh(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}class Ne{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=mn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ct.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Ct.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ct.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Ct.workingColorSpace){if(e=Xu(e,1),t=xn(t,0,1),n=xn(n,0,1),t===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+t):n+t-n*t,c=2*n-o;this.r=jh(c,o,e+1/3),this.g=jh(c,o,e),this.b=jh(c,o,e-1/3)}return Ct.toWorkingColorSpace(this,i),this}setStyle(e,t=mn){function n(o){o!==void 0&&parseFloat(o)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const c=i[1],l=i[2];switch(c){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,t);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,t);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],c=o.length;if(c===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(c===6)return this.setHex(parseInt(o,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=mn){const n=r_[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=oo(e.r),this.g=oo(e.g),this.b=oo(e.b),this}copyLinearToSRGB(e){return this.r=Uh(e.r),this.g=Uh(e.g),this.b=Uh(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=mn){return Ct.fromWorkingColorSpace(Tn.copy(this),e),Math.round(xn(Tn.r*255,0,255))*65536+Math.round(xn(Tn.g*255,0,255))*256+Math.round(xn(Tn.b*255,0,255))}getHexString(e=mn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ct.workingColorSpace){Ct.fromWorkingColorSpace(Tn.copy(this),t);const n=Tn.r,i=Tn.g,o=Tn.b,c=Math.max(n,i,o),l=Math.min(n,i,o);let u,f;const d=(l+c)/2;if(l===c)u=0,f=0;else{const p=c-l;switch(f=d<=.5?p/(c+l):p/(2-c-l),c){case n:u=(i-o)/p+(i<o?6:0);break;case i:u=(o-n)/p+2;break;case o:u=(n-i)/p+4;break}u/=6}return e.h=u,e.s=f,e.l=d,e}getRGB(e,t=Ct.workingColorSpace){return Ct.fromWorkingColorSpace(Tn.copy(this),t),e.r=Tn.r,e.g=Tn.g,e.b=Tn.b,e}getStyle(e=mn){Ct.fromWorkingColorSpace(Tn.copy(this),e);const t=Tn.r,n=Tn.g,i=Tn.b;return e!==mn?`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(Ar),this.setHSL(Ar.h+e,Ar.s+t,Ar.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(Ar),e.getHSL(xc);const n=fa(Ar.h,xc.h,t),i=fa(Ar.s,xc.s,t),o=fa(Ar.l,xc.l,t);return this.setHSL(n,i,o),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,o=e.elements;return this.r=o[0]*t+o[3]*n+o[6]*i,this.g=o[1]*t+o[4]*n+o[7]*i,this.b=o[2]*t+o[5]*n+o[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 Tn=new Ne;Ne.NAMES=r_;let gT=0;class ui extends fs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:gT++}),this.uuid=bi(),this.name="",this.type="Material",this.blending=ro,this.side=Fi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=xu,this.blendDst=yu,this.blendEquation=os,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ne(0,0,0),this.blendAlpha=0,this.depthFunc=Jc,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=im,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.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.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.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==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.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!==ro&&(n.blending=this.blending),this.side!==Fi&&(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!==xu&&(n.blendSrc=this.blendSrc),this.blendDst!==yu&&(n.blendDst=this.blendDst),this.blendEquation!==os&&(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!==Jc&&(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!==im&&(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.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(o){const c=[];for(const l in o){const u=o[l];delete u.metadata,c.push(u)}return c}if(t){const o=i(e.textures),c=i(e.images);o.length>0&&(n.textures=o),c.length>0&&(n.images=c)}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 o=0;o!==i;++o)n[o]=t[o].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.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 Ni extends ui{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ne(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 Ti,this.combine=zg,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 nn=new U,yc=new Ie;class cn{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=bu,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Oi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return t_("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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,o=this.itemSize;i<o;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++)yc.fromBufferAttribute(this,t),yc.applyMatrix3(e),this.setXY(t,yc.x,yc.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)nn.fromBufferAttribute(this,t),nn.applyMatrix3(e),this.setXYZ(t,nn.x,nn.y,nn.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)nn.fromBufferAttribute(this,t),nn.applyMatrix4(e),this.setXYZ(t,nn.x,nn.y,nn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)nn.fromBufferAttribute(this,t),nn.applyNormalMatrix(e),this.setXYZ(t,nn.x,nn.y,nn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)nn.fromBufferAttribute(this,t),nn.transformDirection(e),this.setXYZ(t,nn.x,nn.y,nn.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=Si(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Lt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Si(t,this.array)),t}setX(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Si(t,this.array)),t}setY(e,t){return this.normalized&&(t=Lt(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=Si(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Lt(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=Si(t,this.array)),t}setW(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(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=Lt(t,this.array),n=Lt(n,this.array),i=Lt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,o){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),i=Lt(i,this.array),o=Lt(o,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=o,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==bu&&(e.usage=this.usage),e}}class s_ extends cn{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class o_ extends cn{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Nt extends cn{constructor(e,t,n){super(new Float32Array(e),t,n)}}let _T=0;const ci=new $e,qh=new _t,Gs=new U,$n=new Ai,jo=new Ai,dn=new U;class $t extends fs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:_T++}),this.uuid=bi(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(e_(e)?o_:s_)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const o=new lt().getNormalMatrix(e);n.applyNormalMatrix(o),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 ci.makeRotationFromQuaternion(e),this.applyMatrix4(ci),this}rotateX(e){return ci.makeRotationX(e),this.applyMatrix4(ci),this}rotateY(e){return ci.makeRotationY(e),this.applyMatrix4(ci),this}rotateZ(e){return ci.makeRotationZ(e),this.applyMatrix4(ci),this}translate(e,t,n){return ci.makeTranslation(e,t,n),this.applyMatrix4(ci),this}scale(e,t,n){return ci.makeScale(e,t,n),this.applyMatrix4(ci),this}lookAt(e){return qh.lookAt(e),qh.updateMatrix(),this.applyMatrix4(qh.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Gs).negate(),this.translate(Gs.x,Gs.y,Gs.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const o=e[n];t.push(o.x,o.y,o.z||0)}return this.setAttribute("position",new Nt(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ai);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new U(-1/0,-1/0,-1/0),new U(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 o=t[n];$n.setFromBufferAttribute(o),this.morphTargetsRelative?(dn.addVectors(this.boundingBox.min,$n.min),this.boundingBox.expandByPoint(dn),dn.addVectors(this.boundingBox.max,$n.max),this.boundingBox.expandByPoint(dn)):(this.boundingBox.expandByPoint($n.min),this.boundingBox.expandByPoint($n.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Hi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new U,1/0);return}if(e){const n=this.boundingSphere.center;if($n.setFromBufferAttribute(e),t)for(let o=0,c=t.length;o<c;o++){const l=t[o];jo.setFromBufferAttribute(l),this.morphTargetsRelative?(dn.addVectors($n.min,jo.min),$n.expandByPoint(dn),dn.addVectors($n.max,jo.max),$n.expandByPoint(dn)):($n.expandByPoint(jo.min),$n.expandByPoint(jo.max))}$n.getCenter(n);let i=0;for(let o=0,c=e.count;o<c;o++)dn.fromBufferAttribute(e,o),i=Math.max(i,n.distanceToSquared(dn));if(t)for(let o=0,c=t.length;o<c;o++){const l=t[o],u=this.morphTargetsRelative;for(let f=0,d=l.count;f<d;f++)dn.fromBufferAttribute(l,f),u&&(Gs.fromBufferAttribute(e,f),dn.add(Gs)),i=Math.max(i,n.distanceToSquared(dn))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,o=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new cn(new Float32Array(4*n.count),4));const c=this.getAttribute("tangent"),l=[],u=[];for(let k=0;k<n.count;k++)l[k]=new U,u[k]=new U;const f=new U,d=new U,p=new U,m=new Ie,v=new Ie,S=new Ie,b=new U,x=new U;function _(k,C,T){f.fromBufferAttribute(n,k),d.fromBufferAttribute(n,C),p.fromBufferAttribute(n,T),m.fromBufferAttribute(o,k),v.fromBufferAttribute(o,C),S.fromBufferAttribute(o,T),d.sub(f),p.sub(f),v.sub(m),S.sub(m);const W=1/(v.x*S.y-S.x*v.y);isFinite(W)&&(b.copy(d).multiplyScalar(S.y).addScaledVector(p,-v.y).multiplyScalar(W),x.copy(p).multiplyScalar(v.x).addScaledVector(d,-S.x).multiplyScalar(W),l[k].add(b),l[C].add(b),l[T].add(b),u[k].add(x),u[C].add(x),u[T].add(x))}let R=this.groups;R.length===0&&(R=[{start:0,count:e.count}]);for(let k=0,C=R.length;k<C;++k){const T=R[k],W=T.start,j=T.count;for(let H=W,K=W+j;H<K;H+=3)_(e.getX(H+0),e.getX(H+1),e.getX(H+2))}const E=new U,L=new U,B=new U,N=new U;function D(k){B.fromBufferAttribute(i,k),N.copy(B);const C=l[k];E.copy(C),E.sub(B.multiplyScalar(B.dot(C))).normalize(),L.crossVectors(N,C);const W=L.dot(u[k])<0?-1:1;c.setXYZW(k,E.x,E.y,E.z,W)}for(let k=0,C=R.length;k<C;++k){const T=R[k],W=T.start,j=T.count;for(let H=W,K=W+j;H<K;H+=3)D(e.getX(H+0)),D(e.getX(H+1)),D(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 cn(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let m=0,v=n.count;m<v;m++)n.setXYZ(m,0,0,0);const i=new U,o=new U,c=new U,l=new U,u=new U,f=new U,d=new U,p=new U;if(e)for(let m=0,v=e.count;m<v;m+=3){const S=e.getX(m+0),b=e.getX(m+1),x=e.getX(m+2);i.fromBufferAttribute(t,S),o.fromBufferAttribute(t,b),c.fromBufferAttribute(t,x),d.subVectors(c,o),p.subVectors(i,o),d.cross(p),l.fromBufferAttribute(n,S),u.fromBufferAttribute(n,b),f.fromBufferAttribute(n,x),l.add(d),u.add(d),f.add(d),n.setXYZ(S,l.x,l.y,l.z),n.setXYZ(b,u.x,u.y,u.z),n.setXYZ(x,f.x,f.y,f.z)}else for(let m=0,v=t.count;m<v;m+=3)i.fromBufferAttribute(t,m+0),o.fromBufferAttribute(t,m+1),c.fromBufferAttribute(t,m+2),d.subVectors(c,o),p.subVectors(i,o),d.cross(p),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++)dn.fromBufferAttribute(e,t),dn.normalize(),e.setXYZ(t,dn.x,dn.y,dn.z)}toNonIndexed(){function e(l,u){const f=l.array,d=l.itemSize,p=l.normalized,m=new f.constructor(u.length*d);let v=0,S=0;for(let b=0,x=u.length;b<x;b++){l.isInterleavedBufferAttribute?v=u[b]*l.data.stride+l.offset:v=u[b]*d;for(let _=0;_<d;_++)m[S++]=f[v++]}return new cn(m,d,p)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new $t,n=this.index.array,i=this.attributes;for(const l in i){const u=i[l],f=e(u,n);t.setAttribute(l,f)}const o=this.morphAttributes;for(const l in o){const u=[],f=o[l];for(let d=0,p=f.length;d<p;d++){const m=f[d],v=e(m,n);u.push(v)}t.morphAttributes[l]=u}t.morphTargetsRelative=this.morphTargetsRelative;const c=this.groups;for(let l=0,u=c.length;l<u;l++){const f=c[l];t.addGroup(f.start,f.count,f.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,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 f in u)u[f]!==void 0&&(e[f]=u[f]);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 f=n[u];e.data.attributes[u]=f.toJSON(e.data)}const i={};let o=!1;for(const u in this.morphAttributes){const f=this.morphAttributes[u],d=[];for(let p=0,m=f.length;p<m;p++){const v=f[p];d.push(v.toJSON(e.data))}d.length>0&&(i[u]=d,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const c=this.groups;c.length>0&&(e.data.groups=JSON.parse(JSON.stringify(c)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const f in i){const d=i[f];this.setAttribute(f,d.clone(t))}const o=e.morphAttributes;for(const f in o){const d=[],p=o[f];for(let m=0,v=p.length;m<v;m++)d.push(p[m].clone(t));this.morphAttributes[f]=d}this.morphTargetsRelative=e.morphTargetsRelative;const c=e.groups;for(let f=0,d=c.length;f<d;f++){const p=c[f];this.addGroup(p.start,p.count,p.materialIndex)}const l=e.boundingBox;l!==null&&(this.boundingBox=l.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"})}}const vm=new $e,$r=new vo,Sc=new Hi,xm=new U,Vs=new U,Ws=new U,Xs=new U,Kh=new U,Mc=new U,Ec=new Ie,bc=new Ie,Tc=new Ie,ym=new U,Sm=new U,Mm=new U,Ac=new U,wc=new U;class ye extends _t{constructor(e=new $t,t=new Ni){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,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 o=0,c=i.length;o<c;o++){const l=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=o}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,o=n.morphAttributes.position,c=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const l=this.morphTargetInfluences;if(o&&l){Mc.set(0,0,0);for(let u=0,f=o.length;u<f;u++){const d=l[u],p=o[u];d!==0&&(Kh.fromBufferAttribute(p,e),c?Mc.addScaledVector(Kh,d):Mc.addScaledVector(Kh.sub(t),d))}t.add(Mc)}return t}raycast(e,t){const n=this.geometry,i=this.material,o=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Sc.copy(n.boundingSphere),Sc.applyMatrix4(o),$r.copy(e.ray).recast(e.near),!(Sc.containsPoint($r.origin)===!1&&($r.intersectSphere(Sc,xm)===null||$r.origin.distanceToSquared(xm)>(e.far-e.near)**2))&&(vm.copy(o).invert(),$r.copy(e.ray).applyMatrix4(vm),!(n.boundingBox!==null&&$r.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,$r)))}_computeIntersections(e,t,n){let i;const o=this.geometry,c=this.material,l=o.index,u=o.attributes.position,f=o.attributes.uv,d=o.attributes.uv1,p=o.attributes.normal,m=o.groups,v=o.drawRange;if(l!==null)if(Array.isArray(c))for(let S=0,b=m.length;S<b;S++){const x=m[S],_=c[x.materialIndex],R=Math.max(x.start,v.start),E=Math.min(l.count,Math.min(x.start+x.count,v.start+v.count));for(let L=R,B=E;L<B;L+=3){const N=l.getX(L),D=l.getX(L+1),k=l.getX(L+2);i=Rc(this,_,e,n,f,d,p,N,D,k),i&&(i.faceIndex=Math.floor(L/3),i.face.materialIndex=x.materialIndex,t.push(i))}}else{const S=Math.max(0,v.start),b=Math.min(l.count,v.start+v.count);for(let x=S,_=b;x<_;x+=3){const R=l.getX(x),E=l.getX(x+1),L=l.getX(x+2);i=Rc(this,c,e,n,f,d,p,R,E,L),i&&(i.faceIndex=Math.floor(x/3),t.push(i))}}else if(u!==void 0)if(Array.isArray(c))for(let S=0,b=m.length;S<b;S++){const x=m[S],_=c[x.materialIndex],R=Math.max(x.start,v.start),E=Math.min(u.count,Math.min(x.start+x.count,v.start+v.count));for(let L=R,B=E;L<B;L+=3){const N=L,D=L+1,k=L+2;i=Rc(this,_,e,n,f,d,p,N,D,k),i&&(i.faceIndex=Math.floor(L/3),i.face.materialIndex=x.materialIndex,t.push(i))}}else{const S=Math.max(0,v.start),b=Math.min(u.count,v.start+v.count);for(let x=S,_=b;x<_;x+=3){const R=x,E=x+1,L=x+2;i=Rc(this,c,e,n,f,d,p,R,E,L),i&&(i.faceIndex=Math.floor(x/3),t.push(i))}}}}function vT(s,e,t,n,i,o,c,l){let u;if(e.side===Vn?u=n.intersectTriangle(c,o,i,!0,l):u=n.intersectTriangle(i,o,c,e.side===Fi,l),u===null)return null;wc.copy(l),wc.applyMatrix4(s.matrixWorld);const f=t.ray.origin.distanceTo(wc);return f<t.near||f>t.far?null:{distance:f,point:wc.clone(),object:s}}function Rc(s,e,t,n,i,o,c,l,u,f){s.getVertexPosition(l,Vs),s.getVertexPosition(u,Ws),s.getVertexPosition(f,Xs);const d=vT(s,e,t,n,Vs,Ws,Xs,Ac);if(d){i&&(Ec.fromBufferAttribute(i,l),bc.fromBufferAttribute(i,u),Tc.fromBufferAttribute(i,f),d.uv=Mi.getInterpolation(Ac,Vs,Ws,Xs,Ec,bc,Tc,new Ie)),o&&(Ec.fromBufferAttribute(o,l),bc.fromBufferAttribute(o,u),Tc.fromBufferAttribute(o,f),d.uv1=Mi.getInterpolation(Ac,Vs,Ws,Xs,Ec,bc,Tc,new Ie)),c&&(ym.fromBufferAttribute(c,l),Sm.fromBufferAttribute(c,u),Mm.fromBufferAttribute(c,f),d.normal=Mi.getInterpolation(Ac,Vs,Ws,Xs,ym,Sm,Mm,new U),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));const p={a:l,b:u,c:f,normal:new U,materialIndex:0};Mi.getNormal(Vs,Ws,Xs,p.normal),d.face=p}return d}class jt extends $t{constructor(e=1,t=1,n=1,i=1,o=1,c=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:c};const l=this;i=Math.floor(i),o=Math.floor(o),c=Math.floor(c);const u=[],f=[],d=[],p=[];let m=0,v=0;S("z","y","x",-1,-1,n,t,e,c,o,0),S("z","y","x",1,-1,n,t,-e,c,o,1),S("x","z","y",1,1,e,n,t,i,c,2),S("x","z","y",1,-1,e,n,-t,i,c,3),S("x","y","z",1,-1,e,t,n,i,o,4),S("x","y","z",-1,-1,e,t,-n,i,o,5),this.setIndex(u),this.setAttribute("position",new Nt(f,3)),this.setAttribute("normal",new Nt(d,3)),this.setAttribute("uv",new Nt(p,2));function S(b,x,_,R,E,L,B,N,D,k,C){const T=L/D,W=B/k,j=L/2,H=B/2,K=N/2,ne=D+1,he=k+1;let me=0,$=0;const fe=new U;for(let pe=0;pe<he;pe++){const Ee=pe*W-H;for(let Je=0;Je<ne;Je++){const bt=Je*T-j;fe[b]=bt*R,fe[x]=Ee*E,fe[_]=K,f.push(fe.x,fe.y,fe.z),fe[b]=0,fe[x]=0,fe[_]=N>0?1:-1,d.push(fe.x,fe.y,fe.z),p.push(Je/D),p.push(1-pe/k),me+=1}}for(let pe=0;pe<k;pe++)for(let Ee=0;Ee<D;Ee++){const Je=m+Ee+ne*pe,bt=m+Ee+ne*(pe+1),ie=m+(Ee+1)+ne*(pe+1),_e=m+(Ee+1)+ne*pe;u.push(Je,bt,_e),u.push(bt,ie,_e),$+=6}l.addGroup(v,$,C),v+=$,m+=me}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new jt(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function mo(s){const e={};for(const t in s){e[t]={};for(const n in s[t]){const i=s[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("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 Un(s){const e={};for(let t=0;t<s.length;t++){const n=mo(s[t]);for(const i in n)e[i]=n[i]}return e}function xT(s){const e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}function a_(s){const e=s.getRenderTarget();return e===null?s.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ct.workingColorSpace}const yT={clone:mo,merge:Un};var ST=`void main() {
|
|
5
|
+
*/const ef="163",Bs={ROTATE:0,DOLLY:1,PAN:2},zs={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},eb=0,Up=1,tb=2,qg=1,Kg=2,mr=3,Yi=0,Xn=1,Ai=2,Wr=0,fo=1,Np=2,Fp=3,Bp=4,nb=5,ps=100,ib=101,rb=102,sb=103,ob=104,ab=200,cb=201,lb=202,ub=203,Lh=204,Ih=205,hb=206,fb=207,db=208,pb=209,mb=210,gb=211,_b=212,vb=213,xb=214,yb=0,Sb=1,Mb=2,ll=3,Eb=4,bb=5,Tb=6,Ab=7,Zg=0,wb=1,Rb=2,yr=0,Cb=1,Pb=2,Lb=3,Ib=4,Db=5,Ob=6,Ub=7,zp="attached",Nb="detached",$g=300,_o=301,vo=302,Dh=303,Oh=304,xl=306,_s=1e3,gr=1001,ba=1002,zn=1003,Jg=1004,ha=1005,Wn=1006,rl=1007,_r=1008,Xr=1009,Fb=1010,Bb=1011,Qg=1012,e_=1013,xo=1014,Vi=1015,ul=1016,t_=1017,n_=1018,Ca=1020,zb=35902,kb=1021,Hb=1022,Ci=1023,Gb=1024,Vb=1025,po=1026,Ta=1027,i_=1028,r_=1029,Wb=1030,s_=1031,o_=1033,Fu=33776,Bu=33777,zu=33778,ku=33779,kp=35840,Hp=35841,Gp=35842,Vp=35843,a_=36196,Wp=37492,Xp=37496,Yp=37808,jp=37809,qp=37810,Kp=37811,Zp=37812,$p=37813,Jp=37814,Qp=37815,em=37816,tm=37817,nm=37818,im=37819,rm=37820,sm=37821,Hu=36492,om=36494,am=36495,Xb=36283,cm=36284,lm=36285,um=36286,Aa=2300,yo=2301,Gu=2302,hm=2400,fm=2401,dm=2402,Yb=2500,jb=0,c_=1,Uh=2,qb=3200,Kb=3201,l_=0,Zb=1,Fn="",ln="srgb",yn="srgb-linear",tf="display-p3",yl="display-p3-linear",hl="linear",Gt="srgb",fl="rec709",dl="p3",ks=7680,pm=519,$b=512,Jb=513,Qb=514,u_=515,eT=516,tT=517,nT=518,iT=519,Nh=35044,mm="300 es",vr=2e3,pl=2001;class ys{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 r=this._listeners[e];if(r!==void 0){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let o=0,c=r.length;o<c;o++)r[o].call(this,e);e.target=null}}}const Tn=["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","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let gm=1234567;const xa=Math.PI/180,So=180/Math.PI;function Pi(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Tn[i&255]+Tn[i>>8&255]+Tn[i>>16&255]+Tn[i>>24&255]+"-"+Tn[e&255]+Tn[e>>8&255]+"-"+Tn[e>>16&15|64]+Tn[e>>24&255]+"-"+Tn[t&63|128]+Tn[t>>8&255]+"-"+Tn[t>>16&255]+Tn[t>>24&255]+Tn[n&255]+Tn[n>>8&255]+Tn[n>>16&255]+Tn[n>>24&255]).toLowerCase()}function xn(i,e,t){return Math.max(e,Math.min(t,i))}function nf(i,e){return(i%e+e)%e}function rT(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function sT(i,e,t){return i!==e?(t-i)/(e-i):0}function ya(i,e,t){return(1-t)*i+t*e}function oT(i,e,t,n){return ya(i,e,1-Math.exp(-t*n))}function aT(i,e=1){return e-Math.abs(nf(i,e*2)-e)}function cT(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function lT(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function uT(i,e){return i+Math.floor(Math.random()*(e-i+1))}function hT(i,e){return i+Math.random()*(e-i)}function fT(i){return i*(.5-Math.random())}function dT(i){i!==void 0&&(gm=i);let e=gm+=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 pT(i){return i*xa}function mT(i){return i*So}function gT(i){return(i&i-1)===0&&i!==0}function _T(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function vT(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function xT(i,e,t,n,r){const o=Math.cos,c=Math.sin,l=o(t/2),h=c(t/2),f=o((e+n)/2),d=c((e+n)/2),p=o((e-n)/2),m=c((e-n)/2),x=o((n-e)/2),M=c((n-e)/2);switch(r){case"XYX":i.set(l*d,h*p,h*m,l*f);break;case"YZY":i.set(h*m,l*d,h*p,l*f);break;case"ZXZ":i.set(h*p,h*m,l*d,l*f);break;case"XZX":i.set(l*d,h*M,h*x,l*f);break;case"YXY":i.set(h*x,l*d,h*M,l*f);break;case"ZYZ":i.set(h*M,h*x,l*d,l*f);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function wi(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function Lt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const ji={DEG2RAD:xa,RAD2DEG:So,generateUUID:Pi,clamp:xn,euclideanModulo:nf,mapLinear:rT,inverseLerp:sT,lerp:ya,damp:oT,pingpong:aT,smoothstep:cT,smootherstep:lT,randInt:uT,randFloat:hT,randFloatSpread:fT,seededRandom:dT,degToRad:pT,radToDeg:mT,isPowerOfTwo:gT,ceilPowerOfTwo:_T,floorPowerOfTwo:vT,setQuaternionFromProperEuler:xT,normalize:Lt,denormalize:wi};class Pe{constructor(e=0,t=0){Pe.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}sub(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,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=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(xn(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),r=Math.sin(t),o=this.x-e.x,c=this.y-e.y;return this.x=o*n-c*r+e.x,this.y=o*r+c*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ht{constructor(e,t,n,r,o,c,l,h,f){ht.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,o,c,l,h,f)}set(e,t,n,r,o,c,l,h,f){const d=this.elements;return d[0]=e,d[1]=r,d[2]=l,d[3]=t,d[4]=o,d[5]=h,d[6]=n,d[7]=c,d[8]=f,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,r=t.elements,o=this.elements,c=n[0],l=n[3],h=n[6],f=n[1],d=n[4],p=n[7],m=n[2],x=n[5],M=n[8],A=r[0],v=r[3],_=r[6],C=r[1],b=r[4],L=r[7],k=r[2],U=r[5],O=r[8];return o[0]=c*A+l*C+h*k,o[3]=c*v+l*b+h*U,o[6]=c*_+l*L+h*O,o[1]=f*A+d*C+p*k,o[4]=f*v+d*b+p*U,o[7]=f*_+d*L+p*O,o[2]=m*A+x*C+M*k,o[5]=m*v+x*b+M*U,o[8]=m*_+x*L+M*O,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],r=e[2],o=e[3],c=e[4],l=e[5],h=e[6],f=e[7],d=e[8];return t*c*d-t*l*f-n*o*d+n*l*h+r*o*f-r*c*h}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],o=e[3],c=e[4],l=e[5],h=e[6],f=e[7],d=e[8],p=d*c-l*f,m=l*h-d*o,x=f*o-c*h,M=t*p+n*m+r*x;if(M===0)return this.set(0,0,0,0,0,0,0,0,0);const A=1/M;return e[0]=p*A,e[1]=(r*f-d*n)*A,e[2]=(l*n-r*c)*A,e[3]=m*A,e[4]=(d*t-r*h)*A,e[5]=(r*o-l*t)*A,e[6]=x*A,e[7]=(n*h-f*t)*A,e[8]=(c*t-n*o)*A,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,r,o,c,l){const h=Math.cos(o),f=Math.sin(o);return this.set(n*h,n*f,-n*(h*c+f*l)+c+e,-r*f,r*h,-r*(-f*c+h*l)+l+t,0,0,1),this}scale(e,t){return this.premultiply(Vu.makeScale(e,t)),this}rotate(e){return this.premultiply(Vu.makeRotation(-e)),this}translate(e,t){return this.premultiply(Vu.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 r=0;r<9;r++)if(t[r]!==n[r])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 Vu=new ht;function h_(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function wa(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function yT(){const i=wa("canvas");return i.style.display="block",i}const _m={};function f_(i){i in _m||(_m[i]=!0,console.warn(i))}const vm=new ht().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),xm=new ht().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Mc={[yn]:{transfer:hl,primaries:fl,toReference:i=>i,fromReference:i=>i},[ln]:{transfer:Gt,primaries:fl,toReference:i=>i.convertSRGBToLinear(),fromReference:i=>i.convertLinearToSRGB()},[yl]:{transfer:hl,primaries:dl,toReference:i=>i.applyMatrix3(xm),fromReference:i=>i.applyMatrix3(vm)},[tf]:{transfer:Gt,primaries:dl,toReference:i=>i.convertSRGBToLinear().applyMatrix3(xm),fromReference:i=>i.applyMatrix3(vm).convertLinearToSRGB()}},ST=new Set([yn,yl]),Ct={enabled:!0,_workingColorSpace:yn,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!ST.has(i))throw new Error(`Unsupported working color space, "${i}".`);this._workingColorSpace=i},convert:function(i,e,t){if(this.enabled===!1||e===t||!e||!t)return i;const n=Mc[e].toReference,r=Mc[t].fromReference;return r(n(i))},fromWorkingColorSpace:function(i,e){return this.convert(i,this._workingColorSpace,e)},toWorkingColorSpace:function(i,e){return this.convert(i,e,this._workingColorSpace)},getPrimaries:function(i){return Mc[i].primaries},getTransfer:function(i){return i===Fn?hl:Mc[i].transfer}};function mo(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Wu(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Hs;class MT{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Hs===void 0&&(Hs=wa("canvas")),Hs.width=e.width,Hs.height=e.height;const n=Hs.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Hs}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=wa("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),o=r.data;for(let c=0;c<o.length;c++)o[c]=mo(o[c]/255)*255;return n.putImageData(r,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(mo(t[n]/255)*255):t[n]=mo(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let ET=0;class d_{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ET++}),this.uuid=Pi(),this.data=e,this.dataReady=!0,this.version=0}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:""},r=this.data;if(r!==null){let o;if(Array.isArray(r)){o=[];for(let c=0,l=r.length;c<l;c++)r[c].isDataTexture?o.push(Xu(r[c].image)):o.push(Xu(r[c]))}else o=Xu(r);n.url=o}return t||(e.images[this.uuid]=n),n}}function Xu(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?MT.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let bT=0;class un extends ys{constructor(e=un.DEFAULT_IMAGE,t=un.DEFAULT_MAPPING,n=gr,r=gr,o=Wn,c=_r,l=Ci,h=Xr,f=un.DEFAULT_ANISOTROPY,d=Fn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:bT++}),this.uuid=Pi(),this.name="",this.source=new d_(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=o,this.minFilter=c,this.anisotropy=f,this.format=l,this.internalFormat=null,this.type=h,this.offset=new Pe(0,0),this.repeat=new Pe(1,1),this.center=new Pe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ht,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}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)}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.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,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!==$g)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case _s:e.x=e.x-Math.floor(e.x);break;case gr:e.x=e.x<0?0:1;break;case ba: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 _s:e.y=e.y-Math.floor(e.y);break;case gr:e.y=e.y<0?0:1;break;case ba: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++}}un.DEFAULT_IMAGE=null;un.DEFAULT_MAPPING=$g;un.DEFAULT_ANISOTROPY=1;class Dt{constructor(e=0,t=0,n=0,r=1){Dt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}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,r){return this.x=e,this.y=t,this.z=n,this.w=r,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,r=this.z,o=this.w,c=e.elements;return this.x=c[0]*t+c[4]*n+c[8]*r+c[12]*o,this.y=c[1]*t+c[5]*n+c[9]*r+c[13]*o,this.z=c[2]*t+c[6]*n+c[10]*r+c[14]*o,this.w=c[3]*t+c[7]*n+c[11]*r+c[15]*o,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,r,o;const h=e.elements,f=h[0],d=h[4],p=h[8],m=h[1],x=h[5],M=h[9],A=h[2],v=h[6],_=h[10];if(Math.abs(d-m)<.01&&Math.abs(p-A)<.01&&Math.abs(M-v)<.01){if(Math.abs(d+m)<.1&&Math.abs(p+A)<.1&&Math.abs(M+v)<.1&&Math.abs(f+x+_-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const b=(f+1)/2,L=(x+1)/2,k=(_+1)/2,U=(d+m)/4,O=(p+A)/4,I=(M+v)/4;return b>L&&b>k?b<.01?(n=0,r=.707106781,o=.707106781):(n=Math.sqrt(b),r=U/n,o=O/n):L>k?L<.01?(n=.707106781,r=0,o=.707106781):(r=Math.sqrt(L),n=U/r,o=I/r):k<.01?(n=.707106781,r=.707106781,o=0):(o=Math.sqrt(k),n=O/o,r=I/o),this.set(n,r,o,t),this}let C=Math.sqrt((v-M)*(v-M)+(p-A)*(p-A)+(m-d)*(m-d));return Math.abs(C)<.001&&(C=1),this.x=(v-M)/C,this.y=(p-A)/C,this.z=(m-d)/C,this.w=Math.acos((f+x+_-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=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 TT extends ys{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Dt(0,0,e,t),this.scissorTest=!1,this.viewport=new Dt(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Wn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},n);const o=new un(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);o.flipY=!1,o.generateMipmaps=n.generateMipmaps,o.internalFormat=n.internalFormat,this.textures=[];const c=n.count;for(let l=0;l<c;l++)this.textures[l]=o.clone(),this.textures[l].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}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 r=0,o=this.textures.length;r<o;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){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 n=0,r=e.textures.length;n<r;n++)this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new d_(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class vs extends TT{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class p_ extends un{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=zn,this.minFilter=zn,this.wrapR=gr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class AT extends un{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=zn,this.minFilter=zn,this.wrapR=gr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class on{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,o,c,l){let h=n[r+0],f=n[r+1],d=n[r+2],p=n[r+3];const m=o[c+0],x=o[c+1],M=o[c+2],A=o[c+3];if(l===0){e[t+0]=h,e[t+1]=f,e[t+2]=d,e[t+3]=p;return}if(l===1){e[t+0]=m,e[t+1]=x,e[t+2]=M,e[t+3]=A;return}if(p!==A||h!==m||f!==x||d!==M){let v=1-l;const _=h*m+f*x+d*M+p*A,C=_>=0?1:-1,b=1-_*_;if(b>Number.EPSILON){const k=Math.sqrt(b),U=Math.atan2(k,_*C);v=Math.sin(v*U)/k,l=Math.sin(l*U)/k}const L=l*C;if(h=h*v+m*L,f=f*v+x*L,d=d*v+M*L,p=p*v+A*L,v===1-l){const k=1/Math.sqrt(h*h+f*f+d*d+p*p);h*=k,f*=k,d*=k,p*=k}}e[t]=h,e[t+1]=f,e[t+2]=d,e[t+3]=p}static multiplyQuaternionsFlat(e,t,n,r,o,c){const l=n[r],h=n[r+1],f=n[r+2],d=n[r+3],p=o[c],m=o[c+1],x=o[c+2],M=o[c+3];return e[t]=l*M+d*p+h*x-f*m,e[t+1]=h*M+d*m+f*p-l*x,e[t+2]=f*M+d*x+l*m-h*p,e[t+3]=d*M-l*p-h*m-f*x,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,r){return this._x=e,this._y=t,this._z=n,this._w=r,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,r=e._y,o=e._z,c=e._order,l=Math.cos,h=Math.sin,f=l(n/2),d=l(r/2),p=l(o/2),m=h(n/2),x=h(r/2),M=h(o/2);switch(c){case"XYZ":this._x=m*d*p+f*x*M,this._y=f*x*p-m*d*M,this._z=f*d*M+m*x*p,this._w=f*d*p-m*x*M;break;case"YXZ":this._x=m*d*p+f*x*M,this._y=f*x*p-m*d*M,this._z=f*d*M-m*x*p,this._w=f*d*p+m*x*M;break;case"ZXY":this._x=m*d*p-f*x*M,this._y=f*x*p+m*d*M,this._z=f*d*M+m*x*p,this._w=f*d*p-m*x*M;break;case"ZYX":this._x=m*d*p-f*x*M,this._y=f*x*p+m*d*M,this._z=f*d*M-m*x*p,this._w=f*d*p+m*x*M;break;case"YZX":this._x=m*d*p+f*x*M,this._y=f*x*p+m*d*M,this._z=f*d*M-m*x*p,this._w=f*d*p-m*x*M;break;case"XZY":this._x=m*d*p-f*x*M,this._y=f*x*p-m*d*M,this._z=f*d*M+m*x*p,this._w=f*d*p+m*x*M;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+c)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],o=t[8],c=t[1],l=t[5],h=t[9],f=t[2],d=t[6],p=t[10],m=n+l+p;if(m>0){const x=.5/Math.sqrt(m+1);this._w=.25/x,this._x=(d-h)*x,this._y=(o-f)*x,this._z=(c-r)*x}else if(n>l&&n>p){const x=2*Math.sqrt(1+n-l-p);this._w=(d-h)/x,this._x=.25*x,this._y=(r+c)/x,this._z=(o+f)/x}else if(l>p){const x=2*Math.sqrt(1+l-n-p);this._w=(o-f)/x,this._x=(r+c)/x,this._y=.25*x,this._z=(h+d)/x}else{const x=2*Math.sqrt(1+p-n-l);this._w=(c-r)/x,this._x=(o+f)/x,this._y=(h+d)/x,this._z=.25*x}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(xn(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),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,r=e._y,o=e._z,c=e._w,l=t._x,h=t._y,f=t._z,d=t._w;return this._x=n*d+c*l+r*f-o*h,this._y=r*d+c*h+o*l-n*f,this._z=o*d+c*f+n*h-r*l,this._w=c*d-n*l-r*h-o*f,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,o=this._z,c=this._w;let l=c*e._w+n*e._x+r*e._y+o*e._z;if(l<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,l=-l):this.copy(e),l>=1)return this._w=c,this._x=n,this._y=r,this._z=o,this;const h=1-l*l;if(h<=Number.EPSILON){const x=1-t;return this._w=x*c+t*this._w,this._x=x*n+t*this._x,this._y=x*r+t*this._y,this._z=x*o+t*this._z,this.normalize(),this}const f=Math.sqrt(h),d=Math.atan2(f,l),p=Math.sin((1-t)*d)/f,m=Math.sin(t*d)/f;return this._w=c*p+this._w*m,this._x=n*p+this._x*m,this._y=r*p+this._y*m,this._z=o*p+this._z*m,this._onChangeCallback(),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(),r=Math.sqrt(1-n),o=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),o*Math.sin(t),o*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 N{constructor(e=0,t=0,n=0){N.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(ym.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(ym.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*r,this.y=o[1]*t+o[4]*n+o[7]*r,this.z=o[2]*t+o[5]*n+o[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,o=e.elements,c=1/(o[3]*t+o[7]*n+o[11]*r+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*r+o[12])*c,this.y=(o[1]*t+o[5]*n+o[9]*r+o[13])*c,this.z=(o[2]*t+o[6]*n+o[10]*r+o[14])*c,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,o=e.x,c=e.y,l=e.z,h=e.w,f=2*(c*r-l*n),d=2*(l*t-o*r),p=2*(o*n-c*t);return this.x=t+h*f+c*p-l*d,this.y=n+h*d+l*f-o*p,this.z=r+h*p+o*d-c*f,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,r=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r,this.y=o[1]*t+o[5]*n+o[9]*r,this.z=o[2]*t+o[6]*n+o[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=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,r=e.y,o=e.z,c=t.x,l=t.y,h=t.z;return this.x=r*h-o*l,this.y=o*c-n*h,this.z=n*l-r*c,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 Yu.copy(this).projectOnVector(e),this.sub(Yu)}reflect(e){return this.sub(Yu.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(xn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}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 r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*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(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,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 Yu=new N,ym=new on;class Ii{constructor(e=new N(1/0,1/0,1/0),t=new N(-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(Si.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Si.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=Si.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 o=n.getAttribute("position");if(t===!0&&o!==void 0&&e.isInstancedMesh!==!0)for(let c=0,l=o.count;c<l;c++)e.isMesh===!0?e.getVertexPosition(c,Si):Si.fromBufferAttribute(o,c),Si.applyMatrix4(e.matrixWorld),this.expandByPoint(Si);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Ec.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Ec.copy(n.boundingBox)),Ec.applyMatrix4(e.matrixWorld),this.union(Ec)}const r=e.children;for(let o=0,c=r.length;o<c;o++)this.expandByObject(r[o],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,Si),Si.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($o),bc.subVectors(this.max,$o),Gs.subVectors(e.a,$o),Vs.subVectors(e.b,$o),Ws.subVectors(e.c,$o),Ir.subVectors(Vs,Gs),Dr.subVectors(Ws,Vs),is.subVectors(Gs,Ws);let t=[0,-Ir.z,Ir.y,0,-Dr.z,Dr.y,0,-is.z,is.y,Ir.z,0,-Ir.x,Dr.z,0,-Dr.x,is.z,0,-is.x,-Ir.y,Ir.x,0,-Dr.y,Dr.x,0,-is.y,is.x,0];return!ju(t,Gs,Vs,Ws,bc)||(t=[1,0,0,0,1,0,0,0,1],!ju(t,Gs,Vs,Ws,bc))?!1:(Tc.crossVectors(Ir,Dr),t=[Tc.x,Tc.y,Tc.z],ju(t,Gs,Vs,Ws,bc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Si).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Si).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:(lr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),lr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),lr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),lr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),lr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),lr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),lr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),lr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(lr),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 lr=[new N,new N,new N,new N,new N,new N,new N,new N],Si=new N,Ec=new Ii,Gs=new N,Vs=new N,Ws=new N,Ir=new N,Dr=new N,is=new N,$o=new N,bc=new N,Tc=new N,rs=new N;function ju(i,e,t,n,r){for(let o=0,c=i.length-3;o<=c;o+=3){rs.fromArray(i,o);const l=r.x*Math.abs(rs.x)+r.y*Math.abs(rs.y)+r.z*Math.abs(rs.z),h=e.dot(rs),f=t.dot(rs),d=n.dot(rs);if(Math.max(-Math.max(h,f,d),Math.min(h,f,d))>l)return!1}return!0}const wT=new Ii,Jo=new N,qu=new N;class Zi{constructor(e=new N,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):wT.setFromPoints(e).getCenter(n);let r=0;for(let o=0,c=e.length;o<c;o++)r=Math.max(r,n.distanceToSquared(e[o]));return this.radius=Math.sqrt(r),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;Jo.subVectors(e,this.center);const t=Jo.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Jo,r/n),this.radius+=r}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):(qu.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Jo.copy(e.center).add(qu)),this.expandByPoint(Jo.copy(e.center).sub(qu))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const ur=new N,Ku=new N,Ac=new N,Or=new N,Zu=new N,wc=new N,$u=new N;class To{constructor(e=new N,t=new N(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,ur)),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=ur.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ur.copy(this.origin).addScaledVector(this.direction,t),ur.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Ku.copy(e).add(t).multiplyScalar(.5),Ac.copy(t).sub(e).normalize(),Or.copy(this.origin).sub(Ku);const o=e.distanceTo(t)*.5,c=-this.direction.dot(Ac),l=Or.dot(this.direction),h=-Or.dot(Ac),f=Or.lengthSq(),d=Math.abs(1-c*c);let p,m,x,M;if(d>0)if(p=c*h-l,m=c*l-h,M=o*d,p>=0)if(m>=-M)if(m<=M){const A=1/d;p*=A,m*=A,x=p*(p+c*m+2*l)+m*(c*p+m+2*h)+f}else m=o,p=Math.max(0,-(c*m+l)),x=-p*p+m*(m+2*h)+f;else m=-o,p=Math.max(0,-(c*m+l)),x=-p*p+m*(m+2*h)+f;else m<=-M?(p=Math.max(0,-(-c*o+l)),m=p>0?-o:Math.min(Math.max(-o,-h),o),x=-p*p+m*(m+2*h)+f):m<=M?(p=0,m=Math.min(Math.max(-o,-h),o),x=m*(m+2*h)+f):(p=Math.max(0,-(c*o+l)),m=p>0?o:Math.min(Math.max(-o,-h),o),x=-p*p+m*(m+2*h)+f);else m=c>0?-o:o,p=Math.max(0,-(c*m+l)),x=-p*p+m*(m+2*h)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,p),r&&r.copy(Ku).addScaledVector(Ac,m),x}intersectSphere(e,t){ur.subVectors(e.center,this.origin);const n=ur.dot(this.direction),r=ur.dot(ur)-n*n,o=e.radius*e.radius;if(r>o)return null;const c=Math.sqrt(o-r),l=n-c,h=n+c;return h<0?null:l<0?this.at(h,t):this.at(l,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const 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,r,o,c,l,h;const f=1/this.direction.x,d=1/this.direction.y,p=1/this.direction.z,m=this.origin;return f>=0?(n=(e.min.x-m.x)*f,r=(e.max.x-m.x)*f):(n=(e.max.x-m.x)*f,r=(e.min.x-m.x)*f),d>=0?(o=(e.min.y-m.y)*d,c=(e.max.y-m.y)*d):(o=(e.max.y-m.y)*d,c=(e.min.y-m.y)*d),n>c||o>r||((o>n||isNaN(n))&&(n=o),(c<r||isNaN(r))&&(r=c),p>=0?(l=(e.min.z-m.z)*p,h=(e.max.z-m.z)*p):(l=(e.max.z-m.z)*p,h=(e.min.z-m.z)*p),n>h||l>r)||((l>n||n!==n)&&(n=l),(h<r||r!==r)&&(r=h),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,ur)!==null}intersectTriangle(e,t,n,r,o){Zu.subVectors(t,e),wc.subVectors(n,e),$u.crossVectors(Zu,wc);let c=this.direction.dot($u),l;if(c>0){if(r)return null;l=1}else if(c<0)l=-1,c=-c;else return null;Or.subVectors(this.origin,e);const h=l*this.direction.dot(wc.crossVectors(Or,wc));if(h<0)return null;const f=l*this.direction.dot(Zu.cross(Or));if(f<0||h+f>c)return null;const d=-l*Or.dot($u);return d<0?null:this.at(d/c,o)}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 Qe{constructor(e,t,n,r,o,c,l,h,f,d,p,m,x,M,A,v){Qe.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,r,o,c,l,h,f,d,p,m,x,M,A,v)}set(e,t,n,r,o,c,l,h,f,d,p,m,x,M,A,v){const _=this.elements;return _[0]=e,_[4]=t,_[8]=n,_[12]=r,_[1]=o,_[5]=c,_[9]=l,_[13]=h,_[2]=f,_[6]=d,_[10]=p,_[14]=m,_[3]=x,_[7]=M,_[11]=A,_[15]=v,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Qe().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 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){const t=this.elements,n=e.elements,r=1/Xs.setFromMatrixColumn(e,0).length(),o=1/Xs.setFromMatrixColumn(e,1).length(),c=1/Xs.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*o,t[7]=0,t[8]=n[8]*c,t[9]=n[9]*c,t[10]=n[10]*c,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,r=e.y,o=e.z,c=Math.cos(n),l=Math.sin(n),h=Math.cos(r),f=Math.sin(r),d=Math.cos(o),p=Math.sin(o);if(e.order==="XYZ"){const m=c*d,x=c*p,M=l*d,A=l*p;t[0]=h*d,t[4]=-h*p,t[8]=f,t[1]=x+M*f,t[5]=m-A*f,t[9]=-l*h,t[2]=A-m*f,t[6]=M+x*f,t[10]=c*h}else if(e.order==="YXZ"){const m=h*d,x=h*p,M=f*d,A=f*p;t[0]=m+A*l,t[4]=M*l-x,t[8]=c*f,t[1]=c*p,t[5]=c*d,t[9]=-l,t[2]=x*l-M,t[6]=A+m*l,t[10]=c*h}else if(e.order==="ZXY"){const m=h*d,x=h*p,M=f*d,A=f*p;t[0]=m-A*l,t[4]=-c*p,t[8]=M+x*l,t[1]=x+M*l,t[5]=c*d,t[9]=A-m*l,t[2]=-c*f,t[6]=l,t[10]=c*h}else if(e.order==="ZYX"){const m=c*d,x=c*p,M=l*d,A=l*p;t[0]=h*d,t[4]=M*f-x,t[8]=m*f+A,t[1]=h*p,t[5]=A*f+m,t[9]=x*f-M,t[2]=-f,t[6]=l*h,t[10]=c*h}else if(e.order==="YZX"){const m=c*h,x=c*f,M=l*h,A=l*f;t[0]=h*d,t[4]=A-m*p,t[8]=M*p+x,t[1]=p,t[5]=c*d,t[9]=-l*d,t[2]=-f*d,t[6]=x*p+M,t[10]=m-A*p}else if(e.order==="XZY"){const m=c*h,x=c*f,M=l*h,A=l*f;t[0]=h*d,t[4]=-p,t[8]=f*d,t[1]=m*p+A,t[5]=c*d,t[9]=x*p-M,t[2]=M*p-x,t[6]=l*d,t[10]=A*p+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(RT,e,CT)}lookAt(e,t,n){const r=this.elements;return Jn.subVectors(e,t),Jn.lengthSq()===0&&(Jn.z=1),Jn.normalize(),Ur.crossVectors(n,Jn),Ur.lengthSq()===0&&(Math.abs(n.z)===1?Jn.x+=1e-4:Jn.z+=1e-4,Jn.normalize(),Ur.crossVectors(n,Jn)),Ur.normalize(),Rc.crossVectors(Jn,Ur),r[0]=Ur.x,r[4]=Rc.x,r[8]=Jn.x,r[1]=Ur.y,r[5]=Rc.y,r[9]=Jn.y,r[2]=Ur.z,r[6]=Rc.z,r[10]=Jn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,o=this.elements,c=n[0],l=n[4],h=n[8],f=n[12],d=n[1],p=n[5],m=n[9],x=n[13],M=n[2],A=n[6],v=n[10],_=n[14],C=n[3],b=n[7],L=n[11],k=n[15],U=r[0],O=r[4],I=r[8],E=r[12],y=r[1],F=r[5],V=r[9],G=r[13],q=r[2],ne=r[6],se=r[10],pe=r[14],K=r[3],he=r[7],me=r[11],Me=r[15];return o[0]=c*U+l*y+h*q+f*K,o[4]=c*O+l*F+h*ne+f*he,o[8]=c*I+l*V+h*se+f*me,o[12]=c*E+l*G+h*pe+f*Me,o[1]=d*U+p*y+m*q+x*K,o[5]=d*O+p*F+m*ne+x*he,o[9]=d*I+p*V+m*se+x*me,o[13]=d*E+p*G+m*pe+x*Me,o[2]=M*U+A*y+v*q+_*K,o[6]=M*O+A*F+v*ne+_*he,o[10]=M*I+A*V+v*se+_*me,o[14]=M*E+A*G+v*pe+_*Me,o[3]=C*U+b*y+L*q+k*K,o[7]=C*O+b*F+L*ne+k*he,o[11]=C*I+b*V+L*se+k*me,o[15]=C*E+b*G+L*pe+k*Me,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],r=e[8],o=e[12],c=e[1],l=e[5],h=e[9],f=e[13],d=e[2],p=e[6],m=e[10],x=e[14],M=e[3],A=e[7],v=e[11],_=e[15];return M*(+o*h*p-r*f*p-o*l*m+n*f*m+r*l*x-n*h*x)+A*(+t*h*x-t*f*m+o*c*m-r*c*x+r*f*d-o*h*d)+v*(+t*f*p-t*l*x-o*c*p+n*c*x+o*l*d-n*f*d)+_*(-r*l*d-t*h*p+t*l*m+r*c*p-n*c*m+n*h*d)}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 r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],o=e[3],c=e[4],l=e[5],h=e[6],f=e[7],d=e[8],p=e[9],m=e[10],x=e[11],M=e[12],A=e[13],v=e[14],_=e[15],C=p*v*f-A*m*f+A*h*x-l*v*x-p*h*_+l*m*_,b=M*m*f-d*v*f-M*h*x+c*v*x+d*h*_-c*m*_,L=d*A*f-M*p*f+M*l*x-c*A*x-d*l*_+c*p*_,k=M*p*h-d*A*h-M*l*m+c*A*m+d*l*v-c*p*v,U=t*C+n*b+r*L+o*k;if(U===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const O=1/U;return e[0]=C*O,e[1]=(A*m*o-p*v*o-A*r*x+n*v*x+p*r*_-n*m*_)*O,e[2]=(l*v*o-A*h*o+A*r*f-n*v*f-l*r*_+n*h*_)*O,e[3]=(p*h*o-l*m*o-p*r*f+n*m*f+l*r*x-n*h*x)*O,e[4]=b*O,e[5]=(d*v*o-M*m*o+M*r*x-t*v*x-d*r*_+t*m*_)*O,e[6]=(M*h*o-c*v*o-M*r*f+t*v*f+c*r*_-t*h*_)*O,e[7]=(c*m*o-d*h*o+d*r*f-t*m*f-c*r*x+t*h*x)*O,e[8]=L*O,e[9]=(M*p*o-d*A*o-M*n*x+t*A*x+d*n*_-t*p*_)*O,e[10]=(c*A*o-M*l*o+M*n*f-t*A*f-c*n*_+t*l*_)*O,e[11]=(d*l*o-c*p*o-d*n*f+t*p*f+c*n*x-t*l*x)*O,e[12]=k*O,e[13]=(d*A*r-M*p*r+M*n*m-t*A*m-d*n*v+t*p*v)*O,e[14]=(M*l*r-c*A*r-M*n*h+t*A*h+c*n*v-t*l*v)*O,e[15]=(c*p*r-d*l*r+d*n*h-t*p*h-c*n*m+t*l*m)*O,this}scale(e){const t=this.elements,n=e.x,r=e.y,o=e.z;return t[0]*=n,t[4]*=r,t[8]*=o,t[1]*=n,t[5]*=r,t[9]*=o,t[2]*=n,t[6]*=r,t[10]*=o,t[3]*=n,t[7]*=r,t[11]*=o,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],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}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),r=Math.sin(t),o=1-n,c=e.x,l=e.y,h=e.z,f=o*c,d=o*l;return this.set(f*c+n,f*l-r*h,f*h+r*l,0,f*l+r*h,d*l+n,d*h-r*c,0,f*h-r*l,d*h+r*c,o*h*h+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,r,o,c){return this.set(1,n,o,0,e,1,c,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,o=t._x,c=t._y,l=t._z,h=t._w,f=o+o,d=c+c,p=l+l,m=o*f,x=o*d,M=o*p,A=c*d,v=c*p,_=l*p,C=h*f,b=h*d,L=h*p,k=n.x,U=n.y,O=n.z;return r[0]=(1-(A+_))*k,r[1]=(x+L)*k,r[2]=(M-b)*k,r[3]=0,r[4]=(x-L)*U,r[5]=(1-(m+_))*U,r[6]=(v+C)*U,r[7]=0,r[8]=(M+b)*O,r[9]=(v-C)*O,r[10]=(1-(m+A))*O,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let o=Xs.set(r[0],r[1],r[2]).length();const c=Xs.set(r[4],r[5],r[6]).length(),l=Xs.set(r[8],r[9],r[10]).length();this.determinant()<0&&(o=-o),e.x=r[12],e.y=r[13],e.z=r[14],Mi.copy(this);const f=1/o,d=1/c,p=1/l;return Mi.elements[0]*=f,Mi.elements[1]*=f,Mi.elements[2]*=f,Mi.elements[4]*=d,Mi.elements[5]*=d,Mi.elements[6]*=d,Mi.elements[8]*=p,Mi.elements[9]*=p,Mi.elements[10]*=p,t.setFromRotationMatrix(Mi),n.x=o,n.y=c,n.z=l,this}makePerspective(e,t,n,r,o,c,l=vr){const h=this.elements,f=2*o/(t-e),d=2*o/(n-r),p=(t+e)/(t-e),m=(n+r)/(n-r);let x,M;if(l===vr)x=-(c+o)/(c-o),M=-2*c*o/(c-o);else if(l===pl)x=-c/(c-o),M=-c*o/(c-o);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return h[0]=f,h[4]=0,h[8]=p,h[12]=0,h[1]=0,h[5]=d,h[9]=m,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,r,o,c,l=vr){const h=this.elements,f=1/(t-e),d=1/(n-r),p=1/(c-o),m=(t+e)*f,x=(n+r)*d;let M,A;if(l===vr)M=(c+o)*p,A=-2*p;else if(l===pl)M=o*p,A=-1*p;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return h[0]=2*f,h[4]=0,h[8]=0,h[12]=-m,h[1]=0,h[5]=2*d,h[9]=0,h[13]=-x,h[2]=0,h[6]=0,h[10]=A,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 r=0;r<16;r++)if(t[r]!==n[r])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 Xs=new N,Mi=new Qe,RT=new N(0,0,0),CT=new N(1,1,1),Ur=new N,Rc=new N,Jn=new N,Sm=new Qe,Mm=new on;class Li{constructor(e=0,t=0,n=0,r=Li.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}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,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,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 r=e.elements,o=r[0],c=r[4],l=r[8],h=r[1],f=r[5],d=r[9],p=r[2],m=r[6],x=r[10];switch(t){case"XYZ":this._y=Math.asin(xn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,x),this._z=Math.atan2(-c,o)):(this._x=Math.atan2(m,f),this._z=0);break;case"YXZ":this._x=Math.asin(-xn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(l,x),this._z=Math.atan2(h,f)):(this._y=Math.atan2(-p,o),this._z=0);break;case"ZXY":this._x=Math.asin(xn(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-p,x),this._z=Math.atan2(-c,f)):(this._y=0,this._z=Math.atan2(h,o));break;case"ZYX":this._y=Math.asin(-xn(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(m,x),this._z=Math.atan2(h,o)):(this._x=0,this._z=Math.atan2(-c,f));break;case"YZX":this._z=Math.asin(xn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-d,f),this._y=Math.atan2(-p,o)):(this._x=0,this._y=Math.atan2(l,x));break;case"XZY":this._z=Math.asin(-xn(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(m,f),this._y=Math.atan2(l,o)):(this._x=Math.atan2(-d,x),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Sm.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Sm,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Mm.setFromEuler(this),this.setFromQuaternion(Mm,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}}Li.DEFAULT_ORDER="XYZ";class rf{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 PT=0;const Em=new N,Ys=new on,hr=new Qe,Cc=new N,Qo=new N,LT=new N,IT=new on,bm=new N(1,0,0),Tm=new N(0,1,0),Am=new N(0,0,1),wm={type:"added"},DT={type:"removed"},js={type:"childadded",child:null},Ju={type:"childremoved",child:null};class mt extends ys{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:PT++}),this.uuid=Pi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=mt.DEFAULT_UP.clone();const e=new N,t=new Li,n=new on,r=new N(1,1,1);function o(){n.setFromEuler(t,!1)}function c(){t.setFromQuaternion(n,void 0,!1)}t._onChange(o),n._onChange(c),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:r},modelViewMatrix:{value:new Qe},normalMatrix:{value:new ht}}),this.matrix=new Qe,this.matrixWorld=new Qe,this.matrixAutoUpdate=mt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=mt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new rf,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Ys.setFromAxisAngle(e,t),this.quaternion.multiply(Ys),this}rotateOnWorldAxis(e,t){return Ys.setFromAxisAngle(e,t),this.quaternion.premultiply(Ys),this}rotateX(e){return this.rotateOnAxis(bm,e)}rotateY(e){return this.rotateOnAxis(Tm,e)}rotateZ(e){return this.rotateOnAxis(Am,e)}translateOnAxis(e,t){return Em.copy(e).applyQuaternion(this.quaternion),this.position.add(Em.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(bm,e)}translateY(e){return this.translateOnAxis(Tm,e)}translateZ(e){return this.translateOnAxis(Am,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(hr.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Cc.copy(e):Cc.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Qo.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?hr.lookAt(Qo,Cc,this.up):hr.lookAt(Cc,Qo,this.up),this.quaternion.setFromRotationMatrix(hr),r&&(hr.extractRotation(r.matrixWorld),Ys.setFromRotationMatrix(hr),this.quaternion.premultiply(Ys.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.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(wm),js.child=e,this.dispatchEvent(js),js.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(DT),Ju.child=e,this.dispatchEvent(Ju),Ju.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),hr.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),hr.multiply(e.parent.matrixWorld)),e.applyMatrix4(hr),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(wm),js.child=e,this.dispatchEvent(js),js.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,r=this.children.length;n<r;n++){const c=this.children[n].getObjectByProperty(e,t);if(c!==void 0)return c}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let o=0,c=r.length;o<c;o++)r[o].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(Qo,e,LT),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Qo,IT,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,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;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),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++){const o=t[n];(o.matrixWorldAutoUpdate===!0||e===!0)&&o.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const r=this.children;for(let o=0,c=r.length;o<c;o++){const l=r[o];l.matrixWorldAutoUpdate===!0&&l.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.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(l=>({boxInitialized:l.boxInitialized,boxMin:l.box.min.toArray(),boxMax:l.box.max.toArray(),sphereInitialized:l.sphereInitialized,sphereRadius:l.sphere.radius,sphereCenter:l.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function o(l,h){return l[h.uuid]===void 0&&(l[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=o(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const h=l.shapes;if(Array.isArray(h))for(let f=0,d=h.length;f<d;f++){const p=h[f];o(e.shapes,p)}else o(e.shapes,h)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(o(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const l=[];for(let h=0,f=this.material.length;h<f;h++)l.push(o(e.materials,this.material[h]));r.material=l}else r.material=o(e.materials,this.material);if(this.children.length>0){r.children=[];for(let l=0;l<this.children.length;l++)r.children.push(this.children[l].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let l=0;l<this.animations.length;l++){const h=this.animations[l];r.animations.push(o(e.animations,h))}}if(t){const l=c(e.geometries),h=c(e.materials),f=c(e.textures),d=c(e.images),p=c(e.shapes),m=c(e.skeletons),x=c(e.animations),M=c(e.nodes);l.length>0&&(n.geometries=l),h.length>0&&(n.materials=h),f.length>0&&(n.textures=f),d.length>0&&(n.images=d),p.length>0&&(n.shapes=p),m.length>0&&(n.skeletons=m),x.length>0&&(n.animations=x),M.length>0&&(n.nodes=M)}return n.object=r,n;function c(l){const h=[];for(const f in l){const d=l[f];delete d.metadata,h.push(d)}return h}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}mt.DEFAULT_UP=new N(0,1,0);mt.DEFAULT_MATRIX_AUTO_UPDATE=!0;mt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ei=new N,fr=new N,Qu=new N,dr=new N,qs=new N,Ks=new N,Rm=new N,eh=new N,th=new N,nh=new N;class Ri{constructor(e=new N,t=new N,n=new N){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Ei.subVectors(e,t),r.cross(Ei);const o=r.lengthSq();return o>0?r.multiplyScalar(1/Math.sqrt(o)):r.set(0,0,0)}static getBarycoord(e,t,n,r,o){Ei.subVectors(r,t),fr.subVectors(n,t),Qu.subVectors(e,t);const c=Ei.dot(Ei),l=Ei.dot(fr),h=Ei.dot(Qu),f=fr.dot(fr),d=fr.dot(Qu),p=c*f-l*l;if(p===0)return o.set(0,0,0),null;const m=1/p,x=(f*h-l*d)*m,M=(c*d-l*h)*m;return o.set(1-x-M,M,x)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,dr)===null?!1:dr.x>=0&&dr.y>=0&&dr.x+dr.y<=1}static getInterpolation(e,t,n,r,o,c,l,h){return this.getBarycoord(e,t,n,r,dr)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(o,dr.x),h.addScaledVector(c,dr.y),h.addScaledVector(l,dr.z),h)}static isFrontFacing(e,t,n,r){return Ei.subVectors(n,t),fr.subVectors(e,t),Ei.cross(fr).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),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 Ei.subVectors(this.c,this.b),fr.subVectors(this.a,this.b),Ei.cross(fr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ri.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ri.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,o){return Ri.getInterpolation(e,this.a,this.b,this.c,t,n,r,o)}containsPoint(e){return Ri.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ri.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,o=this.c;let c,l;qs.subVectors(r,n),Ks.subVectors(o,n),eh.subVectors(e,n);const h=qs.dot(eh),f=Ks.dot(eh);if(h<=0&&f<=0)return t.copy(n);th.subVectors(e,r);const d=qs.dot(th),p=Ks.dot(th);if(d>=0&&p<=d)return t.copy(r);const m=h*p-d*f;if(m<=0&&h>=0&&d<=0)return c=h/(h-d),t.copy(n).addScaledVector(qs,c);nh.subVectors(e,o);const x=qs.dot(nh),M=Ks.dot(nh);if(M>=0&&x<=M)return t.copy(o);const A=x*f-h*M;if(A<=0&&f>=0&&M<=0)return l=f/(f-M),t.copy(n).addScaledVector(Ks,l);const v=d*M-x*p;if(v<=0&&p-d>=0&&x-M>=0)return Rm.subVectors(o,r),l=(p-d)/(p-d+(x-M)),t.copy(r).addScaledVector(Rm,l);const _=1/(v+A+m);return c=A*_,l=m*_,t.copy(n).addScaledVector(qs,c).addScaledVector(Ks,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const m_={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},Nr={h:0,s:0,l:0},Pc={h:0,s:0,l:0};function ih(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class Ne{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 r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ln){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ct.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=Ct.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ct.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=Ct.workingColorSpace){if(e=nf(e,1),t=xn(t,0,1),n=xn(n,0,1),t===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+t):n+t-n*t,c=2*n-o;this.r=ih(c,o,e+1/3),this.g=ih(c,o,e),this.b=ih(c,o,e-1/3)}return Ct.toWorkingColorSpace(this,r),this}setStyle(e,t=ln){function n(o){o!==void 0&&parseFloat(o)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const c=r[1],l=r[2];switch(c){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,t);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,t);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=r[1],c=o.length;if(c===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(c===6)return this.setHex(parseInt(o,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=ln){const n=m_[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=mo(e.r),this.g=mo(e.g),this.b=mo(e.b),this}copyLinearToSRGB(e){return this.r=Wu(e.r),this.g=Wu(e.g),this.b=Wu(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ln){return Ct.fromWorkingColorSpace(An.copy(this),e),Math.round(xn(An.r*255,0,255))*65536+Math.round(xn(An.g*255,0,255))*256+Math.round(xn(An.b*255,0,255))}getHexString(e=ln){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ct.workingColorSpace){Ct.fromWorkingColorSpace(An.copy(this),t);const n=An.r,r=An.g,o=An.b,c=Math.max(n,r,o),l=Math.min(n,r,o);let h,f;const d=(l+c)/2;if(l===c)h=0,f=0;else{const p=c-l;switch(f=d<=.5?p/(c+l):p/(2-c-l),c){case n:h=(r-o)/p+(r<o?6:0);break;case r:h=(o-n)/p+2;break;case o:h=(n-r)/p+4;break}h/=6}return e.h=h,e.s=f,e.l=d,e}getRGB(e,t=Ct.workingColorSpace){return Ct.fromWorkingColorSpace(An.copy(this),t),e.r=An.r,e.g=An.g,e.b=An.b,e}getStyle(e=ln){Ct.fromWorkingColorSpace(An.copy(this),e);const t=An.r,n=An.g,r=An.b;return e!==ln?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(Nr),this.setHSL(Nr.h+e,Nr.s+t,Nr.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(Nr),e.getHSL(Pc);const n=ya(Nr.h,Pc.h,t),r=ya(Nr.s,Pc.s,t),o=ya(Nr.l,Pc.l,t);return this.setHSL(n,r,o),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,r=this.b,o=e.elements;return this.r=o[0]*t+o[3]*n+o[6]*r,this.g=o[1]*t+o[4]*n+o[7]*r,this.b=o[2]*t+o[5]*n+o[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const An=new Ne;Ne.NAMES=m_;let OT=0;class mi extends ys{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:OT++}),this.uuid=Pi(),this.name="",this.type="Material",this.blending=fo,this.side=Yi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Lh,this.blendDst=Ih,this.blendEquation=ps,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ne(0,0,0),this.blendAlpha=0,this.depthFunc=ll,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=pm,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ks,this.stencilZFail=ks,this.stencilZPass=ks,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.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==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.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!==fo&&(n.blending=this.blending),this.side!==Yi&&(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!==Lh&&(n.blendSrc=this.blendSrc),this.blendDst!==Ih&&(n.blendDst=this.blendDst),this.blendEquation!==ps&&(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!==ll&&(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!==pm&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ks&&(n.stencilFail=this.stencilFail),this.stencilZFail!==ks&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==ks&&(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.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 r(o){const c=[];for(const l in o){const h=o[l];delete h.metadata,c.push(h)}return c}if(t){const o=r(e.textures),c=r(e.images);o.length>0&&(n.textures=o),c.length>0&&(n.images=c)}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 r=t.length;n=new Array(r);for(let o=0;o!==r;++o)n[o]=t[o].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.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 Wi extends mi{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ne(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 Li,this.combine=Zg,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 sn=new N,Lc=new Pe;class nn{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Nh,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Vi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return f_("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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 r=0,o=this.itemSize;r<o;r++)this.array[e+r]=t.array[n+r];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++)Lc.fromBufferAttribute(this,t),Lc.applyMatrix3(e),this.setXY(t,Lc.x,Lc.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)sn.fromBufferAttribute(this,t),sn.applyMatrix3(e),this.setXYZ(t,sn.x,sn.y,sn.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)sn.fromBufferAttribute(this,t),sn.applyMatrix4(e),this.setXYZ(t,sn.x,sn.y,sn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)sn.fromBufferAttribute(this,t),sn.applyNormalMatrix(e),this.setXYZ(t,sn.x,sn.y,sn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)sn.fromBufferAttribute(this,t),sn.transformDirection(e),this.setXYZ(t,sn.x,sn.y,sn.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=wi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Lt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=wi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=wi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Lt(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=wi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Lt(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=wi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Lt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),r=Lt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,o){return e*=this.itemSize,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),r=Lt(r,this.array),o=Lt(o,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=o,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Nh&&(e.usage=this.usage),e}}class g_ extends nn{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class __ extends nn{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Nt extends nn{constructor(e,t,n){super(new Float32Array(e),t,n)}}let UT=0;const hi=new Qe,rh=new mt,Zs=new N,Qn=new Ii,ea=new Ii,mn=new N;class Jt extends ys{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:UT++}),this.uuid=Pi(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(h_(e)?__:g_)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const o=new ht().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return hi.makeRotationFromQuaternion(e),this.applyMatrix4(hi),this}rotateX(e){return hi.makeRotationX(e),this.applyMatrix4(hi),this}rotateY(e){return hi.makeRotationY(e),this.applyMatrix4(hi),this}rotateZ(e){return hi.makeRotationZ(e),this.applyMatrix4(hi),this}translate(e,t,n){return hi.makeTranslation(e,t,n),this.applyMatrix4(hi),this}scale(e,t,n){return hi.makeScale(e,t,n),this.applyMatrix4(hi),this}lookAt(e){return rh.lookAt(e),rh.updateMatrix(),this.applyMatrix4(rh.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Zs).negate(),this.translate(Zs.x,Zs.y,Zs.z),this}setFromPoints(e){const t=[];for(let n=0,r=e.length;n<r;n++){const o=e[n];t.push(o.x,o.y,o.z||0)}return this.setAttribute("position",new Nt(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ii);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new N(-1/0,-1/0,-1/0),new N(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const o=t[n];Qn.setFromBufferAttribute(o),this.morphTargetsRelative?(mn.addVectors(this.boundingBox.min,Qn.min),this.boundingBox.expandByPoint(mn),mn.addVectors(this.boundingBox.max,Qn.max),this.boundingBox.expandByPoint(mn)):(this.boundingBox.expandByPoint(Qn.min),this.boundingBox.expandByPoint(Qn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Zi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new N,1/0);return}if(e){const n=this.boundingSphere.center;if(Qn.setFromBufferAttribute(e),t)for(let o=0,c=t.length;o<c;o++){const l=t[o];ea.setFromBufferAttribute(l),this.morphTargetsRelative?(mn.addVectors(Qn.min,ea.min),Qn.expandByPoint(mn),mn.addVectors(Qn.max,ea.max),Qn.expandByPoint(mn)):(Qn.expandByPoint(ea.min),Qn.expandByPoint(ea.max))}Qn.getCenter(n);let r=0;for(let o=0,c=e.count;o<c;o++)mn.fromBufferAttribute(e,o),r=Math.max(r,n.distanceToSquared(mn));if(t)for(let o=0,c=t.length;o<c;o++){const l=t[o],h=this.morphTargetsRelative;for(let f=0,d=l.count;f<d;f++)mn.fromBufferAttribute(l,f),h&&(Zs.fromBufferAttribute(e,f),mn.add(Zs)),r=Math.max(r,n.distanceToSquared(mn))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.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){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,o=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new nn(new Float32Array(4*n.count),4));const c=this.getAttribute("tangent"),l=[],h=[];for(let I=0;I<n.count;I++)l[I]=new N,h[I]=new N;const f=new N,d=new N,p=new N,m=new Pe,x=new Pe,M=new Pe,A=new N,v=new N;function _(I,E,y){f.fromBufferAttribute(n,I),d.fromBufferAttribute(n,E),p.fromBufferAttribute(n,y),m.fromBufferAttribute(o,I),x.fromBufferAttribute(o,E),M.fromBufferAttribute(o,y),d.sub(f),p.sub(f),x.sub(m),M.sub(m);const F=1/(x.x*M.y-M.x*x.y);isFinite(F)&&(A.copy(d).multiplyScalar(M.y).addScaledVector(p,-x.y).multiplyScalar(F),v.copy(p).multiplyScalar(x.x).addScaledVector(d,-M.x).multiplyScalar(F),l[I].add(A),l[E].add(A),l[y].add(A),h[I].add(v),h[E].add(v),h[y].add(v))}let C=this.groups;C.length===0&&(C=[{start:0,count:e.count}]);for(let I=0,E=C.length;I<E;++I){const y=C[I],F=y.start,V=y.count;for(let G=F,q=F+V;G<q;G+=3)_(e.getX(G+0),e.getX(G+1),e.getX(G+2))}const b=new N,L=new N,k=new N,U=new N;function O(I){k.fromBufferAttribute(r,I),U.copy(k);const E=l[I];b.copy(E),b.sub(k.multiplyScalar(k.dot(E))).normalize(),L.crossVectors(U,E);const F=L.dot(h[I])<0?-1:1;c.setXYZW(I,b.x,b.y,b.z,F)}for(let I=0,E=C.length;I<E;++I){const y=C[I],F=y.start,V=y.count;for(let G=F,q=F+V;G<q;G+=3)O(e.getX(G+0)),O(e.getX(G+1)),O(e.getX(G+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 nn(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let m=0,x=n.count;m<x;m++)n.setXYZ(m,0,0,0);const r=new N,o=new N,c=new N,l=new N,h=new N,f=new N,d=new N,p=new N;if(e)for(let m=0,x=e.count;m<x;m+=3){const M=e.getX(m+0),A=e.getX(m+1),v=e.getX(m+2);r.fromBufferAttribute(t,M),o.fromBufferAttribute(t,A),c.fromBufferAttribute(t,v),d.subVectors(c,o),p.subVectors(r,o),d.cross(p),l.fromBufferAttribute(n,M),h.fromBufferAttribute(n,A),f.fromBufferAttribute(n,v),l.add(d),h.add(d),f.add(d),n.setXYZ(M,l.x,l.y,l.z),n.setXYZ(A,h.x,h.y,h.z),n.setXYZ(v,f.x,f.y,f.z)}else for(let m=0,x=t.count;m<x;m+=3)r.fromBufferAttribute(t,m+0),o.fromBufferAttribute(t,m+1),c.fromBufferAttribute(t,m+2),d.subVectors(c,o),p.subVectors(r,o),d.cross(p),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(l,h){const f=l.array,d=l.itemSize,p=l.normalized,m=new f.constructor(h.length*d);let x=0,M=0;for(let A=0,v=h.length;A<v;A++){l.isInterleavedBufferAttribute?x=h[A]*l.data.stride+l.offset:x=h[A]*d;for(let _=0;_<d;_++)m[M++]=f[x++]}return new nn(m,d,p)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Jt,n=this.index.array,r=this.attributes;for(const l in r){const h=r[l],f=e(h,n);t.setAttribute(l,f)}const o=this.morphAttributes;for(const l in o){const h=[],f=o[l];for(let d=0,p=f.length;d<p;d++){const m=f[d],x=e(m,n);h.push(x)}t.morphAttributes[l]=h}t.morphTargetsRelative=this.morphTargetsRelative;const c=this.groups;for(let l=0,h=c.length;l<h;l++){const f=c[l];t.addGroup(f.start,f.count,f.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,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 h=this.parameters;for(const f in h)h[f]!==void 0&&(e[f]=h[f]);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 h in n){const f=n[h];e.data.attributes[h]=f.toJSON(e.data)}const r={};let o=!1;for(const h in this.morphAttributes){const f=this.morphAttributes[h],d=[];for(let p=0,m=f.length;p<m;p++){const x=f[p];d.push(x.toJSON(e.data))}d.length>0&&(r[h]=d,o=!0)}o&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const c=this.groups;c.length>0&&(e.data.groups=JSON.parse(JSON.stringify(c)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const r=e.attributes;for(const f in r){const d=r[f];this.setAttribute(f,d.clone(t))}const o=e.morphAttributes;for(const f in o){const d=[],p=o[f];for(let m=0,x=p.length;m<x;m++)d.push(p[m].clone(t));this.morphAttributes[f]=d}this.morphTargetsRelative=e.morphTargetsRelative;const c=e.groups;for(let f=0,d=c.length;f<d;f++){const p=c[f];this.addGroup(p.start,p.count,p.materialIndex)}const l=e.boundingBox;l!==null&&(this.boundingBox=l.clone());const h=e.boundingSphere;return h!==null&&(this.boundingSphere=h.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Cm=new Qe,ss=new To,Ic=new Zi,Pm=new N,$s=new N,Js=new N,Qs=new N,sh=new N,Dc=new N,Oc=new Pe,Uc=new Pe,Nc=new Pe,Lm=new N,Im=new N,Dm=new N,Fc=new N,Bc=new N;class ye extends mt{constructor(e=new Jt,t=new Wi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,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 r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,c=r.length;o<c;o++){const l=r[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=o}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,o=n.morphAttributes.position,c=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const l=this.morphTargetInfluences;if(o&&l){Dc.set(0,0,0);for(let h=0,f=o.length;h<f;h++){const d=l[h],p=o[h];d!==0&&(sh.fromBufferAttribute(p,e),c?Dc.addScaledVector(sh,d):Dc.addScaledVector(sh.sub(t),d))}t.add(Dc)}return t}raycast(e,t){const n=this.geometry,r=this.material,o=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Ic.copy(n.boundingSphere),Ic.applyMatrix4(o),ss.copy(e.ray).recast(e.near),!(Ic.containsPoint(ss.origin)===!1&&(ss.intersectSphere(Ic,Pm)===null||ss.origin.distanceToSquared(Pm)>(e.far-e.near)**2))&&(Cm.copy(o).invert(),ss.copy(e.ray).applyMatrix4(Cm),!(n.boundingBox!==null&&ss.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,ss)))}_computeIntersections(e,t,n){let r;const o=this.geometry,c=this.material,l=o.index,h=o.attributes.position,f=o.attributes.uv,d=o.attributes.uv1,p=o.attributes.normal,m=o.groups,x=o.drawRange;if(l!==null)if(Array.isArray(c))for(let M=0,A=m.length;M<A;M++){const v=m[M],_=c[v.materialIndex],C=Math.max(v.start,x.start),b=Math.min(l.count,Math.min(v.start+v.count,x.start+x.count));for(let L=C,k=b;L<k;L+=3){const U=l.getX(L),O=l.getX(L+1),I=l.getX(L+2);r=zc(this,_,e,n,f,d,p,U,O,I),r&&(r.faceIndex=Math.floor(L/3),r.face.materialIndex=v.materialIndex,t.push(r))}}else{const M=Math.max(0,x.start),A=Math.min(l.count,x.start+x.count);for(let v=M,_=A;v<_;v+=3){const C=l.getX(v),b=l.getX(v+1),L=l.getX(v+2);r=zc(this,c,e,n,f,d,p,C,b,L),r&&(r.faceIndex=Math.floor(v/3),t.push(r))}}else if(h!==void 0)if(Array.isArray(c))for(let M=0,A=m.length;M<A;M++){const v=m[M],_=c[v.materialIndex],C=Math.max(v.start,x.start),b=Math.min(h.count,Math.min(v.start+v.count,x.start+x.count));for(let L=C,k=b;L<k;L+=3){const U=L,O=L+1,I=L+2;r=zc(this,_,e,n,f,d,p,U,O,I),r&&(r.faceIndex=Math.floor(L/3),r.face.materialIndex=v.materialIndex,t.push(r))}}else{const M=Math.max(0,x.start),A=Math.min(h.count,x.start+x.count);for(let v=M,_=A;v<_;v+=3){const C=v,b=v+1,L=v+2;r=zc(this,c,e,n,f,d,p,C,b,L),r&&(r.faceIndex=Math.floor(v/3),t.push(r))}}}}function NT(i,e,t,n,r,o,c,l){let h;if(e.side===Xn?h=n.intersectTriangle(c,o,r,!0,l):h=n.intersectTriangle(r,o,c,e.side===Yi,l),h===null)return null;Bc.copy(l),Bc.applyMatrix4(i.matrixWorld);const f=t.ray.origin.distanceTo(Bc);return f<t.near||f>t.far?null:{distance:f,point:Bc.clone(),object:i}}function zc(i,e,t,n,r,o,c,l,h,f){i.getVertexPosition(l,$s),i.getVertexPosition(h,Js),i.getVertexPosition(f,Qs);const d=NT(i,e,t,n,$s,Js,Qs,Fc);if(d){r&&(Oc.fromBufferAttribute(r,l),Uc.fromBufferAttribute(r,h),Nc.fromBufferAttribute(r,f),d.uv=Ri.getInterpolation(Fc,$s,Js,Qs,Oc,Uc,Nc,new Pe)),o&&(Oc.fromBufferAttribute(o,l),Uc.fromBufferAttribute(o,h),Nc.fromBufferAttribute(o,f),d.uv1=Ri.getInterpolation(Fc,$s,Js,Qs,Oc,Uc,Nc,new Pe)),c&&(Lm.fromBufferAttribute(c,l),Im.fromBufferAttribute(c,h),Dm.fromBufferAttribute(c,f),d.normal=Ri.getInterpolation(Fc,$s,Js,Qs,Lm,Im,Dm,new N),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));const p={a:l,b:h,c:f,normal:new N,materialIndex:0};Ri.getNormal($s,Js,Qs,p.normal),d.face=p}return d}class qt extends Jt{constructor(e=1,t=1,n=1,r=1,o=1,c=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:o,depthSegments:c};const l=this;r=Math.floor(r),o=Math.floor(o),c=Math.floor(c);const h=[],f=[],d=[],p=[];let m=0,x=0;M("z","y","x",-1,-1,n,t,e,c,o,0),M("z","y","x",1,-1,n,t,-e,c,o,1),M("x","z","y",1,1,e,n,t,r,c,2),M("x","z","y",1,-1,e,n,-t,r,c,3),M("x","y","z",1,-1,e,t,n,r,o,4),M("x","y","z",-1,-1,e,t,-n,r,o,5),this.setIndex(h),this.setAttribute("position",new Nt(f,3)),this.setAttribute("normal",new Nt(d,3)),this.setAttribute("uv",new Nt(p,2));function M(A,v,_,C,b,L,k,U,O,I,E){const y=L/O,F=k/I,V=L/2,G=k/2,q=U/2,ne=O+1,se=I+1;let pe=0,K=0;const he=new N;for(let me=0;me<se;me++){const Me=me*F-G;for(let Ke=0;Ke<ne;Ke++){const ot=Ke*y-V;he[A]=ot*C,he[v]=Me*b,he[_]=q,f.push(he.x,he.y,he.z),he[A]=0,he[v]=0,he[_]=U>0?1:-1,d.push(he.x,he.y,he.z),p.push(Ke/O),p.push(1-me/I),pe+=1}}for(let me=0;me<I;me++)for(let Me=0;Me<O;Me++){const Ke=m+Me+ne*me,ot=m+Me+ne*(me+1),ie=m+(Me+1)+ne*(me+1),ge=m+(Me+1)+ne*me;h.push(Ke,ot,ge),h.push(ot,ie,ge),K+=6}l.addGroup(x,K,E),x+=K,m+=pe}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qt(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Mo(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function Nn(i){const e={};for(let t=0;t<i.length;t++){const n=Mo(i[t]);for(const r in n)e[r]=n[r]}return e}function FT(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function v_(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ct.workingColorSpace}const BT={clone:Mo,merge:Nn};var zT=`void main() {
|
|
6
6
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
7
|
-
}`,
|
|
7
|
+
}`,kT=`void main() {
|
|
8
8
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
9
|
-
}`;class
|
|
9
|
+
}`;class Yr extends mi{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=zT,this.fragmentShader=kT,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=Mo(e.uniforms),this.uniformsGroups=FT(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}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const c=this.uniforms[r].value;c&&c.isTexture?t.uniforms[r]={type:"t",value:c.toJSON(e).uuid}:c&&c.isColor?t.uniforms[r]={type:"c",value:c.getHex()}:c&&c.isVector2?t.uniforms[r]={type:"v2",value:c.toArray()}:c&&c.isVector3?t.uniforms[r]={type:"v3",value:c.toArray()}:c&&c.isVector4?t.uniforms[r]={type:"v4",value:c.toArray()}:c&&c.isMatrix3?t.uniforms[r]={type:"m3",value:c.toArray()}:c&&c.isMatrix4?t.uniforms[r]={type:"m4",value:c.toArray()}:t.uniforms[r]={value:c}}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 r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class x_ extends mt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Qe,this.projectionMatrix=new Qe,this.projectionMatrixInverse=new Qe,this.coordinateSystem=vr}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.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Fr=new N,Om=new Pe,Um=new Pe;class Bn extends x_{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,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=So*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(xa*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return So*2*Math.atan(Math.tan(xa*.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){Fr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Fr.x,Fr.y).multiplyScalar(-e/Fr.z),Fr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Fr.x,Fr.y).multiplyScalar(-e/Fr.z)}getViewSize(e,t){return this.getViewBounds(e,Om,Um),t.subVectors(Um,Om)}setViewOffset(e,t,n,r,o,c){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=r,this.view.width=o,this.view.height=c,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(xa*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,o=-.5*r;const c=this.view;if(this.view!==null&&this.view.enabled){const h=c.fullWidth,f=c.fullHeight;o+=c.offsetX*r/h,t-=c.offsetY*n/f,r*=c.width/h,n*=c.height/f}const l=this.filmOffset;l!==0&&(o+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(o,o+r,t,t-n,e,this.far,this.coordinateSystem),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}}const eo=-90,to=1;class HT extends mt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Bn(eo,to,e,t);r.layers=this.layers,this.add(r);const o=new Bn(eo,to,e,t);o.layers=this.layers,this.add(o);const c=new Bn(eo,to,e,t);c.layers=this.layers,this.add(c);const l=new Bn(eo,to,e,t);l.layers=this.layers,this.add(l);const h=new Bn(eo,to,e,t);h.layers=this.layers,this.add(h);const f=new Bn(eo,to,e,t);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,o,c,l,h]=t;for(const f of t)this.remove(f);if(e===vr)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),c.up.set(0,0,1),c.lookAt(0,-1,0),l.up.set(0,1,0),l.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(e===pl)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),c.up.set(0,0,-1),c.lookAt(0,-1,0),l.up.set(0,-1,0),l.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const f of t)this.add(f),f.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,c,l,h,f,d]=this.children,p=e.getRenderTarget(),m=e.getActiveCubeFace(),x=e.getActiveMipmapLevel(),M=e.xr.enabled;e.xr.enabled=!1;const A=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,o),e.setRenderTarget(n,1,r),e.render(t,c),e.setRenderTarget(n,2,r),e.render(t,l),e.setRenderTarget(n,3,r),e.render(t,h),e.setRenderTarget(n,4,r),e.render(t,f),n.texture.generateMipmaps=A,e.setRenderTarget(n,5,r),e.render(t,d),e.setRenderTarget(p,m,x),e.xr.enabled=M,n.texture.needsPMREMUpdate=!0}}class y_ extends un{constructor(e,t,n,r,o,c,l,h,f,d){e=e!==void 0?e:[],t=t!==void 0?t:_o,super(e,t,n,r,o,c,l,h,f,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class S_ extends vs{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new y_(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Wn}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:`
|
|
10
10
|
|
|
11
11
|
varying vec3 vWorldDirection;
|
|
12
12
|
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
42
42
|
|
|
43
43
|
}
|
|
44
|
-
`},
|
|
44
|
+
`},r=new qt(5,5,5),o=new Yr({name:"CubemapFromEquirect",uniforms:Mo(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Xn,blending:Wr});o.uniforms.tEquirect.value=t;const c=new ye(r,o),l=t.minFilter;return t.minFilter===_r&&(t.minFilter=Wn),new HT(1,10,this).update(e,c),t.minFilter=l,c.geometry.dispose(),c.material.dispose(),this}clear(e,t,n,r){const o=e.getRenderTarget();for(let c=0;c<6;c++)e.setRenderTarget(this,c),e.clear(t,n,r);e.setRenderTarget(o)}}const oh=new N,GT=new N,VT=new ht;class Hr{constructor(e=new N(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,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=oh.subVectors(n,t).cross(GT.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,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(oh),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const o=-(e.start.dot(this.normal)+this.constant)/r;return o<0||o>1?null:t.copy(e.start).addScaledVector(n,o)}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||VT.getNormalMatrix(e),r=this.coplanarPoint(oh).applyMatrix4(e),o=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(o),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 os=new Zi,kc=new N;class sf{constructor(e=new Hr,t=new Hr,n=new Hr,r=new Hr,o=new Hr,c=new Hr){this.planes=[e,t,n,r,o,c]}set(e,t,n,r,o,c){const l=this.planes;return l[0].copy(e),l[1].copy(t),l[2].copy(n),l[3].copy(r),l[4].copy(o),l[5].copy(c),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=vr){const n=this.planes,r=e.elements,o=r[0],c=r[1],l=r[2],h=r[3],f=r[4],d=r[5],p=r[6],m=r[7],x=r[8],M=r[9],A=r[10],v=r[11],_=r[12],C=r[13],b=r[14],L=r[15];if(n[0].setComponents(h-o,m-f,v-x,L-_).normalize(),n[1].setComponents(h+o,m+f,v+x,L+_).normalize(),n[2].setComponents(h+c,m+d,v+M,L+C).normalize(),n[3].setComponents(h-c,m-d,v-M,L-C).normalize(),n[4].setComponents(h-l,m-p,v-A,L-b).normalize(),t===vr)n[5].setComponents(h+l,m+p,v+A,L+b).normalize();else if(t===pl)n[5].setComponents(l,p,A,b).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(),os.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),os.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(os)}intersectsSprite(e){return os.center.set(0,0,0),os.radius=.7071067811865476,os.applyMatrix4(e.matrixWorld),this.intersectsSphere(os)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(kc.x=r.normal.x>0?e.max.x:e.min.x,kc.y=r.normal.y>0?e.max.y:e.min.y,kc.z=r.normal.z>0?e.max.z:e.min.z,r.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)}}function M_(){let i=null,e=!1,t=null,n=null;function r(o,c){t(o,c),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){i=o}}}function WT(i){const e=new WeakMap;function t(l,h){const f=l.array,d=l.usage,p=f.byteLength,m=i.createBuffer();i.bindBuffer(h,m),i.bufferData(h,f,d),l.onUploadCallback();let x;if(f instanceof Float32Array)x=i.FLOAT;else if(f instanceof Uint16Array)l.isFloat16BufferAttribute?x=i.HALF_FLOAT:x=i.UNSIGNED_SHORT;else if(f instanceof Int16Array)x=i.SHORT;else if(f instanceof Uint32Array)x=i.UNSIGNED_INT;else if(f instanceof Int32Array)x=i.INT;else if(f instanceof Int8Array)x=i.BYTE;else if(f instanceof Uint8Array)x=i.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)x=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:m,type:x,bytesPerElement:f.BYTES_PER_ELEMENT,version:l.version,size:p}}function n(l,h,f){const d=h.array,p=h._updateRange,m=h.updateRanges;if(i.bindBuffer(f,l),p.count===-1&&m.length===0&&i.bufferSubData(f,0,d),m.length!==0){for(let x=0,M=m.length;x<M;x++){const A=m[x];i.bufferSubData(f,A.start*d.BYTES_PER_ELEMENT,d,A.start,A.count)}h.clearUpdateRanges()}p.count!==-1&&(i.bufferSubData(f,p.offset*d.BYTES_PER_ELEMENT,d,p.offset,p.count),p.count=-1),h.onUploadCallback()}function r(l){return l.isInterleavedBufferAttribute&&(l=l.data),e.get(l)}function o(l){l.isInterleavedBufferAttribute&&(l=l.data);const h=e.get(l);h&&(i.deleteBuffer(h.buffer),e.delete(l))}function c(l,h){if(l.isGLBufferAttribute){const d=e.get(l);(!d||d.version<l.version)&&e.set(l,{buffer:l.buffer,type:l.type,bytesPerElement:l.elementSize,version:l.version});return}l.isInterleavedBufferAttribute&&(l=l.data);const f=e.get(l);if(f===void 0)e.set(l,t(l,h));else if(f.version<l.version){if(f.size!==l.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(f.buffer,l,h),f.version=l.version}}return{get:r,remove:o,update:c}}class Ss extends Jt{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const o=e/2,c=t/2,l=Math.floor(n),h=Math.floor(r),f=l+1,d=h+1,p=e/l,m=t/h,x=[],M=[],A=[],v=[];for(let _=0;_<d;_++){const C=_*m-c;for(let b=0;b<f;b++){const L=b*p-o;M.push(L,-C,0),A.push(0,0,1),v.push(b/l),v.push(1-_/h)}}for(let _=0;_<h;_++)for(let C=0;C<l;C++){const b=C+f*_,L=C+f*(_+1),k=C+1+f*(_+1),U=C+1+f*_;x.push(b,L,U),x.push(L,k,U)}this.setIndex(x),this.setAttribute("position",new Nt(M,3)),this.setAttribute("normal",new Nt(A,3)),this.setAttribute("uv",new Nt(v,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ss(e.width,e.height,e.widthSegments,e.heightSegments)}}var XT=`#ifdef USE_ALPHAHASH
|
|
45
45
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
46
|
-
#endif`,
|
|
46
|
+
#endif`,YT=`#ifdef USE_ALPHAHASH
|
|
47
47
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
48
48
|
float hash2D( vec2 value ) {
|
|
49
49
|
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
|
@@ -78,20 +78,20 @@
|
|
|
78
78
|
: cases.z;
|
|
79
79
|
return clamp( threshold , 1.0e-6, 1.0 );
|
|
80
80
|
}
|
|
81
|
-
#endif`,
|
|
81
|
+
#endif`,jT=`#ifdef USE_ALPHAMAP
|
|
82
82
|
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|
83
|
-
#endif`,
|
|
83
|
+
#endif`,qT=`#ifdef USE_ALPHAMAP
|
|
84
84
|
uniform sampler2D alphaMap;
|
|
85
|
-
#endif`,
|
|
85
|
+
#endif`,KT=`#ifdef USE_ALPHATEST
|
|
86
86
|
#ifdef ALPHA_TO_COVERAGE
|
|
87
87
|
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
|
88
88
|
if ( diffuseColor.a == 0.0 ) discard;
|
|
89
89
|
#else
|
|
90
90
|
if ( diffuseColor.a < alphaTest ) discard;
|
|
91
91
|
#endif
|
|
92
|
-
#endif`,
|
|
92
|
+
#endif`,ZT=`#ifdef USE_ALPHATEST
|
|
93
93
|
uniform float alphaTest;
|
|
94
|
-
#endif
|
|
94
|
+
#endif`,$T=`#ifdef USE_AOMAP
|
|
95
95
|
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
96
96
|
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
97
97
|
#if defined( USE_CLEARCOAT )
|
|
@@ -104,10 +104,10 @@
|
|
|
104
104
|
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
|
105
105
|
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|
106
106
|
#endif
|
|
107
|
-
#endif`,
|
|
107
|
+
#endif`,JT=`#ifdef USE_AOMAP
|
|
108
108
|
uniform sampler2D aoMap;
|
|
109
109
|
uniform float aoMapIntensity;
|
|
110
|
-
#endif`,
|
|
110
|
+
#endif`,QT=`#ifdef USE_BATCHING
|
|
111
111
|
attribute float batchId;
|
|
112
112
|
uniform highp sampler2D batchingTexture;
|
|
113
113
|
mat4 getBatchingMatrix( const in float i ) {
|
|
@@ -121,15 +121,15 @@
|
|
|
121
121
|
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
|
|
122
122
|
return mat4( v1, v2, v3, v4 );
|
|
123
123
|
}
|
|
124
|
-
#endif`,
|
|
124
|
+
#endif`,eA=`#ifdef USE_BATCHING
|
|
125
125
|
mat4 batchingMatrix = getBatchingMatrix( batchId );
|
|
126
|
-
#endif`,
|
|
126
|
+
#endif`,tA=`vec3 transformed = vec3( position );
|
|
127
127
|
#ifdef USE_ALPHAHASH
|
|
128
128
|
vPosition = vec3( position );
|
|
129
|
-
#endif`,
|
|
129
|
+
#endif`,nA=`vec3 objectNormal = vec3( normal );
|
|
130
130
|
#ifdef USE_TANGENT
|
|
131
131
|
vec3 objectTangent = vec3( tangent.xyz );
|
|
132
|
-
#endif`,
|
|
132
|
+
#endif`,iA=`float G_BlinnPhong_Implicit( ) {
|
|
133
133
|
return 0.25;
|
|
134
134
|
}
|
|
135
135
|
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
@@ -143,7 +143,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
143
143
|
float G = G_BlinnPhong_Implicit( );
|
|
144
144
|
float D = D_BlinnPhong( shininess, dotNH );
|
|
145
145
|
return F * ( G * D );
|
|
146
|
-
} // validated`,
|
|
146
|
+
} // validated`,rA=`#ifdef USE_IRIDESCENCE
|
|
147
147
|
const mat3 XYZ_TO_REC709 = mat3(
|
|
148
148
|
3.2404542, -0.9692660, 0.0556434,
|
|
149
149
|
-1.5371385, 1.8760108, -0.2040259,
|
|
@@ -206,7 +206,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
206
206
|
}
|
|
207
207
|
return max( I, vec3( 0.0 ) );
|
|
208
208
|
}
|
|
209
|
-
#endif`,
|
|
209
|
+
#endif`,sA=`#ifdef USE_BUMPMAP
|
|
210
210
|
uniform sampler2D bumpMap;
|
|
211
211
|
uniform float bumpScale;
|
|
212
212
|
vec2 dHdxy_fwd() {
|
|
@@ -227,7 +227,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
227
227
|
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
228
228
|
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
229
229
|
}
|
|
230
|
-
#endif`,
|
|
230
|
+
#endif`,oA=`#if NUM_CLIPPING_PLANES > 0
|
|
231
231
|
vec4 plane;
|
|
232
232
|
#ifdef ALPHA_TO_COVERAGE
|
|
233
233
|
float distanceToPlane, distanceGradient;
|
|
@@ -273,26 +273,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
273
273
|
if ( clipped ) discard;
|
|
274
274
|
#endif
|
|
275
275
|
#endif
|
|
276
|
-
#endif`,
|
|
276
|
+
#endif`,aA=`#if NUM_CLIPPING_PLANES > 0
|
|
277
277
|
varying vec3 vClipPosition;
|
|
278
278
|
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
279
|
-
#endif`,
|
|
279
|
+
#endif`,cA=`#if NUM_CLIPPING_PLANES > 0
|
|
280
280
|
varying vec3 vClipPosition;
|
|
281
|
-
#endif`,
|
|
281
|
+
#endif`,lA=`#if NUM_CLIPPING_PLANES > 0
|
|
282
282
|
vClipPosition = - mvPosition.xyz;
|
|
283
|
-
#endif`,
|
|
283
|
+
#endif`,uA=`#if defined( USE_COLOR_ALPHA )
|
|
284
284
|
diffuseColor *= vColor;
|
|
285
285
|
#elif defined( USE_COLOR )
|
|
286
286
|
diffuseColor.rgb *= vColor;
|
|
287
|
-
#endif`,
|
|
287
|
+
#endif`,hA=`#if defined( USE_COLOR_ALPHA )
|
|
288
288
|
varying vec4 vColor;
|
|
289
289
|
#elif defined( USE_COLOR )
|
|
290
290
|
varying vec3 vColor;
|
|
291
|
-
#endif`,
|
|
291
|
+
#endif`,fA=`#if defined( USE_COLOR_ALPHA )
|
|
292
292
|
varying vec4 vColor;
|
|
293
293
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|
294
294
|
varying vec3 vColor;
|
|
295
|
-
#endif`,
|
|
295
|
+
#endif`,dA=`#if defined( USE_COLOR_ALPHA )
|
|
296
296
|
vColor = vec4( 1.0 );
|
|
297
297
|
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
|
298
298
|
vColor = vec3( 1.0 );
|
|
@@ -302,7 +302,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
|
|
|
302
302
|
#endif
|
|
303
303
|
#ifdef USE_INSTANCING_COLOR
|
|
304
304
|
vColor.xyz *= instanceColor.xyz;
|
|
305
|
-
#endif`,
|
|
305
|
+
#endif`,pA=`#define PI 3.141592653589793
|
|
306
306
|
#define PI2 6.283185307179586
|
|
307
307
|
#define PI_HALF 1.5707963267948966
|
|
308
308
|
#define RECIPROCAL_PI 0.3183098861837907
|
|
@@ -380,7 +380,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
|
|
380
380
|
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
381
381
|
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
382
382
|
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
383
|
-
} // validated
|
|
383
|
+
} // validated`,mA=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
384
384
|
#define cubeUV_minMipLevel 4.0
|
|
385
385
|
#define cubeUV_minTileSize 16.0
|
|
386
386
|
float getFace( vec3 direction ) {
|
|
@@ -473,7 +473,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
|
473
473
|
return vec4( mix( color0, color1, mipF ), 1.0 );
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
|
-
#endif`,
|
|
476
|
+
#endif`,gA=`vec3 transformedNormal = objectNormal;
|
|
477
477
|
#ifdef USE_TANGENT
|
|
478
478
|
vec3 transformedTangent = objectTangent;
|
|
479
479
|
#endif
|
|
@@ -502,18 +502,18 @@ transformedNormal = normalMatrix * transformedNormal;
|
|
|
502
502
|
#ifdef FLIP_SIDED
|
|
503
503
|
transformedTangent = - transformedTangent;
|
|
504
504
|
#endif
|
|
505
|
-
#endif`,
|
|
505
|
+
#endif`,_A=`#ifdef USE_DISPLACEMENTMAP
|
|
506
506
|
uniform sampler2D displacementMap;
|
|
507
507
|
uniform float displacementScale;
|
|
508
508
|
uniform float displacementBias;
|
|
509
|
-
#endif`,
|
|
509
|
+
#endif`,vA=`#ifdef USE_DISPLACEMENTMAP
|
|
510
510
|
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
|
511
|
-
#endif`,
|
|
511
|
+
#endif`,xA=`#ifdef USE_EMISSIVEMAP
|
|
512
512
|
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
|
513
513
|
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
514
|
-
#endif`,
|
|
514
|
+
#endif`,yA=`#ifdef USE_EMISSIVEMAP
|
|
515
515
|
uniform sampler2D emissiveMap;
|
|
516
|
-
#endif`,
|
|
516
|
+
#endif`,SA="gl_FragColor = linearToOutputTexel( gl_FragColor );",MA=`
|
|
517
517
|
const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
|
|
518
518
|
vec3( 0.8224621, 0.177538, 0.0 ),
|
|
519
519
|
vec3( 0.0331941, 0.9668058, 0.0 ),
|
|
@@ -541,7 +541,7 @@ vec4 LinearToLinear( in vec4 value ) {
|
|
|
541
541
|
}
|
|
542
542
|
vec4 LinearTosRGB( in vec4 value ) {
|
|
543
543
|
return sRGBTransferOETF( value );
|
|
544
|
-
}`,
|
|
544
|
+
}`,EA=`#ifdef USE_ENVMAP
|
|
545
545
|
#ifdef ENV_WORLDPOS
|
|
546
546
|
vec3 cameraToFrag;
|
|
547
547
|
if ( isOrthographic ) {
|
|
@@ -570,7 +570,7 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
570
570
|
#elif defined( ENVMAP_BLENDING_ADD )
|
|
571
571
|
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
572
572
|
#endif
|
|
573
|
-
#endif`,
|
|
573
|
+
#endif`,bA=`#ifdef USE_ENVMAP
|
|
574
574
|
uniform float envMapIntensity;
|
|
575
575
|
uniform float flipEnvMap;
|
|
576
576
|
uniform mat3 envMapRotation;
|
|
@@ -580,7 +580,7 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
580
580
|
uniform sampler2D envMap;
|
|
581
581
|
#endif
|
|
582
582
|
|
|
583
|
-
#endif`,
|
|
583
|
+
#endif`,TA=`#ifdef USE_ENVMAP
|
|
584
584
|
uniform float reflectivity;
|
|
585
585
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
586
586
|
#define ENV_WORLDPOS
|
|
@@ -591,7 +591,7 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
591
591
|
#else
|
|
592
592
|
varying vec3 vReflect;
|
|
593
593
|
#endif
|
|
594
|
-
#endif`,
|
|
594
|
+
#endif`,AA=`#ifdef USE_ENVMAP
|
|
595
595
|
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
596
596
|
#define ENV_WORLDPOS
|
|
597
597
|
#endif
|
|
@@ -602,7 +602,7 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
602
602
|
varying vec3 vReflect;
|
|
603
603
|
uniform float refractionRatio;
|
|
604
604
|
#endif
|
|
605
|
-
#endif`,
|
|
605
|
+
#endif`,wA=`#ifdef USE_ENVMAP
|
|
606
606
|
#ifdef ENV_WORLDPOS
|
|
607
607
|
vWorldPosition = worldPosition.xyz;
|
|
608
608
|
#else
|
|
@@ -619,18 +619,18 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
619
619
|
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
620
620
|
#endif
|
|
621
621
|
#endif
|
|
622
|
-
#endif`,
|
|
622
|
+
#endif`,RA=`#ifdef USE_FOG
|
|
623
623
|
vFogDepth = - mvPosition.z;
|
|
624
|
-
#endif`,
|
|
624
|
+
#endif`,CA=`#ifdef USE_FOG
|
|
625
625
|
varying float vFogDepth;
|
|
626
|
-
#endif`,
|
|
626
|
+
#endif`,PA=`#ifdef USE_FOG
|
|
627
627
|
#ifdef FOG_EXP2
|
|
628
628
|
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
|
629
629
|
#else
|
|
630
630
|
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
|
631
631
|
#endif
|
|
632
632
|
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|
633
|
-
#endif`,
|
|
633
|
+
#endif`,LA=`#ifdef USE_FOG
|
|
634
634
|
uniform vec3 fogColor;
|
|
635
635
|
varying float vFogDepth;
|
|
636
636
|
#ifdef FOG_EXP2
|
|
@@ -639,7 +639,7 @@ vec4 LinearTosRGB( in vec4 value ) {
|
|
|
639
639
|
uniform float fogNear;
|
|
640
640
|
uniform float fogFar;
|
|
641
641
|
#endif
|
|
642
|
-
#endif`,
|
|
642
|
+
#endif`,IA=`#ifdef USE_GRADIENTMAP
|
|
643
643
|
uniform sampler2D gradientMap;
|
|
644
644
|
#endif
|
|
645
645
|
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
@@ -651,16 +651,16 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
|
651
651
|
vec2 fw = fwidth( coord ) * 0.5;
|
|
652
652
|
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
|
|
653
653
|
#endif
|
|
654
|
-
}`,
|
|
654
|
+
}`,DA=`#ifdef USE_LIGHTMAP
|
|
655
655
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
656
656
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
657
657
|
reflectedLight.indirectDiffuse += lightMapIrradiance;
|
|
658
|
-
#endif`,
|
|
658
|
+
#endif`,OA=`#ifdef USE_LIGHTMAP
|
|
659
659
|
uniform sampler2D lightMap;
|
|
660
660
|
uniform float lightMapIntensity;
|
|
661
|
-
#endif`,
|
|
661
|
+
#endif`,UA=`LambertMaterial material;
|
|
662
662
|
material.diffuseColor = diffuseColor.rgb;
|
|
663
|
-
material.specularStrength = specularStrength;`,
|
|
663
|
+
material.specularStrength = specularStrength;`,NA=`varying vec3 vViewPosition;
|
|
664
664
|
struct LambertMaterial {
|
|
665
665
|
vec3 diffuseColor;
|
|
666
666
|
float specularStrength;
|
|
@@ -674,7 +674,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
|
|
|
674
674
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
675
675
|
}
|
|
676
676
|
#define RE_Direct RE_Direct_Lambert
|
|
677
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,
|
|
677
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,FA=`uniform bool receiveShadow;
|
|
678
678
|
uniform vec3 ambientLightColor;
|
|
679
679
|
#if defined( USE_LIGHT_PROBES )
|
|
680
680
|
uniform vec3 lightProbe[ 9 ];
|
|
@@ -797,7 +797,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
797
797
|
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
|
798
798
|
return irradiance;
|
|
799
799
|
}
|
|
800
|
-
#endif`,
|
|
800
|
+
#endif`,BA=`#ifdef USE_ENVMAP
|
|
801
801
|
vec3 getIBLIrradiance( const in vec3 normal ) {
|
|
802
802
|
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
803
803
|
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
@@ -830,8 +830,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
|
|
|
830
830
|
#endif
|
|
831
831
|
}
|
|
832
832
|
#endif
|
|
833
|
-
#endif`,
|
|
834
|
-
material.diffuseColor = diffuseColor.rgb;`,
|
|
833
|
+
#endif`,zA=`ToonMaterial material;
|
|
834
|
+
material.diffuseColor = diffuseColor.rgb;`,kA=`varying vec3 vViewPosition;
|
|
835
835
|
struct ToonMaterial {
|
|
836
836
|
vec3 diffuseColor;
|
|
837
837
|
};
|
|
@@ -843,11 +843,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
|
|
|
843
843
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
844
844
|
}
|
|
845
845
|
#define RE_Direct RE_Direct_Toon
|
|
846
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,
|
|
846
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,HA=`BlinnPhongMaterial material;
|
|
847
847
|
material.diffuseColor = diffuseColor.rgb;
|
|
848
848
|
material.specularColor = specular;
|
|
849
849
|
material.specularShininess = shininess;
|
|
850
|
-
material.specularStrength = specularStrength;`,
|
|
850
|
+
material.specularStrength = specularStrength;`,GA=`varying vec3 vViewPosition;
|
|
851
851
|
struct BlinnPhongMaterial {
|
|
852
852
|
vec3 diffuseColor;
|
|
853
853
|
vec3 specularColor;
|
|
@@ -864,7 +864,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
|
|
|
864
864
|
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
865
865
|
}
|
|
866
866
|
#define RE_Direct RE_Direct_BlinnPhong
|
|
867
|
-
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,
|
|
867
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,VA=`PhysicalMaterial material;
|
|
868
868
|
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
869
869
|
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
|
|
870
870
|
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
|
@@ -947,7 +947,7 @@ material.roughness = min( material.roughness, 1.0 );
|
|
|
947
947
|
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
|
|
948
948
|
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
|
|
949
949
|
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
|
|
950
|
-
#endif`,
|
|
950
|
+
#endif`,WA=`struct PhysicalMaterial {
|
|
951
951
|
vec3 diffuseColor;
|
|
952
952
|
float roughness;
|
|
953
953
|
vec3 specularColor;
|
|
@@ -1247,7 +1247,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
|
|
|
1247
1247
|
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
1248
1248
|
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
1249
1249
|
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
1250
|
-
}`,
|
|
1250
|
+
}`,XA=`
|
|
1251
1251
|
vec3 geometryPosition = - vViewPosition;
|
|
1252
1252
|
vec3 geometryNormal = normal;
|
|
1253
1253
|
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
@@ -1362,7 +1362,7 @@ IncidentLight directLight;
|
|
|
1362
1362
|
#if defined( RE_IndirectSpecular )
|
|
1363
1363
|
vec3 radiance = vec3( 0.0 );
|
|
1364
1364
|
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
1365
|
-
#endif`,
|
|
1365
|
+
#endif`,YA=`#if defined( RE_IndirectDiffuse )
|
|
1366
1366
|
#ifdef USE_LIGHTMAP
|
|
1367
1367
|
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
1368
1368
|
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
@@ -1381,33 +1381,33 @@ IncidentLight directLight;
|
|
|
1381
1381
|
#ifdef USE_CLEARCOAT
|
|
1382
1382
|
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
|
1383
1383
|
#endif
|
|
1384
|
-
#endif`,
|
|
1384
|
+
#endif`,jA=`#if defined( RE_IndirectDiffuse )
|
|
1385
1385
|
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1386
1386
|
#endif
|
|
1387
1387
|
#if defined( RE_IndirectSpecular )
|
|
1388
1388
|
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1389
|
-
#endif`,
|
|
1389
|
+
#endif`,qA=`#if defined( USE_LOGDEPTHBUF )
|
|
1390
1390
|
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1391
|
-
#endif`,
|
|
1391
|
+
#endif`,KA=`#if defined( USE_LOGDEPTHBUF )
|
|
1392
1392
|
uniform float logDepthBufFC;
|
|
1393
1393
|
varying float vFragDepth;
|
|
1394
1394
|
varying float vIsPerspective;
|
|
1395
|
-
#endif`,
|
|
1395
|
+
#endif`,ZA=`#ifdef USE_LOGDEPTHBUF
|
|
1396
1396
|
varying float vFragDepth;
|
|
1397
1397
|
varying float vIsPerspective;
|
|
1398
|
-
#endif
|
|
1398
|
+
#endif`,$A=`#ifdef USE_LOGDEPTHBUF
|
|
1399
1399
|
vFragDepth = 1.0 + gl_Position.w;
|
|
1400
1400
|
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1401
|
-
#endif`,
|
|
1401
|
+
#endif`,JA=`#ifdef USE_MAP
|
|
1402
1402
|
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
|
1403
1403
|
#ifdef DECODE_VIDEO_TEXTURE
|
|
1404
1404
|
sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
|
|
1405
1405
|
|
|
1406
1406
|
#endif
|
|
1407
1407
|
diffuseColor *= sampledDiffuseColor;
|
|
1408
|
-
#endif`,
|
|
1408
|
+
#endif`,QA=`#ifdef USE_MAP
|
|
1409
1409
|
uniform sampler2D map;
|
|
1410
|
-
#endif`,
|
|
1410
|
+
#endif`,ew=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1411
1411
|
#if defined( USE_POINTS_UV )
|
|
1412
1412
|
vec2 uv = vUv;
|
|
1413
1413
|
#else
|
|
@@ -1419,7 +1419,7 @@ IncidentLight directLight;
|
|
|
1419
1419
|
#endif
|
|
1420
1420
|
#ifdef USE_ALPHAMAP
|
|
1421
1421
|
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
1422
|
-
#endif`,
|
|
1422
|
+
#endif`,tw=`#if defined( USE_POINTS_UV )
|
|
1423
1423
|
varying vec2 vUv;
|
|
1424
1424
|
#else
|
|
1425
1425
|
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
@@ -1431,19 +1431,19 @@ IncidentLight directLight;
|
|
|
1431
1431
|
#endif
|
|
1432
1432
|
#ifdef USE_ALPHAMAP
|
|
1433
1433
|
uniform sampler2D alphaMap;
|
|
1434
|
-
#endif`,
|
|
1434
|
+
#endif`,nw=`float metalnessFactor = metalness;
|
|
1435
1435
|
#ifdef USE_METALNESSMAP
|
|
1436
1436
|
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
|
1437
1437
|
metalnessFactor *= texelMetalness.b;
|
|
1438
|
-
#endif`,
|
|
1438
|
+
#endif`,iw=`#ifdef USE_METALNESSMAP
|
|
1439
1439
|
uniform sampler2D metalnessMap;
|
|
1440
|
-
#endif`,
|
|
1440
|
+
#endif`,rw=`#ifdef USE_INSTANCING_MORPH
|
|
1441
1441
|
float morphTargetInfluences[MORPHTARGETS_COUNT];
|
|
1442
1442
|
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
|
|
1443
1443
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1444
1444
|
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
|
|
1445
1445
|
}
|
|
1446
|
-
#endif`,
|
|
1446
|
+
#endif`,sw=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
|
|
1447
1447
|
vColor *= morphTargetBaseInfluence;
|
|
1448
1448
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1449
1449
|
#if defined( USE_COLOR_ALPHA )
|
|
@@ -1452,7 +1452,7 @@ IncidentLight directLight;
|
|
|
1452
1452
|
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
|
1453
1453
|
#endif
|
|
1454
1454
|
}
|
|
1455
|
-
#endif`,
|
|
1455
|
+
#endif`,ow=`#ifdef USE_MORPHNORMALS
|
|
1456
1456
|
objectNormal *= morphTargetBaseInfluence;
|
|
1457
1457
|
#ifdef MORPHTARGETS_TEXTURE
|
|
1458
1458
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
@@ -1464,7 +1464,7 @@ IncidentLight directLight;
|
|
|
1464
1464
|
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
|
|
1465
1465
|
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
|
|
1466
1466
|
#endif
|
|
1467
|
-
#endif`,
|
|
1467
|
+
#endif`,aw=`#ifdef USE_MORPHTARGETS
|
|
1468
1468
|
#ifndef USE_INSTANCING_MORPH
|
|
1469
1469
|
uniform float morphTargetBaseInfluence;
|
|
1470
1470
|
#endif
|
|
@@ -1488,7 +1488,7 @@ IncidentLight directLight;
|
|
|
1488
1488
|
uniform float morphTargetInfluences[ 4 ];
|
|
1489
1489
|
#endif
|
|
1490
1490
|
#endif
|
|
1491
|
-
#endif`,
|
|
1491
|
+
#endif`,cw=`#ifdef USE_MORPHTARGETS
|
|
1492
1492
|
transformed *= morphTargetBaseInfluence;
|
|
1493
1493
|
#ifdef MORPHTARGETS_TEXTURE
|
|
1494
1494
|
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
@@ -1506,7 +1506,7 @@ IncidentLight directLight;
|
|
|
1506
1506
|
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
|
|
1507
1507
|
#endif
|
|
1508
1508
|
#endif
|
|
1509
|
-
#endif`,
|
|
1509
|
+
#endif`,lw=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|
1510
1510
|
#ifdef FLAT_SHADED
|
|
1511
1511
|
vec3 fdx = dFdx( vViewPosition );
|
|
1512
1512
|
vec3 fdy = dFdy( vViewPosition );
|
|
@@ -1547,7 +1547,7 @@ IncidentLight directLight;
|
|
|
1547
1547
|
tbn2[1] *= faceDirection;
|
|
1548
1548
|
#endif
|
|
1549
1549
|
#endif
|
|
1550
|
-
vec3 nonPerturbedNormal = normal;`,
|
|
1550
|
+
vec3 nonPerturbedNormal = normal;`,uw=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
1551
1551
|
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1552
1552
|
#ifdef FLIP_SIDED
|
|
1553
1553
|
normal = - normal;
|
|
@@ -1562,25 +1562,25 @@ vec3 nonPerturbedNormal = normal;`,YA=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1562
1562
|
normal = normalize( tbn * mapN );
|
|
1563
1563
|
#elif defined( USE_BUMPMAP )
|
|
1564
1564
|
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|
1565
|
-
#endif`,
|
|
1565
|
+
#endif`,hw=`#ifndef FLAT_SHADED
|
|
1566
1566
|
varying vec3 vNormal;
|
|
1567
1567
|
#ifdef USE_TANGENT
|
|
1568
1568
|
varying vec3 vTangent;
|
|
1569
1569
|
varying vec3 vBitangent;
|
|
1570
1570
|
#endif
|
|
1571
|
-
#endif`,
|
|
1571
|
+
#endif`,fw=`#ifndef FLAT_SHADED
|
|
1572
1572
|
varying vec3 vNormal;
|
|
1573
1573
|
#ifdef USE_TANGENT
|
|
1574
1574
|
varying vec3 vTangent;
|
|
1575
1575
|
varying vec3 vBitangent;
|
|
1576
1576
|
#endif
|
|
1577
|
-
#endif`,
|
|
1577
|
+
#endif`,dw=`#ifndef FLAT_SHADED
|
|
1578
1578
|
vNormal = normalize( transformedNormal );
|
|
1579
1579
|
#ifdef USE_TANGENT
|
|
1580
1580
|
vTangent = normalize( transformedTangent );
|
|
1581
1581
|
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
1582
1582
|
#endif
|
|
1583
|
-
#endif`,
|
|
1583
|
+
#endif`,pw=`#ifdef USE_NORMALMAP
|
|
1584
1584
|
uniform sampler2D normalMap;
|
|
1585
1585
|
uniform vec2 normalScale;
|
|
1586
1586
|
#endif
|
|
@@ -1602,13 +1602,13 @@ vec3 nonPerturbedNormal = normal;`,YA=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1602
1602
|
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
|
|
1603
1603
|
return mat3( T * scale, B * scale, N );
|
|
1604
1604
|
}
|
|
1605
|
-
#endif
|
|
1605
|
+
#endif`,mw=`#ifdef USE_CLEARCOAT
|
|
1606
1606
|
vec3 clearcoatNormal = nonPerturbedNormal;
|
|
1607
|
-
#endif`,
|
|
1607
|
+
#endif`,gw=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1608
1608
|
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1609
1609
|
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
1610
1610
|
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
|
1611
|
-
#endif`,
|
|
1611
|
+
#endif`,_w=`#ifdef USE_CLEARCOATMAP
|
|
1612
1612
|
uniform sampler2D clearcoatMap;
|
|
1613
1613
|
#endif
|
|
1614
1614
|
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
@@ -1617,18 +1617,18 @@ vec3 nonPerturbedNormal = normal;`,YA=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
|
1617
1617
|
#endif
|
|
1618
1618
|
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1619
1619
|
uniform sampler2D clearcoatRoughnessMap;
|
|
1620
|
-
#endif`,
|
|
1620
|
+
#endif`,vw=`#ifdef USE_IRIDESCENCEMAP
|
|
1621
1621
|
uniform sampler2D iridescenceMap;
|
|
1622
1622
|
#endif
|
|
1623
1623
|
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
1624
1624
|
uniform sampler2D iridescenceThicknessMap;
|
|
1625
|
-
#endif`,
|
|
1625
|
+
#endif`,xw=`#ifdef OPAQUE
|
|
1626
1626
|
diffuseColor.a = 1.0;
|
|
1627
1627
|
#endif
|
|
1628
1628
|
#ifdef USE_TRANSMISSION
|
|
1629
1629
|
diffuseColor.a *= material.transmissionAlpha;
|
|
1630
1630
|
#endif
|
|
1631
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,
|
|
1631
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,yw=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
1632
1632
|
return normalize( normal ) * 0.5 + 0.5;
|
|
1633
1633
|
}
|
|
1634
1634
|
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
@@ -1669,9 +1669,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const
|
|
|
1669
1669
|
}
|
|
1670
1670
|
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
|
1671
1671
|
return ( near * far ) / ( ( far - near ) * depth - far );
|
|
1672
|
-
}`,
|
|
1672
|
+
}`,Sw=`#ifdef PREMULTIPLIED_ALPHA
|
|
1673
1673
|
gl_FragColor.rgb *= gl_FragColor.a;
|
|
1674
|
-
#endif`,
|
|
1674
|
+
#endif`,Mw=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
1675
1675
|
#ifdef USE_BATCHING
|
|
1676
1676
|
mvPosition = batchingMatrix * mvPosition;
|
|
1677
1677
|
#endif
|
|
@@ -1679,22 +1679,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
|
|
|
1679
1679
|
mvPosition = instanceMatrix * mvPosition;
|
|
1680
1680
|
#endif
|
|
1681
1681
|
mvPosition = modelViewMatrix * mvPosition;
|
|
1682
|
-
gl_Position = projectionMatrix * mvPosition;`,
|
|
1682
|
+
gl_Position = projectionMatrix * mvPosition;`,Ew=`#ifdef DITHERING
|
|
1683
1683
|
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
1684
|
-
#endif`,
|
|
1684
|
+
#endif`,bw=`#ifdef DITHERING
|
|
1685
1685
|
vec3 dithering( vec3 color ) {
|
|
1686
1686
|
float grid_position = rand( gl_FragCoord.xy );
|
|
1687
1687
|
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
1688
1688
|
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
1689
1689
|
return color + dither_shift_RGB;
|
|
1690
1690
|
}
|
|
1691
|
-
#endif`,
|
|
1691
|
+
#endif`,Tw=`float roughnessFactor = roughness;
|
|
1692
1692
|
#ifdef USE_ROUGHNESSMAP
|
|
1693
1693
|
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
|
1694
1694
|
roughnessFactor *= texelRoughness.g;
|
|
1695
|
-
#endif`,
|
|
1695
|
+
#endif`,Aw=`#ifdef USE_ROUGHNESSMAP
|
|
1696
1696
|
uniform sampler2D roughnessMap;
|
|
1697
|
-
#endif`,
|
|
1697
|
+
#endif`,ww=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1698
1698
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1699
1699
|
#endif
|
|
1700
1700
|
#if NUM_SPOT_LIGHT_MAPS > 0
|
|
@@ -1877,7 +1877,7 @@ gl_Position = projectionMatrix * mvPosition;`,sw=`#ifdef DITHERING
|
|
|
1877
1877
|
}
|
|
1878
1878
|
return shadow;
|
|
1879
1879
|
}
|
|
1880
|
-
#endif`,
|
|
1880
|
+
#endif`,Rw=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1881
1881
|
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
|
|
1882
1882
|
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1883
1883
|
#endif
|
|
@@ -1915,7 +1915,7 @@ gl_Position = projectionMatrix * mvPosition;`,sw=`#ifdef DITHERING
|
|
|
1915
1915
|
};
|
|
1916
1916
|
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1917
1917
|
#endif
|
|
1918
|
-
#endif`,
|
|
1918
|
+
#endif`,Cw=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
|
|
1919
1919
|
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
|
1920
1920
|
vec4 shadowWorldPosition;
|
|
1921
1921
|
#endif
|
|
@@ -1947,7 +1947,7 @@ gl_Position = projectionMatrix * mvPosition;`,sw=`#ifdef DITHERING
|
|
|
1947
1947
|
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
|
1948
1948
|
}
|
|
1949
1949
|
#pragma unroll_loop_end
|
|
1950
|
-
#endif`,
|
|
1950
|
+
#endif`,Pw=`float getShadowMask() {
|
|
1951
1951
|
float shadow = 1.0;
|
|
1952
1952
|
#ifdef USE_SHADOWMAP
|
|
1953
1953
|
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
@@ -1979,12 +1979,12 @@ gl_Position = projectionMatrix * mvPosition;`,sw=`#ifdef DITHERING
|
|
|
1979
1979
|
#endif
|
|
1980
1980
|
#endif
|
|
1981
1981
|
return shadow;
|
|
1982
|
-
}`,
|
|
1982
|
+
}`,Lw=`#ifdef USE_SKINNING
|
|
1983
1983
|
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
1984
1984
|
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
1985
1985
|
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
1986
1986
|
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
1987
|
-
#endif`,
|
|
1987
|
+
#endif`,Iw=`#ifdef USE_SKINNING
|
|
1988
1988
|
uniform mat4 bindMatrix;
|
|
1989
1989
|
uniform mat4 bindMatrixInverse;
|
|
1990
1990
|
uniform highp sampler2D boneTexture;
|
|
@@ -1999,7 +1999,7 @@ gl_Position = projectionMatrix * mvPosition;`,sw=`#ifdef DITHERING
|
|
|
1999
1999
|
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
|
2000
2000
|
return mat4( v1, v2, v3, v4 );
|
|
2001
2001
|
}
|
|
2002
|
-
#endif`,
|
|
2002
|
+
#endif`,Dw=`#ifdef USE_SKINNING
|
|
2003
2003
|
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
2004
2004
|
vec4 skinned = vec4( 0.0 );
|
|
2005
2005
|
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
@@ -2007,7 +2007,7 @@ gl_Position = projectionMatrix * mvPosition;`,sw=`#ifdef DITHERING
|
|
|
2007
2007
|
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
2008
2008
|
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
2009
2009
|
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
2010
|
-
#endif`,
|
|
2010
|
+
#endif`,Ow=`#ifdef USE_SKINNING
|
|
2011
2011
|
mat4 skinMatrix = mat4( 0.0 );
|
|
2012
2012
|
skinMatrix += skinWeight.x * boneMatX;
|
|
2013
2013
|
skinMatrix += skinWeight.y * boneMatY;
|
|
@@ -2018,17 +2018,17 @@ gl_Position = projectionMatrix * mvPosition;`,sw=`#ifdef DITHERING
|
|
|
2018
2018
|
#ifdef USE_TANGENT
|
|
2019
2019
|
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
2020
2020
|
#endif
|
|
2021
|
-
#endif`,
|
|
2021
|
+
#endif`,Uw=`float specularStrength;
|
|
2022
2022
|
#ifdef USE_SPECULARMAP
|
|
2023
2023
|
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
|
2024
2024
|
specularStrength = texelSpecular.r;
|
|
2025
2025
|
#else
|
|
2026
2026
|
specularStrength = 1.0;
|
|
2027
|
-
#endif`,
|
|
2027
|
+
#endif`,Nw=`#ifdef USE_SPECULARMAP
|
|
2028
2028
|
uniform sampler2D specularMap;
|
|
2029
|
-
#endif`,
|
|
2029
|
+
#endif`,Fw=`#if defined( TONE_MAPPING )
|
|
2030
2030
|
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
2031
|
-
#endif`,
|
|
2031
|
+
#endif`,Bw=`#ifndef saturate
|
|
2032
2032
|
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
2033
2033
|
#endif
|
|
2034
2034
|
uniform float toneMappingExposure;
|
|
@@ -2125,7 +2125,7 @@ vec3 NeutralToneMapping( vec3 color ) {
|
|
|
2125
2125
|
float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);
|
|
2126
2126
|
return mix(color, newPeak * vec3(1, 1, 1), g);
|
|
2127
2127
|
}
|
|
2128
|
-
vec3 CustomToneMapping( vec3 color ) { return color; }`,
|
|
2128
|
+
vec3 CustomToneMapping( vec3 color ) { return color; }`,zw=`#ifdef USE_TRANSMISSION
|
|
2129
2129
|
material.transmission = transmission;
|
|
2130
2130
|
material.transmissionAlpha = 1.0;
|
|
2131
2131
|
material.thickness = thickness;
|
|
@@ -2146,7 +2146,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Sw=`#ifdef USE_TRANSMISS
|
|
|
2146
2146
|
material.attenuationColor, material.attenuationDistance );
|
|
2147
2147
|
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
|
|
2148
2148
|
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
|
|
2149
|
-
#endif`,
|
|
2149
|
+
#endif`,kw=`#ifdef USE_TRANSMISSION
|
|
2150
2150
|
uniform float transmission;
|
|
2151
2151
|
uniform float thickness;
|
|
2152
2152
|
uniform float attenuationDistance;
|
|
@@ -2252,7 +2252,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Sw=`#ifdef USE_TRANSMISS
|
|
|
2252
2252
|
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
|
|
2253
2253
|
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
|
|
2254
2254
|
}
|
|
2255
|
-
#endif`,
|
|
2255
|
+
#endif`,Hw=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2256
2256
|
varying vec2 vUv;
|
|
2257
2257
|
#endif
|
|
2258
2258
|
#ifdef USE_MAP
|
|
@@ -2322,7 +2322,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Sw=`#ifdef USE_TRANSMISS
|
|
|
2322
2322
|
#ifdef USE_THICKNESSMAP
|
|
2323
2323
|
uniform mat3 thicknessMapTransform;
|
|
2324
2324
|
varying vec2 vThicknessMapUv;
|
|
2325
|
-
#endif`,
|
|
2325
|
+
#endif`,Gw=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2326
2326
|
varying vec2 vUv;
|
|
2327
2327
|
#endif
|
|
2328
2328
|
#ifdef USE_MAP
|
|
@@ -2416,7 +2416,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Sw=`#ifdef USE_TRANSMISS
|
|
|
2416
2416
|
#ifdef USE_THICKNESSMAP
|
|
2417
2417
|
uniform mat3 thicknessMapTransform;
|
|
2418
2418
|
varying vec2 vThicknessMapUv;
|
|
2419
|
-
#endif`,
|
|
2419
|
+
#endif`,Vw=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2420
2420
|
vUv = vec3( uv, 1 ).xy;
|
|
2421
2421
|
#endif
|
|
2422
2422
|
#ifdef USE_MAP
|
|
@@ -2487,7 +2487,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Sw=`#ifdef USE_TRANSMISS
|
|
|
2487
2487
|
#endif
|
|
2488
2488
|
#ifdef USE_THICKNESSMAP
|
|
2489
2489
|
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
|
2490
|
-
#endif`,
|
|
2490
|
+
#endif`,Ww=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
|
|
2491
2491
|
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
2492
2492
|
#ifdef USE_BATCHING
|
|
2493
2493
|
worldPosition = batchingMatrix * worldPosition;
|
|
@@ -2496,12 +2496,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Sw=`#ifdef USE_TRANSMISS
|
|
|
2496
2496
|
worldPosition = instanceMatrix * worldPosition;
|
|
2497
2497
|
#endif
|
|
2498
2498
|
worldPosition = modelMatrix * worldPosition;
|
|
2499
|
-
#endif`;const
|
|
2499
|
+
#endif`;const Xw=`varying vec2 vUv;
|
|
2500
2500
|
uniform mat3 uvTransform;
|
|
2501
2501
|
void main() {
|
|
2502
2502
|
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
2503
2503
|
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
2504
|
-
}`,
|
|
2504
|
+
}`,Yw=`uniform sampler2D t2D;
|
|
2505
2505
|
uniform float backgroundIntensity;
|
|
2506
2506
|
varying vec2 vUv;
|
|
2507
2507
|
void main() {
|
|
@@ -2513,14 +2513,14 @@ void main() {
|
|
|
2513
2513
|
gl_FragColor = texColor;
|
|
2514
2514
|
#include <tonemapping_fragment>
|
|
2515
2515
|
#include <colorspace_fragment>
|
|
2516
|
-
}`,
|
|
2516
|
+
}`,jw=`varying vec3 vWorldDirection;
|
|
2517
2517
|
#include <common>
|
|
2518
2518
|
void main() {
|
|
2519
2519
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2520
2520
|
#include <begin_vertex>
|
|
2521
2521
|
#include <project_vertex>
|
|
2522
2522
|
gl_Position.z = gl_Position.w;
|
|
2523
|
-
}`,
|
|
2523
|
+
}`,qw=`#ifdef ENVMAP_TYPE_CUBE
|
|
2524
2524
|
uniform samplerCube envMap;
|
|
2525
2525
|
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
2526
2526
|
uniform sampler2D envMap;
|
|
@@ -2543,14 +2543,14 @@ void main() {
|
|
|
2543
2543
|
gl_FragColor = texColor;
|
|
2544
2544
|
#include <tonemapping_fragment>
|
|
2545
2545
|
#include <colorspace_fragment>
|
|
2546
|
-
}`,
|
|
2546
|
+
}`,Kw=`varying vec3 vWorldDirection;
|
|
2547
2547
|
#include <common>
|
|
2548
2548
|
void main() {
|
|
2549
2549
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2550
2550
|
#include <begin_vertex>
|
|
2551
2551
|
#include <project_vertex>
|
|
2552
2552
|
gl_Position.z = gl_Position.w;
|
|
2553
|
-
}`,
|
|
2553
|
+
}`,Zw=`uniform samplerCube tCube;
|
|
2554
2554
|
uniform float tFlip;
|
|
2555
2555
|
uniform float opacity;
|
|
2556
2556
|
varying vec3 vWorldDirection;
|
|
@@ -2560,7 +2560,7 @@ void main() {
|
|
|
2560
2560
|
gl_FragColor.a *= opacity;
|
|
2561
2561
|
#include <tonemapping_fragment>
|
|
2562
2562
|
#include <colorspace_fragment>
|
|
2563
|
-
}
|
|
2563
|
+
}`,$w=`#include <common>
|
|
2564
2564
|
#include <batching_pars_vertex>
|
|
2565
2565
|
#include <uv_pars_vertex>
|
|
2566
2566
|
#include <displacementmap_pars_vertex>
|
|
@@ -2587,7 +2587,7 @@ void main() {
|
|
|
2587
2587
|
#include <logdepthbuf_vertex>
|
|
2588
2588
|
#include <clipping_planes_vertex>
|
|
2589
2589
|
vHighPrecisionZW = gl_Position.zw;
|
|
2590
|
-
}`,
|
|
2590
|
+
}`,Jw=`#if DEPTH_PACKING == 3200
|
|
2591
2591
|
uniform float opacity;
|
|
2592
2592
|
#endif
|
|
2593
2593
|
#include <common>
|
|
@@ -2617,7 +2617,7 @@ void main() {
|
|
|
2617
2617
|
#elif DEPTH_PACKING == 3201
|
|
2618
2618
|
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
|
2619
2619
|
#endif
|
|
2620
|
-
}`,
|
|
2620
|
+
}`,Qw=`#define DISTANCE
|
|
2621
2621
|
varying vec3 vWorldPosition;
|
|
2622
2622
|
#include <common>
|
|
2623
2623
|
#include <batching_pars_vertex>
|
|
@@ -2644,7 +2644,7 @@ void main() {
|
|
|
2644
2644
|
#include <worldpos_vertex>
|
|
2645
2645
|
#include <clipping_planes_vertex>
|
|
2646
2646
|
vWorldPosition = worldPosition.xyz;
|
|
2647
|
-
}`,
|
|
2647
|
+
}`,e1=`#define DISTANCE
|
|
2648
2648
|
uniform vec3 referencePosition;
|
|
2649
2649
|
uniform float nearDistance;
|
|
2650
2650
|
uniform float farDistance;
|
|
@@ -2668,13 +2668,13 @@ void main () {
|
|
|
2668
2668
|
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|
2669
2669
|
dist = saturate( dist );
|
|
2670
2670
|
gl_FragColor = packDepthToRGBA( dist );
|
|
2671
|
-
}`,
|
|
2671
|
+
}`,t1=`varying vec3 vWorldDirection;
|
|
2672
2672
|
#include <common>
|
|
2673
2673
|
void main() {
|
|
2674
2674
|
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2675
2675
|
#include <begin_vertex>
|
|
2676
2676
|
#include <project_vertex>
|
|
2677
|
-
}`,
|
|
2677
|
+
}`,n1=`uniform sampler2D tEquirect;
|
|
2678
2678
|
varying vec3 vWorldDirection;
|
|
2679
2679
|
#include <common>
|
|
2680
2680
|
void main() {
|
|
@@ -2683,7 +2683,7 @@ void main() {
|
|
|
2683
2683
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
2684
2684
|
#include <tonemapping_fragment>
|
|
2685
2685
|
#include <colorspace_fragment>
|
|
2686
|
-
}`,
|
|
2686
|
+
}`,i1=`uniform float scale;
|
|
2687
2687
|
attribute float lineDistance;
|
|
2688
2688
|
varying float vLineDistance;
|
|
2689
2689
|
#include <common>
|
|
@@ -2705,7 +2705,7 @@ void main() {
|
|
|
2705
2705
|
#include <logdepthbuf_vertex>
|
|
2706
2706
|
#include <clipping_planes_vertex>
|
|
2707
2707
|
#include <fog_vertex>
|
|
2708
|
-
}`,
|
|
2708
|
+
}`,r1=`uniform vec3 diffuse;
|
|
2709
2709
|
uniform float opacity;
|
|
2710
2710
|
uniform float dashSize;
|
|
2711
2711
|
uniform float totalSize;
|
|
@@ -2733,7 +2733,7 @@ void main() {
|
|
|
2733
2733
|
#include <colorspace_fragment>
|
|
2734
2734
|
#include <fog_fragment>
|
|
2735
2735
|
#include <premultiplied_alpha_fragment>
|
|
2736
|
-
}`,
|
|
2736
|
+
}`,s1=`#include <common>
|
|
2737
2737
|
#include <batching_pars_vertex>
|
|
2738
2738
|
#include <uv_pars_vertex>
|
|
2739
2739
|
#include <envmap_pars_vertex>
|
|
@@ -2765,7 +2765,7 @@ void main() {
|
|
|
2765
2765
|
#include <worldpos_vertex>
|
|
2766
2766
|
#include <envmap_vertex>
|
|
2767
2767
|
#include <fog_vertex>
|
|
2768
|
-
}`,
|
|
2768
|
+
}`,o1=`uniform vec3 diffuse;
|
|
2769
2769
|
uniform float opacity;
|
|
2770
2770
|
#ifndef FLAT_SHADED
|
|
2771
2771
|
varying vec3 vNormal;
|
|
@@ -2813,7 +2813,7 @@ void main() {
|
|
|
2813
2813
|
#include <fog_fragment>
|
|
2814
2814
|
#include <premultiplied_alpha_fragment>
|
|
2815
2815
|
#include <dithering_fragment>
|
|
2816
|
-
}`,
|
|
2816
|
+
}`,a1=`#define LAMBERT
|
|
2817
2817
|
varying vec3 vViewPosition;
|
|
2818
2818
|
#include <common>
|
|
2819
2819
|
#include <batching_pars_vertex>
|
|
@@ -2852,7 +2852,7 @@ void main() {
|
|
|
2852
2852
|
#include <envmap_vertex>
|
|
2853
2853
|
#include <shadowmap_vertex>
|
|
2854
2854
|
#include <fog_vertex>
|
|
2855
|
-
}`,
|
|
2855
|
+
}`,c1=`#define LAMBERT
|
|
2856
2856
|
uniform vec3 diffuse;
|
|
2857
2857
|
uniform vec3 emissive;
|
|
2858
2858
|
uniform float opacity;
|
|
@@ -2909,7 +2909,7 @@ void main() {
|
|
|
2909
2909
|
#include <fog_fragment>
|
|
2910
2910
|
#include <premultiplied_alpha_fragment>
|
|
2911
2911
|
#include <dithering_fragment>
|
|
2912
|
-
}`,
|
|
2912
|
+
}`,l1=`#define MATCAP
|
|
2913
2913
|
varying vec3 vViewPosition;
|
|
2914
2914
|
#include <common>
|
|
2915
2915
|
#include <batching_pars_vertex>
|
|
@@ -2943,7 +2943,7 @@ void main() {
|
|
|
2943
2943
|
#include <clipping_planes_vertex>
|
|
2944
2944
|
#include <fog_vertex>
|
|
2945
2945
|
vViewPosition = - mvPosition.xyz;
|
|
2946
|
-
}`,
|
|
2946
|
+
}`,u1=`#define MATCAP
|
|
2947
2947
|
uniform vec3 diffuse;
|
|
2948
2948
|
uniform float opacity;
|
|
2949
2949
|
uniform sampler2D matcap;
|
|
@@ -2989,7 +2989,7 @@ void main() {
|
|
|
2989
2989
|
#include <fog_fragment>
|
|
2990
2990
|
#include <premultiplied_alpha_fragment>
|
|
2991
2991
|
#include <dithering_fragment>
|
|
2992
|
-
}`,
|
|
2992
|
+
}`,h1=`#define NORMAL
|
|
2993
2993
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
2994
2994
|
varying vec3 vViewPosition;
|
|
2995
2995
|
#endif
|
|
@@ -3022,7 +3022,7 @@ void main() {
|
|
|
3022
3022
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3023
3023
|
vViewPosition = - mvPosition.xyz;
|
|
3024
3024
|
#endif
|
|
3025
|
-
}`,
|
|
3025
|
+
}`,f1=`#define NORMAL
|
|
3026
3026
|
uniform float opacity;
|
|
3027
3027
|
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3028
3028
|
varying vec3 vViewPosition;
|
|
@@ -3044,7 +3044,7 @@ void main() {
|
|
|
3044
3044
|
#ifdef OPAQUE
|
|
3045
3045
|
gl_FragColor.a = 1.0;
|
|
3046
3046
|
#endif
|
|
3047
|
-
}`,
|
|
3047
|
+
}`,d1=`#define PHONG
|
|
3048
3048
|
varying vec3 vViewPosition;
|
|
3049
3049
|
#include <common>
|
|
3050
3050
|
#include <batching_pars_vertex>
|
|
@@ -3083,7 +3083,7 @@ void main() {
|
|
|
3083
3083
|
#include <envmap_vertex>
|
|
3084
3084
|
#include <shadowmap_vertex>
|
|
3085
3085
|
#include <fog_vertex>
|
|
3086
|
-
}`,
|
|
3086
|
+
}`,p1=`#define PHONG
|
|
3087
3087
|
uniform vec3 diffuse;
|
|
3088
3088
|
uniform vec3 emissive;
|
|
3089
3089
|
uniform vec3 specular;
|
|
@@ -3142,7 +3142,7 @@ void main() {
|
|
|
3142
3142
|
#include <fog_fragment>
|
|
3143
3143
|
#include <premultiplied_alpha_fragment>
|
|
3144
3144
|
#include <dithering_fragment>
|
|
3145
|
-
}
|
|
3145
|
+
}`,m1=`#define STANDARD
|
|
3146
3146
|
varying vec3 vViewPosition;
|
|
3147
3147
|
#ifdef USE_TRANSMISSION
|
|
3148
3148
|
varying vec3 vWorldPosition;
|
|
@@ -3185,7 +3185,7 @@ void main() {
|
|
|
3185
3185
|
#ifdef USE_TRANSMISSION
|
|
3186
3186
|
vWorldPosition = worldPosition.xyz;
|
|
3187
3187
|
#endif
|
|
3188
|
-
}`,
|
|
3188
|
+
}`,g1=`#define STANDARD
|
|
3189
3189
|
#ifdef PHYSICAL
|
|
3190
3190
|
#define IOR
|
|
3191
3191
|
#define USE_SPECULAR
|
|
@@ -3307,7 +3307,7 @@ void main() {
|
|
|
3307
3307
|
#include <fog_fragment>
|
|
3308
3308
|
#include <premultiplied_alpha_fragment>
|
|
3309
3309
|
#include <dithering_fragment>
|
|
3310
|
-
}`,
|
|
3310
|
+
}`,_1=`#define TOON
|
|
3311
3311
|
varying vec3 vViewPosition;
|
|
3312
3312
|
#include <common>
|
|
3313
3313
|
#include <batching_pars_vertex>
|
|
@@ -3344,7 +3344,7 @@ void main() {
|
|
|
3344
3344
|
#include <worldpos_vertex>
|
|
3345
3345
|
#include <shadowmap_vertex>
|
|
3346
3346
|
#include <fog_vertex>
|
|
3347
|
-
}`,
|
|
3347
|
+
}`,v1=`#define TOON
|
|
3348
3348
|
uniform vec3 diffuse;
|
|
3349
3349
|
uniform vec3 emissive;
|
|
3350
3350
|
uniform float opacity;
|
|
@@ -3397,7 +3397,7 @@ void main() {
|
|
|
3397
3397
|
#include <fog_fragment>
|
|
3398
3398
|
#include <premultiplied_alpha_fragment>
|
|
3399
3399
|
#include <dithering_fragment>
|
|
3400
|
-
}`,
|
|
3400
|
+
}`,x1=`uniform float size;
|
|
3401
3401
|
uniform float scale;
|
|
3402
3402
|
#include <common>
|
|
3403
3403
|
#include <color_pars_vertex>
|
|
@@ -3428,7 +3428,7 @@ void main() {
|
|
|
3428
3428
|
#include <clipping_planes_vertex>
|
|
3429
3429
|
#include <worldpos_vertex>
|
|
3430
3430
|
#include <fog_vertex>
|
|
3431
|
-
}`,
|
|
3431
|
+
}`,y1=`uniform vec3 diffuse;
|
|
3432
3432
|
uniform float opacity;
|
|
3433
3433
|
#include <common>
|
|
3434
3434
|
#include <color_pars_fragment>
|
|
@@ -3453,7 +3453,7 @@ void main() {
|
|
|
3453
3453
|
#include <colorspace_fragment>
|
|
3454
3454
|
#include <fog_fragment>
|
|
3455
3455
|
#include <premultiplied_alpha_fragment>
|
|
3456
|
-
}`,
|
|
3456
|
+
}`,S1=`#include <common>
|
|
3457
3457
|
#include <batching_pars_vertex>
|
|
3458
3458
|
#include <fog_pars_vertex>
|
|
3459
3459
|
#include <morphtarget_pars_vertex>
|
|
@@ -3476,7 +3476,7 @@ void main() {
|
|
|
3476
3476
|
#include <worldpos_vertex>
|
|
3477
3477
|
#include <shadowmap_vertex>
|
|
3478
3478
|
#include <fog_vertex>
|
|
3479
|
-
}`,
|
|
3479
|
+
}`,M1=`uniform vec3 color;
|
|
3480
3480
|
uniform float opacity;
|
|
3481
3481
|
#include <common>
|
|
3482
3482
|
#include <packing>
|
|
@@ -3492,7 +3492,7 @@ void main() {
|
|
|
3492
3492
|
#include <tonemapping_fragment>
|
|
3493
3493
|
#include <colorspace_fragment>
|
|
3494
3494
|
#include <fog_fragment>
|
|
3495
|
-
}`,
|
|
3495
|
+
}`,E1=`uniform float rotation;
|
|
3496
3496
|
uniform vec2 center;
|
|
3497
3497
|
#include <common>
|
|
3498
3498
|
#include <uv_pars_vertex>
|
|
@@ -3518,7 +3518,7 @@ void main() {
|
|
|
3518
3518
|
#include <logdepthbuf_vertex>
|
|
3519
3519
|
#include <clipping_planes_vertex>
|
|
3520
3520
|
#include <fog_vertex>
|
|
3521
|
-
}`,
|
|
3521
|
+
}`,b1=`uniform vec3 diffuse;
|
|
3522
3522
|
uniform float opacity;
|
|
3523
3523
|
#include <common>
|
|
3524
3524
|
#include <uv_pars_fragment>
|
|
@@ -3543,7 +3543,7 @@ void main() {
|
|
|
3543
3543
|
#include <tonemapping_fragment>
|
|
3544
3544
|
#include <colorspace_fragment>
|
|
3545
3545
|
#include <fog_fragment>
|
|
3546
|
-
}`,ct={alphahash_fragment:wT,alphahash_pars_fragment:RT,alphamap_fragment:CT,alphamap_pars_fragment:PT,alphatest_fragment:LT,alphatest_pars_fragment:IT,aomap_fragment:DT,aomap_pars_fragment:UT,batching_pars_vertex:OT,batching_vertex:NT,begin_vertex:FT,beginnormal_vertex:BT,bsdfs:zT,iridescence_fragment:kT,bumpmap_pars_fragment:HT,clipping_planes_fragment:GT,clipping_planes_pars_fragment:VT,clipping_planes_pars_vertex:WT,clipping_planes_vertex:XT,color_fragment:YT,color_pars_fragment:jT,color_pars_vertex:qT,color_vertex:KT,common:ZT,cube_uv_reflection_fragment:$T,defaultnormal_vertex:JT,displacementmap_pars_vertex:QT,displacementmap_vertex:eA,emissivemap_fragment:tA,emissivemap_pars_fragment:nA,colorspace_fragment:iA,colorspace_pars_fragment:rA,envmap_fragment:sA,envmap_common_pars_fragment:oA,envmap_pars_fragment:aA,envmap_pars_vertex:cA,envmap_physical_pars_fragment:yA,envmap_vertex:lA,fog_vertex:hA,fog_pars_vertex:uA,fog_fragment:fA,fog_pars_fragment:dA,gradientmap_pars_fragment:pA,lightmap_fragment:mA,lightmap_pars_fragment:gA,lights_lambert_fragment:_A,lights_lambert_pars_fragment:vA,lights_pars_begin:xA,lights_toon_fragment:SA,lights_toon_pars_fragment:MA,lights_phong_fragment:EA,lights_phong_pars_fragment:bA,lights_physical_fragment:TA,lights_physical_pars_fragment:AA,lights_fragment_begin:wA,lights_fragment_maps:RA,lights_fragment_end:CA,logdepthbuf_fragment:PA,logdepthbuf_pars_fragment:LA,logdepthbuf_pars_vertex:IA,logdepthbuf_vertex:DA,map_fragment:UA,map_pars_fragment:OA,map_particle_fragment:NA,map_particle_pars_fragment:FA,metalnessmap_fragment:BA,metalnessmap_pars_fragment:zA,morphinstance_vertex:kA,morphcolor_vertex:HA,morphnormal_vertex:GA,morphtarget_pars_vertex:VA,morphtarget_vertex:WA,normal_fragment_begin:XA,normal_fragment_maps:YA,normal_pars_fragment:jA,normal_pars_vertex:qA,normal_vertex:KA,normalmap_pars_fragment:ZA,clearcoat_normal_fragment_begin:$A,clearcoat_normal_fragment_maps:JA,clearcoat_pars_fragment:QA,iridescence_pars_fragment:ew,opaque_fragment:tw,packing:nw,premultiplied_alpha_fragment:iw,project_vertex:rw,dithering_fragment:sw,dithering_pars_fragment:ow,roughnessmap_fragment:aw,roughnessmap_pars_fragment:cw,shadowmap_pars_fragment:lw,shadowmap_pars_vertex:hw,shadowmap_vertex:uw,shadowmask_pars_fragment:fw,skinbase_vertex:dw,skinning_pars_vertex:pw,skinning_vertex:mw,skinnormal_vertex:gw,specularmap_fragment:_w,specularmap_pars_fragment:vw,tonemapping_fragment:xw,tonemapping_pars_fragment:yw,transmission_fragment:Sw,transmission_pars_fragment:Mw,uv_pars_fragment:Ew,uv_pars_vertex:bw,uv_vertex:Tw,worldpos_vertex:Aw,background_vert:ww,background_frag:Rw,backgroundCube_vert:Cw,backgroundCube_frag:Pw,cube_vert:Lw,cube_frag:Iw,depth_vert:Dw,depth_frag:Uw,distanceRGBA_vert:Ow,distanceRGBA_frag:Nw,equirect_vert:Fw,equirect_frag:Bw,linedashed_vert:zw,linedashed_frag:kw,meshbasic_vert:Hw,meshbasic_frag:Gw,meshlambert_vert:Vw,meshlambert_frag:Ww,meshmatcap_vert:Xw,meshmatcap_frag:Yw,meshnormal_vert:jw,meshnormal_frag:qw,meshphong_vert:Kw,meshphong_frag:Zw,meshphysical_vert:$w,meshphysical_frag:Jw,meshtoon_vert:Qw,meshtoon_frag:e1,points_vert:t1,points_frag:n1,shadow_vert:i1,shadow_frag:r1,sprite_vert:s1,sprite_frag:o1},Me={common:{diffuse:{value:new Ne(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new lt},alphaMap:{value:null},alphaMapTransform:{value:new lt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new lt}},envmap:{envMap:{value:null},envMapRotation:{value:new lt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new lt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new lt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new lt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new lt},normalScale:{value:new Ie(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new lt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new lt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new lt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new lt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ne(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ne(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new lt},alphaTest:{value:0},uvTransform:{value:new lt}},sprite:{diffuse:{value:new Ne(16777215)},opacity:{value:1},center:{value:new Ie(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new lt},alphaMap:{value:null},alphaMapTransform:{value:new lt},alphaTest:{value:0}}},Ui={basic:{uniforms:Un([Me.common,Me.specularmap,Me.envmap,Me.aomap,Me.lightmap,Me.fog]),vertexShader:ct.meshbasic_vert,fragmentShader:ct.meshbasic_frag},lambert:{uniforms:Un([Me.common,Me.specularmap,Me.envmap,Me.aomap,Me.lightmap,Me.emissivemap,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.fog,Me.lights,{emissive:{value:new Ne(0)}}]),vertexShader:ct.meshlambert_vert,fragmentShader:ct.meshlambert_frag},phong:{uniforms:Un([Me.common,Me.specularmap,Me.envmap,Me.aomap,Me.lightmap,Me.emissivemap,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.fog,Me.lights,{emissive:{value:new Ne(0)},specular:{value:new Ne(1118481)},shininess:{value:30}}]),vertexShader:ct.meshphong_vert,fragmentShader:ct.meshphong_frag},standard:{uniforms:Un([Me.common,Me.envmap,Me.aomap,Me.lightmap,Me.emissivemap,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.roughnessmap,Me.metalnessmap,Me.fog,Me.lights,{emissive:{value:new Ne(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ct.meshphysical_vert,fragmentShader:ct.meshphysical_frag},toon:{uniforms:Un([Me.common,Me.aomap,Me.lightmap,Me.emissivemap,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.gradientmap,Me.fog,Me.lights,{emissive:{value:new Ne(0)}}]),vertexShader:ct.meshtoon_vert,fragmentShader:ct.meshtoon_frag},matcap:{uniforms:Un([Me.common,Me.bumpmap,Me.normalmap,Me.displacementmap,Me.fog,{matcap:{value:null}}]),vertexShader:ct.meshmatcap_vert,fragmentShader:ct.meshmatcap_frag},points:{uniforms:Un([Me.points,Me.fog]),vertexShader:ct.points_vert,fragmentShader:ct.points_frag},dashed:{uniforms:Un([Me.common,Me.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ct.linedashed_vert,fragmentShader:ct.linedashed_frag},depth:{uniforms:Un([Me.common,Me.displacementmap]),vertexShader:ct.depth_vert,fragmentShader:ct.depth_frag},normal:{uniforms:Un([Me.common,Me.bumpmap,Me.normalmap,Me.displacementmap,{opacity:{value:1}}]),vertexShader:ct.meshnormal_vert,fragmentShader:ct.meshnormal_frag},sprite:{uniforms:Un([Me.sprite,Me.fog]),vertexShader:ct.sprite_vert,fragmentShader:ct.sprite_frag},background:{uniforms:{uvTransform:{value:new lt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ct.background_vert,fragmentShader:ct.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new lt}},vertexShader:ct.backgroundCube_vert,fragmentShader:ct.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ct.cube_vert,fragmentShader:ct.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ct.equirect_vert,fragmentShader:ct.equirect_frag},distanceRGBA:{uniforms:Un([Me.common,Me.displacementmap,{referencePosition:{value:new U},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ct.distanceRGBA_vert,fragmentShader:ct.distanceRGBA_frag},shadow:{uniforms:Un([Me.lights,Me.fog,{color:{value:new Ne(0)},opacity:{value:1}}]),vertexShader:ct.shadow_vert,fragmentShader:ct.shadow_frag}};Ui.physical={uniforms:Un([Ui.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new lt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new lt},clearcoatNormalScale:{value:new Ie(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new lt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new lt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new lt},sheen:{value:0},sheenColor:{value:new Ne(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new lt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new lt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new lt},transmissionSamplerSize:{value:new Ie},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new lt},attenuationDistance:{value:0},attenuationColor:{value:new Ne(0)},specularColor:{value:new Ne(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new lt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new lt},anisotropyVector:{value:new Ie},anisotropyMap:{value:null},anisotropyMapTransform:{value:new lt}}]),vertexShader:ct.meshphysical_vert,fragmentShader:ct.meshphysical_frag};const Pc={r:0,b:0,g:0},Qr=new Ti,a1=new $e;function c1(s,e,t,n,i,o,c){const l=new Ne(0);let u=o===!0?0:1,f,d,p=null,m=0,v=null;function S(x,_){let R=!1,E=_.isScene===!0?_.background:null;E&&E.isTexture&&(E=(_.backgroundBlurriness>0?t:e).get(E)),E===null?b(l,u):E&&E.isColor&&(b(E,1),R=!0);const L=s.xr.getEnvironmentBlendMode();L==="additive"?n.buffers.color.setClear(0,0,0,1,c):L==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,c),(s.autoClear||R)&&s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil),E&&(E.isCubeTexture||E.mapping===ll)?(d===void 0&&(d=new ye(new jt(1,1,1),new Br({name:"BackgroundCubeMaterial",uniforms:mo(Ui.backgroundCube.uniforms),vertexShader:Ui.backgroundCube.vertexShader,fragmentShader:Ui.backgroundCube.fragmentShader,side:Vn,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(B,N,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(d)),Qr.copy(_.backgroundRotation),Qr.x*=-1,Qr.y*=-1,Qr.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(Qr.y*=-1,Qr.z*=-1),d.material.uniforms.envMap.value=E,d.material.uniforms.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=_.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(a1.makeRotationFromEuler(Qr)),d.material.toneMapped=Ct.getTransfer(E.colorSpace)!==Gt,(p!==E||m!==E.version||v!==s.toneMapping)&&(d.material.needsUpdate=!0,p=E,m=E.version,v=s.toneMapping),d.layers.enableAll(),x.unshift(d,d.geometry,d.material,0,0,null)):E&&E.isTexture&&(f===void 0&&(f=new ye(new ds(2,2),new Br({name:"BackgroundMaterial",uniforms:mo(Ui.background.uniforms),vertexShader:Ui.background.vertexShader,fragmentShader:Ui.background.fragmentShader,side:Fi,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),Object.defineProperty(f.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(f)),f.material.uniforms.t2D.value=E,f.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,f.material.toneMapped=Ct.getTransfer(E.colorSpace)!==Gt,E.matrixAutoUpdate===!0&&E.updateMatrix(),f.material.uniforms.uvTransform.value.copy(E.matrix),(p!==E||m!==E.version||v!==s.toneMapping)&&(f.material.needsUpdate=!0,p=E,m=E.version,v=s.toneMapping),f.layers.enableAll(),x.unshift(f,f.geometry,f.material,0,0,null))}function b(x,_){x.getRGB(Pc,a_(s)),n.buffers.color.setClear(Pc.r,Pc.g,Pc.b,_,c)}return{getClearColor:function(){return l},setClearColor:function(x,_=1){l.set(x),u=_,b(l,u)},getClearAlpha:function(){return u},setClearAlpha:function(x){u=x,b(l,u)},render:S}}function l1(s,e){const t=s.getParameter(s.MAX_VERTEX_ATTRIBS),n={},i=m(null);let o=i,c=!1;function l(T,W,j,H,K){let ne=!1;const he=p(H,j,W);o!==he&&(o=he,f(o.object)),ne=v(T,H,j,K),ne&&S(T,H,j,K),K!==null&&e.update(K,s.ELEMENT_ARRAY_BUFFER),(ne||c)&&(c=!1,L(T,W,j,H),K!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e.get(K).buffer))}function u(){return s.createVertexArray()}function f(T){return s.bindVertexArray(T)}function d(T){return s.deleteVertexArray(T)}function p(T,W,j){const H=j.wireframe===!0;let K=n[T.id];K===void 0&&(K={},n[T.id]=K);let ne=K[W.id];ne===void 0&&(ne={},K[W.id]=ne);let he=ne[H];return he===void 0&&(he=m(u()),ne[H]=he),he}function m(T){const W=[],j=[],H=[];for(let K=0;K<t;K++)W[K]=0,j[K]=0,H[K]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:W,enabledAttributes:j,attributeDivisors:H,object:T,attributes:{},index:null}}function v(T,W,j,H){const K=o.attributes,ne=W.attributes;let he=0;const me=j.getAttributes();for(const $ in me)if(me[$].location>=0){const pe=K[$];let Ee=ne[$];if(Ee===void 0&&($==="instanceMatrix"&&T.instanceMatrix&&(Ee=T.instanceMatrix),$==="instanceColor"&&T.instanceColor&&(Ee=T.instanceColor)),pe===void 0||pe.attribute!==Ee||Ee&&pe.data!==Ee.data)return!0;he++}return o.attributesNum!==he||o.index!==H}function S(T,W,j,H){const K={},ne=W.attributes;let he=0;const me=j.getAttributes();for(const $ in me)if(me[$].location>=0){let pe=ne[$];pe===void 0&&($==="instanceMatrix"&&T.instanceMatrix&&(pe=T.instanceMatrix),$==="instanceColor"&&T.instanceColor&&(pe=T.instanceColor));const Ee={};Ee.attribute=pe,pe&&pe.data&&(Ee.data=pe.data),K[$]=Ee,he++}o.attributes=K,o.attributesNum=he,o.index=H}function b(){const T=o.newAttributes;for(let W=0,j=T.length;W<j;W++)T[W]=0}function x(T){_(T,0)}function _(T,W){const j=o.newAttributes,H=o.enabledAttributes,K=o.attributeDivisors;j[T]=1,H[T]===0&&(s.enableVertexAttribArray(T),H[T]=1),K[T]!==W&&(s.vertexAttribDivisor(T,W),K[T]=W)}function R(){const T=o.newAttributes,W=o.enabledAttributes;for(let j=0,H=W.length;j<H;j++)W[j]!==T[j]&&(s.disableVertexAttribArray(j),W[j]=0)}function E(T,W,j,H,K,ne,he){he===!0?s.vertexAttribIPointer(T,W,j,K,ne):s.vertexAttribPointer(T,W,j,H,K,ne)}function L(T,W,j,H){b();const K=H.attributes,ne=j.getAttributes(),he=W.defaultAttributeValues;for(const me in ne){const $=ne[me];if($.location>=0){let fe=K[me];if(fe===void 0&&(me==="instanceMatrix"&&T.instanceMatrix&&(fe=T.instanceMatrix),me==="instanceColor"&&T.instanceColor&&(fe=T.instanceColor)),fe!==void 0){const pe=fe.normalized,Ee=fe.itemSize,Je=e.get(fe);if(Je===void 0)continue;const bt=Je.buffer,ie=Je.type,_e=Je.bytesPerElement,Ce=ie===s.INT||ie===s.UNSIGNED_INT||fe.gpuType===Vg;if(fe.isInterleavedBufferAttribute){const Ae=fe.data,je=Ae.stride,qe=fe.offset;if(Ae.isInstancedInterleavedBuffer){for(let dt=0;dt<$.locationSize;dt++)_($.location+dt,Ae.meshPerAttribute);T.isInstancedMesh!==!0&&H._maxInstanceCount===void 0&&(H._maxInstanceCount=Ae.meshPerAttribute*Ae.count)}else for(let dt=0;dt<$.locationSize;dt++)x($.location+dt);s.bindBuffer(s.ARRAY_BUFFER,bt);for(let dt=0;dt<$.locationSize;dt++)E($.location+dt,Ee/$.locationSize,ie,pe,je*_e,(qe+Ee/$.locationSize*dt)*_e,Ce)}else{if(fe.isInstancedBufferAttribute){for(let Ae=0;Ae<$.locationSize;Ae++)_($.location+Ae,fe.meshPerAttribute);T.isInstancedMesh!==!0&&H._maxInstanceCount===void 0&&(H._maxInstanceCount=fe.meshPerAttribute*fe.count)}else for(let Ae=0;Ae<$.locationSize;Ae++)x($.location+Ae);s.bindBuffer(s.ARRAY_BUFFER,bt);for(let Ae=0;Ae<$.locationSize;Ae++)E($.location+Ae,Ee/$.locationSize,ie,pe,Ee*_e,Ee/$.locationSize*Ae*_e,Ce)}}else if(he!==void 0){const pe=he[me];if(pe!==void 0)switch(pe.length){case 2:s.vertexAttrib2fv($.location,pe);break;case 3:s.vertexAttrib3fv($.location,pe);break;case 4:s.vertexAttrib4fv($.location,pe);break;default:s.vertexAttrib1fv($.location,pe)}}}}R()}function B(){k();for(const T in n){const W=n[T];for(const j in W){const H=W[j];for(const K in H)d(H[K].object),delete H[K];delete W[j]}delete n[T]}}function N(T){if(n[T.id]===void 0)return;const W=n[T.id];for(const j in W){const H=W[j];for(const K in H)d(H[K].object),delete H[K];delete W[j]}delete n[T.id]}function D(T){for(const W in n){const j=n[W];if(j[T.id]===void 0)continue;const H=j[T.id];for(const K in H)d(H[K].object),delete H[K];delete j[T.id]}}function k(){C(),c=!0,o!==i&&(o=i,f(o.object))}function C(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:l,reset:k,resetDefaultState:C,dispose:B,releaseStatesOfGeometry:N,releaseStatesOfProgram:D,initAttributes:b,enableAttribute:x,disableUnusedAttributes:R}}function h1(s,e,t){let n;function i(u){n=u}function o(u,f){s.drawArrays(n,u,f),t.update(f,n,1)}function c(u,f,d){d!==0&&(s.drawArraysInstanced(n,u,f,d),t.update(f,n,d))}function l(u,f,d){if(d===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let m=0;m<d;m++)this.render(u[m],f[m]);else{p.multiDrawArraysWEBGL(n,u,0,f,0,d);let m=0;for(let v=0;v<d;v++)m+=f[v];t.update(m,n,1)}}this.setMode=i,this.render=o,this.renderInstances=c,this.renderMultiDraw=l}function u1(s,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const E=e.get("EXT_texture_filter_anisotropic");n=s.getParameter(E.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function o(E){if(E==="highp"){if(s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.HIGH_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return"highp";E="mediump"}return E==="mediump"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const l=o(c);l!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",l,"instead."),c=l);const u=t.logarithmicDepthBuffer===!0,f=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),d=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),p=s.getParameter(s.MAX_TEXTURE_SIZE),m=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),v=s.getParameter(s.MAX_VERTEX_ATTRIBS),S=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),b=s.getParameter(s.MAX_VARYING_VECTORS),x=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),_=d>0,R=s.getParameter(s.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:i,getMaxPrecision:o,precision:c,logarithmicDepthBuffer:u,maxTextures:f,maxVertexTextures:d,maxTextureSize:p,maxCubemapSize:m,maxAttributes:v,maxVertexUniforms:S,maxVaryings:b,maxFragmentUniforms:x,vertexTextures:_,maxSamples:R}}function f1(s){const e=this;let t=null,n=0,i=!1,o=!1;const c=new Pr,l=new lt,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(p,m){const v=p.length!==0||m||n!==0||i;return i=m,n=p.length,v},this.beginShadows=function(){o=!0,d(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(p,m){t=d(p,m,0)},this.setState=function(p,m,v){const S=p.clippingPlanes,b=p.clipIntersection,x=p.clipShadows,_=s.get(p);if(!i||S===null||S.length===0||o&&!x)o?d(null):f();else{const R=o?0:n,E=R*4;let L=_.clippingState||null;u.value=L,L=d(S,m,E,v);for(let B=0;B!==E;++B)L[B]=t[B];_.clippingState=L,this.numIntersection=b?this.numPlanes:0,this.numPlanes+=R}};function f(){u.value!==t&&(u.value=t,u.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function d(p,m,v,S){const b=p!==null?p.length:0;let x=null;if(b!==0){if(x=u.value,S!==!0||x===null){const _=v+b*4,R=m.matrixWorldInverse;l.getNormalMatrix(R),(x===null||x.length<_)&&(x=new Float32Array(_));for(let E=0,L=v;E!==b;++E,L+=4)c.copy(p[E]).applyMatrix4(R,l),c.normal.toArray(x,L),x[L+3]=c.constant}u.value=x,u.needsUpdate=!0}return e.numPlanes=b,e.numIntersection=0,x}}function d1(s){let e=new WeakMap;function t(c,l){return l===Su?c.mapping=co:l===Mu&&(c.mapping=lo),c}function n(c){if(c&&c.isTexture){const l=c.mapping;if(l===Su||l===Mu)if(e.has(c)){const u=e.get(c).texture;return t(u,c.mapping)}else{const u=c.image;if(u&&u.height>0){const f=new h_(u.height);return f.fromEquirectangularTexture(s,c),e.set(c,f),c.addEventListener("dispose",i),t(f.texture,c.mapping)}else return null}}return c}function i(c){const l=c.target;l.removeEventListener("dispose",i);const u=e.get(l);u!==void 0&&(e.delete(l),u.dispose())}function o(){e=new WeakMap}return{get:n,dispose:o}}class ul extends c_{constructor(e=-1,t=1,n=1,i=-1,o=.1,c=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=o,this.far=c,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,o,c){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=o,this.view.height=c,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 o=n-e,c=n+e,l=i+t,u=i-t;if(this.view!==null&&this.view.enabled){const f=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o+=f*this.view.offsetX,c=o+f*this.view.width,l-=d*this.view.offsetY,u=l-d*this.view.height}this.projectionMatrix.makeOrthographic(o,c,l,u,this.near,this.far,this.coordinateSystem),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}}const to=4,Tm=[.125,.215,.35,.446,.526,.582],as=20,$h=new ul,Am=new Ne;let Jh=null,Qh=0,eu=0,tu=!1;const is=(1+Math.sqrt(5))/2,qs=1/is,wm=[new U(1,1,1),new U(-1,1,1),new U(1,1,-1),new U(-1,1,-1),new U(0,is,qs),new U(0,is,-qs),new U(qs,0,is),new U(-qs,0,is),new U(is,qs,0),new U(-is,qs,0)];class Rm{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Jh=this._renderer.getRenderTarget(),Qh=this._renderer.getActiveCubeFace(),eu=this._renderer.getActiveMipmapLevel(),tu=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,n,i,o),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Lm(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Pm(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Jh,Qh,eu),this._renderer.xr.enabled=tu,e.scissorTest=!1,Lc(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===co||e.mapping===lo?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Jh=this._renderer.getRenderTarget(),Qh=this._renderer.getActiveCubeFace(),eu=this._renderer.getActiveMipmapLevel(),tu=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:Hn,minFilter:Hn,generateMipmaps:!1,type:el,format:Ei,colorSpace:gn,depthBuffer:!1},i=Cm(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Cm(e,t,n);const{_lodMax:o}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=p1(o)),this._blurMaterial=m1(o,e,t)}return i}_compileMaterial(e){const t=new ye(this._lodPlanes[0],e);this._renderer.compile(t,$h)}_sceneToCubeUV(e,t,n,i){const l=new On(90,1,t,n),u=[1,-1,1,1,1,1],f=[1,1,1,-1,-1,-1],d=this._renderer,p=d.autoClear,m=d.toneMapping;d.getClearColor(Am),d.toneMapping=lr,d.autoClear=!1;const v=new Ni({name:"PMREM.Background",side:Vn,depthWrite:!1,depthTest:!1}),S=new ye(new jt,v);let b=!1;const x=e.background;x?x.isColor&&(v.color.copy(x),e.background=null,b=!0):(v.color.copy(Am),b=!0);for(let _=0;_<6;_++){const R=_%3;R===0?(l.up.set(0,u[_],0),l.lookAt(f[_],0,0)):R===1?(l.up.set(0,0,u[_]),l.lookAt(0,f[_],0)):(l.up.set(0,u[_],0),l.lookAt(0,0,f[_]));const E=this._cubeSize;Lc(i,R*E,_>2?E:0,E,E),d.setRenderTarget(i),b&&d.render(S,l),d.render(e,l)}S.geometry.dispose(),S.material.dispose(),d.toneMapping=m,d.autoClear=p,e.background=x}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===co||e.mapping===lo;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Lm()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Pm());const o=i?this._cubemapMaterial:this._equirectMaterial,c=new ye(this._lodPlanes[0],o),l=o.uniforms;l.envMap.value=e;const u=this._cubeSize;Lc(t,0,0,3*u,2*u),n.setRenderTarget(t),n.render(c,$h)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<this._lodPlanes.length;i++){const o=Math.sqrt(this._sigmas[i]*this._sigmas[i]-this._sigmas[i-1]*this._sigmas[i-1]),c=wm[(i-1)%wm.length];this._blur(e,i-1,i,o,c)}t.autoClear=n}_blur(e,t,n,i,o){const c=this._pingPongRenderTarget;this._halfBlur(e,c,t,n,i,"latitudinal",o),this._halfBlur(c,e,n,n,i,"longitudinal",o)}_halfBlur(e,t,n,i,o,c,l){const u=this._renderer,f=this._blurMaterial;c!=="latitudinal"&&c!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const d=3,p=new ye(this._lodPlanes[i],f),m=f.uniforms,v=this._sizeLods[n]-1,S=isFinite(o)?Math.PI/(2*v):2*Math.PI/(2*as-1),b=o/S,x=isFinite(o)?1+Math.floor(d*b):as;x>as&&console.warn(`sigmaRadians, ${o}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${as}`);const _=[];let R=0;for(let D=0;D<as;++D){const k=D/b,C=Math.exp(-k*k/2);_.push(C),D===0?R+=C:D<x&&(R+=2*C)}for(let D=0;D<_.length;D++)_[D]=_[D]/R;m.envMap.value=e.texture,m.samples.value=x,m.weights.value=_,m.latitudinal.value=c==="latitudinal",l&&(m.poleAxis.value=l);const{_lodMax:E}=this;m.dTheta.value=S,m.mipInt.value=E-n;const L=this._sizeLods[i],B=3*L*(i>E-to?i-E+to:0),N=4*(this._cubeSize-L);Lc(t,B,N,3*L,2*L),u.setRenderTarget(t),u.render(p,$h)}}function p1(s){const e=[],t=[],n=[];let i=s;const o=s-to+1+Tm.length;for(let c=0;c<o;c++){const l=Math.pow(2,i);t.push(l);let u=1/l;c>s-to?u=Tm[c-s+to-1]:c===0&&(u=0),n.push(u);const f=1/(l-2),d=-f,p=1+f,m=[d,d,p,d,p,p,d,d,p,p,d,p],v=6,S=6,b=3,x=2,_=1,R=new Float32Array(b*S*v),E=new Float32Array(x*S*v),L=new Float32Array(_*S*v);for(let N=0;N<v;N++){const D=N%3*2/3-1,k=N>2?0:-1,C=[D,k,0,D+2/3,k,0,D+2/3,k+1,0,D,k,0,D+2/3,k+1,0,D,k+1,0];R.set(C,b*S*N),E.set(m,x*S*N);const T=[N,N,N,N,N,N];L.set(T,_*S*N)}const B=new $t;B.setAttribute("position",new cn(R,b)),B.setAttribute("uv",new cn(E,x)),B.setAttribute("faceIndex",new cn(L,_)),e.push(B),i>to&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Cm(s,e,t){const n=new hs(s,e,t);return n.texture.mapping=ll,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Lc(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function m1(s,e,t){const n=new Float32Array(as),i=new U(0,1,0);return new Br({name:"SphericalGaussianBlur",defines:{n:as,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:qu(),fragmentShader:`
|
|
3546
|
+
}`,ut={alphahash_fragment:XT,alphahash_pars_fragment:YT,alphamap_fragment:jT,alphamap_pars_fragment:qT,alphatest_fragment:KT,alphatest_pars_fragment:ZT,aomap_fragment:$T,aomap_pars_fragment:JT,batching_pars_vertex:QT,batching_vertex:eA,begin_vertex:tA,beginnormal_vertex:nA,bsdfs:iA,iridescence_fragment:rA,bumpmap_pars_fragment:sA,clipping_planes_fragment:oA,clipping_planes_pars_fragment:aA,clipping_planes_pars_vertex:cA,clipping_planes_vertex:lA,color_fragment:uA,color_pars_fragment:hA,color_pars_vertex:fA,color_vertex:dA,common:pA,cube_uv_reflection_fragment:mA,defaultnormal_vertex:gA,displacementmap_pars_vertex:_A,displacementmap_vertex:vA,emissivemap_fragment:xA,emissivemap_pars_fragment:yA,colorspace_fragment:SA,colorspace_pars_fragment:MA,envmap_fragment:EA,envmap_common_pars_fragment:bA,envmap_pars_fragment:TA,envmap_pars_vertex:AA,envmap_physical_pars_fragment:BA,envmap_vertex:wA,fog_vertex:RA,fog_pars_vertex:CA,fog_fragment:PA,fog_pars_fragment:LA,gradientmap_pars_fragment:IA,lightmap_fragment:DA,lightmap_pars_fragment:OA,lights_lambert_fragment:UA,lights_lambert_pars_fragment:NA,lights_pars_begin:FA,lights_toon_fragment:zA,lights_toon_pars_fragment:kA,lights_phong_fragment:HA,lights_phong_pars_fragment:GA,lights_physical_fragment:VA,lights_physical_pars_fragment:WA,lights_fragment_begin:XA,lights_fragment_maps:YA,lights_fragment_end:jA,logdepthbuf_fragment:qA,logdepthbuf_pars_fragment:KA,logdepthbuf_pars_vertex:ZA,logdepthbuf_vertex:$A,map_fragment:JA,map_pars_fragment:QA,map_particle_fragment:ew,map_particle_pars_fragment:tw,metalnessmap_fragment:nw,metalnessmap_pars_fragment:iw,morphinstance_vertex:rw,morphcolor_vertex:sw,morphnormal_vertex:ow,morphtarget_pars_vertex:aw,morphtarget_vertex:cw,normal_fragment_begin:lw,normal_fragment_maps:uw,normal_pars_fragment:hw,normal_pars_vertex:fw,normal_vertex:dw,normalmap_pars_fragment:pw,clearcoat_normal_fragment_begin:mw,clearcoat_normal_fragment_maps:gw,clearcoat_pars_fragment:_w,iridescence_pars_fragment:vw,opaque_fragment:xw,packing:yw,premultiplied_alpha_fragment:Sw,project_vertex:Mw,dithering_fragment:Ew,dithering_pars_fragment:bw,roughnessmap_fragment:Tw,roughnessmap_pars_fragment:Aw,shadowmap_pars_fragment:ww,shadowmap_pars_vertex:Rw,shadowmap_vertex:Cw,shadowmask_pars_fragment:Pw,skinbase_vertex:Lw,skinning_pars_vertex:Iw,skinning_vertex:Dw,skinnormal_vertex:Ow,specularmap_fragment:Uw,specularmap_pars_fragment:Nw,tonemapping_fragment:Fw,tonemapping_pars_fragment:Bw,transmission_fragment:zw,transmission_pars_fragment:kw,uv_pars_fragment:Hw,uv_pars_vertex:Gw,uv_vertex:Vw,worldpos_vertex:Ww,background_vert:Xw,background_frag:Yw,backgroundCube_vert:jw,backgroundCube_frag:qw,cube_vert:Kw,cube_frag:Zw,depth_vert:$w,depth_frag:Jw,distanceRGBA_vert:Qw,distanceRGBA_frag:e1,equirect_vert:t1,equirect_frag:n1,linedashed_vert:i1,linedashed_frag:r1,meshbasic_vert:s1,meshbasic_frag:o1,meshlambert_vert:a1,meshlambert_frag:c1,meshmatcap_vert:l1,meshmatcap_frag:u1,meshnormal_vert:h1,meshnormal_frag:f1,meshphong_vert:d1,meshphong_frag:p1,meshphysical_vert:m1,meshphysical_frag:g1,meshtoon_vert:_1,meshtoon_frag:v1,points_vert:x1,points_frag:y1,shadow_vert:S1,shadow_frag:M1,sprite_vert:E1,sprite_frag:b1},be={common:{diffuse:{value:new Ne(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ht},alphaMap:{value:null},alphaMapTransform:{value:new ht},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ht}},envmap:{envMap:{value:null},envMapRotation:{value:new ht},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ht}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ht}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ht},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ht},normalScale:{value:new Pe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ht},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ht}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ht}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ht}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ne(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ne(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ht},alphaTest:{value:0},uvTransform:{value:new ht}},sprite:{diffuse:{value:new Ne(16777215)},opacity:{value:1},center:{value:new Pe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ht},alphaMap:{value:null},alphaMapTransform:{value:new ht},alphaTest:{value:0}}},Hi={basic:{uniforms:Nn([be.common,be.specularmap,be.envmap,be.aomap,be.lightmap,be.fog]),vertexShader:ut.meshbasic_vert,fragmentShader:ut.meshbasic_frag},lambert:{uniforms:Nn([be.common,be.specularmap,be.envmap,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.fog,be.lights,{emissive:{value:new Ne(0)}}]),vertexShader:ut.meshlambert_vert,fragmentShader:ut.meshlambert_frag},phong:{uniforms:Nn([be.common,be.specularmap,be.envmap,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.fog,be.lights,{emissive:{value:new Ne(0)},specular:{value:new Ne(1118481)},shininess:{value:30}}]),vertexShader:ut.meshphong_vert,fragmentShader:ut.meshphong_frag},standard:{uniforms:Nn([be.common,be.envmap,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.roughnessmap,be.metalnessmap,be.fog,be.lights,{emissive:{value:new Ne(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ut.meshphysical_vert,fragmentShader:ut.meshphysical_frag},toon:{uniforms:Nn([be.common,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.gradientmap,be.fog,be.lights,{emissive:{value:new Ne(0)}}]),vertexShader:ut.meshtoon_vert,fragmentShader:ut.meshtoon_frag},matcap:{uniforms:Nn([be.common,be.bumpmap,be.normalmap,be.displacementmap,be.fog,{matcap:{value:null}}]),vertexShader:ut.meshmatcap_vert,fragmentShader:ut.meshmatcap_frag},points:{uniforms:Nn([be.points,be.fog]),vertexShader:ut.points_vert,fragmentShader:ut.points_frag},dashed:{uniforms:Nn([be.common,be.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ut.linedashed_vert,fragmentShader:ut.linedashed_frag},depth:{uniforms:Nn([be.common,be.displacementmap]),vertexShader:ut.depth_vert,fragmentShader:ut.depth_frag},normal:{uniforms:Nn([be.common,be.bumpmap,be.normalmap,be.displacementmap,{opacity:{value:1}}]),vertexShader:ut.meshnormal_vert,fragmentShader:ut.meshnormal_frag},sprite:{uniforms:Nn([be.sprite,be.fog]),vertexShader:ut.sprite_vert,fragmentShader:ut.sprite_frag},background:{uniforms:{uvTransform:{value:new ht},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ut.background_vert,fragmentShader:ut.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ht}},vertexShader:ut.backgroundCube_vert,fragmentShader:ut.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ut.cube_vert,fragmentShader:ut.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ut.equirect_vert,fragmentShader:ut.equirect_frag},distanceRGBA:{uniforms:Nn([be.common,be.displacementmap,{referencePosition:{value:new N},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ut.distanceRGBA_vert,fragmentShader:ut.distanceRGBA_frag},shadow:{uniforms:Nn([be.lights,be.fog,{color:{value:new Ne(0)},opacity:{value:1}}]),vertexShader:ut.shadow_vert,fragmentShader:ut.shadow_frag}};Hi.physical={uniforms:Nn([Hi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ht},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ht},clearcoatNormalScale:{value:new Pe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ht},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ht},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ht},sheen:{value:0},sheenColor:{value:new Ne(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ht},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ht},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ht},transmissionSamplerSize:{value:new Pe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ht},attenuationDistance:{value:0},attenuationColor:{value:new Ne(0)},specularColor:{value:new Ne(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ht},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ht},anisotropyVector:{value:new Pe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ht}}]),vertexShader:ut.meshphysical_vert,fragmentShader:ut.meshphysical_frag};const Hc={r:0,b:0,g:0},as=new Li,T1=new Qe;function A1(i,e,t,n,r,o,c){const l=new Ne(0);let h=o===!0?0:1,f,d,p=null,m=0,x=null;function M(v,_){let C=!1,b=_.isScene===!0?_.background:null;b&&b.isTexture&&(b=(_.backgroundBlurriness>0?t:e).get(b)),b===null?A(l,h):b&&b.isColor&&(A(b,1),C=!0);const L=i.xr.getEnvironmentBlendMode();L==="additive"?n.buffers.color.setClear(0,0,0,1,c):L==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,c),(i.autoClear||C)&&i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil),b&&(b.isCubeTexture||b.mapping===xl)?(d===void 0&&(d=new ye(new qt(1,1,1),new Yr({name:"BackgroundCubeMaterial",uniforms:Mo(Hi.backgroundCube.uniforms),vertexShader:Hi.backgroundCube.vertexShader,fragmentShader:Hi.backgroundCube.fragmentShader,side:Xn,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(k,U,O){this.matrixWorld.copyPosition(O.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(d)),as.copy(_.backgroundRotation),as.x*=-1,as.y*=-1,as.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(as.y*=-1,as.z*=-1),d.material.uniforms.envMap.value=b,d.material.uniforms.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=_.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(T1.makeRotationFromEuler(as)),d.material.toneMapped=Ct.getTransfer(b.colorSpace)!==Gt,(p!==b||m!==b.version||x!==i.toneMapping)&&(d.material.needsUpdate=!0,p=b,m=b.version,x=i.toneMapping),d.layers.enableAll(),v.unshift(d,d.geometry,d.material,0,0,null)):b&&b.isTexture&&(f===void 0&&(f=new ye(new Ss(2,2),new Yr({name:"BackgroundMaterial",uniforms:Mo(Hi.background.uniforms),vertexShader:Hi.background.vertexShader,fragmentShader:Hi.background.fragmentShader,side:Yi,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),Object.defineProperty(f.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(f)),f.material.uniforms.t2D.value=b,f.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,f.material.toneMapped=Ct.getTransfer(b.colorSpace)!==Gt,b.matrixAutoUpdate===!0&&b.updateMatrix(),f.material.uniforms.uvTransform.value.copy(b.matrix),(p!==b||m!==b.version||x!==i.toneMapping)&&(f.material.needsUpdate=!0,p=b,m=b.version,x=i.toneMapping),f.layers.enableAll(),v.unshift(f,f.geometry,f.material,0,0,null))}function A(v,_){v.getRGB(Hc,v_(i)),n.buffers.color.setClear(Hc.r,Hc.g,Hc.b,_,c)}return{getClearColor:function(){return l},setClearColor:function(v,_=1){l.set(v),h=_,A(l,h)},getClearAlpha:function(){return h},setClearAlpha:function(v){h=v,A(l,h)},render:M}}function w1(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=m(null);let o=r,c=!1;function l(y,F,V,G,q){let ne=!1;const se=p(G,V,F);o!==se&&(o=se,f(o.object)),ne=x(y,G,V,q),ne&&M(y,G,V,q),q!==null&&e.update(q,i.ELEMENT_ARRAY_BUFFER),(ne||c)&&(c=!1,L(y,F,V,G),q!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(q).buffer))}function h(){return i.createVertexArray()}function f(y){return i.bindVertexArray(y)}function d(y){return i.deleteVertexArray(y)}function p(y,F,V){const G=V.wireframe===!0;let q=n[y.id];q===void 0&&(q={},n[y.id]=q);let ne=q[F.id];ne===void 0&&(ne={},q[F.id]=ne);let se=ne[G];return se===void 0&&(se=m(h()),ne[G]=se),se}function m(y){const F=[],V=[],G=[];for(let q=0;q<t;q++)F[q]=0,V[q]=0,G[q]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:V,attributeDivisors:G,object:y,attributes:{},index:null}}function x(y,F,V,G){const q=o.attributes,ne=F.attributes;let se=0;const pe=V.getAttributes();for(const K in pe)if(pe[K].location>=0){const me=q[K];let Me=ne[K];if(Me===void 0&&(K==="instanceMatrix"&&y.instanceMatrix&&(Me=y.instanceMatrix),K==="instanceColor"&&y.instanceColor&&(Me=y.instanceColor)),me===void 0||me.attribute!==Me||Me&&me.data!==Me.data)return!0;se++}return o.attributesNum!==se||o.index!==G}function M(y,F,V,G){const q={},ne=F.attributes;let se=0;const pe=V.getAttributes();for(const K in pe)if(pe[K].location>=0){let me=ne[K];me===void 0&&(K==="instanceMatrix"&&y.instanceMatrix&&(me=y.instanceMatrix),K==="instanceColor"&&y.instanceColor&&(me=y.instanceColor));const Me={};Me.attribute=me,me&&me.data&&(Me.data=me.data),q[K]=Me,se++}o.attributes=q,o.attributesNum=se,o.index=G}function A(){const y=o.newAttributes;for(let F=0,V=y.length;F<V;F++)y[F]=0}function v(y){_(y,0)}function _(y,F){const V=o.newAttributes,G=o.enabledAttributes,q=o.attributeDivisors;V[y]=1,G[y]===0&&(i.enableVertexAttribArray(y),G[y]=1),q[y]!==F&&(i.vertexAttribDivisor(y,F),q[y]=F)}function C(){const y=o.newAttributes,F=o.enabledAttributes;for(let V=0,G=F.length;V<G;V++)F[V]!==y[V]&&(i.disableVertexAttribArray(V),F[V]=0)}function b(y,F,V,G,q,ne,se){se===!0?i.vertexAttribIPointer(y,F,V,q,ne):i.vertexAttribPointer(y,F,V,G,q,ne)}function L(y,F,V,G){A();const q=G.attributes,ne=V.getAttributes(),se=F.defaultAttributeValues;for(const pe in ne){const K=ne[pe];if(K.location>=0){let he=q[pe];if(he===void 0&&(pe==="instanceMatrix"&&y.instanceMatrix&&(he=y.instanceMatrix),pe==="instanceColor"&&y.instanceColor&&(he=y.instanceColor)),he!==void 0){const me=he.normalized,Me=he.itemSize,Ke=e.get(he);if(Ke===void 0)continue;const ot=Ke.buffer,ie=Ke.type,ge=Ke.bytesPerElement,we=ie===i.INT||ie===i.UNSIGNED_INT||he.gpuType===e_;if(he.isInterleavedBufferAttribute){const Se=he.data,Ge=Se.stride,Xe=he.offset;if(Se.isInstancedInterleavedBuffer){for(let at=0;at<K.locationSize;at++)_(K.location+at,Se.meshPerAttribute);y.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=Se.meshPerAttribute*Se.count)}else for(let at=0;at<K.locationSize;at++)v(K.location+at);i.bindBuffer(i.ARRAY_BUFFER,ot);for(let at=0;at<K.locationSize;at++)b(K.location+at,Me/K.locationSize,ie,me,Ge*ge,(Xe+Me/K.locationSize*at)*ge,we)}else{if(he.isInstancedBufferAttribute){for(let Se=0;Se<K.locationSize;Se++)_(K.location+Se,he.meshPerAttribute);y.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=he.meshPerAttribute*he.count)}else for(let Se=0;Se<K.locationSize;Se++)v(K.location+Se);i.bindBuffer(i.ARRAY_BUFFER,ot);for(let Se=0;Se<K.locationSize;Se++)b(K.location+Se,Me/K.locationSize,ie,me,Me*ge,Me/K.locationSize*Se*ge,we)}}else if(se!==void 0){const me=se[pe];if(me!==void 0)switch(me.length){case 2:i.vertexAttrib2fv(K.location,me);break;case 3:i.vertexAttrib3fv(K.location,me);break;case 4:i.vertexAttrib4fv(K.location,me);break;default:i.vertexAttrib1fv(K.location,me)}}}}C()}function k(){I();for(const y in n){const F=n[y];for(const V in F){const G=F[V];for(const q in G)d(G[q].object),delete G[q];delete F[V]}delete n[y]}}function U(y){if(n[y.id]===void 0)return;const F=n[y.id];for(const V in F){const G=F[V];for(const q in G)d(G[q].object),delete G[q];delete F[V]}delete n[y.id]}function O(y){for(const F in n){const V=n[F];if(V[y.id]===void 0)continue;const G=V[y.id];for(const q in G)d(G[q].object),delete G[q];delete V[y.id]}}function I(){E(),c=!0,o!==r&&(o=r,f(o.object))}function E(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:l,reset:I,resetDefaultState:E,dispose:k,releaseStatesOfGeometry:U,releaseStatesOfProgram:O,initAttributes:A,enableAttribute:v,disableUnusedAttributes:C}}function R1(i,e,t){let n;function r(h){n=h}function o(h,f){i.drawArrays(n,h,f),t.update(f,n,1)}function c(h,f,d){d!==0&&(i.drawArraysInstanced(n,h,f,d),t.update(f,n,d))}function l(h,f,d){if(d===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let m=0;m<d;m++)this.render(h[m],f[m]);else{p.multiDrawArraysWEBGL(n,h,0,f,0,d);let m=0;for(let x=0;x<d;x++)m+=f[x];t.update(m,n,1)}}this.setMode=r,this.render=o,this.renderInstances=c,this.renderMultiDraw=l}function C1(i,e,t){let n;function r(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const b=e.get("EXT_texture_filter_anisotropic");n=i.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function o(b){if(b==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";b="mediump"}return b==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const l=o(c);l!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",l,"instead."),c=l);const h=t.logarithmicDepthBuffer===!0,f=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),d=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),p=i.getParameter(i.MAX_TEXTURE_SIZE),m=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),x=i.getParameter(i.MAX_VERTEX_ATTRIBS),M=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),A=i.getParameter(i.MAX_VARYING_VECTORS),v=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),_=d>0,C=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:o,precision:c,logarithmicDepthBuffer:h,maxTextures:f,maxVertexTextures:d,maxTextureSize:p,maxCubemapSize:m,maxAttributes:x,maxVertexUniforms:M,maxVaryings:A,maxFragmentUniforms:v,vertexTextures:_,maxSamples:C}}function P1(i){const e=this;let t=null,n=0,r=!1,o=!1;const c=new Hr,l=new ht,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(p,m){const x=p.length!==0||m||n!==0||r;return r=m,n=p.length,x},this.beginShadows=function(){o=!0,d(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(p,m){t=d(p,m,0)},this.setState=function(p,m,x){const M=p.clippingPlanes,A=p.clipIntersection,v=p.clipShadows,_=i.get(p);if(!r||M===null||M.length===0||o&&!v)o?d(null):f();else{const C=o?0:n,b=C*4;let L=_.clippingState||null;h.value=L,L=d(M,m,b,x);for(let k=0;k!==b;++k)L[k]=t[k];_.clippingState=L,this.numIntersection=A?this.numPlanes:0,this.numPlanes+=C}};function f(){h.value!==t&&(h.value=t,h.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function d(p,m,x,M){const A=p!==null?p.length:0;let v=null;if(A!==0){if(v=h.value,M!==!0||v===null){const _=x+A*4,C=m.matrixWorldInverse;l.getNormalMatrix(C),(v===null||v.length<_)&&(v=new Float32Array(_));for(let b=0,L=x;b!==A;++b,L+=4)c.copy(p[b]).applyMatrix4(C,l),c.normal.toArray(v,L),v[L+3]=c.constant}h.value=v,h.needsUpdate=!0}return e.numPlanes=A,e.numIntersection=0,v}}function L1(i){let e=new WeakMap;function t(c,l){return l===Dh?c.mapping=_o:l===Oh&&(c.mapping=vo),c}function n(c){if(c&&c.isTexture){const l=c.mapping;if(l===Dh||l===Oh)if(e.has(c)){const h=e.get(c).texture;return t(h,c.mapping)}else{const h=c.image;if(h&&h.height>0){const f=new S_(h.height);return f.fromEquirectangularTexture(i,c),e.set(c,f),c.addEventListener("dispose",r),t(f.texture,c.mapping)}else return null}}return c}function r(c){const l=c.target;l.removeEventListener("dispose",r);const h=e.get(l);h!==void 0&&(e.delete(l),h.dispose())}function o(){e=new WeakMap}return{get:n,dispose:o}}class Sl extends x_{constructor(e=-1,t=1,n=1,r=-1,o=.1,c=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=r,this.near=o,this.far=c,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,r,o,c){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=r,this.view.width=o,this.view.height=c,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,r=(this.top+this.bottom)/2;let o=n-e,c=n+e,l=r+t,h=r-t;if(this.view!==null&&this.view.enabled){const f=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o+=f*this.view.offsetX,c=o+f*this.view.width,l-=d*this.view.offsetY,h=l-d*this.view.height}this.projectionMatrix.makeOrthographic(o,c,l,h,this.near,this.far,this.coordinateSystem),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}}const lo=4,Nm=[.125,.215,.35,.446,.526,.582],ms=20,ah=new Sl,Fm=new Ne;let ch=null,lh=0,uh=0,hh=!1;const hs=(1+Math.sqrt(5))/2,no=1/hs,Bm=[new N(1,1,1),new N(-1,1,1),new N(1,1,-1),new N(-1,1,-1),new N(0,hs,no),new N(0,hs,-no),new N(no,0,hs),new N(-no,0,hs),new N(hs,no,0),new N(-hs,no,0)];class zm{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100){ch=this._renderer.getRenderTarget(),lh=this._renderer.getActiveCubeFace(),uh=this._renderer.getActiveMipmapLevel(),hh=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,n,r,o),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Gm(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Hm(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(ch,lh,uh),this._renderer.xr.enabled=hh,e.scissorTest=!1,Gc(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===_o||e.mapping===vo?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),ch=this._renderer.getRenderTarget(),lh=this._renderer.getActiveCubeFace(),uh=this._renderer.getActiveMipmapLevel(),hh=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:Wn,minFilter:Wn,generateMipmaps:!1,type:ul,format:Ci,colorSpace:yn,depthBuffer:!1},r=km(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=km(e,t,n);const{_lodMax:o}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=I1(o)),this._blurMaterial=D1(o,e,t)}return r}_compileMaterial(e){const t=new ye(this._lodPlanes[0],e);this._renderer.compile(t,ah)}_sceneToCubeUV(e,t,n,r){const l=new Bn(90,1,t,n),h=[1,-1,1,1,1,1],f=[1,1,1,-1,-1,-1],d=this._renderer,p=d.autoClear,m=d.toneMapping;d.getClearColor(Fm),d.toneMapping=yr,d.autoClear=!1;const x=new Wi({name:"PMREM.Background",side:Xn,depthWrite:!1,depthTest:!1}),M=new ye(new qt,x);let A=!1;const v=e.background;v?v.isColor&&(x.color.copy(v),e.background=null,A=!0):(x.color.copy(Fm),A=!0);for(let _=0;_<6;_++){const C=_%3;C===0?(l.up.set(0,h[_],0),l.lookAt(f[_],0,0)):C===1?(l.up.set(0,0,h[_]),l.lookAt(0,f[_],0)):(l.up.set(0,h[_],0),l.lookAt(0,0,f[_]));const b=this._cubeSize;Gc(r,C*b,_>2?b:0,b,b),d.setRenderTarget(r),A&&d.render(M,l),d.render(e,l)}M.geometry.dispose(),M.material.dispose(),d.toneMapping=m,d.autoClear=p,e.background=v}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===_o||e.mapping===vo;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Gm()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Hm());const o=r?this._cubemapMaterial:this._equirectMaterial,c=new ye(this._lodPlanes[0],o),l=o.uniforms;l.envMap.value=e;const h=this._cubeSize;Gc(t,0,0,3*h,2*h),n.setRenderTarget(t),n.render(c,ah)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const o=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),c=Bm[(r-1)%Bm.length];this._blur(e,r-1,r,o,c)}t.autoClear=n}_blur(e,t,n,r,o){const c=this._pingPongRenderTarget;this._halfBlur(e,c,t,n,r,"latitudinal",o),this._halfBlur(c,e,n,n,r,"longitudinal",o)}_halfBlur(e,t,n,r,o,c,l){const h=this._renderer,f=this._blurMaterial;c!=="latitudinal"&&c!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const d=3,p=new ye(this._lodPlanes[r],f),m=f.uniforms,x=this._sizeLods[n]-1,M=isFinite(o)?Math.PI/(2*x):2*Math.PI/(2*ms-1),A=o/M,v=isFinite(o)?1+Math.floor(d*A):ms;v>ms&&console.warn(`sigmaRadians, ${o}, is too large and will clip, as it requested ${v} samples when the maximum is set to ${ms}`);const _=[];let C=0;for(let O=0;O<ms;++O){const I=O/A,E=Math.exp(-I*I/2);_.push(E),O===0?C+=E:O<v&&(C+=2*E)}for(let O=0;O<_.length;O++)_[O]=_[O]/C;m.envMap.value=e.texture,m.samples.value=v,m.weights.value=_,m.latitudinal.value=c==="latitudinal",l&&(m.poleAxis.value=l);const{_lodMax:b}=this;m.dTheta.value=M,m.mipInt.value=b-n;const L=this._sizeLods[r],k=3*L*(r>b-lo?r-b+lo:0),U=4*(this._cubeSize-L);Gc(t,k,U,3*L,2*L),h.setRenderTarget(t),h.render(p,ah)}}function I1(i){const e=[],t=[],n=[];let r=i;const o=i-lo+1+Nm.length;for(let c=0;c<o;c++){const l=Math.pow(2,r);t.push(l);let h=1/l;c>i-lo?h=Nm[c-i+lo-1]:c===0&&(h=0),n.push(h);const f=1/(l-2),d=-f,p=1+f,m=[d,d,p,d,p,p,d,d,p,p,d,p],x=6,M=6,A=3,v=2,_=1,C=new Float32Array(A*M*x),b=new Float32Array(v*M*x),L=new Float32Array(_*M*x);for(let U=0;U<x;U++){const O=U%3*2/3-1,I=U>2?0:-1,E=[O,I,0,O+2/3,I,0,O+2/3,I+1,0,O,I,0,O+2/3,I+1,0,O,I+1,0];C.set(E,A*M*U),b.set(m,v*M*U);const y=[U,U,U,U,U,U];L.set(y,_*M*U)}const k=new Jt;k.setAttribute("position",new nn(C,A)),k.setAttribute("uv",new nn(b,v)),k.setAttribute("faceIndex",new nn(L,_)),e.push(k),r>lo&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function km(i,e,t){const n=new vs(i,e,t);return n.texture.mapping=xl,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Gc(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function D1(i,e,t){const n=new Float32Array(ms),r=new N(0,1,0);return new Yr({name:"SphericalGaussianBlur",defines:{n:ms,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:of(),fragmentShader:`
|
|
3547
3547
|
|
|
3548
3548
|
precision mediump float;
|
|
3549
3549
|
precision mediump int;
|
|
@@ -3603,7 +3603,7 @@ void main() {
|
|
|
3603
3603
|
}
|
|
3604
3604
|
|
|
3605
3605
|
}
|
|
3606
|
-
`,blending:
|
|
3606
|
+
`,blending:Wr,depthTest:!1,depthWrite:!1})}function Hm(){return new Yr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:of(),fragmentShader:`
|
|
3607
3607
|
|
|
3608
3608
|
precision mediump float;
|
|
3609
3609
|
precision mediump int;
|
|
@@ -3622,7 +3622,7 @@ void main() {
|
|
|
3622
3622
|
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
3623
3623
|
|
|
3624
3624
|
}
|
|
3625
|
-
`,blending:
|
|
3625
|
+
`,blending:Wr,depthTest:!1,depthWrite:!1})}function Gm(){return new Yr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:of(),fragmentShader:`
|
|
3626
3626
|
|
|
3627
3627
|
precision mediump float;
|
|
3628
3628
|
precision mediump int;
|
|
@@ -3638,7 +3638,7 @@ void main() {
|
|
|
3638
3638
|
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|
3639
3639
|
|
|
3640
3640
|
}
|
|
3641
|
-
`,blending:
|
|
3641
|
+
`,blending:Wr,depthTest:!1,depthWrite:!1})}function of(){return`
|
|
3642
3642
|
|
|
3643
3643
|
precision mediump float;
|
|
3644
3644
|
precision mediump int;
|
|
@@ -3693,58 +3693,58 @@ void main() {
|
|
|
3693
3693
|
gl_Position = vec4( position, 1.0 );
|
|
3694
3694
|
|
|
3695
3695
|
}
|
|
3696
|
-
`}function g1(s){let e=new WeakMap,t=null;function n(l){if(l&&l.isTexture){const u=l.mapping,f=u===Su||u===Mu,d=u===co||u===lo;if(f||d){let p=e.get(l);const m=p!==void 0?p.texture.pmremVersion:0;if(l.isRenderTargetTexture&&l.pmremVersion!==m)return t===null&&(t=new Rm(s)),p=f?t.fromEquirectangular(l,p):t.fromCubemap(l,p),p.texture.pmremVersion=l.pmremVersion,e.set(l,p),p.texture;if(p!==void 0)return p.texture;{const v=l.image;return f&&v&&v.height>0||d&&v&&i(v)?(t===null&&(t=new Rm(s)),p=f?t.fromEquirectangular(l):t.fromCubemap(l),p.texture.pmremVersion=l.pmremVersion,e.set(l,p),l.addEventListener("dispose",o),p.texture):null}}}return l}function i(l){let u=0;const f=6;for(let d=0;d<f;d++)l[d]!==void 0&&u++;return u===f}function o(l){const u=l.target;u.removeEventListener("dispose",o);const f=e.get(u);f!==void 0&&(e.delete(u),f.dispose())}function c(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:c}}function _1(s){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=s.getExtension("WEBGL_depth_texture")||s.getExtension("MOZ_WEBGL_depth_texture")||s.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=s.getExtension("EXT_texture_filter_anisotropic")||s.getExtension("MOZ_EXT_texture_filter_anisotropic")||s.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=s.getExtension("WEBGL_compressed_texture_s3tc")||s.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=s.getExtension("WEBGL_compressed_texture_pvrtc")||s.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=s.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&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function v1(s,e,t,n){const i={},o=new WeakMap;function c(p){const m=p.target;m.index!==null&&e.remove(m.index);for(const S in m.attributes)e.remove(m.attributes[S]);for(const S in m.morphAttributes){const b=m.morphAttributes[S];for(let x=0,_=b.length;x<_;x++)e.remove(b[x])}m.removeEventListener("dispose",c),delete i[m.id];const v=o.get(m);v&&(e.remove(v),o.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function l(p,m){return i[m.id]===!0||(m.addEventListener("dispose",c),i[m.id]=!0,t.memory.geometries++),m}function u(p){const m=p.attributes;for(const S in m)e.update(m[S],s.ARRAY_BUFFER);const v=p.morphAttributes;for(const S in v){const b=v[S];for(let x=0,_=b.length;x<_;x++)e.update(b[x],s.ARRAY_BUFFER)}}function f(p){const m=[],v=p.index,S=p.attributes.position;let b=0;if(v!==null){const R=v.array;b=v.version;for(let E=0,L=R.length;E<L;E+=3){const B=R[E+0],N=R[E+1],D=R[E+2];m.push(B,N,N,D,D,B)}}else if(S!==void 0){const R=S.array;b=S.version;for(let E=0,L=R.length/3-1;E<L;E+=3){const B=E+0,N=E+1,D=E+2;m.push(B,N,N,D,D,B)}}else return;const x=new(e_(m)?o_:s_)(m,1);x.version=b;const _=o.get(p);_&&e.remove(_),o.set(p,x)}function d(p){const m=o.get(p);if(m){const v=p.index;v!==null&&m.version<v.version&&f(p)}else f(p);return o.get(p)}return{get:l,update:u,getWireframeAttribute:d}}function x1(s,e,t){let n;function i(p){n=p}let o,c;function l(p){o=p.type,c=p.bytesPerElement}function u(p,m){s.drawElements(n,m,o,p*c),t.update(m,n,1)}function f(p,m,v){v!==0&&(s.drawElementsInstanced(n,m,o,p*c,v),t.update(m,n,v))}function d(p,m,v){if(v===0)return;const S=e.get("WEBGL_multi_draw");if(S===null)for(let b=0;b<v;b++)this.render(p[b]/c,m[b]);else{S.multiDrawElementsWEBGL(n,m,0,o,p,0,v);let b=0;for(let x=0;x<v;x++)b+=m[x];t.update(b,n,1)}}this.setMode=i,this.setIndex=l,this.render=u,this.renderInstances=f,this.renderMultiDraw=d}function y1(s){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(o,c,l){switch(t.calls++,c){case s.TRIANGLES:t.triangles+=l*(o/3);break;case s.LINES:t.lines+=l*(o/2);break;case s.LINE_STRIP:t.lines+=l*(o-1);break;case s.LINE_LOOP:t.lines+=l*o;break;case s.POINTS:t.points+=l*o;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",c);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 S1(s,e,t){const n=new WeakMap,i=new Dt;function o(c,l,u){const f=c.morphTargetInfluences,d=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,p=d!==void 0?d.length:0;let m=n.get(l);if(m===void 0||m.count!==p){let C=function(){D.dispose(),n.delete(l),l.removeEventListener("dispose",C)};m!==void 0&&m.texture.dispose();const v=l.morphAttributes.position!==void 0,S=l.morphAttributes.normal!==void 0,b=l.morphAttributes.color!==void 0,x=l.morphAttributes.position||[],_=l.morphAttributes.normal||[],R=l.morphAttributes.color||[];let E=0;v===!0&&(E=1),S===!0&&(E=2),b===!0&&(E=3);let L=l.attributes.position.count*E,B=1;L>e.maxTextureSize&&(B=Math.ceil(L/e.maxTextureSize),L=e.maxTextureSize);const N=new Float32Array(L*B*4*p),D=new i_(N,L,B,p);D.type=Oi,D.needsUpdate=!0;const k=E*4;for(let T=0;T<p;T++){const W=x[T],j=_[T],H=R[T],K=L*B*4*T;for(let ne=0;ne<W.count;ne++){const he=ne*k;v===!0&&(i.fromBufferAttribute(W,ne),N[K+he+0]=i.x,N[K+he+1]=i.y,N[K+he+2]=i.z,N[K+he+3]=0),S===!0&&(i.fromBufferAttribute(j,ne),N[K+he+4]=i.x,N[K+he+5]=i.y,N[K+he+6]=i.z,N[K+he+7]=0),b===!0&&(i.fromBufferAttribute(H,ne),N[K+he+8]=i.x,N[K+he+9]=i.y,N[K+he+10]=i.z,N[K+he+11]=H.itemSize===4?i.w:1)}}m={count:p,texture:D,size:new Ie(L,B)},n.set(l,m),l.addEventListener("dispose",C)}if(c.isInstancedMesh===!0&&c.morphTexture!==null)u.getUniforms().setValue(s,"morphTexture",c.morphTexture,t);else{let v=0;for(let b=0;b<f.length;b++)v+=f[b];const S=l.morphTargetsRelative?1:1-v;u.getUniforms().setValue(s,"morphTargetBaseInfluence",S),u.getUniforms().setValue(s,"morphTargetInfluences",f)}u.getUniforms().setValue(s,"morphTargetsTexture",m.texture,t),u.getUniforms().setValue(s,"morphTargetsTextureSize",m.size)}return{update:o}}function M1(s,e,t,n){let i=new WeakMap;function o(u){const f=n.render.frame,d=u.geometry,p=e.get(u,d);if(i.get(p)!==f&&(e.update(p),i.set(p,f)),u.isInstancedMesh&&(u.hasEventListener("dispose",l)===!1&&u.addEventListener("dispose",l),i.get(u)!==f&&(t.update(u.instanceMatrix,s.ARRAY_BUFFER),u.instanceColor!==null&&t.update(u.instanceColor,s.ARRAY_BUFFER),i.set(u,f))),u.isSkinnedMesh){const m=u.skeleton;i.get(m)!==f&&(m.update(),i.set(m,f))}return p}function c(){i=new WeakMap}function l(u){const f=u.target;f.removeEventListener("dispose",l),t.remove(f.instanceMatrix),f.instanceColor!==null&&t.remove(f.instanceColor)}return{update:o,dispose:c}}class f_ extends an{constructor(e,t,n,i,o,c,l,u,f,d){if(d=d!==void 0?d:so,d!==so&&d!==ma)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&d===so&&(n=uo),n===void 0&&d===ma&&(n=xa),super(null,i,o,c,l,u,d,n,f),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=l!==void 0?l:Nn,this.minFilter=u!==void 0?u:Nn,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const d_=new an,p_=new f_(1,1);p_.compareFunction=Qg;const m_=new i_,g_=new cT,__=new l_,Im=[],Dm=[],Um=new Float32Array(16),Om=new Float32Array(9),Nm=new Float32Array(4);function xo(s,e,t){const n=s[0];if(n<=0||n>0)return s;const i=e*t;let o=Im[i];if(o===void 0&&(o=new Float32Array(i),Im[i]=o),e!==0){n.toArray(o,0);for(let c=1,l=0;c!==e;++c)l+=t,s[c].toArray(o,l)}return o}function ln(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t<n;t++)if(s[t]!==e[t])return!1;return!0}function hn(s,e){for(let t=0,n=e.length;t<n;t++)s[t]=e[t]}function fl(s,e){let t=Dm[e];t===void 0&&(t=new Int32Array(e),Dm[e]=t);for(let n=0;n!==e;++n)t[n]=s.allocateTextureUnit();return t}function E1(s,e){const t=this.cache;t[0]!==e&&(s.uniform1f(this.addr,e),t[0]=e)}function b1(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ln(t,e))return;s.uniform2fv(this.addr,e),hn(t,e)}}function T1(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.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)&&(s.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(ln(t,e))return;s.uniform3fv(this.addr,e),hn(t,e)}}function A1(s,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)&&(s.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(ln(t,e))return;s.uniform4fv(this.addr,e),hn(t,e)}}function w1(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(ln(t,e))return;s.uniformMatrix2fv(this.addr,!1,e),hn(t,e)}else{if(ln(t,n))return;Nm.set(n),s.uniformMatrix2fv(this.addr,!1,Nm),hn(t,n)}}function R1(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(ln(t,e))return;s.uniformMatrix3fv(this.addr,!1,e),hn(t,e)}else{if(ln(t,n))return;Om.set(n),s.uniformMatrix3fv(this.addr,!1,Om),hn(t,n)}}function C1(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(ln(t,e))return;s.uniformMatrix4fv(this.addr,!1,e),hn(t,e)}else{if(ln(t,n))return;Um.set(n),s.uniformMatrix4fv(this.addr,!1,Um),hn(t,n)}}function P1(s,e){const t=this.cache;t[0]!==e&&(s.uniform1i(this.addr,e),t[0]=e)}function L1(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ln(t,e))return;s.uniform2iv(this.addr,e),hn(t,e)}}function I1(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(ln(t,e))return;s.uniform3iv(this.addr,e),hn(t,e)}}function D1(s,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)&&(s.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(ln(t,e))return;s.uniform4iv(this.addr,e),hn(t,e)}}function U1(s,e){const t=this.cache;t[0]!==e&&(s.uniform1ui(this.addr,e),t[0]=e)}function O1(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ln(t,e))return;s.uniform2uiv(this.addr,e),hn(t,e)}}function N1(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(ln(t,e))return;s.uniform3uiv(this.addr,e),hn(t,e)}}function F1(s,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)&&(s.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(ln(t,e))return;s.uniform4uiv(this.addr,e),hn(t,e)}}function B1(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i);const o=this.type===s.SAMPLER_2D_SHADOW?p_:d_;t.setTexture2D(e||o,i)}function z1(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||g_,i)}function k1(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||__,i)}function H1(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||m_,i)}function G1(s){switch(s){case 5126:return E1;case 35664:return b1;case 35665:return T1;case 35666:return A1;case 35674:return w1;case 35675:return R1;case 35676:return C1;case 5124:case 35670:return P1;case 35667:case 35671:return L1;case 35668:case 35672:return I1;case 35669:case 35673:return D1;case 5125:return U1;case 36294:return O1;case 36295:return N1;case 36296:return F1;case 35678:case 36198:case 36298:case 36306:case 35682:return B1;case 35679:case 36299:case 36307:return z1;case 35680:case 36300:case 36308:case 36293:return k1;case 36289:case 36303:case 36311:case 36292:return H1}}function V1(s,e){s.uniform1fv(this.addr,e)}function W1(s,e){const t=xo(e,this.size,2);s.uniform2fv(this.addr,t)}function X1(s,e){const t=xo(e,this.size,3);s.uniform3fv(this.addr,t)}function Y1(s,e){const t=xo(e,this.size,4);s.uniform4fv(this.addr,t)}function j1(s,e){const t=xo(e,this.size,4);s.uniformMatrix2fv(this.addr,!1,t)}function q1(s,e){const t=xo(e,this.size,9);s.uniformMatrix3fv(this.addr,!1,t)}function K1(s,e){const t=xo(e,this.size,16);s.uniformMatrix4fv(this.addr,!1,t)}function Z1(s,e){s.uniform1iv(this.addr,e)}function $1(s,e){s.uniform2iv(this.addr,e)}function J1(s,e){s.uniform3iv(this.addr,e)}function Q1(s,e){s.uniform4iv(this.addr,e)}function eR(s,e){s.uniform1uiv(this.addr,e)}function tR(s,e){s.uniform2uiv(this.addr,e)}function nR(s,e){s.uniform3uiv(this.addr,e)}function iR(s,e){s.uniform4uiv(this.addr,e)}function rR(s,e,t){const n=this.cache,i=e.length,o=fl(t,i);ln(n,o)||(s.uniform1iv(this.addr,o),hn(n,o));for(let c=0;c!==i;++c)t.setTexture2D(e[c]||d_,o[c])}function sR(s,e,t){const n=this.cache,i=e.length,o=fl(t,i);ln(n,o)||(s.uniform1iv(this.addr,o),hn(n,o));for(let c=0;c!==i;++c)t.setTexture3D(e[c]||g_,o[c])}function oR(s,e,t){const n=this.cache,i=e.length,o=fl(t,i);ln(n,o)||(s.uniform1iv(this.addr,o),hn(n,o));for(let c=0;c!==i;++c)t.setTextureCube(e[c]||__,o[c])}function aR(s,e,t){const n=this.cache,i=e.length,o=fl(t,i);ln(n,o)||(s.uniform1iv(this.addr,o),hn(n,o));for(let c=0;c!==i;++c)t.setTexture2DArray(e[c]||m_,o[c])}function cR(s){switch(s){case 5126:return V1;case 35664:return W1;case 35665:return X1;case 35666:return Y1;case 35674:return j1;case 35675:return q1;case 35676:return K1;case 5124:case 35670:return Z1;case 35667:case 35671:return $1;case 35668:case 35672:return J1;case 35669:case 35673:return Q1;case 5125:return eR;case 36294:return tR;case 36295:return nR;case 36296:return iR;case 35678:case 36198:case 36298:case 36306:case 35682:return rR;case 35679:case 36299:case 36307:return sR;case 35680:case 36300:case 36308:case 36293:return oR;case 36289:case 36303:case 36311:case 36292:return aR}}class lR{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=G1(t.type)}}class hR{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=cR(t.type)}}class uR{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let o=0,c=i.length;o!==c;++o){const l=i[o];l.setValue(e,t[l.id],n)}}}const nu=/(\w+)(\])?(\[|\.)?/g;function Fm(s,e){s.seq.push(e),s.map[e.id]=e}function fR(s,e,t){const n=s.name,i=n.length;for(nu.lastIndex=0;;){const o=nu.exec(n),c=nu.lastIndex;let l=o[1];const u=o[2]==="]",f=o[3];if(u&&(l=l|0),f===void 0||f==="["&&c+2===i){Fm(t,f===void 0?new lR(l,s,e):new hR(l,s,e));break}else{let p=t.map[l];p===void 0&&(p=new uR(l),Fm(t,p)),t=p}}}class qc{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const o=e.getActiveUniform(t,i),c=e.getUniformLocation(t,o.name);fR(o,c,this)}}setValue(e,t,n,i){const o=this.map[t];o!==void 0&&o.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 o=0,c=t.length;o!==c;++o){const l=t[o],u=n[l.id];u.needsUpdate!==!1&&l.setValue(e,u.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,o=e.length;i!==o;++i){const c=e[i];c.id in t&&n.push(c)}return n}}function Bm(s,e,t){const n=s.createShader(e);return s.shaderSource(n,t),s.compileShader(n),n}const dR=37297;let pR=0;function mR(s,e){const t=s.split(`
|
|
3697
|
-
`),n=[],
|
|
3698
|
-
`)}function
|
|
3699
|
-
|
|
3700
|
-
`+
|
|
3701
|
-
|
|
3702
|
-
`+
|
|
3703
|
-
`)}function
|
|
3704
|
-
`)}function
|
|
3705
|
-
precision ${
|
|
3706
|
-
precision ${
|
|
3707
|
-
precision ${
|
|
3708
|
-
precision ${
|
|
3709
|
-
precision ${
|
|
3710
|
-
precision ${
|
|
3711
|
-
precision ${
|
|
3712
|
-
precision ${
|
|
3713
|
-
precision ${
|
|
3714
|
-
precision ${
|
|
3715
|
-
precision ${
|
|
3716
|
-
precision ${
|
|
3717
|
-
precision ${
|
|
3718
|
-
precision ${
|
|
3719
|
-
precision ${
|
|
3720
|
-
precision ${
|
|
3721
|
-
`;return
|
|
3722
|
-
#define HIGH_PRECISION`:
|
|
3723
|
-
#define MEDIUM_PRECISION`:
|
|
3724
|
-
#define LOW_PRECISION`),e}function
|
|
3725
|
-
`:"";t.isRawShaderMaterial?(
|
|
3726
|
-
`),
|
|
3727
|
-
`),_=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,
|
|
3696
|
+
`}function O1(i){let e=new WeakMap,t=null;function n(l){if(l&&l.isTexture){const h=l.mapping,f=h===Dh||h===Oh,d=h===_o||h===vo;if(f||d){let p=e.get(l);const m=p!==void 0?p.texture.pmremVersion:0;if(l.isRenderTargetTexture&&l.pmremVersion!==m)return t===null&&(t=new zm(i)),p=f?t.fromEquirectangular(l,p):t.fromCubemap(l,p),p.texture.pmremVersion=l.pmremVersion,e.set(l,p),p.texture;if(p!==void 0)return p.texture;{const x=l.image;return f&&x&&x.height>0||d&&x&&r(x)?(t===null&&(t=new zm(i)),p=f?t.fromEquirectangular(l):t.fromCubemap(l),p.texture.pmremVersion=l.pmremVersion,e.set(l,p),l.addEventListener("dispose",o),p.texture):null}}}return l}function r(l){let h=0;const f=6;for(let d=0;d<f;d++)l[d]!==void 0&&h++;return h===f}function o(l){const h=l.target;h.removeEventListener("dispose",o);const f=e.get(h);f!==void 0&&(e.delete(h),f.dispose())}function c(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:c}}function U1(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return e[n]=r,r}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 r=t(n);return r===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function N1(i,e,t,n){const r={},o=new WeakMap;function c(p){const m=p.target;m.index!==null&&e.remove(m.index);for(const M in m.attributes)e.remove(m.attributes[M]);for(const M in m.morphAttributes){const A=m.morphAttributes[M];for(let v=0,_=A.length;v<_;v++)e.remove(A[v])}m.removeEventListener("dispose",c),delete r[m.id];const x=o.get(m);x&&(e.remove(x),o.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function l(p,m){return r[m.id]===!0||(m.addEventListener("dispose",c),r[m.id]=!0,t.memory.geometries++),m}function h(p){const m=p.attributes;for(const M in m)e.update(m[M],i.ARRAY_BUFFER);const x=p.morphAttributes;for(const M in x){const A=x[M];for(let v=0,_=A.length;v<_;v++)e.update(A[v],i.ARRAY_BUFFER)}}function f(p){const m=[],x=p.index,M=p.attributes.position;let A=0;if(x!==null){const C=x.array;A=x.version;for(let b=0,L=C.length;b<L;b+=3){const k=C[b+0],U=C[b+1],O=C[b+2];m.push(k,U,U,O,O,k)}}else if(M!==void 0){const C=M.array;A=M.version;for(let b=0,L=C.length/3-1;b<L;b+=3){const k=b+0,U=b+1,O=b+2;m.push(k,U,U,O,O,k)}}else return;const v=new(h_(m)?__:g_)(m,1);v.version=A;const _=o.get(p);_&&e.remove(_),o.set(p,v)}function d(p){const m=o.get(p);if(m){const x=p.index;x!==null&&m.version<x.version&&f(p)}else f(p);return o.get(p)}return{get:l,update:h,getWireframeAttribute:d}}function F1(i,e,t){let n;function r(p){n=p}let o,c;function l(p){o=p.type,c=p.bytesPerElement}function h(p,m){i.drawElements(n,m,o,p*c),t.update(m,n,1)}function f(p,m,x){x!==0&&(i.drawElementsInstanced(n,m,o,p*c,x),t.update(m,n,x))}function d(p,m,x){if(x===0)return;const M=e.get("WEBGL_multi_draw");if(M===null)for(let A=0;A<x;A++)this.render(p[A]/c,m[A]);else{M.multiDrawElementsWEBGL(n,m,0,o,p,0,x);let A=0;for(let v=0;v<x;v++)A+=m[v];t.update(A,n,1)}}this.setMode=r,this.setIndex=l,this.render=h,this.renderInstances=f,this.renderMultiDraw=d}function B1(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(o,c,l){switch(t.calls++,c){case i.TRIANGLES:t.triangles+=l*(o/3);break;case i.LINES:t.lines+=l*(o/2);break;case i.LINE_STRIP:t.lines+=l*(o-1);break;case i.LINE_LOOP:t.lines+=l*o;break;case i.POINTS:t.points+=l*o;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",c);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function z1(i,e,t){const n=new WeakMap,r=new Dt;function o(c,l,h){const f=c.morphTargetInfluences,d=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,p=d!==void 0?d.length:0;let m=n.get(l);if(m===void 0||m.count!==p){let E=function(){O.dispose(),n.delete(l),l.removeEventListener("dispose",E)};m!==void 0&&m.texture.dispose();const x=l.morphAttributes.position!==void 0,M=l.morphAttributes.normal!==void 0,A=l.morphAttributes.color!==void 0,v=l.morphAttributes.position||[],_=l.morphAttributes.normal||[],C=l.morphAttributes.color||[];let b=0;x===!0&&(b=1),M===!0&&(b=2),A===!0&&(b=3);let L=l.attributes.position.count*b,k=1;L>e.maxTextureSize&&(k=Math.ceil(L/e.maxTextureSize),L=e.maxTextureSize);const U=new Float32Array(L*k*4*p),O=new p_(U,L,k,p);O.type=Vi,O.needsUpdate=!0;const I=b*4;for(let y=0;y<p;y++){const F=v[y],V=_[y],G=C[y],q=L*k*4*y;for(let ne=0;ne<F.count;ne++){const se=ne*I;x===!0&&(r.fromBufferAttribute(F,ne),U[q+se+0]=r.x,U[q+se+1]=r.y,U[q+se+2]=r.z,U[q+se+3]=0),M===!0&&(r.fromBufferAttribute(V,ne),U[q+se+4]=r.x,U[q+se+5]=r.y,U[q+se+6]=r.z,U[q+se+7]=0),A===!0&&(r.fromBufferAttribute(G,ne),U[q+se+8]=r.x,U[q+se+9]=r.y,U[q+se+10]=r.z,U[q+se+11]=G.itemSize===4?r.w:1)}}m={count:p,texture:O,size:new Pe(L,k)},n.set(l,m),l.addEventListener("dispose",E)}if(c.isInstancedMesh===!0&&c.morphTexture!==null)h.getUniforms().setValue(i,"morphTexture",c.morphTexture,t);else{let x=0;for(let A=0;A<f.length;A++)x+=f[A];const M=l.morphTargetsRelative?1:1-x;h.getUniforms().setValue(i,"morphTargetBaseInfluence",M),h.getUniforms().setValue(i,"morphTargetInfluences",f)}h.getUniforms().setValue(i,"morphTargetsTexture",m.texture,t),h.getUniforms().setValue(i,"morphTargetsTextureSize",m.size)}return{update:o}}function k1(i,e,t,n){let r=new WeakMap;function o(h){const f=n.render.frame,d=h.geometry,p=e.get(h,d);if(r.get(p)!==f&&(e.update(p),r.set(p,f)),h.isInstancedMesh&&(h.hasEventListener("dispose",l)===!1&&h.addEventListener("dispose",l),r.get(h)!==f&&(t.update(h.instanceMatrix,i.ARRAY_BUFFER),h.instanceColor!==null&&t.update(h.instanceColor,i.ARRAY_BUFFER),r.set(h,f))),h.isSkinnedMesh){const m=h.skeleton;r.get(m)!==f&&(m.update(),r.set(m,f))}return p}function c(){r=new WeakMap}function l(h){const f=h.target;f.removeEventListener("dispose",l),t.remove(f.instanceMatrix),f.instanceColor!==null&&t.remove(f.instanceColor)}return{update:o,dispose:c}}class E_ extends un{constructor(e,t,n,r,o,c,l,h,f,d){if(d=d!==void 0?d:po,d!==po&&d!==Ta)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&d===po&&(n=xo),n===void 0&&d===Ta&&(n=Ca),super(null,r,o,c,l,h,d,n,f),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=l!==void 0?l:zn,this.minFilter=h!==void 0?h:zn,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const b_=new un,T_=new E_(1,1);T_.compareFunction=u_;const A_=new p_,w_=new AT,R_=new y_,Vm=[],Wm=[],Xm=new Float32Array(16),Ym=new Float32Array(9),jm=new Float32Array(4);function Ao(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let o=Vm[r];if(o===void 0&&(o=new Float32Array(r),Vm[r]=o),e!==0){n.toArray(o,0);for(let c=1,l=0;c!==e;++c)l+=t,i[c].toArray(o,l)}return o}function hn(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function fn(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Ml(i,e){let t=Wm[e];t===void 0&&(t=new Int32Array(e),Wm[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function H1(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function G1(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(hn(t,e))return;i.uniform2fv(this.addr,e),fn(t,e)}}function V1(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(hn(t,e))return;i.uniform3fv(this.addr,e),fn(t,e)}}function W1(i,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)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(hn(t,e))return;i.uniform4fv(this.addr,e),fn(t,e)}}function X1(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(hn(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),fn(t,e)}else{if(hn(t,n))return;jm.set(n),i.uniformMatrix2fv(this.addr,!1,jm),fn(t,n)}}function Y1(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(hn(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),fn(t,e)}else{if(hn(t,n))return;Ym.set(n),i.uniformMatrix3fv(this.addr,!1,Ym),fn(t,n)}}function j1(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(hn(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),fn(t,e)}else{if(hn(t,n))return;Xm.set(n),i.uniformMatrix4fv(this.addr,!1,Xm),fn(t,n)}}function q1(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function K1(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(hn(t,e))return;i.uniform2iv(this.addr,e),fn(t,e)}}function Z1(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(hn(t,e))return;i.uniform3iv(this.addr,e),fn(t,e)}}function $1(i,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)&&(i.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(hn(t,e))return;i.uniform4iv(this.addr,e),fn(t,e)}}function J1(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Q1(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(hn(t,e))return;i.uniform2uiv(this.addr,e),fn(t,e)}}function eR(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(hn(t,e))return;i.uniform3uiv(this.addr,e),fn(t,e)}}function tR(i,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)&&(i.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(hn(t,e))return;i.uniform4uiv(this.addr,e),fn(t,e)}}function nR(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);const o=this.type===i.SAMPLER_2D_SHADOW?T_:b_;t.setTexture2D(e||o,r)}function iR(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||w_,r)}function rR(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||R_,r)}function sR(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||A_,r)}function oR(i){switch(i){case 5126:return H1;case 35664:return G1;case 35665:return V1;case 35666:return W1;case 35674:return X1;case 35675:return Y1;case 35676:return j1;case 5124:case 35670:return q1;case 35667:case 35671:return K1;case 35668:case 35672:return Z1;case 35669:case 35673:return $1;case 5125:return J1;case 36294:return Q1;case 36295:return eR;case 36296:return tR;case 35678:case 36198:case 36298:case 36306:case 35682:return nR;case 35679:case 36299:case 36307:return iR;case 35680:case 36300:case 36308:case 36293:return rR;case 36289:case 36303:case 36311:case 36292:return sR}}function aR(i,e){i.uniform1fv(this.addr,e)}function cR(i,e){const t=Ao(e,this.size,2);i.uniform2fv(this.addr,t)}function lR(i,e){const t=Ao(e,this.size,3);i.uniform3fv(this.addr,t)}function uR(i,e){const t=Ao(e,this.size,4);i.uniform4fv(this.addr,t)}function hR(i,e){const t=Ao(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function fR(i,e){const t=Ao(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function dR(i,e){const t=Ao(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function pR(i,e){i.uniform1iv(this.addr,e)}function mR(i,e){i.uniform2iv(this.addr,e)}function gR(i,e){i.uniform3iv(this.addr,e)}function _R(i,e){i.uniform4iv(this.addr,e)}function vR(i,e){i.uniform1uiv(this.addr,e)}function xR(i,e){i.uniform2uiv(this.addr,e)}function yR(i,e){i.uniform3uiv(this.addr,e)}function SR(i,e){i.uniform4uiv(this.addr,e)}function MR(i,e,t){const n=this.cache,r=e.length,o=Ml(t,r);hn(n,o)||(i.uniform1iv(this.addr,o),fn(n,o));for(let c=0;c!==r;++c)t.setTexture2D(e[c]||b_,o[c])}function ER(i,e,t){const n=this.cache,r=e.length,o=Ml(t,r);hn(n,o)||(i.uniform1iv(this.addr,o),fn(n,o));for(let c=0;c!==r;++c)t.setTexture3D(e[c]||w_,o[c])}function bR(i,e,t){const n=this.cache,r=e.length,o=Ml(t,r);hn(n,o)||(i.uniform1iv(this.addr,o),fn(n,o));for(let c=0;c!==r;++c)t.setTextureCube(e[c]||R_,o[c])}function TR(i,e,t){const n=this.cache,r=e.length,o=Ml(t,r);hn(n,o)||(i.uniform1iv(this.addr,o),fn(n,o));for(let c=0;c!==r;++c)t.setTexture2DArray(e[c]||A_,o[c])}function AR(i){switch(i){case 5126:return aR;case 35664:return cR;case 35665:return lR;case 35666:return uR;case 35674:return hR;case 35675:return fR;case 35676:return dR;case 5124:case 35670:return pR;case 35667:case 35671:return mR;case 35668:case 35672:return gR;case 35669:case 35673:return _R;case 5125:return vR;case 36294:return xR;case 36295:return yR;case 36296:return SR;case 35678:case 36198:case 36298:case 36306:case 35682:return MR;case 35679:case 36299:case 36307:return ER;case 35680:case 36300:case 36308:case 36293:return bR;case 36289:case 36303:case 36311:case 36292:return TR}}class wR{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=oR(t.type)}}class RR{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=AR(t.type)}}class CR{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let o=0,c=r.length;o!==c;++o){const l=r[o];l.setValue(e,t[l.id],n)}}}const fh=/(\w+)(\])?(\[|\.)?/g;function qm(i,e){i.seq.push(e),i.map[e.id]=e}function PR(i,e,t){const n=i.name,r=n.length;for(fh.lastIndex=0;;){const o=fh.exec(n),c=fh.lastIndex;let l=o[1];const h=o[2]==="]",f=o[3];if(h&&(l=l|0),f===void 0||f==="["&&c+2===r){qm(t,f===void 0?new wR(l,i,e):new RR(l,i,e));break}else{let p=t.map[l];p===void 0&&(p=new CR(l),qm(t,p)),t=p}}}class sl{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const o=e.getActiveUniform(t,r),c=e.getUniformLocation(t,o.name);PR(o,c,this)}}setValue(e,t,n,r){const o=this.map[t];o!==void 0&&o.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let o=0,c=t.length;o!==c;++o){const l=t[o],h=n[l.id];h.needsUpdate!==!1&&l.setValue(e,h.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,o=e.length;r!==o;++r){const c=e[r];c.id in t&&n.push(c)}return n}}function Km(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const LR=37297;let IR=0;function DR(i,e){const t=i.split(`
|
|
3697
|
+
`),n=[],r=Math.max(e-6,0),o=Math.min(e+6,t.length);for(let c=r;c<o;c++){const l=c+1;n.push(`${l===e?">":" "} ${l}: ${t[c]}`)}return n.join(`
|
|
3698
|
+
`)}function OR(i){const e=Ct.getPrimaries(Ct.workingColorSpace),t=Ct.getPrimaries(i);let n;switch(e===t?n="":e===dl&&t===fl?n="LinearDisplayP3ToLinearSRGB":e===fl&&t===dl&&(n="LinearSRGBToLinearDisplayP3"),i){case yn:case yl:return[n,"LinearTransferOETF"];case ln:case tf:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",i),[n,"LinearTransferOETF"]}}function Zm(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const o=/ERROR: 0:(\d+)/.exec(r);if(o){const c=parseInt(o[1]);return t.toUpperCase()+`
|
|
3699
|
+
|
|
3700
|
+
`+r+`
|
|
3701
|
+
|
|
3702
|
+
`+DR(i.getShaderSource(e),c)}else return r}function UR(i,e){const t=OR(e);return`vec4 ${i}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function NR(i,e){let t;switch(e){case Cb:t="Linear";break;case Pb:t="Reinhard";break;case Lb:t="OptimizedCineon";break;case Ib:t="ACESFilmic";break;case Ob:t="AgX";break;case Ub:t="Neutral";break;case Db:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function FR(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(fa).join(`
|
|
3703
|
+
`)}function BR(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
|
|
3704
|
+
`)}function zR(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const o=i.getActiveAttrib(e,r),c=o.name;let l=1;o.type===i.FLOAT_MAT2&&(l=2),o.type===i.FLOAT_MAT3&&(l=3),o.type===i.FLOAT_MAT4&&(l=4),t[c]={type:o.type,location:i.getAttribLocation(e,c),locationSize:l}}return t}function fa(i){return i!==""}function $m(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.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 Jm(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const kR=/^[ \t]*#include +<([\w\d./]+)>/gm;function Fh(i){return i.replace(kR,GR)}const HR=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function GR(i,e){let t=ut[e];if(t===void 0){const n=HR.get(e);if(n!==void 0)t=ut[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Fh(t)}const VR=/#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 Qm(i){return i.replace(VR,WR)}function WR(i,e,t,n){let r="";for(let o=parseInt(e);o<parseInt(t);o++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+o+" ]").replace(/UNROLLED_LOOP_INDEX/g,o);return r}function eg(i){let e=`precision ${i.precision} float;
|
|
3705
|
+
precision ${i.precision} int;
|
|
3706
|
+
precision ${i.precision} sampler2D;
|
|
3707
|
+
precision ${i.precision} samplerCube;
|
|
3708
|
+
precision ${i.precision} sampler3D;
|
|
3709
|
+
precision ${i.precision} sampler2DArray;
|
|
3710
|
+
precision ${i.precision} sampler2DShadow;
|
|
3711
|
+
precision ${i.precision} samplerCubeShadow;
|
|
3712
|
+
precision ${i.precision} sampler2DArrayShadow;
|
|
3713
|
+
precision ${i.precision} isampler2D;
|
|
3714
|
+
precision ${i.precision} isampler3D;
|
|
3715
|
+
precision ${i.precision} isamplerCube;
|
|
3716
|
+
precision ${i.precision} isampler2DArray;
|
|
3717
|
+
precision ${i.precision} usampler2D;
|
|
3718
|
+
precision ${i.precision} usampler3D;
|
|
3719
|
+
precision ${i.precision} usamplerCube;
|
|
3720
|
+
precision ${i.precision} usampler2DArray;
|
|
3721
|
+
`;return i.precision==="highp"?e+=`
|
|
3722
|
+
#define HIGH_PRECISION`:i.precision==="mediump"?e+=`
|
|
3723
|
+
#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`
|
|
3724
|
+
#define LOW_PRECISION`),e}function XR(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===qg?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===Kg?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===mr&&(e="SHADOWMAP_TYPE_VSM"),e}function YR(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case _o:case vo:e="ENVMAP_TYPE_CUBE";break;case xl:e="ENVMAP_TYPE_CUBE_UV";break}return e}function jR(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case vo:e="ENVMAP_MODE_REFRACTION";break}return e}function qR(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Zg:e="ENVMAP_BLENDING_MULTIPLY";break;case wb:e="ENVMAP_BLENDING_MIX";break;case Rb:e="ENVMAP_BLENDING_ADD";break}return e}function KR(i){const e=i.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),7*16)),texelHeight:n,maxMip:t}}function ZR(i,e,t,n){const r=i.getContext(),o=t.defines;let c=t.vertexShader,l=t.fragmentShader;const h=XR(t),f=YR(t),d=jR(t),p=qR(t),m=KR(t),x=FR(t),M=BR(o),A=r.createProgram();let v,_,C=t.glslVersion?"#version "+t.glslVersion+`
|
|
3725
|
+
`:"";t.isRawShaderMaterial?(v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,M].filter(fa).join(`
|
|
3726
|
+
`),v.length>0&&(v+=`
|
|
3727
|
+
`),_=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,M].filter(fa).join(`
|
|
3728
3728
|
`),_.length>0&&(_+=`
|
|
3729
|
-
`)):(
|
|
3730
|
-
`].filter(
|
|
3731
|
-
`),_=[
|
|
3732
|
-
`].filter(
|
|
3733
|
-
`)),c=
|
|
3734
|
-
`,
|
|
3729
|
+
`)):(v=[eg(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,M,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",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":"",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 "+h:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","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","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
|
|
3730
|
+
`].filter(fa).join(`
|
|
3731
|
+
`),_=[eg(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,M,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 "+f:"",t.envMap?"#define "+d:"",t.envMap?"#define "+p:"",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.iridescence?"#define USE_IRIDESCENCE":"",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?"#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 "+h:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==yr?"#define TONE_MAPPING":"",t.toneMapping!==yr?ut.tonemapping_pars_fragment:"",t.toneMapping!==yr?NR("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ut.colorspace_pars_fragment,UR("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|
3732
|
+
`].filter(fa).join(`
|
|
3733
|
+
`)),c=Fh(c),c=$m(c,t),c=Jm(c,t),l=Fh(l),l=$m(l,t),l=Jm(l,t),c=Qm(c),l=Qm(l),t.isRawShaderMaterial!==!0&&(C=`#version 300 es
|
|
3734
|
+
`,v=[x,"#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
3735
3735
|
`)+`
|
|
3736
|
-
`+
|
|
3736
|
+
`+v,_=["#define varying in",t.glslVersion===mm?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===mm?"":"#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(`
|
|
3737
3737
|
`)+`
|
|
3738
|
-
`+_);const
|
|
3738
|
+
`+_);const b=C+v+c,L=C+_+l,k=Km(r,r.VERTEX_SHADER,b),U=Km(r,r.FRAGMENT_SHADER,L);r.attachShader(A,k),r.attachShader(A,U),t.index0AttributeName!==void 0?r.bindAttribLocation(A,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(A,0,"position"),r.linkProgram(A);function O(F){if(i.debug.checkShaderErrors){const V=r.getProgramInfoLog(A).trim(),G=r.getShaderInfoLog(k).trim(),q=r.getShaderInfoLog(U).trim();let ne=!0,se=!0;if(r.getProgramParameter(A,r.LINK_STATUS)===!1)if(ne=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,A,k,U);else{const pe=Zm(r,k,"vertex"),K=Zm(r,U,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(A,r.VALIDATE_STATUS)+`
|
|
3739
3739
|
|
|
3740
|
-
Material Name: `+
|
|
3741
|
-
Material Type: `+
|
|
3740
|
+
Material Name: `+F.name+`
|
|
3741
|
+
Material Type: `+F.type+`
|
|
3742
3742
|
|
|
3743
|
-
Program Info Log: `+
|
|
3744
|
-
`+
|
|
3745
|
-
`+$)}else j!==""?console.warn("THREE.WebGLProgram: Program Info Log:",j):(H===""||K==="")&&(he=!1);he&&(W.diagnostics={runnable:ne,programLog:j,vertexShader:{log:H,prefix:x},fragmentShader:{log:K,prefix:_}})}i.deleteShader(B),i.deleteShader(N),k=new qc(i,b),C=SR(i,b)}let k;this.getUniforms=function(){return k===void 0&&D(this),k};let C;this.getAttributes=function(){return C===void 0&&D(this),C};let T=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return T===!1&&(T=i.getProgramParameter(b,dR)),T},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(b),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=pR++,this.cacheKey=e,this.usedTimes=1,this.program=b,this.vertexShader=B,this.fragmentShader=N,this}let DR=0;class UR{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),o=this._getShaderStage(n),c=this._getShaderCacheForMaterial(e);return c.has(i)===!1&&(c.add(i),i.usedTimes++),c.has(o)===!1&&(c.add(o),o.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 OR(e),t.set(e,n)),n}}class OR{constructor(e){this.id=DR++,this.code=e,this.usedTimes=0}}function NR(s,e,t,n,i,o,c){const l=new Yu,u=new UR,f=new Set,d=[],p=i.logarithmicDepthBuffer,m=i.vertexTextures;let v=i.precision;const S={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function b(C){return f.add(C),C===0?"uv":`uv${C}`}function x(C,T,W,j,H){const K=j.fog,ne=H.geometry,he=C.isMeshStandardMaterial?j.environment:null,me=(C.isMeshStandardMaterial?t:e).get(C.envMap||he),$=me&&me.mapping===ll?me.image.height:null,fe=S[C.type];C.precision!==null&&(v=i.getMaxPrecision(C.precision),v!==C.precision&&console.warn("THREE.WebGLProgram.getParameters:",C.precision,"not supported, using",v,"instead."));const pe=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,Ee=pe!==void 0?pe.length:0;let Je=0;ne.morphAttributes.position!==void 0&&(Je=1),ne.morphAttributes.normal!==void 0&&(Je=2),ne.morphAttributes.color!==void 0&&(Je=3);let bt,ie,_e,Ce;if(fe){const tn=Ui[fe];bt=tn.vertexShader,ie=tn.fragmentShader}else bt=C.vertexShader,ie=C.fragmentShader,u.update(C),_e=u.getVertexShaderID(C),Ce=u.getFragmentShaderID(C);const Ae=s.getRenderTarget(),je=H.isInstancedMesh===!0,qe=H.isBatchedMesh===!0,dt=!!C.map,Y=!!C.matcap,tt=!!me,Ve=!!C.aoMap,Et=!!C.lightMap,ke=!!C.bumpMap,Tt=!!C.normalMap,O=!!C.displacementMap,A=!!C.emissiveMap,te=!!C.metalnessMap,oe=!!C.roughnessMap,le=C.anisotropy>0,de=C.clearcoat>0,Be=C.iridescence>0,ge=C.sheen>0,De=C.transmission>0,He=le&&!!C.anisotropyMap,ve=de&&!!C.clearcoatMap,be=de&&!!C.clearcoatNormalMap,Ye=de&&!!C.clearcoatRoughnessMap,Pe=Be&&!!C.iridescenceMap,Le=Be&&!!C.iridescenceThicknessMap,ot=ge&&!!C.sheenColorMap,ht=ge&&!!C.sheenRoughnessMap,yt=!!C.specularMap,pt=!!C.specularColorMap,St=!!C.specularIntensityMap,Oe=De&&!!C.transmissionMap,y=De&&!!C.thicknessMap,q=!!C.gradientMap,se=!!C.alphaMap,xe=C.alphaTest>0,we=!!C.alphaHash,mt=!!C.extensions;let ut=lr;C.toneMapped&&(Ae===null||Ae.isXRRenderTarget===!0)&&(ut=s.toneMapping);const Ft={shaderID:fe,shaderType:C.type,shaderName:C.name,vertexShader:bt,fragmentShader:ie,defines:C.defines,customVertexShaderID:_e,customFragmentShaderID:Ce,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:v,batching:qe,instancing:je,instancingColor:je&&H.instanceColor!==null,instancingMorph:je&&H.morphTexture!==null,supportsVertexTextures:m,outputColorSpace:Ae===null?s.outputColorSpace:Ae.isXRRenderTarget===!0?Ae.texture.colorSpace:gn,alphaToCoverage:!!C.alphaToCoverage,map:dt,matcap:Y,envMap:tt,envMapMode:tt&&me.mapping,envMapCubeUVHeight:$,aoMap:Ve,lightMap:Et,bumpMap:ke,normalMap:Tt,displacementMap:m&&O,emissiveMap:A,normalMapObjectSpace:Tt&&C.normalMapType===Ib,normalMapTangentSpace:Tt&&C.normalMapType===Jg,metalnessMap:te,roughnessMap:oe,anisotropy:le,anisotropyMap:He,clearcoat:de,clearcoatMap:ve,clearcoatNormalMap:be,clearcoatRoughnessMap:Ye,iridescence:Be,iridescenceMap:Pe,iridescenceThicknessMap:Le,sheen:ge,sheenColorMap:ot,sheenRoughnessMap:ht,specularMap:yt,specularColorMap:pt,specularIntensityMap:St,transmission:De,transmissionMap:Oe,thicknessMap:y,gradientMap:q,opaque:C.transparent===!1&&C.blending===ro&&C.alphaToCoverage===!1,alphaMap:se,alphaTest:xe,alphaHash:we,combine:C.combine,mapUv:dt&&b(C.map.channel),aoMapUv:Ve&&b(C.aoMap.channel),lightMapUv:Et&&b(C.lightMap.channel),bumpMapUv:ke&&b(C.bumpMap.channel),normalMapUv:Tt&&b(C.normalMap.channel),displacementMapUv:O&&b(C.displacementMap.channel),emissiveMapUv:A&&b(C.emissiveMap.channel),metalnessMapUv:te&&b(C.metalnessMap.channel),roughnessMapUv:oe&&b(C.roughnessMap.channel),anisotropyMapUv:He&&b(C.anisotropyMap.channel),clearcoatMapUv:ve&&b(C.clearcoatMap.channel),clearcoatNormalMapUv:be&&b(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ye&&b(C.clearcoatRoughnessMap.channel),iridescenceMapUv:Pe&&b(C.iridescenceMap.channel),iridescenceThicknessMapUv:Le&&b(C.iridescenceThicknessMap.channel),sheenColorMapUv:ot&&b(C.sheenColorMap.channel),sheenRoughnessMapUv:ht&&b(C.sheenRoughnessMap.channel),specularMapUv:yt&&b(C.specularMap.channel),specularColorMapUv:pt&&b(C.specularColorMap.channel),specularIntensityMapUv:St&&b(C.specularIntensityMap.channel),transmissionMapUv:Oe&&b(C.transmissionMap.channel),thicknessMapUv:y&&b(C.thicknessMap.channel),alphaMapUv:se&&b(C.alphaMap.channel),vertexTangents:!!ne.attributes.tangent&&(Tt||le),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!ne.attributes.color&&ne.attributes.color.itemSize===4,pointsUvs:H.isPoints===!0&&!!ne.attributes.uv&&(dt||se),fog:!!K,useFog:C.fog===!0,fogExp2:!!K&&K.isFogExp2,flatShading:C.flatShading===!0,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:p,skinning:H.isSkinnedMesh===!0,morphTargets:ne.morphAttributes.position!==void 0,morphNormals:ne.morphAttributes.normal!==void 0,morphColors:ne.morphAttributes.color!==void 0,morphTargetsCount:Ee,morphTextureStride:Je,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numLightProbes:T.numLightProbes,numClippingPlanes:c.numPlanes,numClipIntersection:c.numIntersection,dithering:C.dithering,shadowMapEnabled:s.shadowMap.enabled&&W.length>0,shadowMapType:s.shadowMap.type,toneMapping:ut,useLegacyLights:s._useLegacyLights,decodeVideoTexture:dt&&C.map.isVideoTexture===!0&&Ct.getTransfer(C.map.colorSpace)===Gt,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===yi,flipSided:C.side===Vn,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:mt&&C.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:mt&&C.extensions.multiDraw===!0&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return Ft.vertexUv1s=f.has(1),Ft.vertexUv2s=f.has(2),Ft.vertexUv3s=f.has(3),f.clear(),Ft}function _(C){const T=[];if(C.shaderID?T.push(C.shaderID):(T.push(C.customVertexShaderID),T.push(C.customFragmentShaderID)),C.defines!==void 0)for(const W in C.defines)T.push(W),T.push(C.defines[W]);return C.isRawShaderMaterial===!1&&(R(T,C),E(T,C),T.push(s.outputColorSpace)),T.push(C.customProgramCacheKey),T.join()}function R(C,T){C.push(T.precision),C.push(T.outputColorSpace),C.push(T.envMapMode),C.push(T.envMapCubeUVHeight),C.push(T.mapUv),C.push(T.alphaMapUv),C.push(T.lightMapUv),C.push(T.aoMapUv),C.push(T.bumpMapUv),C.push(T.normalMapUv),C.push(T.displacementMapUv),C.push(T.emissiveMapUv),C.push(T.metalnessMapUv),C.push(T.roughnessMapUv),C.push(T.anisotropyMapUv),C.push(T.clearcoatMapUv),C.push(T.clearcoatNormalMapUv),C.push(T.clearcoatRoughnessMapUv),C.push(T.iridescenceMapUv),C.push(T.iridescenceThicknessMapUv),C.push(T.sheenColorMapUv),C.push(T.sheenRoughnessMapUv),C.push(T.specularMapUv),C.push(T.specularColorMapUv),C.push(T.specularIntensityMapUv),C.push(T.transmissionMapUv),C.push(T.thicknessMapUv),C.push(T.combine),C.push(T.fogExp2),C.push(T.sizeAttenuation),C.push(T.morphTargetsCount),C.push(T.morphAttributeCount),C.push(T.numDirLights),C.push(T.numPointLights),C.push(T.numSpotLights),C.push(T.numSpotLightMaps),C.push(T.numHemiLights),C.push(T.numRectAreaLights),C.push(T.numDirLightShadows),C.push(T.numPointLightShadows),C.push(T.numSpotLightShadows),C.push(T.numSpotLightShadowsWithMaps),C.push(T.numLightProbes),C.push(T.shadowMapType),C.push(T.toneMapping),C.push(T.numClippingPlanes),C.push(T.numClipIntersection),C.push(T.depthPacking)}function E(C,T){l.disableAll(),T.supportsVertexTextures&&l.enable(0),T.instancing&&l.enable(1),T.instancingColor&&l.enable(2),T.instancingMorph&&l.enable(3),T.matcap&&l.enable(4),T.envMap&&l.enable(5),T.normalMapObjectSpace&&l.enable(6),T.normalMapTangentSpace&&l.enable(7),T.clearcoat&&l.enable(8),T.iridescence&&l.enable(9),T.alphaTest&&l.enable(10),T.vertexColors&&l.enable(11),T.vertexAlphas&&l.enable(12),T.vertexUv1s&&l.enable(13),T.vertexUv2s&&l.enable(14),T.vertexUv3s&&l.enable(15),T.vertexTangents&&l.enable(16),T.anisotropy&&l.enable(17),T.alphaHash&&l.enable(18),T.batching&&l.enable(19),C.push(l.mask),l.disableAll(),T.fog&&l.enable(0),T.useFog&&l.enable(1),T.flatShading&&l.enable(2),T.logarithmicDepthBuffer&&l.enable(3),T.skinning&&l.enable(4),T.morphTargets&&l.enable(5),T.morphNormals&&l.enable(6),T.morphColors&&l.enable(7),T.premultipliedAlpha&&l.enable(8),T.shadowMapEnabled&&l.enable(9),T.useLegacyLights&&l.enable(10),T.doubleSided&&l.enable(11),T.flipSided&&l.enable(12),T.useDepthPacking&&l.enable(13),T.dithering&&l.enable(14),T.transmission&&l.enable(15),T.sheen&&l.enable(16),T.opaque&&l.enable(17),T.pointsUvs&&l.enable(18),T.decodeVideoTexture&&l.enable(19),T.alphaToCoverage&&l.enable(20),C.push(l.mask)}function L(C){const T=S[C.type];let W;if(T){const j=Ui[T];W=yT.clone(j.uniforms)}else W=C.uniforms;return W}function B(C,T){let W;for(let j=0,H=d.length;j<H;j++){const K=d[j];if(K.cacheKey===T){W=K,++W.usedTimes;break}}return W===void 0&&(W=new IR(s,T,C,o),d.push(W)),W}function N(C){if(--C.usedTimes===0){const T=d.indexOf(C);d[T]=d[d.length-1],d.pop(),C.destroy()}}function D(C){u.remove(C)}function k(){u.dispose()}return{getParameters:x,getProgramCacheKey:_,getUniforms:L,acquireProgram:B,releaseProgram:N,releaseShaderCache:D,programs:d,dispose:k}}function FR(){let s=new WeakMap;function e(o){let c=s.get(o);return c===void 0&&(c={},s.set(o,c)),c}function t(o){s.delete(o)}function n(o,c,l){s.get(o)[c]=l}function i(){s=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function BR(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.z!==e.z?s.z-e.z:s.id-e.id}function Wm(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function Xm(){const s=[];let e=0;const t=[],n=[],i=[];function o(){e=0,t.length=0,n.length=0,i.length=0}function c(p,m,v,S,b,x){let _=s[e];return _===void 0?(_={id:p.id,object:p,geometry:m,material:v,groupOrder:S,renderOrder:p.renderOrder,z:b,group:x},s[e]=_):(_.id=p.id,_.object=p,_.geometry=m,_.material=v,_.groupOrder=S,_.renderOrder=p.renderOrder,_.z=b,_.group=x),e++,_}function l(p,m,v,S,b,x){const _=c(p,m,v,S,b,x);v.transmission>0?n.push(_):v.transparent===!0?i.push(_):t.push(_)}function u(p,m,v,S,b,x){const _=c(p,m,v,S,b,x);v.transmission>0?n.unshift(_):v.transparent===!0?i.unshift(_):t.unshift(_)}function f(p,m){t.length>1&&t.sort(p||BR),n.length>1&&n.sort(m||Wm),i.length>1&&i.sort(m||Wm)}function d(){for(let p=e,m=s.length;p<m;p++){const v=s[p];if(v.id===null)break;v.id=null,v.object=null,v.geometry=null,v.material=null,v.group=null}}return{opaque:t,transmissive:n,transparent:i,init:o,push:l,unshift:u,finish:d,sort:f}}function zR(){let s=new WeakMap;function e(n,i){const o=s.get(n);let c;return o===void 0?(c=new Xm,s.set(n,[c])):i>=o.length?(c=new Xm,o.push(c)):c=o[i],c}function t(){s=new WeakMap}return{get:e,dispose:t}}function kR(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new U,color:new Ne};break;case"SpotLight":t={position:new U,direction:new U,color:new Ne,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new U,color:new Ne,distance:0,decay:0};break;case"HemisphereLight":t={direction:new U,skyColor:new Ne,groundColor:new Ne};break;case"RectAreaLight":t={color:new Ne,position:new U,halfWidth:new U,halfHeight:new U};break}return s[e.id]=t,t}}}function HR(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ie};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ie};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ie,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}let GR=0;function VR(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function WR(s){const e=new kR,t=HR(),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 f=0;f<9;f++)n.probe.push(new U);const i=new U,o=new $e,c=new $e;function l(f,d){let p=0,m=0,v=0;for(let W=0;W<9;W++)n.probe[W].set(0,0,0);let S=0,b=0,x=0,_=0,R=0,E=0,L=0,B=0,N=0,D=0,k=0;f.sort(VR);const C=d===!0?Math.PI:1;for(let W=0,j=f.length;W<j;W++){const H=f[W],K=H.color,ne=H.intensity,he=H.distance,me=H.shadow&&H.shadow.map?H.shadow.map.texture:null;if(H.isAmbientLight)p+=K.r*ne*C,m+=K.g*ne*C,v+=K.b*ne*C;else if(H.isLightProbe){for(let $=0;$<9;$++)n.probe[$].addScaledVector(H.sh.coefficients[$],ne);k++}else if(H.isDirectionalLight){const $=e.get(H);if($.color.copy(H.color).multiplyScalar(H.intensity*C),H.castShadow){const fe=H.shadow,pe=t.get(H);pe.shadowBias=fe.bias,pe.shadowNormalBias=fe.normalBias,pe.shadowRadius=fe.radius,pe.shadowMapSize=fe.mapSize,n.directionalShadow[S]=pe,n.directionalShadowMap[S]=me,n.directionalShadowMatrix[S]=H.shadow.matrix,E++}n.directional[S]=$,S++}else if(H.isSpotLight){const $=e.get(H);$.position.setFromMatrixPosition(H.matrixWorld),$.color.copy(K).multiplyScalar(ne*C),$.distance=he,$.coneCos=Math.cos(H.angle),$.penumbraCos=Math.cos(H.angle*(1-H.penumbra)),$.decay=H.decay,n.spot[x]=$;const fe=H.shadow;if(H.map&&(n.spotLightMap[N]=H.map,N++,fe.updateMatrices(H),H.castShadow&&D++),n.spotLightMatrix[x]=fe.matrix,H.castShadow){const pe=t.get(H);pe.shadowBias=fe.bias,pe.shadowNormalBias=fe.normalBias,pe.shadowRadius=fe.radius,pe.shadowMapSize=fe.mapSize,n.spotShadow[x]=pe,n.spotShadowMap[x]=me,B++}x++}else if(H.isRectAreaLight){const $=e.get(H);$.color.copy(K).multiplyScalar(ne),$.halfWidth.set(H.width*.5,0,0),$.halfHeight.set(0,H.height*.5,0),n.rectArea[_]=$,_++}else if(H.isPointLight){const $=e.get(H);if($.color.copy(H.color).multiplyScalar(H.intensity*C),$.distance=H.distance,$.decay=H.decay,H.castShadow){const fe=H.shadow,pe=t.get(H);pe.shadowBias=fe.bias,pe.shadowNormalBias=fe.normalBias,pe.shadowRadius=fe.radius,pe.shadowMapSize=fe.mapSize,pe.shadowCameraNear=fe.camera.near,pe.shadowCameraFar=fe.camera.far,n.pointShadow[b]=pe,n.pointShadowMap[b]=me,n.pointShadowMatrix[b]=H.shadow.matrix,L++}n.point[b]=$,b++}else if(H.isHemisphereLight){const $=e.get(H);$.skyColor.copy(H.color).multiplyScalar(ne*C),$.groundColor.copy(H.groundColor).multiplyScalar(ne*C),n.hemi[R]=$,R++}}_>0&&(s.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Me.LTC_FLOAT_1,n.rectAreaLTC2=Me.LTC_FLOAT_2):(n.rectAreaLTC1=Me.LTC_HALF_1,n.rectAreaLTC2=Me.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=m,n.ambient[2]=v;const T=n.hash;(T.directionalLength!==S||T.pointLength!==b||T.spotLength!==x||T.rectAreaLength!==_||T.hemiLength!==R||T.numDirectionalShadows!==E||T.numPointShadows!==L||T.numSpotShadows!==B||T.numSpotMaps!==N||T.numLightProbes!==k)&&(n.directional.length=S,n.spot.length=x,n.rectArea.length=_,n.point.length=b,n.hemi.length=R,n.directionalShadow.length=E,n.directionalShadowMap.length=E,n.pointShadow.length=L,n.pointShadowMap.length=L,n.spotShadow.length=B,n.spotShadowMap.length=B,n.directionalShadowMatrix.length=E,n.pointShadowMatrix.length=L,n.spotLightMatrix.length=B+N-D,n.spotLightMap.length=N,n.numSpotLightShadowsWithMaps=D,n.numLightProbes=k,T.directionalLength=S,T.pointLength=b,T.spotLength=x,T.rectAreaLength=_,T.hemiLength=R,T.numDirectionalShadows=E,T.numPointShadows=L,T.numSpotShadows=B,T.numSpotMaps=N,T.numLightProbes=k,n.version=GR++)}function u(f,d){let p=0,m=0,v=0,S=0,b=0;const x=d.matrixWorldInverse;for(let _=0,R=f.length;_<R;_++){const E=f[_];if(E.isDirectionalLight){const L=n.directional[p];L.direction.setFromMatrixPosition(E.matrixWorld),i.setFromMatrixPosition(E.target.matrixWorld),L.direction.sub(i),L.direction.transformDirection(x),p++}else if(E.isSpotLight){const L=n.spot[v];L.position.setFromMatrixPosition(E.matrixWorld),L.position.applyMatrix4(x),L.direction.setFromMatrixPosition(E.matrixWorld),i.setFromMatrixPosition(E.target.matrixWorld),L.direction.sub(i),L.direction.transformDirection(x),v++}else if(E.isRectAreaLight){const L=n.rectArea[S];L.position.setFromMatrixPosition(E.matrixWorld),L.position.applyMatrix4(x),c.identity(),o.copy(E.matrixWorld),o.premultiply(x),c.extractRotation(o),L.halfWidth.set(E.width*.5,0,0),L.halfHeight.set(0,E.height*.5,0),L.halfWidth.applyMatrix4(c),L.halfHeight.applyMatrix4(c),S++}else if(E.isPointLight){const L=n.point[m];L.position.setFromMatrixPosition(E.matrixWorld),L.position.applyMatrix4(x),m++}else if(E.isHemisphereLight){const L=n.hemi[b];L.direction.setFromMatrixPosition(E.matrixWorld),L.direction.transformDirection(x),b++}}}return{setup:l,setupView:u,state:n}}function Ym(s){const e=new WR(s),t=[],n=[];function i(){t.length=0,n.length=0}function o(d){t.push(d)}function c(d){n.push(d)}function l(d){e.setup(t,d)}function u(d){e.setupView(t,d)}return{init:i,state:{lightsArray:t,shadowsArray:n,lights:e,transmissionRenderTarget:null},setupLights:l,setupLightsView:u,pushLight:o,pushShadow:c}}function XR(s){let e=new WeakMap;function t(i,o=0){const c=e.get(i);let l;return c===void 0?(l=new Ym(s),e.set(i,[l])):o>=c.length?(l=new Ym(s),c.push(l)):l=c[o],l}function n(){e=new WeakMap}return{get:t,dispose:n}}class YR extends ui{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Pb,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 jR extends ui{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}}const qR=`void main() {
|
|
3743
|
+
Program Info Log: `+V+`
|
|
3744
|
+
`+pe+`
|
|
3745
|
+
`+K)}else V!==""?console.warn("THREE.WebGLProgram: Program Info Log:",V):(G===""||q==="")&&(se=!1);se&&(F.diagnostics={runnable:ne,programLog:V,vertexShader:{log:G,prefix:v},fragmentShader:{log:q,prefix:_}})}r.deleteShader(k),r.deleteShader(U),I=new sl(r,A),E=zR(r,A)}let I;this.getUniforms=function(){return I===void 0&&O(this),I};let E;this.getAttributes=function(){return E===void 0&&O(this),E};let y=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return y===!1&&(y=r.getProgramParameter(A,LR)),y},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(A),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=IR++,this.cacheKey=e,this.usedTimes=1,this.program=A,this.vertexShader=k,this.fragmentShader=U,this}let $R=0;class JR{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),o=this._getShaderStage(n),c=this._getShaderCacheForMaterial(e);return c.has(r)===!1&&(c.add(r),r.usedTimes++),c.has(o)===!1&&(c.add(o),o.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 QR(e),t.set(e,n)),n}}class QR{constructor(e){this.id=$R++,this.code=e,this.usedTimes=0}}function eC(i,e,t,n,r,o,c){const l=new rf,h=new JR,f=new Set,d=[],p=r.logarithmicDepthBuffer,m=r.vertexTextures;let x=r.precision;const M={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function A(E){return f.add(E),E===0?"uv":`uv${E}`}function v(E,y,F,V,G){const q=V.fog,ne=G.geometry,se=E.isMeshStandardMaterial?V.environment:null,pe=(E.isMeshStandardMaterial?t:e).get(E.envMap||se),K=pe&&pe.mapping===xl?pe.image.height:null,he=M[E.type];E.precision!==null&&(x=r.getMaxPrecision(E.precision),x!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",x,"instead."));const me=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,Me=me!==void 0?me.length:0;let Ke=0;ne.morphAttributes.position!==void 0&&(Ke=1),ne.morphAttributes.normal!==void 0&&(Ke=2),ne.morphAttributes.color!==void 0&&(Ke=3);let ot,ie,ge,we;if(he){const rn=Hi[he];ot=rn.vertexShader,ie=rn.fragmentShader}else ot=E.vertexShader,ie=E.fragmentShader,h.update(E),ge=h.getVertexShaderID(E),we=h.getFragmentShaderID(E);const Se=i.getRenderTarget(),Ge=G.isInstancedMesh===!0,Xe=G.isBatchedMesh===!0,at=!!E.map,j=!!E.matcap,$e=!!pe,ze=!!E.aoMap,bt=!!E.lightMap,He=!!E.bumpMap,Tt=!!E.normalMap,B=!!E.displacementMap,w=!!E.emissiveMap,te=!!E.metalnessMap,ae=!!E.roughnessMap,ue=E.anisotropy>0,de=E.clearcoat>0,Be=E.iridescence>0,_e=E.sheen>0,De=E.transmission>0,Ve=ue&&!!E.anisotropyMap,ve=de&&!!E.clearcoatMap,Te=de&&!!E.clearcoatNormalMap,qe=de&&!!E.clearcoatRoughnessMap,Le=Be&&!!E.iridescenceMap,Ie=Be&&!!E.iridescenceThicknessMap,ct=_e&&!!E.sheenColorMap,ft=_e&&!!E.sheenRoughnessMap,St=!!E.specularMap,gt=!!E.specularColorMap,Mt=!!E.specularIntensityMap,Ue=De&&!!E.transmissionMap,S=De&&!!E.thicknessMap,Z=!!E.gradientMap,oe=!!E.alphaMap,xe=E.alphaTest>0,Re=!!E.alphaHash,_t=!!E.extensions;let dt=yr;E.toneMapped&&(Se===null||Se.isXRRenderTarget===!0)&&(dt=i.toneMapping);const Ft={shaderID:he,shaderType:E.type,shaderName:E.name,vertexShader:ot,fragmentShader:ie,defines:E.defines,customVertexShaderID:ge,customFragmentShaderID:we,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:x,batching:Xe,instancing:Ge,instancingColor:Ge&&G.instanceColor!==null,instancingMorph:Ge&&G.morphTexture!==null,supportsVertexTextures:m,outputColorSpace:Se===null?i.outputColorSpace:Se.isXRRenderTarget===!0?Se.texture.colorSpace:yn,alphaToCoverage:!!E.alphaToCoverage,map:at,matcap:j,envMap:$e,envMapMode:$e&&pe.mapping,envMapCubeUVHeight:K,aoMap:ze,lightMap:bt,bumpMap:He,normalMap:Tt,displacementMap:m&&B,emissiveMap:w,normalMapObjectSpace:Tt&&E.normalMapType===Zb,normalMapTangentSpace:Tt&&E.normalMapType===l_,metalnessMap:te,roughnessMap:ae,anisotropy:ue,anisotropyMap:Ve,clearcoat:de,clearcoatMap:ve,clearcoatNormalMap:Te,clearcoatRoughnessMap:qe,iridescence:Be,iridescenceMap:Le,iridescenceThicknessMap:Ie,sheen:_e,sheenColorMap:ct,sheenRoughnessMap:ft,specularMap:St,specularColorMap:gt,specularIntensityMap:Mt,transmission:De,transmissionMap:Ue,thicknessMap:S,gradientMap:Z,opaque:E.transparent===!1&&E.blending===fo&&E.alphaToCoverage===!1,alphaMap:oe,alphaTest:xe,alphaHash:Re,combine:E.combine,mapUv:at&&A(E.map.channel),aoMapUv:ze&&A(E.aoMap.channel),lightMapUv:bt&&A(E.lightMap.channel),bumpMapUv:He&&A(E.bumpMap.channel),normalMapUv:Tt&&A(E.normalMap.channel),displacementMapUv:B&&A(E.displacementMap.channel),emissiveMapUv:w&&A(E.emissiveMap.channel),metalnessMapUv:te&&A(E.metalnessMap.channel),roughnessMapUv:ae&&A(E.roughnessMap.channel),anisotropyMapUv:Ve&&A(E.anisotropyMap.channel),clearcoatMapUv:ve&&A(E.clearcoatMap.channel),clearcoatNormalMapUv:Te&&A(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:qe&&A(E.clearcoatRoughnessMap.channel),iridescenceMapUv:Le&&A(E.iridescenceMap.channel),iridescenceThicknessMapUv:Ie&&A(E.iridescenceThicknessMap.channel),sheenColorMapUv:ct&&A(E.sheenColorMap.channel),sheenRoughnessMapUv:ft&&A(E.sheenRoughnessMap.channel),specularMapUv:St&&A(E.specularMap.channel),specularColorMapUv:gt&&A(E.specularColorMap.channel),specularIntensityMapUv:Mt&&A(E.specularIntensityMap.channel),transmissionMapUv:Ue&&A(E.transmissionMap.channel),thicknessMapUv:S&&A(E.thicknessMap.channel),alphaMapUv:oe&&A(E.alphaMap.channel),vertexTangents:!!ne.attributes.tangent&&(Tt||ue),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!ne.attributes.color&&ne.attributes.color.itemSize===4,pointsUvs:G.isPoints===!0&&!!ne.attributes.uv&&(at||oe),fog:!!q,useFog:E.fog===!0,fogExp2:!!q&&q.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:p,skinning:G.isSkinnedMesh===!0,morphTargets:ne.morphAttributes.position!==void 0,morphNormals:ne.morphAttributes.normal!==void 0,morphColors:ne.morphAttributes.color!==void 0,morphTargetsCount:Me,morphTextureStride:Ke,numDirLights:y.directional.length,numPointLights:y.point.length,numSpotLights:y.spot.length,numSpotLightMaps:y.spotLightMap.length,numRectAreaLights:y.rectArea.length,numHemiLights:y.hemi.length,numDirLightShadows:y.directionalShadowMap.length,numPointLightShadows:y.pointShadowMap.length,numSpotLightShadows:y.spotShadowMap.length,numSpotLightShadowsWithMaps:y.numSpotLightShadowsWithMaps,numLightProbes:y.numLightProbes,numClippingPlanes:c.numPlanes,numClipIntersection:c.numIntersection,dithering:E.dithering,shadowMapEnabled:i.shadowMap.enabled&&F.length>0,shadowMapType:i.shadowMap.type,toneMapping:dt,useLegacyLights:i._useLegacyLights,decodeVideoTexture:at&&E.map.isVideoTexture===!0&&Ct.getTransfer(E.map.colorSpace)===Gt,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Ai,flipSided:E.side===Xn,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:_t&&E.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:_t&&E.extensions.multiDraw===!0&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return Ft.vertexUv1s=f.has(1),Ft.vertexUv2s=f.has(2),Ft.vertexUv3s=f.has(3),f.clear(),Ft}function _(E){const y=[];if(E.shaderID?y.push(E.shaderID):(y.push(E.customVertexShaderID),y.push(E.customFragmentShaderID)),E.defines!==void 0)for(const F in E.defines)y.push(F),y.push(E.defines[F]);return E.isRawShaderMaterial===!1&&(C(y,E),b(y,E),y.push(i.outputColorSpace)),y.push(E.customProgramCacheKey),y.join()}function C(E,y){E.push(y.precision),E.push(y.outputColorSpace),E.push(y.envMapMode),E.push(y.envMapCubeUVHeight),E.push(y.mapUv),E.push(y.alphaMapUv),E.push(y.lightMapUv),E.push(y.aoMapUv),E.push(y.bumpMapUv),E.push(y.normalMapUv),E.push(y.displacementMapUv),E.push(y.emissiveMapUv),E.push(y.metalnessMapUv),E.push(y.roughnessMapUv),E.push(y.anisotropyMapUv),E.push(y.clearcoatMapUv),E.push(y.clearcoatNormalMapUv),E.push(y.clearcoatRoughnessMapUv),E.push(y.iridescenceMapUv),E.push(y.iridescenceThicknessMapUv),E.push(y.sheenColorMapUv),E.push(y.sheenRoughnessMapUv),E.push(y.specularMapUv),E.push(y.specularColorMapUv),E.push(y.specularIntensityMapUv),E.push(y.transmissionMapUv),E.push(y.thicknessMapUv),E.push(y.combine),E.push(y.fogExp2),E.push(y.sizeAttenuation),E.push(y.morphTargetsCount),E.push(y.morphAttributeCount),E.push(y.numDirLights),E.push(y.numPointLights),E.push(y.numSpotLights),E.push(y.numSpotLightMaps),E.push(y.numHemiLights),E.push(y.numRectAreaLights),E.push(y.numDirLightShadows),E.push(y.numPointLightShadows),E.push(y.numSpotLightShadows),E.push(y.numSpotLightShadowsWithMaps),E.push(y.numLightProbes),E.push(y.shadowMapType),E.push(y.toneMapping),E.push(y.numClippingPlanes),E.push(y.numClipIntersection),E.push(y.depthPacking)}function b(E,y){l.disableAll(),y.supportsVertexTextures&&l.enable(0),y.instancing&&l.enable(1),y.instancingColor&&l.enable(2),y.instancingMorph&&l.enable(3),y.matcap&&l.enable(4),y.envMap&&l.enable(5),y.normalMapObjectSpace&&l.enable(6),y.normalMapTangentSpace&&l.enable(7),y.clearcoat&&l.enable(8),y.iridescence&&l.enable(9),y.alphaTest&&l.enable(10),y.vertexColors&&l.enable(11),y.vertexAlphas&&l.enable(12),y.vertexUv1s&&l.enable(13),y.vertexUv2s&&l.enable(14),y.vertexUv3s&&l.enable(15),y.vertexTangents&&l.enable(16),y.anisotropy&&l.enable(17),y.alphaHash&&l.enable(18),y.batching&&l.enable(19),E.push(l.mask),l.disableAll(),y.fog&&l.enable(0),y.useFog&&l.enable(1),y.flatShading&&l.enable(2),y.logarithmicDepthBuffer&&l.enable(3),y.skinning&&l.enable(4),y.morphTargets&&l.enable(5),y.morphNormals&&l.enable(6),y.morphColors&&l.enable(7),y.premultipliedAlpha&&l.enable(8),y.shadowMapEnabled&&l.enable(9),y.useLegacyLights&&l.enable(10),y.doubleSided&&l.enable(11),y.flipSided&&l.enable(12),y.useDepthPacking&&l.enable(13),y.dithering&&l.enable(14),y.transmission&&l.enable(15),y.sheen&&l.enable(16),y.opaque&&l.enable(17),y.pointsUvs&&l.enable(18),y.decodeVideoTexture&&l.enable(19),y.alphaToCoverage&&l.enable(20),E.push(l.mask)}function L(E){const y=M[E.type];let F;if(y){const V=Hi[y];F=BT.clone(V.uniforms)}else F=E.uniforms;return F}function k(E,y){let F;for(let V=0,G=d.length;V<G;V++){const q=d[V];if(q.cacheKey===y){F=q,++F.usedTimes;break}}return F===void 0&&(F=new ZR(i,y,E,o),d.push(F)),F}function U(E){if(--E.usedTimes===0){const y=d.indexOf(E);d[y]=d[d.length-1],d.pop(),E.destroy()}}function O(E){h.remove(E)}function I(){h.dispose()}return{getParameters:v,getProgramCacheKey:_,getUniforms:L,acquireProgram:k,releaseProgram:U,releaseShaderCache:O,programs:d,dispose:I}}function tC(){let i=new WeakMap;function e(o){let c=i.get(o);return c===void 0&&(c={},i.set(o,c)),c}function t(o){i.delete(o)}function n(o,c,l){i.get(o)[c]=l}function r(){i=new WeakMap}return{get:e,remove:t,update:n,dispose:r}}function nC(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function tg(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function ng(){const i=[];let e=0;const t=[],n=[],r=[];function o(){e=0,t.length=0,n.length=0,r.length=0}function c(p,m,x,M,A,v){let _=i[e];return _===void 0?(_={id:p.id,object:p,geometry:m,material:x,groupOrder:M,renderOrder:p.renderOrder,z:A,group:v},i[e]=_):(_.id=p.id,_.object=p,_.geometry=m,_.material=x,_.groupOrder=M,_.renderOrder=p.renderOrder,_.z=A,_.group=v),e++,_}function l(p,m,x,M,A,v){const _=c(p,m,x,M,A,v);x.transmission>0?n.push(_):x.transparent===!0?r.push(_):t.push(_)}function h(p,m,x,M,A,v){const _=c(p,m,x,M,A,v);x.transmission>0?n.unshift(_):x.transparent===!0?r.unshift(_):t.unshift(_)}function f(p,m){t.length>1&&t.sort(p||nC),n.length>1&&n.sort(m||tg),r.length>1&&r.sort(m||tg)}function d(){for(let p=e,m=i.length;p<m;p++){const x=i[p];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:r,init:o,push:l,unshift:h,finish:d,sort:f}}function iC(){let i=new WeakMap;function e(n,r){const o=i.get(n);let c;return o===void 0?(c=new ng,i.set(n,[c])):r>=o.length?(c=new ng,o.push(c)):c=o[r],c}function t(){i=new WeakMap}return{get:e,dispose:t}}function rC(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new N,color:new Ne};break;case"SpotLight":t={position:new N,direction:new N,color:new Ne,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new N,color:new Ne,distance:0,decay:0};break;case"HemisphereLight":t={direction:new N,skyColor:new Ne,groundColor:new Ne};break;case"RectAreaLight":t={color:new Ne,position:new N,halfWidth:new N,halfHeight:new N};break}return i[e.id]=t,t}}}function sC(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let oC=0;function aC(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function cC(i){const e=new rC,t=sC(),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 f=0;f<9;f++)n.probe.push(new N);const r=new N,o=new Qe,c=new Qe;function l(f,d){let p=0,m=0,x=0;for(let F=0;F<9;F++)n.probe[F].set(0,0,0);let M=0,A=0,v=0,_=0,C=0,b=0,L=0,k=0,U=0,O=0,I=0;f.sort(aC);const E=d===!0?Math.PI:1;for(let F=0,V=f.length;F<V;F++){const G=f[F],q=G.color,ne=G.intensity,se=G.distance,pe=G.shadow&&G.shadow.map?G.shadow.map.texture:null;if(G.isAmbientLight)p+=q.r*ne*E,m+=q.g*ne*E,x+=q.b*ne*E;else if(G.isLightProbe){for(let K=0;K<9;K++)n.probe[K].addScaledVector(G.sh.coefficients[K],ne);I++}else if(G.isDirectionalLight){const K=e.get(G);if(K.color.copy(G.color).multiplyScalar(G.intensity*E),G.castShadow){const he=G.shadow,me=t.get(G);me.shadowBias=he.bias,me.shadowNormalBias=he.normalBias,me.shadowRadius=he.radius,me.shadowMapSize=he.mapSize,n.directionalShadow[M]=me,n.directionalShadowMap[M]=pe,n.directionalShadowMatrix[M]=G.shadow.matrix,b++}n.directional[M]=K,M++}else if(G.isSpotLight){const K=e.get(G);K.position.setFromMatrixPosition(G.matrixWorld),K.color.copy(q).multiplyScalar(ne*E),K.distance=se,K.coneCos=Math.cos(G.angle),K.penumbraCos=Math.cos(G.angle*(1-G.penumbra)),K.decay=G.decay,n.spot[v]=K;const he=G.shadow;if(G.map&&(n.spotLightMap[U]=G.map,U++,he.updateMatrices(G),G.castShadow&&O++),n.spotLightMatrix[v]=he.matrix,G.castShadow){const me=t.get(G);me.shadowBias=he.bias,me.shadowNormalBias=he.normalBias,me.shadowRadius=he.radius,me.shadowMapSize=he.mapSize,n.spotShadow[v]=me,n.spotShadowMap[v]=pe,k++}v++}else if(G.isRectAreaLight){const K=e.get(G);K.color.copy(q).multiplyScalar(ne),K.halfWidth.set(G.width*.5,0,0),K.halfHeight.set(0,G.height*.5,0),n.rectArea[_]=K,_++}else if(G.isPointLight){const K=e.get(G);if(K.color.copy(G.color).multiplyScalar(G.intensity*E),K.distance=G.distance,K.decay=G.decay,G.castShadow){const he=G.shadow,me=t.get(G);me.shadowBias=he.bias,me.shadowNormalBias=he.normalBias,me.shadowRadius=he.radius,me.shadowMapSize=he.mapSize,me.shadowCameraNear=he.camera.near,me.shadowCameraFar=he.camera.far,n.pointShadow[A]=me,n.pointShadowMap[A]=pe,n.pointShadowMatrix[A]=G.shadow.matrix,L++}n.point[A]=K,A++}else if(G.isHemisphereLight){const K=e.get(G);K.skyColor.copy(G.color).multiplyScalar(ne*E),K.groundColor.copy(G.groundColor).multiplyScalar(ne*E),n.hemi[C]=K,C++}}_>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=be.LTC_FLOAT_1,n.rectAreaLTC2=be.LTC_FLOAT_2):(n.rectAreaLTC1=be.LTC_HALF_1,n.rectAreaLTC2=be.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=m,n.ambient[2]=x;const y=n.hash;(y.directionalLength!==M||y.pointLength!==A||y.spotLength!==v||y.rectAreaLength!==_||y.hemiLength!==C||y.numDirectionalShadows!==b||y.numPointShadows!==L||y.numSpotShadows!==k||y.numSpotMaps!==U||y.numLightProbes!==I)&&(n.directional.length=M,n.spot.length=v,n.rectArea.length=_,n.point.length=A,n.hemi.length=C,n.directionalShadow.length=b,n.directionalShadowMap.length=b,n.pointShadow.length=L,n.pointShadowMap.length=L,n.spotShadow.length=k,n.spotShadowMap.length=k,n.directionalShadowMatrix.length=b,n.pointShadowMatrix.length=L,n.spotLightMatrix.length=k+U-O,n.spotLightMap.length=U,n.numSpotLightShadowsWithMaps=O,n.numLightProbes=I,y.directionalLength=M,y.pointLength=A,y.spotLength=v,y.rectAreaLength=_,y.hemiLength=C,y.numDirectionalShadows=b,y.numPointShadows=L,y.numSpotShadows=k,y.numSpotMaps=U,y.numLightProbes=I,n.version=oC++)}function h(f,d){let p=0,m=0,x=0,M=0,A=0;const v=d.matrixWorldInverse;for(let _=0,C=f.length;_<C;_++){const b=f[_];if(b.isDirectionalLight){const L=n.directional[p];L.direction.setFromMatrixPosition(b.matrixWorld),r.setFromMatrixPosition(b.target.matrixWorld),L.direction.sub(r),L.direction.transformDirection(v),p++}else if(b.isSpotLight){const L=n.spot[x];L.position.setFromMatrixPosition(b.matrixWorld),L.position.applyMatrix4(v),L.direction.setFromMatrixPosition(b.matrixWorld),r.setFromMatrixPosition(b.target.matrixWorld),L.direction.sub(r),L.direction.transformDirection(v),x++}else if(b.isRectAreaLight){const L=n.rectArea[M];L.position.setFromMatrixPosition(b.matrixWorld),L.position.applyMatrix4(v),c.identity(),o.copy(b.matrixWorld),o.premultiply(v),c.extractRotation(o),L.halfWidth.set(b.width*.5,0,0),L.halfHeight.set(0,b.height*.5,0),L.halfWidth.applyMatrix4(c),L.halfHeight.applyMatrix4(c),M++}else if(b.isPointLight){const L=n.point[m];L.position.setFromMatrixPosition(b.matrixWorld),L.position.applyMatrix4(v),m++}else if(b.isHemisphereLight){const L=n.hemi[A];L.direction.setFromMatrixPosition(b.matrixWorld),L.direction.transformDirection(v),A++}}}return{setup:l,setupView:h,state:n}}function ig(i){const e=new cC(i),t=[],n=[];function r(){t.length=0,n.length=0}function o(d){t.push(d)}function c(d){n.push(d)}function l(d){e.setup(t,d)}function h(d){e.setupView(t,d)}return{init:r,state:{lightsArray:t,shadowsArray:n,lights:e,transmissionRenderTarget:null},setupLights:l,setupLightsView:h,pushLight:o,pushShadow:c}}function lC(i){let e=new WeakMap;function t(r,o=0){const c=e.get(r);let l;return c===void 0?(l=new ig(i),e.set(r,[l])):o>=c.length?(l=new ig(i),c.push(l)):l=c[o],l}function n(){e=new WeakMap}return{get:t,dispose:n}}class uC extends mi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=qb,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 hC extends mi{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}}const fC=`void main() {
|
|
3746
3746
|
gl_Position = vec4( position, 1.0 );
|
|
3747
|
-
}`,
|
|
3747
|
+
}`,dC=`uniform sampler2D shadow_pass;
|
|
3748
3748
|
uniform vec2 resolution;
|
|
3749
3749
|
uniform float radius;
|
|
3750
3750
|
#include <packing>
|
|
@@ -3770,12 +3770,12 @@ void main() {
|
|
|
3770
3770
|
squared_mean = squared_mean / samples;
|
|
3771
3771
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|
3772
3772
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
3773
|
-
}`;function ZR(s,e,t){let n=new ju;const i=new Ie,o=new Ie,c=new Dt,l=new YR({depthPacking:Lb}),u=new jR,f={},d=t.maxTextureSize,p={[Fi]:Vn,[Vn]:Fi,[yi]:yi},m=new Br({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ie},radius:{value:4}},vertexShader:qR,fragmentShader:KR}),v=m.clone();v.defines.HORIZONTAL_PASS=1;const S=new $t;S.setAttribute("position",new cn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new ye(S,m),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Fg;let _=this.type;this.render=function(N,D,k){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||N.length===0)return;const C=s.getRenderTarget(),T=s.getActiveCubeFace(),W=s.getActiveMipmapLevel(),j=s.state;j.setBlending(Nr),j.buffers.color.setClear(1,1,1,1),j.buffers.depth.setTest(!0),j.setScissorTest(!1);const H=_!==sr&&this.type===sr,K=_===sr&&this.type!==sr;for(let ne=0,he=N.length;ne<he;ne++){const me=N[ne],$=me.shadow;if($===void 0){console.warn("THREE.WebGLShadowMap:",me,"has no shadow.");continue}if($.autoUpdate===!1&&$.needsUpdate===!1)continue;i.copy($.mapSize);const fe=$.getFrameExtents();if(i.multiply(fe),o.copy($.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(o.x=Math.floor(d/fe.x),i.x=o.x*fe.x,$.mapSize.x=o.x),i.y>d&&(o.y=Math.floor(d/fe.y),i.y=o.y*fe.y,$.mapSize.y=o.y)),$.map===null||H===!0||K===!0){const Ee=this.type!==sr?{minFilter:Nn,magFilter:Nn}:{};$.map!==null&&$.map.dispose(),$.map=new hs(i.x,i.y,Ee),$.map.texture.name=me.name+".shadowMap",$.camera.updateProjectionMatrix()}s.setRenderTarget($.map),s.clear();const pe=$.getViewportCount();for(let Ee=0;Ee<pe;Ee++){const Je=$.getViewport(Ee);c.set(o.x*Je.x,o.y*Je.y,o.x*Je.z,o.y*Je.w),j.viewport(c),$.updateMatrices(me,Ee),n=$.getFrustum(),L(D,k,$.camera,me,this.type)}$.isPointLightShadow!==!0&&this.type===sr&&R($,k),$.needsUpdate=!1}_=this.type,x.needsUpdate=!1,s.setRenderTarget(C,T,W)};function R(N,D){const k=e.update(b);m.defines.VSM_SAMPLES!==N.blurSamples&&(m.defines.VSM_SAMPLES=N.blurSamples,v.defines.VSM_SAMPLES=N.blurSamples,m.needsUpdate=!0,v.needsUpdate=!0),N.mapPass===null&&(N.mapPass=new hs(i.x,i.y)),m.uniforms.shadow_pass.value=N.map.texture,m.uniforms.resolution.value=N.mapSize,m.uniforms.radius.value=N.radius,s.setRenderTarget(N.mapPass),s.clear(),s.renderBufferDirect(D,null,k,m,b,null),v.uniforms.shadow_pass.value=N.mapPass.texture,v.uniforms.resolution.value=N.mapSize,v.uniforms.radius.value=N.radius,s.setRenderTarget(N.map),s.clear(),s.renderBufferDirect(D,null,k,v,b,null)}function E(N,D,k,C){let T=null;const W=k.isPointLight===!0?N.customDistanceMaterial:N.customDepthMaterial;if(W!==void 0)T=W;else if(T=k.isPointLight===!0?u:l,s.localClippingEnabled&&D.clipShadows===!0&&Array.isArray(D.clippingPlanes)&&D.clippingPlanes.length!==0||D.displacementMap&&D.displacementScale!==0||D.alphaMap&&D.alphaTest>0||D.map&&D.alphaTest>0){const j=T.uuid,H=D.uuid;let K=f[j];K===void 0&&(K={},f[j]=K);let ne=K[H];ne===void 0&&(ne=T.clone(),K[H]=ne,D.addEventListener("dispose",B)),T=ne}if(T.visible=D.visible,T.wireframe=D.wireframe,C===sr?T.side=D.shadowSide!==null?D.shadowSide:D.side:T.side=D.shadowSide!==null?D.shadowSide:p[D.side],T.alphaMap=D.alphaMap,T.alphaTest=D.alphaTest,T.map=D.map,T.clipShadows=D.clipShadows,T.clippingPlanes=D.clippingPlanes,T.clipIntersection=D.clipIntersection,T.displacementMap=D.displacementMap,T.displacementScale=D.displacementScale,T.displacementBias=D.displacementBias,T.wireframeLinewidth=D.wireframeLinewidth,T.linewidth=D.linewidth,k.isPointLight===!0&&T.isMeshDistanceMaterial===!0){const j=s.properties.get(T);j.light=k}return T}function L(N,D,k,C,T){if(N.visible===!1)return;if(N.layers.test(D.layers)&&(N.isMesh||N.isLine||N.isPoints)&&(N.castShadow||N.receiveShadow&&T===sr)&&(!N.frustumCulled||n.intersectsObject(N))){N.modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,N.matrixWorld);const H=e.update(N),K=N.material;if(Array.isArray(K)){const ne=H.groups;for(let he=0,me=ne.length;he<me;he++){const $=ne[he],fe=K[$.materialIndex];if(fe&&fe.visible){const pe=E(N,fe,C,T);N.onBeforeShadow(s,N,D,k,H,pe,$),s.renderBufferDirect(k,null,H,pe,N,$),N.onAfterShadow(s,N,D,k,H,pe,$)}}}else if(K.visible){const ne=E(N,K,C,T);N.onBeforeShadow(s,N,D,k,H,ne,null),s.renderBufferDirect(k,null,H,ne,N,null),N.onAfterShadow(s,N,D,k,H,ne,null)}}const j=N.children;for(let H=0,K=j.length;H<K;H++)L(j[H],D,k,C,T)}function B(N){N.target.removeEventListener("dispose",B);for(const k in f){const C=f[k],T=N.target.uuid;T in C&&(C[T].dispose(),delete C[T])}}}function $R(s){function e(){let y=!1;const q=new Dt;let se=null;const xe=new Dt(0,0,0,0);return{setMask:function(we){se!==we&&!y&&(s.colorMask(we,we,we,we),se=we)},setLocked:function(we){y=we},setClear:function(we,mt,ut,Ft,tn){tn===!0&&(we*=Ft,mt*=Ft,ut*=Ft),q.set(we,mt,ut,Ft),xe.equals(q)===!1&&(s.clearColor(we,mt,ut,Ft),xe.copy(q))},reset:function(){y=!1,se=null,xe.set(-1,0,0,0)}}}function t(){let y=!1,q=null,se=null,xe=null;return{setTest:function(we){we?Ce(s.DEPTH_TEST):Ae(s.DEPTH_TEST)},setMask:function(we){q!==we&&!y&&(s.depthMask(we),q=we)},setFunc:function(we){if(se!==we){switch(we){case nb:s.depthFunc(s.NEVER);break;case ib:s.depthFunc(s.ALWAYS);break;case rb:s.depthFunc(s.LESS);break;case Jc:s.depthFunc(s.LEQUAL);break;case sb:s.depthFunc(s.EQUAL);break;case ob:s.depthFunc(s.GEQUAL);break;case ab:s.depthFunc(s.GREATER);break;case cb:s.depthFunc(s.NOTEQUAL);break;default:s.depthFunc(s.LEQUAL)}se=we}},setLocked:function(we){y=we},setClear:function(we){xe!==we&&(s.clearDepth(we),xe=we)},reset:function(){y=!1,q=null,se=null,xe=null}}}function n(){let y=!1,q=null,se=null,xe=null,we=null,mt=null,ut=null,Ft=null,tn=null;return{setTest:function(At){y||(At?Ce(s.STENCIL_TEST):Ae(s.STENCIL_TEST))},setMask:function(At){q!==At&&!y&&(s.stencilMask(At),q=At)},setFunc:function(At,qt,Kt){(se!==At||xe!==qt||we!==Kt)&&(s.stencilFunc(At,qt,Kt),se=At,xe=qt,we=Kt)},setOp:function(At,qt,Kt){(mt!==At||ut!==qt||Ft!==Kt)&&(s.stencilOp(At,qt,Kt),mt=At,ut=qt,Ft=Kt)},setLocked:function(At){y=At},setClear:function(At){tn!==At&&(s.clearStencil(At),tn=At)},reset:function(){y=!1,q=null,se=null,xe=null,we=null,mt=null,ut=null,Ft=null,tn=null}}}const i=new e,o=new t,c=new n,l=new WeakMap,u=new WeakMap;let f={},d={},p=new WeakMap,m=[],v=null,S=!1,b=null,x=null,_=null,R=null,E=null,L=null,B=null,N=new Ne(0,0,0),D=0,k=!1,C=null,T=null,W=null,j=null,H=null;const K=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let ne=!1,he=0;const me=s.getParameter(s.VERSION);me.indexOf("WebGL")!==-1?(he=parseFloat(/^WebGL (\d)/.exec(me)[1]),ne=he>=1):me.indexOf("OpenGL ES")!==-1&&(he=parseFloat(/^OpenGL ES (\d)/.exec(me)[1]),ne=he>=2);let $=null,fe={};const pe=s.getParameter(s.SCISSOR_BOX),Ee=s.getParameter(s.VIEWPORT),Je=new Dt().fromArray(pe),bt=new Dt().fromArray(Ee);function ie(y,q,se,xe){const we=new Uint8Array(4),mt=s.createTexture();s.bindTexture(y,mt),s.texParameteri(y,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(y,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let ut=0;ut<se;ut++)y===s.TEXTURE_3D||y===s.TEXTURE_2D_ARRAY?s.texImage3D(q,0,s.RGBA,1,1,xe,0,s.RGBA,s.UNSIGNED_BYTE,we):s.texImage2D(q+ut,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,we);return mt}const _e={};_e[s.TEXTURE_2D]=ie(s.TEXTURE_2D,s.TEXTURE_2D,1),_e[s.TEXTURE_CUBE_MAP]=ie(s.TEXTURE_CUBE_MAP,s.TEXTURE_CUBE_MAP_POSITIVE_X,6),_e[s.TEXTURE_2D_ARRAY]=ie(s.TEXTURE_2D_ARRAY,s.TEXTURE_2D_ARRAY,1,1),_e[s.TEXTURE_3D]=ie(s.TEXTURE_3D,s.TEXTURE_3D,1,1),i.setClear(0,0,0,1),o.setClear(1),c.setClear(0),Ce(s.DEPTH_TEST),o.setFunc(Jc),ke(!1),Tt(bp),Ce(s.CULL_FACE),Ve(Nr);function Ce(y){f[y]!==!0&&(s.enable(y),f[y]=!0)}function Ae(y){f[y]!==!1&&(s.disable(y),f[y]=!1)}function je(y,q){return d[y]!==q?(s.bindFramebuffer(y,q),d[y]=q,y===s.DRAW_FRAMEBUFFER&&(d[s.FRAMEBUFFER]=q),y===s.FRAMEBUFFER&&(d[s.DRAW_FRAMEBUFFER]=q),!0):!1}function qe(y,q){let se=m,xe=!1;if(y){se=p.get(q),se===void 0&&(se=[],p.set(q,se));const we=y.textures;if(se.length!==we.length||se[0]!==s.COLOR_ATTACHMENT0){for(let mt=0,ut=we.length;mt<ut;mt++)se[mt]=s.COLOR_ATTACHMENT0+mt;se.length=we.length,xe=!0}}else se[0]!==s.BACK&&(se[0]=s.BACK,xe=!0);xe&&s.drawBuffers(se)}function dt(y){return v!==y?(s.useProgram(y),v=y,!0):!1}const Y={[os]:s.FUNC_ADD,[zE]:s.FUNC_SUBTRACT,[kE]:s.FUNC_REVERSE_SUBTRACT};Y[HE]=s.MIN,Y[GE]=s.MAX;const tt={[VE]:s.ZERO,[WE]:s.ONE,[XE]:s.SRC_COLOR,[xu]:s.SRC_ALPHA,[$E]:s.SRC_ALPHA_SATURATE,[KE]:s.DST_COLOR,[jE]:s.DST_ALPHA,[YE]:s.ONE_MINUS_SRC_COLOR,[yu]:s.ONE_MINUS_SRC_ALPHA,[ZE]:s.ONE_MINUS_DST_COLOR,[qE]:s.ONE_MINUS_DST_ALPHA,[JE]:s.CONSTANT_COLOR,[QE]:s.ONE_MINUS_CONSTANT_COLOR,[eb]:s.CONSTANT_ALPHA,[tb]:s.ONE_MINUS_CONSTANT_ALPHA};function Ve(y,q,se,xe,we,mt,ut,Ft,tn,At){if(y===Nr){S===!0&&(Ae(s.BLEND),S=!1);return}if(S===!1&&(Ce(s.BLEND),S=!0),y!==BE){if(y!==b||At!==k){if((x!==os||E!==os)&&(s.blendEquation(s.FUNC_ADD),x=os,E=os),At)switch(y){case ro:s.blendFuncSeparate(s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Tp:s.blendFunc(s.ONE,s.ONE);break;case Ap:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case wp:s.blendFuncSeparate(s.ZERO,s.SRC_COLOR,s.ZERO,s.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",y);break}else switch(y){case ro:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Tp:s.blendFunc(s.SRC_ALPHA,s.ONE);break;case Ap:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case wp:s.blendFunc(s.ZERO,s.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",y);break}_=null,R=null,L=null,B=null,N.set(0,0,0),D=0,b=y,k=At}return}we=we||q,mt=mt||se,ut=ut||xe,(q!==x||we!==E)&&(s.blendEquationSeparate(Y[q],Y[we]),x=q,E=we),(se!==_||xe!==R||mt!==L||ut!==B)&&(s.blendFuncSeparate(tt[se],tt[xe],tt[mt],tt[ut]),_=se,R=xe,L=mt,B=ut),(Ft.equals(N)===!1||tn!==D)&&(s.blendColor(Ft.r,Ft.g,Ft.b,tn),N.copy(Ft),D=tn),b=y,k=!1}function Et(y,q){y.side===yi?Ae(s.CULL_FACE):Ce(s.CULL_FACE);let se=y.side===Vn;q&&(se=!se),ke(se),y.blending===ro&&y.transparent===!1?Ve(Nr):Ve(y.blending,y.blendEquation,y.blendSrc,y.blendDst,y.blendEquationAlpha,y.blendSrcAlpha,y.blendDstAlpha,y.blendColor,y.blendAlpha,y.premultipliedAlpha),o.setFunc(y.depthFunc),o.setTest(y.depthTest),o.setMask(y.depthWrite),i.setMask(y.colorWrite);const xe=y.stencilWrite;c.setTest(xe),xe&&(c.setMask(y.stencilWriteMask),c.setFunc(y.stencilFunc,y.stencilRef,y.stencilFuncMask),c.setOp(y.stencilFail,y.stencilZFail,y.stencilZPass)),A(y.polygonOffset,y.polygonOffsetFactor,y.polygonOffsetUnits),y.alphaToCoverage===!0?Ce(s.SAMPLE_ALPHA_TO_COVERAGE):Ae(s.SAMPLE_ALPHA_TO_COVERAGE)}function ke(y){C!==y&&(y?s.frontFace(s.CW):s.frontFace(s.CCW),C=y)}function Tt(y){y!==NE?(Ce(s.CULL_FACE),y!==T&&(y===bp?s.cullFace(s.BACK):y===FE?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK))):Ae(s.CULL_FACE),T=y}function O(y){y!==W&&(ne&&s.lineWidth(y),W=y)}function A(y,q,se){y?(Ce(s.POLYGON_OFFSET_FILL),(j!==q||H!==se)&&(s.polygonOffset(q,se),j=q,H=se)):Ae(s.POLYGON_OFFSET_FILL)}function te(y){y?Ce(s.SCISSOR_TEST):Ae(s.SCISSOR_TEST)}function oe(y){y===void 0&&(y=s.TEXTURE0+K-1),$!==y&&(s.activeTexture(y),$=y)}function le(y,q,se){se===void 0&&($===null?se=s.TEXTURE0+K-1:se=$);let xe=fe[se];xe===void 0&&(xe={type:void 0,texture:void 0},fe[se]=xe),(xe.type!==y||xe.texture!==q)&&($!==se&&(s.activeTexture(se),$=se),s.bindTexture(y,q||_e[y]),xe.type=y,xe.texture=q)}function de(){const y=fe[$];y!==void 0&&y.type!==void 0&&(s.bindTexture(y.type,null),y.type=void 0,y.texture=void 0)}function Be(){try{s.compressedTexImage2D.apply(s,arguments)}catch(y){console.error("THREE.WebGLState:",y)}}function ge(){try{s.compressedTexImage3D.apply(s,arguments)}catch(y){console.error("THREE.WebGLState:",y)}}function De(){try{s.texSubImage2D.apply(s,arguments)}catch(y){console.error("THREE.WebGLState:",y)}}function He(){try{s.texSubImage3D.apply(s,arguments)}catch(y){console.error("THREE.WebGLState:",y)}}function ve(){try{s.compressedTexSubImage2D.apply(s,arguments)}catch(y){console.error("THREE.WebGLState:",y)}}function be(){try{s.compressedTexSubImage3D.apply(s,arguments)}catch(y){console.error("THREE.WebGLState:",y)}}function Ye(){try{s.texStorage2D.apply(s,arguments)}catch(y){console.error("THREE.WebGLState:",y)}}function Pe(){try{s.texStorage3D.apply(s,arguments)}catch(y){console.error("THREE.WebGLState:",y)}}function Le(){try{s.texImage2D.apply(s,arguments)}catch(y){console.error("THREE.WebGLState:",y)}}function ot(){try{s.texImage3D.apply(s,arguments)}catch(y){console.error("THREE.WebGLState:",y)}}function ht(y){Je.equals(y)===!1&&(s.scissor(y.x,y.y,y.z,y.w),Je.copy(y))}function yt(y){bt.equals(y)===!1&&(s.viewport(y.x,y.y,y.z,y.w),bt.copy(y))}function pt(y,q){let se=u.get(q);se===void 0&&(se=new WeakMap,u.set(q,se));let xe=se.get(y);xe===void 0&&(xe=s.getUniformBlockIndex(q,y.name),se.set(y,xe))}function St(y,q){const xe=u.get(q).get(y);l.get(q)!==xe&&(s.uniformBlockBinding(q,xe,y.__bindingPointIndex),l.set(q,xe))}function Oe(){s.disable(s.BLEND),s.disable(s.CULL_FACE),s.disable(s.DEPTH_TEST),s.disable(s.POLYGON_OFFSET_FILL),s.disable(s.SCISSOR_TEST),s.disable(s.STENCIL_TEST),s.disable(s.SAMPLE_ALPHA_TO_COVERAGE),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ONE,s.ZERO),s.blendFuncSeparate(s.ONE,s.ZERO,s.ONE,s.ZERO),s.blendColor(0,0,0,0),s.colorMask(!0,!0,!0,!0),s.clearColor(0,0,0,0),s.depthMask(!0),s.depthFunc(s.LESS),s.clearDepth(1),s.stencilMask(4294967295),s.stencilFunc(s.ALWAYS,0,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.KEEP),s.clearStencil(0),s.cullFace(s.BACK),s.frontFace(s.CCW),s.polygonOffset(0,0),s.activeTexture(s.TEXTURE0),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),s.bindFramebuffer(s.READ_FRAMEBUFFER,null),s.useProgram(null),s.lineWidth(1),s.scissor(0,0,s.canvas.width,s.canvas.height),s.viewport(0,0,s.canvas.width,s.canvas.height),f={},$=null,fe={},d={},p=new WeakMap,m=[],v=null,S=!1,b=null,x=null,_=null,R=null,E=null,L=null,B=null,N=new Ne(0,0,0),D=0,k=!1,C=null,T=null,W=null,j=null,H=null,Je.set(0,0,s.canvas.width,s.canvas.height),bt.set(0,0,s.canvas.width,s.canvas.height),i.reset(),o.reset(),c.reset()}return{buffers:{color:i,depth:o,stencil:c},enable:Ce,disable:Ae,bindFramebuffer:je,drawBuffers:qe,useProgram:dt,setBlending:Ve,setMaterial:Et,setFlipSided:ke,setCullFace:Tt,setLineWidth:O,setPolygonOffset:A,setScissorTest:te,activeTexture:oe,bindTexture:le,unbindTexture:de,compressedTexImage2D:Be,compressedTexImage3D:ge,texImage2D:Le,texImage3D:ot,updateUBOMapping:pt,uniformBlockBinding:St,texStorage2D:Ye,texStorage3D:Pe,texSubImage2D:De,texSubImage3D:He,compressedTexSubImage2D:ve,compressedTexSubImage3D:be,scissor:ht,viewport:yt,reset:Oe}}function JR(s,e,t,n,i,o,c){const l=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),f=new Ie,d=new WeakMap;let p;const m=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function S(O,A){return v?new OffscreenCanvas(O,A):_a("canvas")}function b(O,A,te){let oe=1;const le=Tt(O);if((le.width>te||le.height>te)&&(oe=te/Math.max(le.width,le.height)),oe<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(oe*le.width),Be=Math.floor(oe*le.height);p===void 0&&(p=S(de,Be));const ge=A?S(de,Be):p;return ge.width=de,ge.height=Be,ge.getContext("2d").drawImage(O,0,0,de,Be),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+le.width+"x"+le.height+") to ("+de+"x"+Be+")."),ge}else return"data"in O&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+le.width+"x"+le.height+")."),O;return O}function x(O){return O.generateMipmaps&&O.minFilter!==Nn&&O.minFilter!==Hn}function _(O){s.generateMipmap(O)}function R(O,A,te,oe,le=!1){if(O!==null){if(s[O]!==void 0)return s[O];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+O+"'")}let de=A;if(A===s.RED&&(te===s.FLOAT&&(de=s.R32F),te===s.HALF_FLOAT&&(de=s.R16F),te===s.UNSIGNED_BYTE&&(de=s.R8)),A===s.RED_INTEGER&&(te===s.UNSIGNED_BYTE&&(de=s.R8UI),te===s.UNSIGNED_SHORT&&(de=s.R16UI),te===s.UNSIGNED_INT&&(de=s.R32UI),te===s.BYTE&&(de=s.R8I),te===s.SHORT&&(de=s.R16I),te===s.INT&&(de=s.R32I)),A===s.RG&&(te===s.FLOAT&&(de=s.RG32F),te===s.HALF_FLOAT&&(de=s.RG16F),te===s.UNSIGNED_BYTE&&(de=s.RG8)),A===s.RG_INTEGER&&(te===s.UNSIGNED_BYTE&&(de=s.RG8UI),te===s.UNSIGNED_SHORT&&(de=s.RG16UI),te===s.UNSIGNED_INT&&(de=s.RG32UI),te===s.BYTE&&(de=s.RG8I),te===s.SHORT&&(de=s.RG16I),te===s.INT&&(de=s.RG32I)),A===s.RGB&&te===s.UNSIGNED_INT_5_9_9_9_REV&&(de=s.RGB9_E5),A===s.RGBA){const Be=le?tl:Ct.getTransfer(oe);te===s.FLOAT&&(de=s.RGBA32F),te===s.HALF_FLOAT&&(de=s.RGBA16F),te===s.UNSIGNED_BYTE&&(de=Be===Gt?s.SRGB8_ALPHA8:s.RGBA8),te===s.UNSIGNED_SHORT_4_4_4_4&&(de=s.RGBA4),te===s.UNSIGNED_SHORT_5_5_5_1&&(de=s.RGB5_A1)}return(de===s.R16F||de===s.R32F||de===s.RG16F||de===s.RG32F||de===s.RGBA16F||de===s.RGBA32F)&&e.get("EXT_color_buffer_float"),de}function E(O,A){return x(O)===!0||O.isFramebufferTexture&&O.minFilter!==Nn&&O.minFilter!==Hn?Math.log2(Math.max(A.width,A.height))+1:O.mipmaps!==void 0&&O.mipmaps.length>0?O.mipmaps.length:O.isCompressedTexture&&Array.isArray(O.image)?A.mipmaps.length:1}function L(O){const A=O.target;A.removeEventListener("dispose",L),N(A),A.isVideoTexture&&d.delete(A)}function B(O){const A=O.target;A.removeEventListener("dispose",B),k(A)}function N(O){const A=n.get(O);if(A.__webglInit===void 0)return;const te=O.source,oe=m.get(te);if(oe){const le=oe[A.__cacheKey];le.usedTimes--,le.usedTimes===0&&D(O),Object.keys(oe).length===0&&m.delete(te)}n.remove(O)}function D(O){const A=n.get(O);s.deleteTexture(A.__webglTexture);const te=O.source,oe=m.get(te);delete oe[A.__cacheKey],c.memory.textures--}function k(O){const A=n.get(O);if(O.depthTexture&&O.depthTexture.dispose(),O.isWebGLCubeRenderTarget)for(let oe=0;oe<6;oe++){if(Array.isArray(A.__webglFramebuffer[oe]))for(let le=0;le<A.__webglFramebuffer[oe].length;le++)s.deleteFramebuffer(A.__webglFramebuffer[oe][le]);else s.deleteFramebuffer(A.__webglFramebuffer[oe]);A.__webglDepthbuffer&&s.deleteRenderbuffer(A.__webglDepthbuffer[oe])}else{if(Array.isArray(A.__webglFramebuffer))for(let oe=0;oe<A.__webglFramebuffer.length;oe++)s.deleteFramebuffer(A.__webglFramebuffer[oe]);else s.deleteFramebuffer(A.__webglFramebuffer);if(A.__webglDepthbuffer&&s.deleteRenderbuffer(A.__webglDepthbuffer),A.__webglMultisampledFramebuffer&&s.deleteFramebuffer(A.__webglMultisampledFramebuffer),A.__webglColorRenderbuffer)for(let oe=0;oe<A.__webglColorRenderbuffer.length;oe++)A.__webglColorRenderbuffer[oe]&&s.deleteRenderbuffer(A.__webglColorRenderbuffer[oe]);A.__webglDepthRenderbuffer&&s.deleteRenderbuffer(A.__webglDepthRenderbuffer)}const te=O.textures;for(let oe=0,le=te.length;oe<le;oe++){const de=n.get(te[oe]);de.__webglTexture&&(s.deleteTexture(de.__webglTexture),c.memory.textures--),n.remove(te[oe])}n.remove(O)}let C=0;function T(){C=0}function W(){const O=C;return O>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+O+" texture units while this GPU supports only "+i.maxTextures),C+=1,O}function j(O){const A=[];return A.push(O.wrapS),A.push(O.wrapT),A.push(O.wrapR||0),A.push(O.magFilter),A.push(O.minFilter),A.push(O.anisotropy),A.push(O.internalFormat),A.push(O.format),A.push(O.type),A.push(O.generateMipmaps),A.push(O.premultiplyAlpha),A.push(O.flipY),A.push(O.unpackAlignment),A.push(O.colorSpace),A.join()}function H(O,A){const te=n.get(O);if(O.isVideoTexture&&Et(O),O.isRenderTargetTexture===!1&&O.version>0&&te.__version!==O.version){const oe=O.image;if(oe===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(oe.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Je(te,O,A);return}}t.bindTexture(s.TEXTURE_2D,te.__webglTexture,s.TEXTURE0+A)}function K(O,A){const te=n.get(O);if(O.version>0&&te.__version!==O.version){Je(te,O,A);return}t.bindTexture(s.TEXTURE_2D_ARRAY,te.__webglTexture,s.TEXTURE0+A)}function ne(O,A){const te=n.get(O);if(O.version>0&&te.__version!==O.version){Je(te,O,A);return}t.bindTexture(s.TEXTURE_3D,te.__webglTexture,s.TEXTURE0+A)}function he(O,A){const te=n.get(O);if(O.version>0&&te.__version!==O.version){bt(te,O,A);return}t.bindTexture(s.TEXTURE_CUBE_MAP,te.__webglTexture,s.TEXTURE0+A)}const me={[ho]:s.REPEAT,[Dr]:s.CLAMP_TO_EDGE,[Qc]:s.MIRRORED_REPEAT},$={[Nn]:s.NEAREST,[Hg]:s.NEAREST_MIPMAP_NEAREST,[ra]:s.NEAREST_MIPMAP_LINEAR,[Hn]:s.LINEAR,[jc]:s.LINEAR_MIPMAP_NEAREST,[or]:s.LINEAR_MIPMAP_LINEAR},fe={[Db]:s.NEVER,[zb]:s.ALWAYS,[Ub]:s.LESS,[Qg]:s.LEQUAL,[Ob]:s.EQUAL,[Bb]:s.GEQUAL,[Nb]:s.GREATER,[Fb]:s.NOTEQUAL};function pe(O,A){if(A.type===Oi&&e.has("OES_texture_float_linear")===!1&&(A.magFilter===Hn||A.magFilter===jc||A.magFilter===ra||A.magFilter===or||A.minFilter===Hn||A.minFilter===jc||A.minFilter===ra||A.minFilter===or)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),s.texParameteri(O,s.TEXTURE_WRAP_S,me[A.wrapS]),s.texParameteri(O,s.TEXTURE_WRAP_T,me[A.wrapT]),(O===s.TEXTURE_3D||O===s.TEXTURE_2D_ARRAY)&&s.texParameteri(O,s.TEXTURE_WRAP_R,me[A.wrapR]),s.texParameteri(O,s.TEXTURE_MAG_FILTER,$[A.magFilter]),s.texParameteri(O,s.TEXTURE_MIN_FILTER,$[A.minFilter]),A.compareFunction&&(s.texParameteri(O,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(O,s.TEXTURE_COMPARE_FUNC,fe[A.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(A.magFilter===Nn||A.minFilter!==ra&&A.minFilter!==or||A.type===Oi&&e.has("OES_texture_float_linear")===!1)return;if(A.anisotropy>1||n.get(A).__currentAnisotropy){const te=e.get("EXT_texture_filter_anisotropic");s.texParameterf(O,te.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(A.anisotropy,i.getMaxAnisotropy())),n.get(A).__currentAnisotropy=A.anisotropy}}}function Ee(O,A){let te=!1;O.__webglInit===void 0&&(O.__webglInit=!0,A.addEventListener("dispose",L));const oe=A.source;let le=m.get(oe);le===void 0&&(le={},m.set(oe,le));const de=j(A);if(de!==O.__cacheKey){le[de]===void 0&&(le[de]={texture:s.createTexture(),usedTimes:0},c.memory.textures++,te=!0),le[de].usedTimes++;const Be=le[O.__cacheKey];Be!==void 0&&(le[O.__cacheKey].usedTimes--,Be.usedTimes===0&&D(A)),O.__cacheKey=de,O.__webglTexture=le[de].texture}return te}function Je(O,A,te){let oe=s.TEXTURE_2D;(A.isDataArrayTexture||A.isCompressedArrayTexture)&&(oe=s.TEXTURE_2D_ARRAY),A.isData3DTexture&&(oe=s.TEXTURE_3D);const le=Ee(O,A),de=A.source;t.bindTexture(oe,O.__webglTexture,s.TEXTURE0+te);const Be=n.get(de);if(de.version!==Be.__version||le===!0){t.activeTexture(s.TEXTURE0+te);const ge=Ct.getPrimaries(Ct.workingColorSpace),De=A.colorSpace===Ir?null:Ct.getPrimaries(A.colorSpace),He=A.colorSpace===Ir||ge===De?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,A.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,A.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,A.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,He);let ve=b(A.image,!1,i.maxTextureSize);ve=ke(A,ve);const be=o.convert(A.format,A.colorSpace),Ye=o.convert(A.type);let Pe=R(A.internalFormat,be,Ye,A.colorSpace,A.isVideoTexture);pe(oe,A);let Le;const ot=A.mipmaps,ht=A.isVideoTexture!==!0&&Pe!==Zg,yt=Be.__version===void 0||le===!0,pt=de.dataReady,St=E(A,ve);if(A.isDepthTexture)Pe=s.DEPTH_COMPONENT16,A.type===Oi?Pe=s.DEPTH_COMPONENT32F:A.type===uo?Pe=s.DEPTH_COMPONENT24:A.type===xa&&(Pe=s.DEPTH24_STENCIL8),yt&&(ht?t.texStorage2D(s.TEXTURE_2D,1,Pe,ve.width,ve.height):t.texImage2D(s.TEXTURE_2D,0,Pe,ve.width,ve.height,0,be,Ye,null));else if(A.isDataTexture)if(ot.length>0){ht&&yt&&t.texStorage2D(s.TEXTURE_2D,St,Pe,ot[0].width,ot[0].height);for(let Oe=0,y=ot.length;Oe<y;Oe++)Le=ot[Oe],ht?pt&&t.texSubImage2D(s.TEXTURE_2D,Oe,0,0,Le.width,Le.height,be,Ye,Le.data):t.texImage2D(s.TEXTURE_2D,Oe,Pe,Le.width,Le.height,0,be,Ye,Le.data);A.generateMipmaps=!1}else ht?(yt&&t.texStorage2D(s.TEXTURE_2D,St,Pe,ve.width,ve.height),pt&&t.texSubImage2D(s.TEXTURE_2D,0,0,0,ve.width,ve.height,be,Ye,ve.data)):t.texImage2D(s.TEXTURE_2D,0,Pe,ve.width,ve.height,0,be,Ye,ve.data);else if(A.isCompressedTexture)if(A.isCompressedArrayTexture){ht&&yt&&t.texStorage3D(s.TEXTURE_2D_ARRAY,St,Pe,ot[0].width,ot[0].height,ve.depth);for(let Oe=0,y=ot.length;Oe<y;Oe++)Le=ot[Oe],A.format!==Ei?be!==null?ht?pt&&t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,Oe,0,0,0,Le.width,Le.height,ve.depth,be,Le.data,0,0):t.compressedTexImage3D(s.TEXTURE_2D_ARRAY,Oe,Pe,Le.width,Le.height,ve.depth,0,Le.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ht?pt&&t.texSubImage3D(s.TEXTURE_2D_ARRAY,Oe,0,0,0,Le.width,Le.height,ve.depth,be,Ye,Le.data):t.texImage3D(s.TEXTURE_2D_ARRAY,Oe,Pe,Le.width,Le.height,ve.depth,0,be,Ye,Le.data)}else{ht&&yt&&t.texStorage2D(s.TEXTURE_2D,St,Pe,ot[0].width,ot[0].height);for(let Oe=0,y=ot.length;Oe<y;Oe++)Le=ot[Oe],A.format!==Ei?be!==null?ht?pt&&t.compressedTexSubImage2D(s.TEXTURE_2D,Oe,0,0,Le.width,Le.height,be,Le.data):t.compressedTexImage2D(s.TEXTURE_2D,Oe,Pe,Le.width,Le.height,0,Le.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ht?pt&&t.texSubImage2D(s.TEXTURE_2D,Oe,0,0,Le.width,Le.height,be,Ye,Le.data):t.texImage2D(s.TEXTURE_2D,Oe,Pe,Le.width,Le.height,0,be,Ye,Le.data)}else if(A.isDataArrayTexture)ht?(yt&&t.texStorage3D(s.TEXTURE_2D_ARRAY,St,Pe,ve.width,ve.height,ve.depth),pt&&t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,ve.width,ve.height,ve.depth,be,Ye,ve.data)):t.texImage3D(s.TEXTURE_2D_ARRAY,0,Pe,ve.width,ve.height,ve.depth,0,be,Ye,ve.data);else if(A.isData3DTexture)ht?(yt&&t.texStorage3D(s.TEXTURE_3D,St,Pe,ve.width,ve.height,ve.depth),pt&&t.texSubImage3D(s.TEXTURE_3D,0,0,0,0,ve.width,ve.height,ve.depth,be,Ye,ve.data)):t.texImage3D(s.TEXTURE_3D,0,Pe,ve.width,ve.height,ve.depth,0,be,Ye,ve.data);else if(A.isFramebufferTexture){if(yt)if(ht)t.texStorage2D(s.TEXTURE_2D,St,Pe,ve.width,ve.height);else{let Oe=ve.width,y=ve.height;for(let q=0;q<St;q++)t.texImage2D(s.TEXTURE_2D,q,Pe,Oe,y,0,be,Ye,null),Oe>>=1,y>>=1}}else if(ot.length>0){if(ht&&yt){const Oe=Tt(ot[0]);t.texStorage2D(s.TEXTURE_2D,St,Pe,Oe.width,Oe.height)}for(let Oe=0,y=ot.length;Oe<y;Oe++)Le=ot[Oe],ht?pt&&t.texSubImage2D(s.TEXTURE_2D,Oe,0,0,be,Ye,Le):t.texImage2D(s.TEXTURE_2D,Oe,Pe,be,Ye,Le);A.generateMipmaps=!1}else if(ht){if(yt){const Oe=Tt(ve);t.texStorage2D(s.TEXTURE_2D,St,Pe,Oe.width,Oe.height)}pt&&t.texSubImage2D(s.TEXTURE_2D,0,0,0,be,Ye,ve)}else t.texImage2D(s.TEXTURE_2D,0,Pe,be,Ye,ve);x(A)&&_(oe),Be.__version=de.version,A.onUpdate&&A.onUpdate(A)}O.__version=A.version}function bt(O,A,te){if(A.image.length!==6)return;const oe=Ee(O,A),le=A.source;t.bindTexture(s.TEXTURE_CUBE_MAP,O.__webglTexture,s.TEXTURE0+te);const de=n.get(le);if(le.version!==de.__version||oe===!0){t.activeTexture(s.TEXTURE0+te);const Be=Ct.getPrimaries(Ct.workingColorSpace),ge=A.colorSpace===Ir?null:Ct.getPrimaries(A.colorSpace),De=A.colorSpace===Ir||Be===ge?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,A.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,A.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,A.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,De);const He=A.isCompressedTexture||A.image[0].isCompressedTexture,ve=A.image[0]&&A.image[0].isDataTexture,be=[];for(let y=0;y<6;y++)!He&&!ve?be[y]=b(A.image[y],!0,i.maxCubemapSize):be[y]=ve?A.image[y].image:A.image[y],be[y]=ke(A,be[y]);const Ye=be[0],Pe=o.convert(A.format,A.colorSpace),Le=o.convert(A.type),ot=R(A.internalFormat,Pe,Le,A.colorSpace),ht=A.isVideoTexture!==!0,yt=de.__version===void 0||oe===!0,pt=le.dataReady;let St=E(A,Ye);pe(s.TEXTURE_CUBE_MAP,A);let Oe;if(He){ht&&yt&&t.texStorage2D(s.TEXTURE_CUBE_MAP,St,ot,Ye.width,Ye.height);for(let y=0;y<6;y++){Oe=be[y].mipmaps;for(let q=0;q<Oe.length;q++){const se=Oe[q];A.format!==Ei?Pe!==null?ht?pt&&t.compressedTexSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+y,q,0,0,se.width,se.height,Pe,se.data):t.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+y,q,ot,se.width,se.height,0,se.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ht?pt&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+y,q,0,0,se.width,se.height,Pe,Le,se.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+y,q,ot,se.width,se.height,0,Pe,Le,se.data)}}}else{if(Oe=A.mipmaps,ht&&yt){Oe.length>0&&St++;const y=Tt(be[0]);t.texStorage2D(s.TEXTURE_CUBE_MAP,St,ot,y.width,y.height)}for(let y=0;y<6;y++)if(ve){ht?pt&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+y,0,0,0,be[y].width,be[y].height,Pe,Le,be[y].data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+y,0,ot,be[y].width,be[y].height,0,Pe,Le,be[y].data);for(let q=0;q<Oe.length;q++){const xe=Oe[q].image[y].image;ht?pt&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+y,q+1,0,0,xe.width,xe.height,Pe,Le,xe.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+y,q+1,ot,xe.width,xe.height,0,Pe,Le,xe.data)}}else{ht?pt&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+y,0,0,0,Pe,Le,be[y]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+y,0,ot,Pe,Le,be[y]);for(let q=0;q<Oe.length;q++){const se=Oe[q];ht?pt&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+y,q+1,0,0,Pe,Le,se.image[y]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+y,q+1,ot,Pe,Le,se.image[y])}}}x(A)&&_(s.TEXTURE_CUBE_MAP),de.__version=le.version,A.onUpdate&&A.onUpdate(A)}O.__version=A.version}function ie(O,A,te,oe,le,de){const Be=o.convert(te.format,te.colorSpace),ge=o.convert(te.type),De=R(te.internalFormat,Be,ge,te.colorSpace);if(!n.get(A).__hasExternalTextures){const ve=Math.max(1,A.width>>de),be=Math.max(1,A.height>>de);le===s.TEXTURE_3D||le===s.TEXTURE_2D_ARRAY?t.texImage3D(le,de,De,ve,be,A.depth,0,Be,ge,null):t.texImage2D(le,de,De,ve,be,0,Be,ge,null)}t.bindFramebuffer(s.FRAMEBUFFER,O),Ve(A)?l.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,oe,le,n.get(te).__webglTexture,0,tt(A)):(le===s.TEXTURE_2D||le>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&le<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,oe,le,n.get(te).__webglTexture,de),t.bindFramebuffer(s.FRAMEBUFFER,null)}function _e(O,A,te){if(s.bindRenderbuffer(s.RENDERBUFFER,O),A.depthBuffer&&!A.stencilBuffer){let oe=s.DEPTH_COMPONENT24;if(te||Ve(A)){const le=A.depthTexture;le&&le.isDepthTexture&&(le.type===Oi?oe=s.DEPTH_COMPONENT32F:le.type===uo&&(oe=s.DEPTH_COMPONENT24));const de=tt(A);Ve(A)?l.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,de,oe,A.width,A.height):s.renderbufferStorageMultisample(s.RENDERBUFFER,de,oe,A.width,A.height)}else s.renderbufferStorage(s.RENDERBUFFER,oe,A.width,A.height);s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,O)}else if(A.depthBuffer&&A.stencilBuffer){const oe=tt(A);te&&Ve(A)===!1?s.renderbufferStorageMultisample(s.RENDERBUFFER,oe,s.DEPTH24_STENCIL8,A.width,A.height):Ve(A)?l.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,oe,s.DEPTH24_STENCIL8,A.width,A.height):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,A.width,A.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,O)}else{const oe=A.textures;for(let le=0;le<oe.length;le++){const de=oe[le],Be=o.convert(de.format,de.colorSpace),ge=o.convert(de.type),De=R(de.internalFormat,Be,ge,de.colorSpace),He=tt(A);te&&Ve(A)===!1?s.renderbufferStorageMultisample(s.RENDERBUFFER,He,De,A.width,A.height):Ve(A)?l.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,He,De,A.width,A.height):s.renderbufferStorage(s.RENDERBUFFER,De,A.width,A.height)}}s.bindRenderbuffer(s.RENDERBUFFER,null)}function Ce(O,A){if(A&&A.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(s.FRAMEBUFFER,O),!(A.depthTexture&&A.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(A.depthTexture).__webglTexture||A.depthTexture.image.width!==A.width||A.depthTexture.image.height!==A.height)&&(A.depthTexture.image.width=A.width,A.depthTexture.image.height=A.height,A.depthTexture.needsUpdate=!0),H(A.depthTexture,0);const oe=n.get(A.depthTexture).__webglTexture,le=tt(A);if(A.depthTexture.format===so)Ve(A)?l.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,oe,0,le):s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,oe,0);else if(A.depthTexture.format===ma)Ve(A)?l.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.TEXTURE_2D,oe,0,le):s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.TEXTURE_2D,oe,0);else throw new Error("Unknown depthTexture format")}function Ae(O){const A=n.get(O),te=O.isWebGLCubeRenderTarget===!0;if(O.depthTexture&&!A.__autoAllocateDepthBuffer){if(te)throw new Error("target.depthTexture not supported in Cube render targets");Ce(A.__webglFramebuffer,O)}else if(te){A.__webglDepthbuffer=[];for(let oe=0;oe<6;oe++)t.bindFramebuffer(s.FRAMEBUFFER,A.__webglFramebuffer[oe]),A.__webglDepthbuffer[oe]=s.createRenderbuffer(),_e(A.__webglDepthbuffer[oe],O,!1)}else t.bindFramebuffer(s.FRAMEBUFFER,A.__webglFramebuffer),A.__webglDepthbuffer=s.createRenderbuffer(),_e(A.__webglDepthbuffer,O,!1);t.bindFramebuffer(s.FRAMEBUFFER,null)}function je(O,A,te){const oe=n.get(O);A!==void 0&&ie(oe.__webglFramebuffer,O,O.texture,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,0),te!==void 0&&Ae(O)}function qe(O){const A=O.texture,te=n.get(O),oe=n.get(A);O.addEventListener("dispose",B);const le=O.textures,de=O.isWebGLCubeRenderTarget===!0,Be=le.length>1;if(Be||(oe.__webglTexture===void 0&&(oe.__webglTexture=s.createTexture()),oe.__version=A.version,c.memory.textures++),de){te.__webglFramebuffer=[];for(let ge=0;ge<6;ge++)if(A.mipmaps&&A.mipmaps.length>0){te.__webglFramebuffer[ge]=[];for(let De=0;De<A.mipmaps.length;De++)te.__webglFramebuffer[ge][De]=s.createFramebuffer()}else te.__webglFramebuffer[ge]=s.createFramebuffer()}else{if(A.mipmaps&&A.mipmaps.length>0){te.__webglFramebuffer=[];for(let ge=0;ge<A.mipmaps.length;ge++)te.__webglFramebuffer[ge]=s.createFramebuffer()}else te.__webglFramebuffer=s.createFramebuffer();if(Be)for(let ge=0,De=le.length;ge<De;ge++){const He=n.get(le[ge]);He.__webglTexture===void 0&&(He.__webglTexture=s.createTexture(),c.memory.textures++)}if(O.samples>0&&Ve(O)===!1){te.__webglMultisampledFramebuffer=s.createFramebuffer(),te.__webglColorRenderbuffer=[],t.bindFramebuffer(s.FRAMEBUFFER,te.__webglMultisampledFramebuffer);for(let ge=0;ge<le.length;ge++){const De=le[ge];te.__webglColorRenderbuffer[ge]=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,te.__webglColorRenderbuffer[ge]);const He=o.convert(De.format,De.colorSpace),ve=o.convert(De.type),be=R(De.internalFormat,He,ve,De.colorSpace,O.isXRRenderTarget===!0),Ye=tt(O);s.renderbufferStorageMultisample(s.RENDERBUFFER,Ye,be,O.width,O.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+ge,s.RENDERBUFFER,te.__webglColorRenderbuffer[ge])}s.bindRenderbuffer(s.RENDERBUFFER,null),O.depthBuffer&&(te.__webglDepthRenderbuffer=s.createRenderbuffer(),_e(te.__webglDepthRenderbuffer,O,!0)),t.bindFramebuffer(s.FRAMEBUFFER,null)}}if(de){t.bindTexture(s.TEXTURE_CUBE_MAP,oe.__webglTexture),pe(s.TEXTURE_CUBE_MAP,A);for(let ge=0;ge<6;ge++)if(A.mipmaps&&A.mipmaps.length>0)for(let De=0;De<A.mipmaps.length;De++)ie(te.__webglFramebuffer[ge][De],O,A,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+ge,De);else ie(te.__webglFramebuffer[ge],O,A,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+ge,0);x(A)&&_(s.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Be){for(let ge=0,De=le.length;ge<De;ge++){const He=le[ge],ve=n.get(He);t.bindTexture(s.TEXTURE_2D,ve.__webglTexture),pe(s.TEXTURE_2D,He),ie(te.__webglFramebuffer,O,He,s.COLOR_ATTACHMENT0+ge,s.TEXTURE_2D,0),x(He)&&_(s.TEXTURE_2D)}t.unbindTexture()}else{let ge=s.TEXTURE_2D;if((O.isWebGL3DRenderTarget||O.isWebGLArrayRenderTarget)&&(ge=O.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(ge,oe.__webglTexture),pe(ge,A),A.mipmaps&&A.mipmaps.length>0)for(let De=0;De<A.mipmaps.length;De++)ie(te.__webglFramebuffer[De],O,A,s.COLOR_ATTACHMENT0,ge,De);else ie(te.__webglFramebuffer,O,A,s.COLOR_ATTACHMENT0,ge,0);x(A)&&_(ge),t.unbindTexture()}O.depthBuffer&&Ae(O)}function dt(O){const A=O.textures;for(let te=0,oe=A.length;te<oe;te++){const le=A[te];if(x(le)){const de=O.isWebGLCubeRenderTarget?s.TEXTURE_CUBE_MAP:s.TEXTURE_2D,Be=n.get(le).__webglTexture;t.bindTexture(de,Be),_(de),t.unbindTexture()}}}function Y(O){if(O.samples>0&&Ve(O)===!1){const A=O.textures,te=O.width,oe=O.height;let le=s.COLOR_BUFFER_BIT;const de=[],Be=O.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ge=n.get(O),De=A.length>1;if(De)for(let He=0;He<A.length;He++)t.bindFramebuffer(s.FRAMEBUFFER,ge.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+He,s.RENDERBUFFER,null),t.bindFramebuffer(s.FRAMEBUFFER,ge.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+He,s.TEXTURE_2D,null,0);t.bindFramebuffer(s.READ_FRAMEBUFFER,ge.__webglMultisampledFramebuffer),t.bindFramebuffer(s.DRAW_FRAMEBUFFER,ge.__webglFramebuffer);for(let He=0;He<A.length;He++){de.push(s.COLOR_ATTACHMENT0+He),O.depthBuffer&&de.push(Be);const ve=ge.__ignoreDepthValues!==void 0?ge.__ignoreDepthValues:!1;if(ve===!1&&(O.depthBuffer&&(le|=s.DEPTH_BUFFER_BIT),O.stencilBuffer&&ge.__isTransmissionRenderTarget!==!0&&(le|=s.STENCIL_BUFFER_BIT)),De&&s.framebufferRenderbuffer(s.READ_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,ge.__webglColorRenderbuffer[He]),ve===!0&&(s.invalidateFramebuffer(s.READ_FRAMEBUFFER,[Be]),s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,[Be])),De){const be=n.get(A[He]).__webglTexture;s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,be,0)}s.blitFramebuffer(0,0,te,oe,0,0,te,oe,le,s.NEAREST),u&&s.invalidateFramebuffer(s.READ_FRAMEBUFFER,de)}if(t.bindFramebuffer(s.READ_FRAMEBUFFER,null),t.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),De)for(let He=0;He<A.length;He++){t.bindFramebuffer(s.FRAMEBUFFER,ge.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+He,s.RENDERBUFFER,ge.__webglColorRenderbuffer[He]);const ve=n.get(A[He]).__webglTexture;t.bindFramebuffer(s.FRAMEBUFFER,ge.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+He,s.TEXTURE_2D,ve,0)}t.bindFramebuffer(s.DRAW_FRAMEBUFFER,ge.__webglMultisampledFramebuffer)}}function tt(O){return Math.min(i.maxSamples,O.samples)}function Ve(O){const A=n.get(O);return O.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&A.__useRenderToTexture!==!1}function Et(O){const A=c.render.frame;d.get(O)!==A&&(d.set(O,A),O.update())}function ke(O,A){const te=O.colorSpace,oe=O.format,le=O.type;return O.isCompressedTexture===!0||O.isVideoTexture===!0||te!==gn&&te!==Ir&&(Ct.getTransfer(te)===Gt?(oe!==Ei||le!==Fr)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",te)),A}function Tt(O){return typeof HTMLImageElement<"u"&&O instanceof HTMLImageElement?(f.width=O.naturalWidth||O.width,f.height=O.naturalHeight||O.height):typeof VideoFrame<"u"&&O instanceof VideoFrame?(f.width=O.displayWidth,f.height=O.displayHeight):(f.width=O.width,f.height=O.height),f}this.allocateTextureUnit=W,this.resetTextureUnits=T,this.setTexture2D=H,this.setTexture2DArray=K,this.setTexture3D=ne,this.setTextureCube=he,this.rebindTextures=je,this.setupRenderTarget=qe,this.updateRenderTargetMipmap=dt,this.updateMultisampleRenderTarget=Y,this.setupDepthRenderbuffer=Ae,this.setupFrameBufferTexture=ie,this.useMultisampledRTT=Ve}function QR(s,e){function t(n,i=Ir){let o;const c=Ct.getTransfer(i);if(n===Fr)return s.UNSIGNED_BYTE;if(n===Wg)return s.UNSIGNED_SHORT_4_4_4_4;if(n===Xg)return s.UNSIGNED_SHORT_5_5_5_1;if(n===Sb)return s.UNSIGNED_INT_5_9_9_9_REV;if(n===xb)return s.BYTE;if(n===yb)return s.SHORT;if(n===Gg)return s.UNSIGNED_SHORT;if(n===Vg)return s.INT;if(n===uo)return s.UNSIGNED_INT;if(n===Oi)return s.FLOAT;if(n===el)return s.HALF_FLOAT;if(n===Mb)return s.ALPHA;if(n===Eb)return s.RGB;if(n===Ei)return s.RGBA;if(n===bb)return s.LUMINANCE;if(n===Tb)return s.LUMINANCE_ALPHA;if(n===so)return s.DEPTH_COMPONENT;if(n===ma)return s.DEPTH_STENCIL;if(n===Yg)return s.RED;if(n===jg)return s.RED_INTEGER;if(n===Ab)return s.RG;if(n===qg)return s.RG_INTEGER;if(n===Kg)return s.RGBA_INTEGER;if(n===wh||n===Rh||n===Ch||n===Ph)if(c===Gt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(n===wh)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Rh)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ch)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ph)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(n===wh)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Rh)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ch)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ph)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Cp||n===Pp||n===Lp||n===Ip)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(n===Cp)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Pp)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Lp)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Ip)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Zg)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===Dp||n===Up)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(n===Dp)return c===Gt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===Up)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Op||n===Np||n===Fp||n===Bp||n===zp||n===kp||n===Hp||n===Gp||n===Vp||n===Wp||n===Xp||n===Yp||n===jp||n===qp)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(n===Op)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Np)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Fp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Bp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===zp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===kp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Hp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Gp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Vp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Wp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Xp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Yp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===jp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===qp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Lh||n===Kp||n===Zp)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(n===Lh)return c===Gt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Kp)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Zp)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===wb||n===$p||n===Jp||n===Qp)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(n===Lh)return o.COMPRESSED_RED_RGTC1_EXT;if(n===$p)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Jp)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Qp)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===xa?s.UNSIGNED_INT_24_8:s[n]!==void 0?s[n]:null}return{convert:t}}class eC extends On{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}let Ur=class extends _t{constructor(){super(),this.isGroup=!0,this.type="Group"}};const tC={type:"move"};class iu{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ur,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 Ur,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new U,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new U),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ur,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new U,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new U),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,o=null,c=null;const l=this._targetRay,u=this._grip,f=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(f&&e.hand){c=!0;for(const b of e.hand.values()){const x=t.getJointPose(b,n),_=this._getHandJoint(f,b);x!==null&&(_.matrix.fromArray(x.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.matrixWorldNeedsUpdate=!0,_.jointRadius=x.radius),_.visible=x!==null}const d=f.joints["index-finger-tip"],p=f.joints["thumb-tip"],m=d.position.distanceTo(p.position),v=.02,S=.005;f.inputState.pinching&&m>v+S?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&m<=v-S&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(u.matrix.fromArray(o.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,o.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(o.linearVelocity)):u.hasLinearVelocity=!1,o.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(o.angularVelocity)):u.hasAngularVelocity=!1));l!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&o!==null&&(i=o),i!==null&&(l.matrix.fromArray(i.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,i.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(i.linearVelocity)):l.hasLinearVelocity=!1,i.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(i.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(tC)))}return l!==null&&(l.visible=i!==null),u!==null&&(u.visible=o!==null),f!==null&&(f.visible=c!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Ur;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const nC=`
|
|
3773
|
+
}`;function pC(i,e,t){let n=new sf;const r=new Pe,o=new Pe,c=new Dt,l=new uC({depthPacking:Kb}),h=new hC,f={},d=t.maxTextureSize,p={[Yi]:Xn,[Xn]:Yi,[Ai]:Ai},m=new Yr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Pe},radius:{value:4}},vertexShader:fC,fragmentShader:dC}),x=m.clone();x.defines.HORIZONTAL_PASS=1;const M=new Jt;M.setAttribute("position",new nn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const A=new ye(M,m),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=qg;let _=this.type;this.render=function(U,O,I){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||U.length===0)return;const E=i.getRenderTarget(),y=i.getActiveCubeFace(),F=i.getActiveMipmapLevel(),V=i.state;V.setBlending(Wr),V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);const G=_!==mr&&this.type===mr,q=_===mr&&this.type!==mr;for(let ne=0,se=U.length;ne<se;ne++){const pe=U[ne],K=pe.shadow;if(K===void 0){console.warn("THREE.WebGLShadowMap:",pe,"has no shadow.");continue}if(K.autoUpdate===!1&&K.needsUpdate===!1)continue;r.copy(K.mapSize);const he=K.getFrameExtents();if(r.multiply(he),o.copy(K.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(o.x=Math.floor(d/he.x),r.x=o.x*he.x,K.mapSize.x=o.x),r.y>d&&(o.y=Math.floor(d/he.y),r.y=o.y*he.y,K.mapSize.y=o.y)),K.map===null||G===!0||q===!0){const Me=this.type!==mr?{minFilter:zn,magFilter:zn}:{};K.map!==null&&K.map.dispose(),K.map=new vs(r.x,r.y,Me),K.map.texture.name=pe.name+".shadowMap",K.camera.updateProjectionMatrix()}i.setRenderTarget(K.map),i.clear();const me=K.getViewportCount();for(let Me=0;Me<me;Me++){const Ke=K.getViewport(Me);c.set(o.x*Ke.x,o.y*Ke.y,o.x*Ke.z,o.y*Ke.w),V.viewport(c),K.updateMatrices(pe,Me),n=K.getFrustum(),L(O,I,K.camera,pe,this.type)}K.isPointLightShadow!==!0&&this.type===mr&&C(K,I),K.needsUpdate=!1}_=this.type,v.needsUpdate=!1,i.setRenderTarget(E,y,F)};function C(U,O){const I=e.update(A);m.defines.VSM_SAMPLES!==U.blurSamples&&(m.defines.VSM_SAMPLES=U.blurSamples,x.defines.VSM_SAMPLES=U.blurSamples,m.needsUpdate=!0,x.needsUpdate=!0),U.mapPass===null&&(U.mapPass=new vs(r.x,r.y)),m.uniforms.shadow_pass.value=U.map.texture,m.uniforms.resolution.value=U.mapSize,m.uniforms.radius.value=U.radius,i.setRenderTarget(U.mapPass),i.clear(),i.renderBufferDirect(O,null,I,m,A,null),x.uniforms.shadow_pass.value=U.mapPass.texture,x.uniforms.resolution.value=U.mapSize,x.uniforms.radius.value=U.radius,i.setRenderTarget(U.map),i.clear(),i.renderBufferDirect(O,null,I,x,A,null)}function b(U,O,I,E){let y=null;const F=I.isPointLight===!0?U.customDistanceMaterial:U.customDepthMaterial;if(F!==void 0)y=F;else if(y=I.isPointLight===!0?h:l,i.localClippingEnabled&&O.clipShadows===!0&&Array.isArray(O.clippingPlanes)&&O.clippingPlanes.length!==0||O.displacementMap&&O.displacementScale!==0||O.alphaMap&&O.alphaTest>0||O.map&&O.alphaTest>0){const V=y.uuid,G=O.uuid;let q=f[V];q===void 0&&(q={},f[V]=q);let ne=q[G];ne===void 0&&(ne=y.clone(),q[G]=ne,O.addEventListener("dispose",k)),y=ne}if(y.visible=O.visible,y.wireframe=O.wireframe,E===mr?y.side=O.shadowSide!==null?O.shadowSide:O.side:y.side=O.shadowSide!==null?O.shadowSide:p[O.side],y.alphaMap=O.alphaMap,y.alphaTest=O.alphaTest,y.map=O.map,y.clipShadows=O.clipShadows,y.clippingPlanes=O.clippingPlanes,y.clipIntersection=O.clipIntersection,y.displacementMap=O.displacementMap,y.displacementScale=O.displacementScale,y.displacementBias=O.displacementBias,y.wireframeLinewidth=O.wireframeLinewidth,y.linewidth=O.linewidth,I.isPointLight===!0&&y.isMeshDistanceMaterial===!0){const V=i.properties.get(y);V.light=I}return y}function L(U,O,I,E,y){if(U.visible===!1)return;if(U.layers.test(O.layers)&&(U.isMesh||U.isLine||U.isPoints)&&(U.castShadow||U.receiveShadow&&y===mr)&&(!U.frustumCulled||n.intersectsObject(U))){U.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,U.matrixWorld);const G=e.update(U),q=U.material;if(Array.isArray(q)){const ne=G.groups;for(let se=0,pe=ne.length;se<pe;se++){const K=ne[se],he=q[K.materialIndex];if(he&&he.visible){const me=b(U,he,E,y);U.onBeforeShadow(i,U,O,I,G,me,K),i.renderBufferDirect(I,null,G,me,U,K),U.onAfterShadow(i,U,O,I,G,me,K)}}}else if(q.visible){const ne=b(U,q,E,y);U.onBeforeShadow(i,U,O,I,G,ne,null),i.renderBufferDirect(I,null,G,ne,U,null),U.onAfterShadow(i,U,O,I,G,ne,null)}}const V=U.children;for(let G=0,q=V.length;G<q;G++)L(V[G],O,I,E,y)}function k(U){U.target.removeEventListener("dispose",k);for(const I in f){const E=f[I],y=U.target.uuid;y in E&&(E[y].dispose(),delete E[y])}}}function mC(i){function e(){let S=!1;const Z=new Dt;let oe=null;const xe=new Dt(0,0,0,0);return{setMask:function(Re){oe!==Re&&!S&&(i.colorMask(Re,Re,Re,Re),oe=Re)},setLocked:function(Re){S=Re},setClear:function(Re,_t,dt,Ft,rn){rn===!0&&(Re*=Ft,_t*=Ft,dt*=Ft),Z.set(Re,_t,dt,Ft),xe.equals(Z)===!1&&(i.clearColor(Re,_t,dt,Ft),xe.copy(Z))},reset:function(){S=!1,oe=null,xe.set(-1,0,0,0)}}}function t(){let S=!1,Z=null,oe=null,xe=null;return{setTest:function(Re){Re?we(i.DEPTH_TEST):Se(i.DEPTH_TEST)},setMask:function(Re){Z!==Re&&!S&&(i.depthMask(Re),Z=Re)},setFunc:function(Re){if(oe!==Re){switch(Re){case yb:i.depthFunc(i.NEVER);break;case Sb:i.depthFunc(i.ALWAYS);break;case Mb:i.depthFunc(i.LESS);break;case ll:i.depthFunc(i.LEQUAL);break;case Eb:i.depthFunc(i.EQUAL);break;case bb:i.depthFunc(i.GEQUAL);break;case Tb:i.depthFunc(i.GREATER);break;case Ab:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}oe=Re}},setLocked:function(Re){S=Re},setClear:function(Re){xe!==Re&&(i.clearDepth(Re),xe=Re)},reset:function(){S=!1,Z=null,oe=null,xe=null}}}function n(){let S=!1,Z=null,oe=null,xe=null,Re=null,_t=null,dt=null,Ft=null,rn=null;return{setTest:function(At){S||(At?we(i.STENCIL_TEST):Se(i.STENCIL_TEST))},setMask:function(At){Z!==At&&!S&&(i.stencilMask(At),Z=At)},setFunc:function(At,Kt,Zt){(oe!==At||xe!==Kt||Re!==Zt)&&(i.stencilFunc(At,Kt,Zt),oe=At,xe=Kt,Re=Zt)},setOp:function(At,Kt,Zt){(_t!==At||dt!==Kt||Ft!==Zt)&&(i.stencilOp(At,Kt,Zt),_t=At,dt=Kt,Ft=Zt)},setLocked:function(At){S=At},setClear:function(At){rn!==At&&(i.clearStencil(At),rn=At)},reset:function(){S=!1,Z=null,oe=null,xe=null,Re=null,_t=null,dt=null,Ft=null,rn=null}}}const r=new e,o=new t,c=new n,l=new WeakMap,h=new WeakMap;let f={},d={},p=new WeakMap,m=[],x=null,M=!1,A=null,v=null,_=null,C=null,b=null,L=null,k=null,U=new Ne(0,0,0),O=0,I=!1,E=null,y=null,F=null,V=null,G=null;const q=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let ne=!1,se=0;const pe=i.getParameter(i.VERSION);pe.indexOf("WebGL")!==-1?(se=parseFloat(/^WebGL (\d)/.exec(pe)[1]),ne=se>=1):pe.indexOf("OpenGL ES")!==-1&&(se=parseFloat(/^OpenGL ES (\d)/.exec(pe)[1]),ne=se>=2);let K=null,he={};const me=i.getParameter(i.SCISSOR_BOX),Me=i.getParameter(i.VIEWPORT),Ke=new Dt().fromArray(me),ot=new Dt().fromArray(Me);function ie(S,Z,oe,xe){const Re=new Uint8Array(4),_t=i.createTexture();i.bindTexture(S,_t),i.texParameteri(S,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(S,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let dt=0;dt<oe;dt++)S===i.TEXTURE_3D||S===i.TEXTURE_2D_ARRAY?i.texImage3D(Z,0,i.RGBA,1,1,xe,0,i.RGBA,i.UNSIGNED_BYTE,Re):i.texImage2D(Z+dt,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,Re);return _t}const ge={};ge[i.TEXTURE_2D]=ie(i.TEXTURE_2D,i.TEXTURE_2D,1),ge[i.TEXTURE_CUBE_MAP]=ie(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),ge[i.TEXTURE_2D_ARRAY]=ie(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),ge[i.TEXTURE_3D]=ie(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),o.setClear(1),c.setClear(0),we(i.DEPTH_TEST),o.setFunc(ll),He(!1),Tt(Up),we(i.CULL_FACE),ze(Wr);function we(S){f[S]!==!0&&(i.enable(S),f[S]=!0)}function Se(S){f[S]!==!1&&(i.disable(S),f[S]=!1)}function Ge(S,Z){return d[S]!==Z?(i.bindFramebuffer(S,Z),d[S]=Z,S===i.DRAW_FRAMEBUFFER&&(d[i.FRAMEBUFFER]=Z),S===i.FRAMEBUFFER&&(d[i.DRAW_FRAMEBUFFER]=Z),!0):!1}function Xe(S,Z){let oe=m,xe=!1;if(S){oe=p.get(Z),oe===void 0&&(oe=[],p.set(Z,oe));const Re=S.textures;if(oe.length!==Re.length||oe[0]!==i.COLOR_ATTACHMENT0){for(let _t=0,dt=Re.length;_t<dt;_t++)oe[_t]=i.COLOR_ATTACHMENT0+_t;oe.length=Re.length,xe=!0}}else oe[0]!==i.BACK&&(oe[0]=i.BACK,xe=!0);xe&&i.drawBuffers(oe)}function at(S){return x!==S?(i.useProgram(S),x=S,!0):!1}const j={[ps]:i.FUNC_ADD,[ib]:i.FUNC_SUBTRACT,[rb]:i.FUNC_REVERSE_SUBTRACT};j[sb]=i.MIN,j[ob]=i.MAX;const $e={[ab]:i.ZERO,[cb]:i.ONE,[lb]:i.SRC_COLOR,[Lh]:i.SRC_ALPHA,[mb]:i.SRC_ALPHA_SATURATE,[db]:i.DST_COLOR,[hb]:i.DST_ALPHA,[ub]:i.ONE_MINUS_SRC_COLOR,[Ih]:i.ONE_MINUS_SRC_ALPHA,[pb]:i.ONE_MINUS_DST_COLOR,[fb]:i.ONE_MINUS_DST_ALPHA,[gb]:i.CONSTANT_COLOR,[_b]:i.ONE_MINUS_CONSTANT_COLOR,[vb]:i.CONSTANT_ALPHA,[xb]:i.ONE_MINUS_CONSTANT_ALPHA};function ze(S,Z,oe,xe,Re,_t,dt,Ft,rn,At){if(S===Wr){M===!0&&(Se(i.BLEND),M=!1);return}if(M===!1&&(we(i.BLEND),M=!0),S!==nb){if(S!==A||At!==I){if((v!==ps||b!==ps)&&(i.blendEquation(i.FUNC_ADD),v=ps,b=ps),At)switch(S){case fo:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Np:i.blendFunc(i.ONE,i.ONE);break;case Fp:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Bp:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",S);break}else switch(S){case fo:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Np:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case Fp:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Bp:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",S);break}_=null,C=null,L=null,k=null,U.set(0,0,0),O=0,A=S,I=At}return}Re=Re||Z,_t=_t||oe,dt=dt||xe,(Z!==v||Re!==b)&&(i.blendEquationSeparate(j[Z],j[Re]),v=Z,b=Re),(oe!==_||xe!==C||_t!==L||dt!==k)&&(i.blendFuncSeparate($e[oe],$e[xe],$e[_t],$e[dt]),_=oe,C=xe,L=_t,k=dt),(Ft.equals(U)===!1||rn!==O)&&(i.blendColor(Ft.r,Ft.g,Ft.b,rn),U.copy(Ft),O=rn),A=S,I=!1}function bt(S,Z){S.side===Ai?Se(i.CULL_FACE):we(i.CULL_FACE);let oe=S.side===Xn;Z&&(oe=!oe),He(oe),S.blending===fo&&S.transparent===!1?ze(Wr):ze(S.blending,S.blendEquation,S.blendSrc,S.blendDst,S.blendEquationAlpha,S.blendSrcAlpha,S.blendDstAlpha,S.blendColor,S.blendAlpha,S.premultipliedAlpha),o.setFunc(S.depthFunc),o.setTest(S.depthTest),o.setMask(S.depthWrite),r.setMask(S.colorWrite);const xe=S.stencilWrite;c.setTest(xe),xe&&(c.setMask(S.stencilWriteMask),c.setFunc(S.stencilFunc,S.stencilRef,S.stencilFuncMask),c.setOp(S.stencilFail,S.stencilZFail,S.stencilZPass)),w(S.polygonOffset,S.polygonOffsetFactor,S.polygonOffsetUnits),S.alphaToCoverage===!0?we(i.SAMPLE_ALPHA_TO_COVERAGE):Se(i.SAMPLE_ALPHA_TO_COVERAGE)}function He(S){E!==S&&(S?i.frontFace(i.CW):i.frontFace(i.CCW),E=S)}function Tt(S){S!==eb?(we(i.CULL_FACE),S!==y&&(S===Up?i.cullFace(i.BACK):S===tb?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Se(i.CULL_FACE),y=S}function B(S){S!==F&&(ne&&i.lineWidth(S),F=S)}function w(S,Z,oe){S?(we(i.POLYGON_OFFSET_FILL),(V!==Z||G!==oe)&&(i.polygonOffset(Z,oe),V=Z,G=oe)):Se(i.POLYGON_OFFSET_FILL)}function te(S){S?we(i.SCISSOR_TEST):Se(i.SCISSOR_TEST)}function ae(S){S===void 0&&(S=i.TEXTURE0+q-1),K!==S&&(i.activeTexture(S),K=S)}function ue(S,Z,oe){oe===void 0&&(K===null?oe=i.TEXTURE0+q-1:oe=K);let xe=he[oe];xe===void 0&&(xe={type:void 0,texture:void 0},he[oe]=xe),(xe.type!==S||xe.texture!==Z)&&(K!==oe&&(i.activeTexture(oe),K=oe),i.bindTexture(S,Z||ge[S]),xe.type=S,xe.texture=Z)}function de(){const S=he[K];S!==void 0&&S.type!==void 0&&(i.bindTexture(S.type,null),S.type=void 0,S.texture=void 0)}function Be(){try{i.compressedTexImage2D.apply(i,arguments)}catch(S){console.error("THREE.WebGLState:",S)}}function _e(){try{i.compressedTexImage3D.apply(i,arguments)}catch(S){console.error("THREE.WebGLState:",S)}}function De(){try{i.texSubImage2D.apply(i,arguments)}catch(S){console.error("THREE.WebGLState:",S)}}function Ve(){try{i.texSubImage3D.apply(i,arguments)}catch(S){console.error("THREE.WebGLState:",S)}}function ve(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(S){console.error("THREE.WebGLState:",S)}}function Te(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(S){console.error("THREE.WebGLState:",S)}}function qe(){try{i.texStorage2D.apply(i,arguments)}catch(S){console.error("THREE.WebGLState:",S)}}function Le(){try{i.texStorage3D.apply(i,arguments)}catch(S){console.error("THREE.WebGLState:",S)}}function Ie(){try{i.texImage2D.apply(i,arguments)}catch(S){console.error("THREE.WebGLState:",S)}}function ct(){try{i.texImage3D.apply(i,arguments)}catch(S){console.error("THREE.WebGLState:",S)}}function ft(S){Ke.equals(S)===!1&&(i.scissor(S.x,S.y,S.z,S.w),Ke.copy(S))}function St(S){ot.equals(S)===!1&&(i.viewport(S.x,S.y,S.z,S.w),ot.copy(S))}function gt(S,Z){let oe=h.get(Z);oe===void 0&&(oe=new WeakMap,h.set(Z,oe));let xe=oe.get(S);xe===void 0&&(xe=i.getUniformBlockIndex(Z,S.name),oe.set(S,xe))}function Mt(S,Z){const xe=h.get(Z).get(S);l.get(Z)!==xe&&(i.uniformBlockBinding(Z,xe,S.__bindingPointIndex),l.set(Z,xe))}function Ue(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),f={},K=null,he={},d={},p=new WeakMap,m=[],x=null,M=!1,A=null,v=null,_=null,C=null,b=null,L=null,k=null,U=new Ne(0,0,0),O=0,I=!1,E=null,y=null,F=null,V=null,G=null,Ke.set(0,0,i.canvas.width,i.canvas.height),ot.set(0,0,i.canvas.width,i.canvas.height),r.reset(),o.reset(),c.reset()}return{buffers:{color:r,depth:o,stencil:c},enable:we,disable:Se,bindFramebuffer:Ge,drawBuffers:Xe,useProgram:at,setBlending:ze,setMaterial:bt,setFlipSided:He,setCullFace:Tt,setLineWidth:B,setPolygonOffset:w,setScissorTest:te,activeTexture:ae,bindTexture:ue,unbindTexture:de,compressedTexImage2D:Be,compressedTexImage3D:_e,texImage2D:Ie,texImage3D:ct,updateUBOMapping:gt,uniformBlockBinding:Mt,texStorage2D:qe,texStorage3D:Le,texSubImage2D:De,texSubImage3D:Ve,compressedTexSubImage2D:ve,compressedTexSubImage3D:Te,scissor:ft,viewport:St,reset:Ue}}function gC(i,e,t,n,r,o,c){const l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,h=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new Pe,d=new WeakMap;let p;const m=new WeakMap;let x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function M(B,w){return x?new OffscreenCanvas(B,w):wa("canvas")}function A(B,w,te){let ae=1;const ue=Tt(B);if((ue.width>te||ue.height>te)&&(ae=te/Math.max(ue.width,ue.height)),ae<1)if(typeof HTMLImageElement<"u"&&B instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&B instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&B instanceof ImageBitmap||typeof VideoFrame<"u"&&B instanceof VideoFrame){const de=Math.floor(ae*ue.width),Be=Math.floor(ae*ue.height);p===void 0&&(p=M(de,Be));const _e=w?M(de,Be):p;return _e.width=de,_e.height=Be,_e.getContext("2d").drawImage(B,0,0,de,Be),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ue.width+"x"+ue.height+") to ("+de+"x"+Be+")."),_e}else return"data"in B&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ue.width+"x"+ue.height+")."),B;return B}function v(B){return B.generateMipmaps&&B.minFilter!==zn&&B.minFilter!==Wn}function _(B){i.generateMipmap(B)}function C(B,w,te,ae,ue=!1){if(B!==null){if(i[B]!==void 0)return i[B];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+B+"'")}let de=w;if(w===i.RED&&(te===i.FLOAT&&(de=i.R32F),te===i.HALF_FLOAT&&(de=i.R16F),te===i.UNSIGNED_BYTE&&(de=i.R8)),w===i.RED_INTEGER&&(te===i.UNSIGNED_BYTE&&(de=i.R8UI),te===i.UNSIGNED_SHORT&&(de=i.R16UI),te===i.UNSIGNED_INT&&(de=i.R32UI),te===i.BYTE&&(de=i.R8I),te===i.SHORT&&(de=i.R16I),te===i.INT&&(de=i.R32I)),w===i.RG&&(te===i.FLOAT&&(de=i.RG32F),te===i.HALF_FLOAT&&(de=i.RG16F),te===i.UNSIGNED_BYTE&&(de=i.RG8)),w===i.RG_INTEGER&&(te===i.UNSIGNED_BYTE&&(de=i.RG8UI),te===i.UNSIGNED_SHORT&&(de=i.RG16UI),te===i.UNSIGNED_INT&&(de=i.RG32UI),te===i.BYTE&&(de=i.RG8I),te===i.SHORT&&(de=i.RG16I),te===i.INT&&(de=i.RG32I)),w===i.RGB&&te===i.UNSIGNED_INT_5_9_9_9_REV&&(de=i.RGB9_E5),w===i.RGBA){const Be=ue?hl:Ct.getTransfer(ae);te===i.FLOAT&&(de=i.RGBA32F),te===i.HALF_FLOAT&&(de=i.RGBA16F),te===i.UNSIGNED_BYTE&&(de=Be===Gt?i.SRGB8_ALPHA8:i.RGBA8),te===i.UNSIGNED_SHORT_4_4_4_4&&(de=i.RGBA4),te===i.UNSIGNED_SHORT_5_5_5_1&&(de=i.RGB5_A1)}return(de===i.R16F||de===i.R32F||de===i.RG16F||de===i.RG32F||de===i.RGBA16F||de===i.RGBA32F)&&e.get("EXT_color_buffer_float"),de}function b(B,w){return v(B)===!0||B.isFramebufferTexture&&B.minFilter!==zn&&B.minFilter!==Wn?Math.log2(Math.max(w.width,w.height))+1:B.mipmaps!==void 0&&B.mipmaps.length>0?B.mipmaps.length:B.isCompressedTexture&&Array.isArray(B.image)?w.mipmaps.length:1}function L(B){const w=B.target;w.removeEventListener("dispose",L),U(w),w.isVideoTexture&&d.delete(w)}function k(B){const w=B.target;w.removeEventListener("dispose",k),I(w)}function U(B){const w=n.get(B);if(w.__webglInit===void 0)return;const te=B.source,ae=m.get(te);if(ae){const ue=ae[w.__cacheKey];ue.usedTimes--,ue.usedTimes===0&&O(B),Object.keys(ae).length===0&&m.delete(te)}n.remove(B)}function O(B){const w=n.get(B);i.deleteTexture(w.__webglTexture);const te=B.source,ae=m.get(te);delete ae[w.__cacheKey],c.memory.textures--}function I(B){const w=n.get(B);if(B.depthTexture&&B.depthTexture.dispose(),B.isWebGLCubeRenderTarget)for(let ae=0;ae<6;ae++){if(Array.isArray(w.__webglFramebuffer[ae]))for(let ue=0;ue<w.__webglFramebuffer[ae].length;ue++)i.deleteFramebuffer(w.__webglFramebuffer[ae][ue]);else i.deleteFramebuffer(w.__webglFramebuffer[ae]);w.__webglDepthbuffer&&i.deleteRenderbuffer(w.__webglDepthbuffer[ae])}else{if(Array.isArray(w.__webglFramebuffer))for(let ae=0;ae<w.__webglFramebuffer.length;ae++)i.deleteFramebuffer(w.__webglFramebuffer[ae]);else i.deleteFramebuffer(w.__webglFramebuffer);if(w.__webglDepthbuffer&&i.deleteRenderbuffer(w.__webglDepthbuffer),w.__webglMultisampledFramebuffer&&i.deleteFramebuffer(w.__webglMultisampledFramebuffer),w.__webglColorRenderbuffer)for(let ae=0;ae<w.__webglColorRenderbuffer.length;ae++)w.__webglColorRenderbuffer[ae]&&i.deleteRenderbuffer(w.__webglColorRenderbuffer[ae]);w.__webglDepthRenderbuffer&&i.deleteRenderbuffer(w.__webglDepthRenderbuffer)}const te=B.textures;for(let ae=0,ue=te.length;ae<ue;ae++){const de=n.get(te[ae]);de.__webglTexture&&(i.deleteTexture(de.__webglTexture),c.memory.textures--),n.remove(te[ae])}n.remove(B)}let E=0;function y(){E=0}function F(){const B=E;return B>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+B+" texture units while this GPU supports only "+r.maxTextures),E+=1,B}function V(B){const w=[];return w.push(B.wrapS),w.push(B.wrapT),w.push(B.wrapR||0),w.push(B.magFilter),w.push(B.minFilter),w.push(B.anisotropy),w.push(B.internalFormat),w.push(B.format),w.push(B.type),w.push(B.generateMipmaps),w.push(B.premultiplyAlpha),w.push(B.flipY),w.push(B.unpackAlignment),w.push(B.colorSpace),w.join()}function G(B,w){const te=n.get(B);if(B.isVideoTexture&&bt(B),B.isRenderTargetTexture===!1&&B.version>0&&te.__version!==B.version){const ae=B.image;if(ae===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ae.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ke(te,B,w);return}}t.bindTexture(i.TEXTURE_2D,te.__webglTexture,i.TEXTURE0+w)}function q(B,w){const te=n.get(B);if(B.version>0&&te.__version!==B.version){Ke(te,B,w);return}t.bindTexture(i.TEXTURE_2D_ARRAY,te.__webglTexture,i.TEXTURE0+w)}function ne(B,w){const te=n.get(B);if(B.version>0&&te.__version!==B.version){Ke(te,B,w);return}t.bindTexture(i.TEXTURE_3D,te.__webglTexture,i.TEXTURE0+w)}function se(B,w){const te=n.get(B);if(B.version>0&&te.__version!==B.version){ot(te,B,w);return}t.bindTexture(i.TEXTURE_CUBE_MAP,te.__webglTexture,i.TEXTURE0+w)}const pe={[_s]:i.REPEAT,[gr]:i.CLAMP_TO_EDGE,[ba]:i.MIRRORED_REPEAT},K={[zn]:i.NEAREST,[Jg]:i.NEAREST_MIPMAP_NEAREST,[ha]:i.NEAREST_MIPMAP_LINEAR,[Wn]:i.LINEAR,[rl]:i.LINEAR_MIPMAP_NEAREST,[_r]:i.LINEAR_MIPMAP_LINEAR},he={[$b]:i.NEVER,[iT]:i.ALWAYS,[Jb]:i.LESS,[u_]:i.LEQUAL,[Qb]:i.EQUAL,[nT]:i.GEQUAL,[eT]:i.GREATER,[tT]:i.NOTEQUAL};function me(B,w){if(w.type===Vi&&e.has("OES_texture_float_linear")===!1&&(w.magFilter===Wn||w.magFilter===rl||w.magFilter===ha||w.magFilter===_r||w.minFilter===Wn||w.minFilter===rl||w.minFilter===ha||w.minFilter===_r)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(B,i.TEXTURE_WRAP_S,pe[w.wrapS]),i.texParameteri(B,i.TEXTURE_WRAP_T,pe[w.wrapT]),(B===i.TEXTURE_3D||B===i.TEXTURE_2D_ARRAY)&&i.texParameteri(B,i.TEXTURE_WRAP_R,pe[w.wrapR]),i.texParameteri(B,i.TEXTURE_MAG_FILTER,K[w.magFilter]),i.texParameteri(B,i.TEXTURE_MIN_FILTER,K[w.minFilter]),w.compareFunction&&(i.texParameteri(B,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(B,i.TEXTURE_COMPARE_FUNC,he[w.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(w.magFilter===zn||w.minFilter!==ha&&w.minFilter!==_r||w.type===Vi&&e.has("OES_texture_float_linear")===!1)return;if(w.anisotropy>1||n.get(w).__currentAnisotropy){const te=e.get("EXT_texture_filter_anisotropic");i.texParameterf(B,te.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(w.anisotropy,r.getMaxAnisotropy())),n.get(w).__currentAnisotropy=w.anisotropy}}}function Me(B,w){let te=!1;B.__webglInit===void 0&&(B.__webglInit=!0,w.addEventListener("dispose",L));const ae=w.source;let ue=m.get(ae);ue===void 0&&(ue={},m.set(ae,ue));const de=V(w);if(de!==B.__cacheKey){ue[de]===void 0&&(ue[de]={texture:i.createTexture(),usedTimes:0},c.memory.textures++,te=!0),ue[de].usedTimes++;const Be=ue[B.__cacheKey];Be!==void 0&&(ue[B.__cacheKey].usedTimes--,Be.usedTimes===0&&O(w)),B.__cacheKey=de,B.__webglTexture=ue[de].texture}return te}function Ke(B,w,te){let ae=i.TEXTURE_2D;(w.isDataArrayTexture||w.isCompressedArrayTexture)&&(ae=i.TEXTURE_2D_ARRAY),w.isData3DTexture&&(ae=i.TEXTURE_3D);const ue=Me(B,w),de=w.source;t.bindTexture(ae,B.__webglTexture,i.TEXTURE0+te);const Be=n.get(de);if(de.version!==Be.__version||ue===!0){t.activeTexture(i.TEXTURE0+te);const _e=Ct.getPrimaries(Ct.workingColorSpace),De=w.colorSpace===Fn?null:Ct.getPrimaries(w.colorSpace),Ve=w.colorSpace===Fn||_e===De?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,w.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,w.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,w.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ve);let ve=A(w.image,!1,r.maxTextureSize);ve=He(w,ve);const Te=o.convert(w.format,w.colorSpace),qe=o.convert(w.type);let Le=C(w.internalFormat,Te,qe,w.colorSpace,w.isVideoTexture);me(ae,w);let Ie;const ct=w.mipmaps,ft=w.isVideoTexture!==!0&&Le!==a_,St=Be.__version===void 0||ue===!0,gt=de.dataReady,Mt=b(w,ve);if(w.isDepthTexture)Le=i.DEPTH_COMPONENT16,w.type===Vi?Le=i.DEPTH_COMPONENT32F:w.type===xo?Le=i.DEPTH_COMPONENT24:w.type===Ca&&(Le=i.DEPTH24_STENCIL8),St&&(ft?t.texStorage2D(i.TEXTURE_2D,1,Le,ve.width,ve.height):t.texImage2D(i.TEXTURE_2D,0,Le,ve.width,ve.height,0,Te,qe,null));else if(w.isDataTexture)if(ct.length>0){ft&&St&&t.texStorage2D(i.TEXTURE_2D,Mt,Le,ct[0].width,ct[0].height);for(let Ue=0,S=ct.length;Ue<S;Ue++)Ie=ct[Ue],ft?gt&&t.texSubImage2D(i.TEXTURE_2D,Ue,0,0,Ie.width,Ie.height,Te,qe,Ie.data):t.texImage2D(i.TEXTURE_2D,Ue,Le,Ie.width,Ie.height,0,Te,qe,Ie.data);w.generateMipmaps=!1}else ft?(St&&t.texStorage2D(i.TEXTURE_2D,Mt,Le,ve.width,ve.height),gt&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,ve.width,ve.height,Te,qe,ve.data)):t.texImage2D(i.TEXTURE_2D,0,Le,ve.width,ve.height,0,Te,qe,ve.data);else if(w.isCompressedTexture)if(w.isCompressedArrayTexture){ft&&St&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Mt,Le,ct[0].width,ct[0].height,ve.depth);for(let Ue=0,S=ct.length;Ue<S;Ue++)Ie=ct[Ue],w.format!==Ci?Te!==null?ft?gt&&t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ue,0,0,0,Ie.width,Ie.height,ve.depth,Te,Ie.data,0,0):t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Ue,Le,Ie.width,Ie.height,ve.depth,0,Ie.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ft?gt&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Ue,0,0,0,Ie.width,Ie.height,ve.depth,Te,qe,Ie.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Ue,Le,Ie.width,Ie.height,ve.depth,0,Te,qe,Ie.data)}else{ft&&St&&t.texStorage2D(i.TEXTURE_2D,Mt,Le,ct[0].width,ct[0].height);for(let Ue=0,S=ct.length;Ue<S;Ue++)Ie=ct[Ue],w.format!==Ci?Te!==null?ft?gt&&t.compressedTexSubImage2D(i.TEXTURE_2D,Ue,0,0,Ie.width,Ie.height,Te,Ie.data):t.compressedTexImage2D(i.TEXTURE_2D,Ue,Le,Ie.width,Ie.height,0,Ie.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ft?gt&&t.texSubImage2D(i.TEXTURE_2D,Ue,0,0,Ie.width,Ie.height,Te,qe,Ie.data):t.texImage2D(i.TEXTURE_2D,Ue,Le,Ie.width,Ie.height,0,Te,qe,Ie.data)}else if(w.isDataArrayTexture)ft?(St&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Mt,Le,ve.width,ve.height,ve.depth),gt&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,ve.width,ve.height,ve.depth,Te,qe,ve.data)):t.texImage3D(i.TEXTURE_2D_ARRAY,0,Le,ve.width,ve.height,ve.depth,0,Te,qe,ve.data);else if(w.isData3DTexture)ft?(St&&t.texStorage3D(i.TEXTURE_3D,Mt,Le,ve.width,ve.height,ve.depth),gt&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,ve.width,ve.height,ve.depth,Te,qe,ve.data)):t.texImage3D(i.TEXTURE_3D,0,Le,ve.width,ve.height,ve.depth,0,Te,qe,ve.data);else if(w.isFramebufferTexture){if(St)if(ft)t.texStorage2D(i.TEXTURE_2D,Mt,Le,ve.width,ve.height);else{let Ue=ve.width,S=ve.height;for(let Z=0;Z<Mt;Z++)t.texImage2D(i.TEXTURE_2D,Z,Le,Ue,S,0,Te,qe,null),Ue>>=1,S>>=1}}else if(ct.length>0){if(ft&&St){const Ue=Tt(ct[0]);t.texStorage2D(i.TEXTURE_2D,Mt,Le,Ue.width,Ue.height)}for(let Ue=0,S=ct.length;Ue<S;Ue++)Ie=ct[Ue],ft?gt&&t.texSubImage2D(i.TEXTURE_2D,Ue,0,0,Te,qe,Ie):t.texImage2D(i.TEXTURE_2D,Ue,Le,Te,qe,Ie);w.generateMipmaps=!1}else if(ft){if(St){const Ue=Tt(ve);t.texStorage2D(i.TEXTURE_2D,Mt,Le,Ue.width,Ue.height)}gt&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Te,qe,ve)}else t.texImage2D(i.TEXTURE_2D,0,Le,Te,qe,ve);v(w)&&_(ae),Be.__version=de.version,w.onUpdate&&w.onUpdate(w)}B.__version=w.version}function ot(B,w,te){if(w.image.length!==6)return;const ae=Me(B,w),ue=w.source;t.bindTexture(i.TEXTURE_CUBE_MAP,B.__webglTexture,i.TEXTURE0+te);const de=n.get(ue);if(ue.version!==de.__version||ae===!0){t.activeTexture(i.TEXTURE0+te);const Be=Ct.getPrimaries(Ct.workingColorSpace),_e=w.colorSpace===Fn?null:Ct.getPrimaries(w.colorSpace),De=w.colorSpace===Fn||Be===_e?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,w.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,w.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,w.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,De);const Ve=w.isCompressedTexture||w.image[0].isCompressedTexture,ve=w.image[0]&&w.image[0].isDataTexture,Te=[];for(let S=0;S<6;S++)!Ve&&!ve?Te[S]=A(w.image[S],!0,r.maxCubemapSize):Te[S]=ve?w.image[S].image:w.image[S],Te[S]=He(w,Te[S]);const qe=Te[0],Le=o.convert(w.format,w.colorSpace),Ie=o.convert(w.type),ct=C(w.internalFormat,Le,Ie,w.colorSpace),ft=w.isVideoTexture!==!0,St=de.__version===void 0||ae===!0,gt=ue.dataReady;let Mt=b(w,qe);me(i.TEXTURE_CUBE_MAP,w);let Ue;if(Ve){ft&&St&&t.texStorage2D(i.TEXTURE_CUBE_MAP,Mt,ct,qe.width,qe.height);for(let S=0;S<6;S++){Ue=Te[S].mipmaps;for(let Z=0;Z<Ue.length;Z++){const oe=Ue[Z];w.format!==Ci?Le!==null?ft?gt&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+S,Z,0,0,oe.width,oe.height,Le,oe.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+S,Z,ct,oe.width,oe.height,0,oe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ft?gt&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+S,Z,0,0,oe.width,oe.height,Le,Ie,oe.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+S,Z,ct,oe.width,oe.height,0,Le,Ie,oe.data)}}}else{if(Ue=w.mipmaps,ft&&St){Ue.length>0&&Mt++;const S=Tt(Te[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,Mt,ct,S.width,S.height)}for(let S=0;S<6;S++)if(ve){ft?gt&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+S,0,0,0,Te[S].width,Te[S].height,Le,Ie,Te[S].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+S,0,ct,Te[S].width,Te[S].height,0,Le,Ie,Te[S].data);for(let Z=0;Z<Ue.length;Z++){const xe=Ue[Z].image[S].image;ft?gt&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+S,Z+1,0,0,xe.width,xe.height,Le,Ie,xe.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+S,Z+1,ct,xe.width,xe.height,0,Le,Ie,xe.data)}}else{ft?gt&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+S,0,0,0,Le,Ie,Te[S]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+S,0,ct,Le,Ie,Te[S]);for(let Z=0;Z<Ue.length;Z++){const oe=Ue[Z];ft?gt&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+S,Z+1,0,0,Le,Ie,oe.image[S]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+S,Z+1,ct,Le,Ie,oe.image[S])}}}v(w)&&_(i.TEXTURE_CUBE_MAP),de.__version=ue.version,w.onUpdate&&w.onUpdate(w)}B.__version=w.version}function ie(B,w,te,ae,ue,de){const Be=o.convert(te.format,te.colorSpace),_e=o.convert(te.type),De=C(te.internalFormat,Be,_e,te.colorSpace);if(!n.get(w).__hasExternalTextures){const ve=Math.max(1,w.width>>de),Te=Math.max(1,w.height>>de);ue===i.TEXTURE_3D||ue===i.TEXTURE_2D_ARRAY?t.texImage3D(ue,de,De,ve,Te,w.depth,0,Be,_e,null):t.texImage2D(ue,de,De,ve,Te,0,Be,_e,null)}t.bindFramebuffer(i.FRAMEBUFFER,B),ze(w)?l.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,ae,ue,n.get(te).__webglTexture,0,$e(w)):(ue===i.TEXTURE_2D||ue>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&ue<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,ae,ue,n.get(te).__webglTexture,de),t.bindFramebuffer(i.FRAMEBUFFER,null)}function ge(B,w,te){if(i.bindRenderbuffer(i.RENDERBUFFER,B),w.depthBuffer&&!w.stencilBuffer){let ae=i.DEPTH_COMPONENT24;if(te||ze(w)){const ue=w.depthTexture;ue&&ue.isDepthTexture&&(ue.type===Vi?ae=i.DEPTH_COMPONENT32F:ue.type===xo&&(ae=i.DEPTH_COMPONENT24));const de=$e(w);ze(w)?l.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,de,ae,w.width,w.height):i.renderbufferStorageMultisample(i.RENDERBUFFER,de,ae,w.width,w.height)}else i.renderbufferStorage(i.RENDERBUFFER,ae,w.width,w.height);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,B)}else if(w.depthBuffer&&w.stencilBuffer){const ae=$e(w);te&&ze(w)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,ae,i.DEPTH24_STENCIL8,w.width,w.height):ze(w)?l.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ae,i.DEPTH24_STENCIL8,w.width,w.height):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,w.width,w.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,B)}else{const ae=w.textures;for(let ue=0;ue<ae.length;ue++){const de=ae[ue],Be=o.convert(de.format,de.colorSpace),_e=o.convert(de.type),De=C(de.internalFormat,Be,_e,de.colorSpace),Ve=$e(w);te&&ze(w)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Ve,De,w.width,w.height):ze(w)?l.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Ve,De,w.width,w.height):i.renderbufferStorage(i.RENDERBUFFER,De,w.width,w.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function we(B,w){if(w&&w.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,B),!(w.depthTexture&&w.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(w.depthTexture).__webglTexture||w.depthTexture.image.width!==w.width||w.depthTexture.image.height!==w.height)&&(w.depthTexture.image.width=w.width,w.depthTexture.image.height=w.height,w.depthTexture.needsUpdate=!0),G(w.depthTexture,0);const ae=n.get(w.depthTexture).__webglTexture,ue=$e(w);if(w.depthTexture.format===po)ze(w)?l.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,ae,0,ue):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,ae,0);else if(w.depthTexture.format===Ta)ze(w)?l.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,ae,0,ue):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,ae,0);else throw new Error("Unknown depthTexture format")}function Se(B){const w=n.get(B),te=B.isWebGLCubeRenderTarget===!0;if(B.depthTexture&&!w.__autoAllocateDepthBuffer){if(te)throw new Error("target.depthTexture not supported in Cube render targets");we(w.__webglFramebuffer,B)}else if(te){w.__webglDepthbuffer=[];for(let ae=0;ae<6;ae++)t.bindFramebuffer(i.FRAMEBUFFER,w.__webglFramebuffer[ae]),w.__webglDepthbuffer[ae]=i.createRenderbuffer(),ge(w.__webglDepthbuffer[ae],B,!1)}else t.bindFramebuffer(i.FRAMEBUFFER,w.__webglFramebuffer),w.__webglDepthbuffer=i.createRenderbuffer(),ge(w.__webglDepthbuffer,B,!1);t.bindFramebuffer(i.FRAMEBUFFER,null)}function Ge(B,w,te){const ae=n.get(B);w!==void 0&&ie(ae.__webglFramebuffer,B,B.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),te!==void 0&&Se(B)}function Xe(B){const w=B.texture,te=n.get(B),ae=n.get(w);B.addEventListener("dispose",k);const ue=B.textures,de=B.isWebGLCubeRenderTarget===!0,Be=ue.length>1;if(Be||(ae.__webglTexture===void 0&&(ae.__webglTexture=i.createTexture()),ae.__version=w.version,c.memory.textures++),de){te.__webglFramebuffer=[];for(let _e=0;_e<6;_e++)if(w.mipmaps&&w.mipmaps.length>0){te.__webglFramebuffer[_e]=[];for(let De=0;De<w.mipmaps.length;De++)te.__webglFramebuffer[_e][De]=i.createFramebuffer()}else te.__webglFramebuffer[_e]=i.createFramebuffer()}else{if(w.mipmaps&&w.mipmaps.length>0){te.__webglFramebuffer=[];for(let _e=0;_e<w.mipmaps.length;_e++)te.__webglFramebuffer[_e]=i.createFramebuffer()}else te.__webglFramebuffer=i.createFramebuffer();if(Be)for(let _e=0,De=ue.length;_e<De;_e++){const Ve=n.get(ue[_e]);Ve.__webglTexture===void 0&&(Ve.__webglTexture=i.createTexture(),c.memory.textures++)}if(B.samples>0&&ze(B)===!1){te.__webglMultisampledFramebuffer=i.createFramebuffer(),te.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,te.__webglMultisampledFramebuffer);for(let _e=0;_e<ue.length;_e++){const De=ue[_e];te.__webglColorRenderbuffer[_e]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,te.__webglColorRenderbuffer[_e]);const Ve=o.convert(De.format,De.colorSpace),ve=o.convert(De.type),Te=C(De.internalFormat,Ve,ve,De.colorSpace,B.isXRRenderTarget===!0),qe=$e(B);i.renderbufferStorageMultisample(i.RENDERBUFFER,qe,Te,B.width,B.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+_e,i.RENDERBUFFER,te.__webglColorRenderbuffer[_e])}i.bindRenderbuffer(i.RENDERBUFFER,null),B.depthBuffer&&(te.__webglDepthRenderbuffer=i.createRenderbuffer(),ge(te.__webglDepthRenderbuffer,B,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(de){t.bindTexture(i.TEXTURE_CUBE_MAP,ae.__webglTexture),me(i.TEXTURE_CUBE_MAP,w);for(let _e=0;_e<6;_e++)if(w.mipmaps&&w.mipmaps.length>0)for(let De=0;De<w.mipmaps.length;De++)ie(te.__webglFramebuffer[_e][De],B,w,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+_e,De);else ie(te.__webglFramebuffer[_e],B,w,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0);v(w)&&_(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Be){for(let _e=0,De=ue.length;_e<De;_e++){const Ve=ue[_e],ve=n.get(Ve);t.bindTexture(i.TEXTURE_2D,ve.__webglTexture),me(i.TEXTURE_2D,Ve),ie(te.__webglFramebuffer,B,Ve,i.COLOR_ATTACHMENT0+_e,i.TEXTURE_2D,0),v(Ve)&&_(i.TEXTURE_2D)}t.unbindTexture()}else{let _e=i.TEXTURE_2D;if((B.isWebGL3DRenderTarget||B.isWebGLArrayRenderTarget)&&(_e=B.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(_e,ae.__webglTexture),me(_e,w),w.mipmaps&&w.mipmaps.length>0)for(let De=0;De<w.mipmaps.length;De++)ie(te.__webglFramebuffer[De],B,w,i.COLOR_ATTACHMENT0,_e,De);else ie(te.__webglFramebuffer,B,w,i.COLOR_ATTACHMENT0,_e,0);v(w)&&_(_e),t.unbindTexture()}B.depthBuffer&&Se(B)}function at(B){const w=B.textures;for(let te=0,ae=w.length;te<ae;te++){const ue=w[te];if(v(ue)){const de=B.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:i.TEXTURE_2D,Be=n.get(ue).__webglTexture;t.bindTexture(de,Be),_(de),t.unbindTexture()}}}function j(B){if(B.samples>0&&ze(B)===!1){const w=B.textures,te=B.width,ae=B.height;let ue=i.COLOR_BUFFER_BIT;const de=[],Be=B.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,_e=n.get(B),De=w.length>1;if(De)for(let Ve=0;Ve<w.length;Ve++)t.bindFramebuffer(i.FRAMEBUFFER,_e.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ve,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,_e.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ve,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,_e.__webglMultisampledFramebuffer),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,_e.__webglFramebuffer);for(let Ve=0;Ve<w.length;Ve++){de.push(i.COLOR_ATTACHMENT0+Ve),B.depthBuffer&&de.push(Be);const ve=_e.__ignoreDepthValues!==void 0?_e.__ignoreDepthValues:!1;if(ve===!1&&(B.depthBuffer&&(ue|=i.DEPTH_BUFFER_BIT),B.stencilBuffer&&_e.__isTransmissionRenderTarget!==!0&&(ue|=i.STENCIL_BUFFER_BIT)),De&&i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,_e.__webglColorRenderbuffer[Ve]),ve===!0&&(i.invalidateFramebuffer(i.READ_FRAMEBUFFER,[Be]),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[Be])),De){const Te=n.get(w[Ve]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,Te,0)}i.blitFramebuffer(0,0,te,ae,0,0,te,ae,ue,i.NEAREST),h&&i.invalidateFramebuffer(i.READ_FRAMEBUFFER,de)}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),De)for(let Ve=0;Ve<w.length;Ve++){t.bindFramebuffer(i.FRAMEBUFFER,_e.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ve,i.RENDERBUFFER,_e.__webglColorRenderbuffer[Ve]);const ve=n.get(w[Ve]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,_e.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ve,i.TEXTURE_2D,ve,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,_e.__webglMultisampledFramebuffer)}}function $e(B){return Math.min(r.maxSamples,B.samples)}function ze(B){const w=n.get(B);return B.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&w.__useRenderToTexture!==!1}function bt(B){const w=c.render.frame;d.get(B)!==w&&(d.set(B,w),B.update())}function He(B,w){const te=B.colorSpace,ae=B.format,ue=B.type;return B.isCompressedTexture===!0||B.isVideoTexture===!0||te!==yn&&te!==Fn&&(Ct.getTransfer(te)===Gt?(ae!==Ci||ue!==Xr)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",te)),w}function Tt(B){return typeof HTMLImageElement<"u"&&B instanceof HTMLImageElement?(f.width=B.naturalWidth||B.width,f.height=B.naturalHeight||B.height):typeof VideoFrame<"u"&&B instanceof VideoFrame?(f.width=B.displayWidth,f.height=B.displayHeight):(f.width=B.width,f.height=B.height),f}this.allocateTextureUnit=F,this.resetTextureUnits=y,this.setTexture2D=G,this.setTexture2DArray=q,this.setTexture3D=ne,this.setTextureCube=se,this.rebindTextures=Ge,this.setupRenderTarget=Xe,this.updateRenderTargetMipmap=at,this.updateMultisampleRenderTarget=j,this.setupDepthRenderbuffer=Se,this.setupFrameBufferTexture=ie,this.useMultisampledRTT=ze}function _C(i,e){function t(n,r=Fn){let o;const c=Ct.getTransfer(r);if(n===Xr)return i.UNSIGNED_BYTE;if(n===t_)return i.UNSIGNED_SHORT_4_4_4_4;if(n===n_)return i.UNSIGNED_SHORT_5_5_5_1;if(n===zb)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Fb)return i.BYTE;if(n===Bb)return i.SHORT;if(n===Qg)return i.UNSIGNED_SHORT;if(n===e_)return i.INT;if(n===xo)return i.UNSIGNED_INT;if(n===Vi)return i.FLOAT;if(n===ul)return i.HALF_FLOAT;if(n===kb)return i.ALPHA;if(n===Hb)return i.RGB;if(n===Ci)return i.RGBA;if(n===Gb)return i.LUMINANCE;if(n===Vb)return i.LUMINANCE_ALPHA;if(n===po)return i.DEPTH_COMPONENT;if(n===Ta)return i.DEPTH_STENCIL;if(n===i_)return i.RED;if(n===r_)return i.RED_INTEGER;if(n===Wb)return i.RG;if(n===s_)return i.RG_INTEGER;if(n===o_)return i.RGBA_INTEGER;if(n===Fu||n===Bu||n===zu||n===ku)if(c===Gt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(n===Fu)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Bu)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===zu)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===ku)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(n===Fu)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Bu)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===zu)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===ku)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===kp||n===Hp||n===Gp||n===Vp)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(n===kp)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Hp)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Gp)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Vp)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===a_)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===Wp||n===Xp)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(n===Wp)return c===Gt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===Xp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Yp||n===jp||n===qp||n===Kp||n===Zp||n===$p||n===Jp||n===Qp||n===em||n===tm||n===nm||n===im||n===rm||n===sm)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(n===Yp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===jp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===qp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Kp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Zp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===$p)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Jp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Qp)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===em)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===tm)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===nm)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===im)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===rm)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===sm)return c===Gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Hu||n===om||n===am)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(n===Hu)return c===Gt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===om)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===am)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Xb||n===cm||n===lm||n===um)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(n===Hu)return o.COMPRESSED_RED_RGTC1_EXT;if(n===cm)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===lm)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===um)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ca?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}class vC extends Bn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}let Xi=class extends mt{constructor(){super(),this.isGroup=!0,this.type="Group"}};const xC={type:"move"};class dh{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Xi,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 Xi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new N,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new N),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Xi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new N,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new N),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 r=null,o=null,c=null;const l=this._targetRay,h=this._grip,f=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(f&&e.hand){c=!0;for(const A of e.hand.values()){const v=t.getJointPose(A,n),_=this._getHandJoint(f,A);v!==null&&(_.matrix.fromArray(v.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.matrixWorldNeedsUpdate=!0,_.jointRadius=v.radius),_.visible=v!==null}const d=f.joints["index-finger-tip"],p=f.joints["thumb-tip"],m=d.position.distanceTo(p.position),x=.02,M=.005;f.inputState.pinching&&m>x+M?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&m<=x-M&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else h!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(h.matrix.fromArray(o.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,o.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(o.linearVelocity)):h.hasLinearVelocity=!1,o.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(o.angularVelocity)):h.hasAngularVelocity=!1));l!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&o!==null&&(r=o),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(xC)))}return l!==null&&(l.visible=r!==null),h!==null&&(h.visible=o!==null),f!==null&&(f.visible=c!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Xi;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const yC=`
|
|
3774
3774
|
void main() {
|
|
3775
3775
|
|
|
3776
3776
|
gl_Position = vec4( position, 1.0 );
|
|
3777
3777
|
|
|
3778
|
-
}`,
|
|
3778
|
+
}`,SC=`
|
|
3779
3779
|
uniform sampler2DArray depthColor;
|
|
3780
3780
|
uniform float depthWidth;
|
|
3781
3781
|
uniform float depthHeight;
|
|
@@ -3794,37 +3794,42 @@ void main() {
|
|
|
3794
3794
|
|
|
3795
3795
|
}
|
|
3796
3796
|
|
|
3797
|
-
}`;class rC{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const i=new an,o=e.properties.get(i);o.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}render(e,t){if(this.texture!==null){if(this.mesh===null){const n=t.cameras[0].viewport,i=new Br({vertexShader:nC,fragmentShader:iC,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new ye(new ds(20,20),i)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}}class sC extends fs{constructor(e,t){super();const n=this;let i=null,o=1,c=null,l="local-floor",u=1,f=null,d=null,p=null,m=null,v=null,S=null;const b=new rC,x=t.getContextAttributes();let _=null,R=null;const E=[],L=[],B=new Ie;let N=null;const D=new On;D.layers.enable(1),D.viewport=new Dt;const k=new On;k.layers.enable(2),k.viewport=new Dt;const C=[D,k],T=new eC;T.layers.enable(1),T.layers.enable(2);let W=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ie){let _e=E[ie];return _e===void 0&&(_e=new iu,E[ie]=_e),_e.getTargetRaySpace()},this.getControllerGrip=function(ie){let _e=E[ie];return _e===void 0&&(_e=new iu,E[ie]=_e),_e.getGripSpace()},this.getHand=function(ie){let _e=E[ie];return _e===void 0&&(_e=new iu,E[ie]=_e),_e.getHandSpace()};function H(ie){const _e=L.indexOf(ie.inputSource);if(_e===-1)return;const Ce=E[_e];Ce!==void 0&&(Ce.update(ie.inputSource,ie.frame,f||c),Ce.dispatchEvent({type:ie.type,data:ie.inputSource}))}function K(){i.removeEventListener("select",H),i.removeEventListener("selectstart",H),i.removeEventListener("selectend",H),i.removeEventListener("squeeze",H),i.removeEventListener("squeezestart",H),i.removeEventListener("squeezeend",H),i.removeEventListener("end",K),i.removeEventListener("inputsourceschange",ne);for(let ie=0;ie<E.length;ie++){const _e=L[ie];_e!==null&&(L[ie]=null,E[ie].disconnect(_e))}W=null,j=null,b.reset(),e.setRenderTarget(_),v=null,m=null,p=null,i=null,R=null,bt.stop(),n.isPresenting=!1,e.setPixelRatio(N),e.setSize(B.width,B.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ie){o=ie,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ie){l=ie,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return f||c},this.setReferenceSpace=function(ie){f=ie},this.getBaseLayer=function(){return m!==null?m:v},this.getBinding=function(){return p},this.getFrame=function(){return S},this.getSession=function(){return i},this.setSession=async function(ie){if(i=ie,i!==null){if(_=e.getRenderTarget(),i.addEventListener("select",H),i.addEventListener("selectstart",H),i.addEventListener("selectend",H),i.addEventListener("squeeze",H),i.addEventListener("squeezestart",H),i.addEventListener("squeezeend",H),i.addEventListener("end",K),i.addEventListener("inputsourceschange",ne),x.xrCompatible!==!0&&await t.makeXRCompatible(),N=e.getPixelRatio(),e.getSize(B),i.renderState.layers===void 0){const _e={antialias:x.antialias,alpha:!0,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:o};v=new XRWebGLLayer(i,t,_e),i.updateRenderState({baseLayer:v}),e.setPixelRatio(1),e.setSize(v.framebufferWidth,v.framebufferHeight,!1),R=new hs(v.framebufferWidth,v.framebufferHeight,{format:Ei,type:Fr,colorSpace:e.outputColorSpace,stencilBuffer:x.stencil})}else{let _e=null,Ce=null,Ae=null;x.depth&&(Ae=x.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,_e=x.stencil?ma:so,Ce=x.stencil?xa:uo);const je={colorFormat:t.RGBA8,depthFormat:Ae,scaleFactor:o};p=new XRWebGLBinding(i,t),m=p.createProjectionLayer(je),i.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),R=new hs(m.textureWidth,m.textureHeight,{format:Ei,type:Fr,depthTexture:new f_(m.textureWidth,m.textureHeight,Ce,void 0,void 0,void 0,void 0,void 0,void 0,_e),stencilBuffer:x.stencil,colorSpace:e.outputColorSpace,samples:x.antialias?4:0});const qe=e.properties.get(R);qe.__ignoreDepthValues=m.ignoreDepthValues}R.isXRRenderTarget=!0,this.setFoveation(u),f=null,c=await i.requestReferenceSpace(l),bt.setContext(i),bt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode};function ne(ie){for(let _e=0;_e<ie.removed.length;_e++){const Ce=ie.removed[_e],Ae=L.indexOf(Ce);Ae>=0&&(L[Ae]=null,E[Ae].disconnect(Ce))}for(let _e=0;_e<ie.added.length;_e++){const Ce=ie.added[_e];let Ae=L.indexOf(Ce);if(Ae===-1){for(let qe=0;qe<E.length;qe++)if(qe>=L.length){L.push(Ce),Ae=qe;break}else if(L[qe]===null){L[qe]=Ce,Ae=qe;break}if(Ae===-1)break}const je=E[Ae];je&&je.connect(Ce)}}const he=new U,me=new U;function $(ie,_e,Ce){he.setFromMatrixPosition(_e.matrixWorld),me.setFromMatrixPosition(Ce.matrixWorld);const Ae=he.distanceTo(me),je=_e.projectionMatrix.elements,qe=Ce.projectionMatrix.elements,dt=je[14]/(je[10]-1),Y=je[14]/(je[10]+1),tt=(je[9]+1)/je[5],Ve=(je[9]-1)/je[5],Et=(je[8]-1)/je[0],ke=(qe[8]+1)/qe[0],Tt=dt*Et,O=dt*ke,A=Ae/(-Et+ke),te=A*-Et;_e.matrixWorld.decompose(ie.position,ie.quaternion,ie.scale),ie.translateX(te),ie.translateZ(A),ie.matrixWorld.compose(ie.position,ie.quaternion,ie.scale),ie.matrixWorldInverse.copy(ie.matrixWorld).invert();const oe=dt+A,le=Y+A,de=Tt-te,Be=O+(Ae-te),ge=tt*Y/le*oe,De=Ve*Y/le*oe;ie.projectionMatrix.makePerspective(de,Be,ge,De,oe,le),ie.projectionMatrixInverse.copy(ie.projectionMatrix).invert()}function fe(ie,_e){_e===null?ie.matrixWorld.copy(ie.matrix):ie.matrixWorld.multiplyMatrices(_e.matrixWorld,ie.matrix),ie.matrixWorldInverse.copy(ie.matrixWorld).invert()}this.updateCamera=function(ie){if(i===null)return;b.texture!==null&&(ie.near=b.depthNear,ie.far=b.depthFar),T.near=k.near=D.near=ie.near,T.far=k.far=D.far=ie.far,(W!==T.near||j!==T.far)&&(i.updateRenderState({depthNear:T.near,depthFar:T.far}),W=T.near,j=T.far,D.near=W,D.far=j,k.near=W,k.far=j,D.updateProjectionMatrix(),k.updateProjectionMatrix(),ie.updateProjectionMatrix());const _e=ie.parent,Ce=T.cameras;fe(T,_e);for(let Ae=0;Ae<Ce.length;Ae++)fe(Ce[Ae],_e);Ce.length===2?$(T,D,k):T.projectionMatrix.copy(D.projectionMatrix),pe(ie,T,_e)};function pe(ie,_e,Ce){Ce===null?ie.matrix.copy(_e.matrixWorld):(ie.matrix.copy(Ce.matrixWorld),ie.matrix.invert(),ie.matrix.multiply(_e.matrixWorld)),ie.matrix.decompose(ie.position,ie.quaternion,ie.scale),ie.updateMatrixWorld(!0),ie.projectionMatrix.copy(_e.projectionMatrix),ie.projectionMatrixInverse.copy(_e.projectionMatrixInverse),ie.isPerspectiveCamera&&(ie.fov=po*2*Math.atan(1/ie.projectionMatrix.elements[5]),ie.zoom=1)}this.getCamera=function(){return T},this.getFoveation=function(){if(!(m===null&&v===null))return u},this.setFoveation=function(ie){u=ie,m!==null&&(m.fixedFoveation=ie),v!==null&&v.fixedFoveation!==void 0&&(v.fixedFoveation=ie)},this.hasDepthSensing=function(){return b.texture!==null};let Ee=null;function Je(ie,_e){if(d=_e.getViewerPose(f||c),S=_e,d!==null){const Ce=d.views;v!==null&&(e.setRenderTargetFramebuffer(R,v.framebuffer),e.setRenderTarget(R));let Ae=!1;Ce.length!==T.cameras.length&&(T.cameras.length=0,Ae=!0);for(let qe=0;qe<Ce.length;qe++){const dt=Ce[qe];let Y=null;if(v!==null)Y=v.getViewport(dt);else{const Ve=p.getViewSubImage(m,dt);Y=Ve.viewport,qe===0&&(e.setRenderTargetTextures(R,Ve.colorTexture,m.ignoreDepthValues?void 0:Ve.depthStencilTexture),e.setRenderTarget(R))}let tt=C[qe];tt===void 0&&(tt=new On,tt.layers.enable(qe),tt.viewport=new Dt,C[qe]=tt),tt.matrix.fromArray(dt.transform.matrix),tt.matrix.decompose(tt.position,tt.quaternion,tt.scale),tt.projectionMatrix.fromArray(dt.projectionMatrix),tt.projectionMatrixInverse.copy(tt.projectionMatrix).invert(),tt.viewport.set(Y.x,Y.y,Y.width,Y.height),qe===0&&(T.matrix.copy(tt.matrix),T.matrix.decompose(T.position,T.quaternion,T.scale)),Ae===!0&&T.cameras.push(tt)}const je=i.enabledFeatures;if(je&&je.includes("depth-sensing")){const qe=p.getDepthInformation(Ce[0]);qe&&qe.isValid&&qe.texture&&b.init(e,qe,i.renderState)}}for(let Ce=0;Ce<E.length;Ce++){const Ae=L[Ce],je=E[Ce];Ae!==null&&je!==void 0&&je.update(Ae,_e,f||c)}b.render(e,T),Ee&&Ee(ie,_e),_e.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:_e}),S=null}const bt=new u_;bt.setAnimationLoop(Je),this.setAnimationLoop=function(ie){Ee=ie},this.dispose=function(){}}}const es=new Ti,oC=new $e;function aC(s,e){function t(x,_){x.matrixAutoUpdate===!0&&x.updateMatrix(),_.value.copy(x.matrix)}function n(x,_){_.color.getRGB(x.fogColor.value,a_(s)),_.isFog?(x.fogNear.value=_.near,x.fogFar.value=_.far):_.isFogExp2&&(x.fogDensity.value=_.density)}function i(x,_,R,E,L){_.isMeshBasicMaterial||_.isMeshLambertMaterial?o(x,_):_.isMeshToonMaterial?(o(x,_),p(x,_)):_.isMeshPhongMaterial?(o(x,_),d(x,_)):_.isMeshStandardMaterial?(o(x,_),m(x,_),_.isMeshPhysicalMaterial&&v(x,_,L)):_.isMeshMatcapMaterial?(o(x,_),S(x,_)):_.isMeshDepthMaterial?o(x,_):_.isMeshDistanceMaterial?(o(x,_),b(x,_)):_.isMeshNormalMaterial?o(x,_):_.isLineBasicMaterial?(c(x,_),_.isLineDashedMaterial&&l(x,_)):_.isPointsMaterial?u(x,_,R,E):_.isSpriteMaterial?f(x,_):_.isShadowMaterial?(x.color.value.copy(_.color),x.opacity.value=_.opacity):_.isShaderMaterial&&(_.uniformsNeedUpdate=!1)}function o(x,_){x.opacity.value=_.opacity,_.color&&x.diffuse.value.copy(_.color),_.emissive&&x.emissive.value.copy(_.emissive).multiplyScalar(_.emissiveIntensity),_.map&&(x.map.value=_.map,t(_.map,x.mapTransform)),_.alphaMap&&(x.alphaMap.value=_.alphaMap,t(_.alphaMap,x.alphaMapTransform)),_.bumpMap&&(x.bumpMap.value=_.bumpMap,t(_.bumpMap,x.bumpMapTransform),x.bumpScale.value=_.bumpScale,_.side===Vn&&(x.bumpScale.value*=-1)),_.normalMap&&(x.normalMap.value=_.normalMap,t(_.normalMap,x.normalMapTransform),x.normalScale.value.copy(_.normalScale),_.side===Vn&&x.normalScale.value.negate()),_.displacementMap&&(x.displacementMap.value=_.displacementMap,t(_.displacementMap,x.displacementMapTransform),x.displacementScale.value=_.displacementScale,x.displacementBias.value=_.displacementBias),_.emissiveMap&&(x.emissiveMap.value=_.emissiveMap,t(_.emissiveMap,x.emissiveMapTransform)),_.specularMap&&(x.specularMap.value=_.specularMap,t(_.specularMap,x.specularMapTransform)),_.alphaTest>0&&(x.alphaTest.value=_.alphaTest);const R=e.get(_),E=R.envMap,L=R.envMapRotation;if(E&&(x.envMap.value=E,es.copy(L),es.x*=-1,es.y*=-1,es.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(es.y*=-1,es.z*=-1),x.envMapRotation.value.setFromMatrix4(oC.makeRotationFromEuler(es)),x.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=_.reflectivity,x.ior.value=_.ior,x.refractionRatio.value=_.refractionRatio),_.lightMap){x.lightMap.value=_.lightMap;const B=s._useLegacyLights===!0?Math.PI:1;x.lightMapIntensity.value=_.lightMapIntensity*B,t(_.lightMap,x.lightMapTransform)}_.aoMap&&(x.aoMap.value=_.aoMap,x.aoMapIntensity.value=_.aoMapIntensity,t(_.aoMap,x.aoMapTransform))}function c(x,_){x.diffuse.value.copy(_.color),x.opacity.value=_.opacity,_.map&&(x.map.value=_.map,t(_.map,x.mapTransform))}function l(x,_){x.dashSize.value=_.dashSize,x.totalSize.value=_.dashSize+_.gapSize,x.scale.value=_.scale}function u(x,_,R,E){x.diffuse.value.copy(_.color),x.opacity.value=_.opacity,x.size.value=_.size*R,x.scale.value=E*.5,_.map&&(x.map.value=_.map,t(_.map,x.uvTransform)),_.alphaMap&&(x.alphaMap.value=_.alphaMap,t(_.alphaMap,x.alphaMapTransform)),_.alphaTest>0&&(x.alphaTest.value=_.alphaTest)}function f(x,_){x.diffuse.value.copy(_.color),x.opacity.value=_.opacity,x.rotation.value=_.rotation,_.map&&(x.map.value=_.map,t(_.map,x.mapTransform)),_.alphaMap&&(x.alphaMap.value=_.alphaMap,t(_.alphaMap,x.alphaMapTransform)),_.alphaTest>0&&(x.alphaTest.value=_.alphaTest)}function d(x,_){x.specular.value.copy(_.specular),x.shininess.value=Math.max(_.shininess,1e-4)}function p(x,_){_.gradientMap&&(x.gradientMap.value=_.gradientMap)}function m(x,_){x.metalness.value=_.metalness,_.metalnessMap&&(x.metalnessMap.value=_.metalnessMap,t(_.metalnessMap,x.metalnessMapTransform)),x.roughness.value=_.roughness,_.roughnessMap&&(x.roughnessMap.value=_.roughnessMap,t(_.roughnessMap,x.roughnessMapTransform)),_.envMap&&(x.envMapIntensity.value=_.envMapIntensity)}function v(x,_,R){x.ior.value=_.ior,_.sheen>0&&(x.sheenColor.value.copy(_.sheenColor).multiplyScalar(_.sheen),x.sheenRoughness.value=_.sheenRoughness,_.sheenColorMap&&(x.sheenColorMap.value=_.sheenColorMap,t(_.sheenColorMap,x.sheenColorMapTransform)),_.sheenRoughnessMap&&(x.sheenRoughnessMap.value=_.sheenRoughnessMap,t(_.sheenRoughnessMap,x.sheenRoughnessMapTransform))),_.clearcoat>0&&(x.clearcoat.value=_.clearcoat,x.clearcoatRoughness.value=_.clearcoatRoughness,_.clearcoatMap&&(x.clearcoatMap.value=_.clearcoatMap,t(_.clearcoatMap,x.clearcoatMapTransform)),_.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=_.clearcoatRoughnessMap,t(_.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),_.clearcoatNormalMap&&(x.clearcoatNormalMap.value=_.clearcoatNormalMap,t(_.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(_.clearcoatNormalScale),_.side===Vn&&x.clearcoatNormalScale.value.negate())),_.iridescence>0&&(x.iridescence.value=_.iridescence,x.iridescenceIOR.value=_.iridescenceIOR,x.iridescenceThicknessMinimum.value=_.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=_.iridescenceThicknessRange[1],_.iridescenceMap&&(x.iridescenceMap.value=_.iridescenceMap,t(_.iridescenceMap,x.iridescenceMapTransform)),_.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=_.iridescenceThicknessMap,t(_.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),_.transmission>0&&(x.transmission.value=_.transmission,x.transmissionSamplerMap.value=R.texture,x.transmissionSamplerSize.value.set(R.width,R.height),_.transmissionMap&&(x.transmissionMap.value=_.transmissionMap,t(_.transmissionMap,x.transmissionMapTransform)),x.thickness.value=_.thickness,_.thicknessMap&&(x.thicknessMap.value=_.thicknessMap,t(_.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=_.attenuationDistance,x.attenuationColor.value.copy(_.attenuationColor)),_.anisotropy>0&&(x.anisotropyVector.value.set(_.anisotropy*Math.cos(_.anisotropyRotation),_.anisotropy*Math.sin(_.anisotropyRotation)),_.anisotropyMap&&(x.anisotropyMap.value=_.anisotropyMap,t(_.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=_.specularIntensity,x.specularColor.value.copy(_.specularColor),_.specularColorMap&&(x.specularColorMap.value=_.specularColorMap,t(_.specularColorMap,x.specularColorMapTransform)),_.specularIntensityMap&&(x.specularIntensityMap.value=_.specularIntensityMap,t(_.specularIntensityMap,x.specularIntensityMapTransform))}function S(x,_){_.matcap&&(x.matcap.value=_.matcap)}function b(x,_){const R=e.get(_).light;x.referencePosition.value.setFromMatrixPosition(R.matrixWorld),x.nearDistance.value=R.shadow.camera.near,x.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function cC(s,e,t,n){let i={},o={},c=[];const l=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function u(R,E){const L=E.program;n.uniformBlockBinding(R,L)}function f(R,E){let L=i[R.id];L===void 0&&(S(R),L=d(R),i[R.id]=L,R.addEventListener("dispose",x));const B=E.program;n.updateUBOMapping(R,B);const N=e.render.frame;o[R.id]!==N&&(m(R),o[R.id]=N)}function d(R){const E=p();R.__bindingPointIndex=E;const L=s.createBuffer(),B=R.__size,N=R.usage;return s.bindBuffer(s.UNIFORM_BUFFER,L),s.bufferData(s.UNIFORM_BUFFER,B,N),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,E,L),L}function p(){for(let R=0;R<l;R++)if(c.indexOf(R)===-1)return c.push(R),R;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(R){const E=i[R.id],L=R.uniforms,B=R.__cache;s.bindBuffer(s.UNIFORM_BUFFER,E);for(let N=0,D=L.length;N<D;N++){const k=Array.isArray(L[N])?L[N]:[L[N]];for(let C=0,T=k.length;C<T;C++){const W=k[C];if(v(W,N,C,B)===!0){const j=W.__offset,H=Array.isArray(W.value)?W.value:[W.value];let K=0;for(let ne=0;ne<H.length;ne++){const he=H[ne],me=b(he);typeof he=="number"||typeof he=="boolean"?(W.__data[0]=he,s.bufferSubData(s.UNIFORM_BUFFER,j+K,W.__data)):he.isMatrix3?(W.__data[0]=he.elements[0],W.__data[1]=he.elements[1],W.__data[2]=he.elements[2],W.__data[3]=0,W.__data[4]=he.elements[3],W.__data[5]=he.elements[4],W.__data[6]=he.elements[5],W.__data[7]=0,W.__data[8]=he.elements[6],W.__data[9]=he.elements[7],W.__data[10]=he.elements[8],W.__data[11]=0):(he.toArray(W.__data,K),K+=me.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,j,W.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function v(R,E,L,B){const N=R.value,D=E+"_"+L;if(B[D]===void 0)return typeof N=="number"||typeof N=="boolean"?B[D]=N:B[D]=N.clone(),!0;{const k=B[D];if(typeof N=="number"||typeof N=="boolean"){if(k!==N)return B[D]=N,!0}else if(k.equals(N)===!1)return k.copy(N),!0}return!1}function S(R){const E=R.uniforms;let L=0;const B=16;for(let D=0,k=E.length;D<k;D++){const C=Array.isArray(E[D])?E[D]:[E[D]];for(let T=0,W=C.length;T<W;T++){const j=C[T],H=Array.isArray(j.value)?j.value:[j.value];for(let K=0,ne=H.length;K<ne;K++){const he=H[K],me=b(he),$=L%B;$!==0&&B-$<me.boundary&&(L+=B-$),j.__data=new Float32Array(me.storage/Float32Array.BYTES_PER_ELEMENT),j.__offset=L,L+=me.storage}}}const N=L%B;return N>0&&(L+=B-N),R.__size=L,R.__cache={},this}function b(R){const E={boundary:0,storage:0};return typeof R=="number"||typeof R=="boolean"?(E.boundary=4,E.storage=4):R.isVector2?(E.boundary=8,E.storage=8):R.isVector3||R.isColor?(E.boundary=16,E.storage=12):R.isVector4?(E.boundary=16,E.storage=16):R.isMatrix3?(E.boundary=48,E.storage=48):R.isMatrix4?(E.boundary=64,E.storage=64):R.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",R),E}function x(R){const E=R.target;E.removeEventListener("dispose",x);const L=c.indexOf(E.__bindingPointIndex);c.splice(L,1),s.deleteBuffer(i[E.id]),delete i[E.id],delete o[E.id]}function _(){for(const R in i)s.deleteBuffer(i[R]);c=[],i={},o={}}return{bind:u,update:f,dispose:_}}class lC{constructor(e={}){const{canvas:t=nT(),context:n=null,depth:i=!0,stencil:o=!1,alpha:c=!1,antialias:l=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:f=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:p=!1}=e;this.isWebGLRenderer=!0;let m;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=n.getContextAttributes().alpha}else m=c;const v=new Uint32Array(4),S=new Int32Array(4);let b=null,x=null;const _=[],R=[];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._outputColorSpace=mn,this._useLegacyLights=!1,this.toneMapping=lr,this.toneMappingExposure=1;const E=this;let L=!1,B=0,N=0,D=null,k=-1,C=null;const T=new Dt,W=new Dt;let j=null;const H=new Ne(0);let K=0,ne=t.width,he=t.height,me=1,$=null,fe=null;const pe=new Dt(0,0,ne,he),Ee=new Dt(0,0,ne,he);let Je=!1;const bt=new ju;let ie=!1,_e=!1;const Ce=new $e,Ae=new Ie,je=new U,qe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function dt(){return D===null?me:1}let Y=n;function tt(I,X){const Q=t.getContext(I,X);return Q!==null?Q:null}try{const I={alpha:!0,depth:i,stencil:o,antialias:l,premultipliedAlpha:u,preserveDrawingBuffer:f,powerPreference:d,failIfMajorPerformanceCaveat:p};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Vu}`),t.addEventListener("webglcontextlost",q,!1),t.addEventListener("webglcontextrestored",se,!1),t.addEventListener("webglcontextcreationerror",xe,!1),Y===null){const X="webgl2";if(Y=tt(X,I),Y===null)throw tt(X)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(I){throw console.error("THREE.WebGLRenderer: "+I.message),I}let Ve,Et,ke,Tt,O,A,te,oe,le,de,Be,ge,De,He,ve,be,Ye,Pe,Le,ot,ht,yt,pt,St;function Oe(){Ve=new _1(Y),Ve.init(),Et=new u1(Y,Ve,e),yt=new QR(Y,Ve),ke=new $R(Y),Tt=new y1(Y),O=new FR,A=new JR(Y,Ve,ke,O,Et,yt,Tt),te=new d1(E),oe=new g1(E),le=new AT(Y),pt=new l1(Y,le),de=new v1(Y,le,Tt,pt),Be=new M1(Y,de,le,Tt),Le=new S1(Y,Et,A),be=new f1(O),ge=new NR(E,te,oe,Ve,Et,pt,be),De=new aC(E,O),He=new zR,ve=new XR(Ve),Pe=new c1(E,te,oe,ke,Be,m,u),Ye=new ZR(E,Be,Et),St=new cC(Y,Tt,Et,ke),ot=new h1(Y,Ve,Tt),ht=new x1(Y,Ve,Tt),Tt.programs=ge.programs,E.capabilities=Et,E.extensions=Ve,E.properties=O,E.renderLists=He,E.shadowMap=Ye,E.state=ke,E.info=Tt}Oe();const y=new sC(E,Y);this.xr=y,this.getContext=function(){return Y},this.getContextAttributes=function(){return Y.getContextAttributes()},this.forceContextLoss=function(){const I=Ve.get("WEBGL_lose_context");I&&I.loseContext()},this.forceContextRestore=function(){const I=Ve.get("WEBGL_lose_context");I&&I.restoreContext()},this.getPixelRatio=function(){return me},this.setPixelRatio=function(I){I!==void 0&&(me=I,this.setSize(ne,he,!1))},this.getSize=function(I){return I.set(ne,he)},this.setSize=function(I,X,Q=!0){if(y.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}ne=I,he=X,t.width=Math.floor(I*me),t.height=Math.floor(X*me),Q===!0&&(t.style.width=I+"px",t.style.height=X+"px"),this.setViewport(0,0,I,X)},this.getDrawingBufferSize=function(I){return I.set(ne*me,he*me).floor()},this.setDrawingBufferSize=function(I,X,Q){ne=I,he=X,me=Q,t.width=Math.floor(I*Q),t.height=Math.floor(X*Q),this.setViewport(0,0,I,X)},this.getCurrentViewport=function(I){return I.copy(T)},this.getViewport=function(I){return I.copy(pe)},this.setViewport=function(I,X,Q,ee){I.isVector4?pe.set(I.x,I.y,I.z,I.w):pe.set(I,X,Q,ee),ke.viewport(T.copy(pe).multiplyScalar(me).round())},this.getScissor=function(I){return I.copy(Ee)},this.setScissor=function(I,X,Q,ee){I.isVector4?Ee.set(I.x,I.y,I.z,I.w):Ee.set(I,X,Q,ee),ke.scissor(W.copy(Ee).multiplyScalar(me).round())},this.getScissorTest=function(){return Je},this.setScissorTest=function(I){ke.setScissorTest(Je=I)},this.setOpaqueSort=function(I){$=I},this.setTransparentSort=function(I){fe=I},this.getClearColor=function(I){return I.copy(Pe.getClearColor())},this.setClearColor=function(){Pe.setClearColor.apply(Pe,arguments)},this.getClearAlpha=function(){return Pe.getClearAlpha()},this.setClearAlpha=function(){Pe.setClearAlpha.apply(Pe,arguments)},this.clear=function(I=!0,X=!0,Q=!0){let ee=0;if(I){let Z=!1;if(D!==null){const Te=D.texture.format;Z=Te===Kg||Te===qg||Te===jg}if(Z){const Te=D.texture.type,Fe=Te===Fr||Te===uo||Te===Gg||Te===xa||Te===Wg||Te===Xg,ze=Pe.getClearColor(),Ke=Pe.getClearAlpha(),Ze=ze.r,Qe=ze.g,nt=ze.b;Fe?(v[0]=Ze,v[1]=Qe,v[2]=nt,v[3]=Ke,Y.clearBufferuiv(Y.COLOR,0,v)):(S[0]=Ze,S[1]=Qe,S[2]=nt,S[3]=Ke,Y.clearBufferiv(Y.COLOR,0,S))}else ee|=Y.COLOR_BUFFER_BIT}X&&(ee|=Y.DEPTH_BUFFER_BIT),Q&&(ee|=Y.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Y.clear(ee)},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",q,!1),t.removeEventListener("webglcontextrestored",se,!1),t.removeEventListener("webglcontextcreationerror",xe,!1),He.dispose(),ve.dispose(),O.dispose(),te.dispose(),oe.dispose(),Be.dispose(),pt.dispose(),St.dispose(),ge.dispose(),y.dispose(),y.removeEventListener("sessionstart",qt),y.removeEventListener("sessionend",Kt),Rn.stop()};function q(I){I.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),L=!0}function se(){console.log("THREE.WebGLRenderer: Context Restored."),L=!1;const I=Tt.autoReset,X=Ye.enabled,Q=Ye.autoUpdate,ee=Ye.needsUpdate,Z=Ye.type;Oe(),Tt.autoReset=I,Ye.enabled=X,Ye.autoUpdate=Q,Ye.needsUpdate=ee,Ye.type=Z}function xe(I){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",I.statusMessage)}function we(I){const X=I.target;X.removeEventListener("dispose",we),mt(X)}function mt(I){ut(I),O.remove(I)}function ut(I){const X=O.get(I).programs;X!==void 0&&(X.forEach(function(Q){ge.releaseProgram(Q)}),I.isShaderMaterial&&ge.releaseShaderCache(I))}this.renderBufferDirect=function(I,X,Q,ee,Z,Te){X===null&&(X=qe);const Fe=Z.isMesh&&Z.matrixWorld.determinant()<0,ze=ml(I,X,Q,ee,Z);ke.setMaterial(ee,Fe);let Ke=Q.index,Ze=1;if(ee.wireframe===!0){if(Ke=de.getWireframeAttribute(Q),Ke===void 0)return;Ze=2}const Qe=Q.drawRange,nt=Q.attributes.position;let Xt=Qe.start*Ze,Sn=(Qe.start+Qe.count)*Ze;Te!==null&&(Xt=Math.max(Xt,Te.start*Ze),Sn=Math.min(Sn,(Te.start+Te.count)*Ze)),Ke!==null?(Xt=Math.max(Xt,0),Sn=Math.min(Sn,Ke.count)):nt!=null&&(Xt=Math.max(Xt,0),Sn=Math.min(Sn,nt.count));const Jt=Sn-Xt;if(Jt<0||Jt===1/0)return;pt.setup(Z,ee,ze,Q,Ke);let Qn,kt=ot;if(Ke!==null&&(Qn=le.get(Ke),kt=ht,kt.setIndex(Qn)),Z.isMesh)ee.wireframe===!0?(ke.setLineWidth(ee.wireframeLinewidth*dt()),kt.setMode(Y.LINES)):kt.setMode(Y.TRIANGLES);else if(Z.isLine){let rt=ee.linewidth;rt===void 0&&(rt=1),ke.setLineWidth(rt*dt()),Z.isLineSegments?kt.setMode(Y.LINES):Z.isLineLoop?kt.setMode(Y.LINE_LOOP):kt.setMode(Y.LINE_STRIP)}else Z.isPoints?kt.setMode(Y.POINTS):Z.isSprite&&kt.setMode(Y.TRIANGLES);if(Z.isBatchedMesh)kt.renderMultiDraw(Z._multiDrawStarts,Z._multiDrawCounts,Z._multiDrawCount);else if(Z.isInstancedMesh)kt.renderInstances(Xt,Jt,Z.count);else if(Q.isInstancedBufferGeometry){const rt=Q._maxInstanceCount!==void 0?Q._maxInstanceCount:1/0,To=Math.min(Q.instanceCount,rt);kt.renderInstances(Xt,Jt,To)}else kt.render(Xt,Jt)};function Ft(I,X,Q){I.transparent===!0&&I.side===yi&&I.forceSinglePass===!1?(I.side=Vn,I.needsUpdate=!0,ms(I,X,Q),I.side=Fi,I.needsUpdate=!0,ms(I,X,Q),I.side=yi):ms(I,X,Q)}this.compile=function(I,X,Q=null){Q===null&&(Q=I),x=ve.get(Q),x.init(),R.push(x),Q.traverseVisible(function(Z){Z.isLight&&Z.layers.test(X.layers)&&(x.pushLight(Z),Z.castShadow&&x.pushShadow(Z))}),I!==Q&&I.traverseVisible(function(Z){Z.isLight&&Z.layers.test(X.layers)&&(x.pushLight(Z),Z.castShadow&&x.pushShadow(Z))}),x.setupLights(E._useLegacyLights);const ee=new Set;return I.traverse(function(Z){const Te=Z.material;if(Te)if(Array.isArray(Te))for(let Fe=0;Fe<Te.length;Fe++){const ze=Te[Fe];Ft(ze,Q,Z),ee.add(ze)}else Ft(Te,Q,Z),ee.add(Te)}),R.pop(),x=null,ee},this.compileAsync=function(I,X,Q=null){const ee=this.compile(I,X,Q);return new Promise(Z=>{function Te(){if(ee.forEach(function(Fe){O.get(Fe).currentProgram.isReady()&&ee.delete(Fe)}),ee.size===0){Z(I);return}setTimeout(Te,10)}Ve.get("KHR_parallel_shader_compile")!==null?Te():setTimeout(Te,10)})};let tn=null;function At(I){tn&&tn(I)}function qt(){Rn.stop()}function Kt(){Rn.start()}const Rn=new u_;Rn.setAnimationLoop(At),typeof self<"u"&&Rn.setContext(self),this.setAnimationLoop=function(I){tn=I,y.setAnimationLoop(I),I===null?Rn.stop():Rn.start()},y.addEventListener("sessionstart",qt),y.addEventListener("sessionend",Kt),this.render=function(I,X){if(X!==void 0&&X.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),X.parent===null&&X.matrixWorldAutoUpdate===!0&&X.updateMatrixWorld(),y.enabled===!0&&y.isPresenting===!0&&(y.cameraAutoUpdate===!0&&y.updateCamera(X),X=y.getCamera()),I.isScene===!0&&I.onBeforeRender(E,I,X,D),x=ve.get(I,R.length),x.init(),R.push(x),Ce.multiplyMatrices(X.projectionMatrix,X.matrixWorldInverse),bt.setFromProjectionMatrix(Ce),_e=this.localClippingEnabled,ie=be.init(this.clippingPlanes,_e),b=He.get(I,_.length),b.init(),_.push(b),yn(I,X,0,E.sortObjects),b.finish(),E.sortObjects===!0&&b.sort($,fe),this.info.render.frame++,ie===!0&&be.beginShadows();const Q=x.state.shadowsArray;if(Ye.render(Q,I,X),ie===!0&&be.endShadows(),this.info.autoReset===!0&&this.info.reset(),(y.enabled===!1||y.isPresenting===!1||y.hasDepthSensing()===!1)&&Pe.render(b,I),x.setupLights(E._useLegacyLights),X.isArrayCamera){const ee=X.cameras;for(let Z=0,Te=ee.length;Z<Te;Z++){const Fe=ee[Z];wi(b,I,Fe,Fe.viewport)}}else wi(b,I,X);D!==null&&(A.updateMultisampleRenderTarget(D),A.updateRenderTargetMipmap(D)),I.isScene===!0&&I.onAfterRender(E,I,X),pt.resetDefaultState(),k=-1,C=null,R.pop(),R.length>0?x=R[R.length-1]:x=null,_.pop(),_.length>0?b=_[_.length-1]:b=null};function yn(I,X,Q,ee){if(I.visible===!1)return;if(I.layers.test(X.layers)){if(I.isGroup)Q=I.renderOrder;else if(I.isLOD)I.autoUpdate===!0&&I.update(X);else if(I.isLight)x.pushLight(I),I.castShadow&&x.pushShadow(I);else if(I.isSprite){if(!I.frustumCulled||bt.intersectsSprite(I)){ee&&je.setFromMatrixPosition(I.matrixWorld).applyMatrix4(Ce);const Fe=Be.update(I),ze=I.material;ze.visible&&b.push(I,Fe,ze,Q,je.z,null)}}else if((I.isMesh||I.isLine||I.isPoints)&&(!I.frustumCulled||bt.intersectsObject(I))){const Fe=Be.update(I),ze=I.material;if(ee&&(I.boundingSphere!==void 0?(I.boundingSphere===null&&I.computeBoundingSphere(),je.copy(I.boundingSphere.center)):(Fe.boundingSphere===null&&Fe.computeBoundingSphere(),je.copy(Fe.boundingSphere.center)),je.applyMatrix4(I.matrixWorld).applyMatrix4(Ce)),Array.isArray(ze)){const Ke=Fe.groups;for(let Ze=0,Qe=Ke.length;Ze<Qe;Ze++){const nt=Ke[Ze],Xt=ze[nt.materialIndex];Xt&&Xt.visible&&b.push(I,Fe,Xt,Q,je.z,nt)}}else ze.visible&&b.push(I,Fe,ze,Q,je.z,null)}}const Te=I.children;for(let Fe=0,ze=Te.length;Fe<ze;Fe++)yn(Te[Fe],X,Q,ee)}function wi(I,X,Q,ee){const Z=I.opaque,Te=I.transmissive,Fe=I.transparent;x.setupLightsView(Q),ie===!0&&be.setGlobalState(E.clippingPlanes,Q),Te.length>0&&Ri(Z,Te,X,Q),ee&&ke.viewport(T.copy(ee)),Z.length>0&&Vi(Z,X,Q),Te.length>0&&Vi(Te,X,Q),Fe.length>0&&Vi(Fe,X,Q),ke.buffers.depth.setTest(!0),ke.buffers.depth.setMask(!0),ke.buffers.color.setMask(!0),ke.setPolygonOffset(!1)}function Ri(I,X,Q,ee){if((Q.isScene===!0?Q.overrideMaterial:null)!==null)return;if(x.state.transmissionRenderTarget===null){x.state.transmissionRenderTarget=new hs(1,1,{generateMipmaps:!0,type:Ve.has("EXT_color_buffer_half_float")||Ve.has("EXT_color_buffer_float")?el:Fr,minFilter:or,samples:4,stencilBuffer:o});const Ze=O.get(x.state.transmissionRenderTarget);Ze.__isTransmissionRenderTarget=!0}const Te=x.state.transmissionRenderTarget;E.getDrawingBufferSize(Ae),Te.setSize(Ae.x,Ae.y);const Fe=E.getRenderTarget();E.setRenderTarget(Te),E.getClearColor(H),K=E.getClearAlpha(),K<1&&E.setClearColor(16777215,.5),E.clear();const ze=E.toneMapping;E.toneMapping=lr,Vi(I,Q,ee),A.updateMultisampleRenderTarget(Te),A.updateRenderTargetMipmap(Te);let Ke=!1;for(let Ze=0,Qe=X.length;Ze<Qe;Ze++){const nt=X[Ze],Xt=nt.object,Sn=nt.geometry,Jt=nt.material,Qn=nt.group;if(Jt.side===yi&&Xt.layers.test(ee.layers)){const kt=Jt.side;Jt.side=Vn,Jt.needsUpdate=!0,Ma(Xt,Q,ee,Sn,Jt,Qn),Jt.side=kt,Jt.needsUpdate=!0,Ke=!0}}Ke===!0&&(A.updateMultisampleRenderTarget(Te),A.updateRenderTargetMipmap(Te)),E.setRenderTarget(Fe),E.setClearColor(H,K),E.toneMapping=ze}function Vi(I,X,Q){const ee=X.isScene===!0?X.overrideMaterial:null;for(let Z=0,Te=I.length;Z<Te;Z++){const Fe=I[Z],ze=Fe.object,Ke=Fe.geometry,Ze=ee===null?Fe.material:ee,Qe=Fe.group;ze.layers.test(Q.layers)&&Ma(ze,X,Q,Ke,Ze,Qe)}}function Ma(I,X,Q,ee,Z,Te){I.onBeforeRender(E,X,Q,ee,Z,Te),I.modelViewMatrix.multiplyMatrices(Q.matrixWorldInverse,I.matrixWorld),I.normalMatrix.getNormalMatrix(I.modelViewMatrix),Z.onBeforeRender(E,X,Q,ee,I,Te),Z.transparent===!0&&Z.side===yi&&Z.forceSinglePass===!1?(Z.side=Vn,Z.needsUpdate=!0,E.renderBufferDirect(Q,X,ee,Z,I,Te),Z.side=Fi,Z.needsUpdate=!0,E.renderBufferDirect(Q,X,ee,Z,I,Te),Z.side=yi):E.renderBufferDirect(Q,X,ee,Z,I,Te),I.onAfterRender(E,X,Q,ee,Z,Te)}function ms(I,X,Q){X.isScene!==!0&&(X=qe);const ee=O.get(I),Z=x.state.lights,Te=x.state.shadowsArray,Fe=Z.state.version,ze=ge.getParameters(I,Z.state,Te,X,Q),Ke=ge.getProgramCacheKey(ze);let Ze=ee.programs;ee.environment=I.isMeshStandardMaterial?X.environment:null,ee.fog=X.fog,ee.envMap=(I.isMeshStandardMaterial?oe:te).get(I.envMap||ee.environment),ee.envMapRotation=ee.environment!==null&&I.envMap===null?X.environmentRotation:I.envMapRotation,Ze===void 0&&(I.addEventListener("dispose",we),Ze=new Map,ee.programs=Ze);let Qe=Ze.get(Ke);if(Qe!==void 0){if(ee.currentProgram===Qe&&ee.lightsStateVersion===Fe)return ba(I,ze),Qe}else ze.uniforms=ge.getUniforms(I),I.onBuild(Q,ze,E),I.onBeforeCompile(ze,E),Qe=ge.acquireProgram(ze,Ke),Ze.set(Ke,Qe),ee.uniforms=ze.uniforms;const nt=ee.uniforms;return(!I.isShaderMaterial&&!I.isRawShaderMaterial||I.clipping===!0)&&(nt.clippingPlanes=be.uniform),ba(I,ze),ee.needsLights=_l(I),ee.lightsStateVersion=Fe,ee.needsLights&&(nt.ambientLightColor.value=Z.state.ambient,nt.lightProbe.value=Z.state.probe,nt.directionalLights.value=Z.state.directional,nt.directionalLightShadows.value=Z.state.directionalShadow,nt.spotLights.value=Z.state.spot,nt.spotLightShadows.value=Z.state.spotShadow,nt.rectAreaLights.value=Z.state.rectArea,nt.ltc_1.value=Z.state.rectAreaLTC1,nt.ltc_2.value=Z.state.rectAreaLTC2,nt.pointLights.value=Z.state.point,nt.pointLightShadows.value=Z.state.pointShadow,nt.hemisphereLights.value=Z.state.hemi,nt.directionalShadowMap.value=Z.state.directionalShadowMap,nt.directionalShadowMatrix.value=Z.state.directionalShadowMatrix,nt.spotShadowMap.value=Z.state.spotShadowMap,nt.spotLightMatrix.value=Z.state.spotLightMatrix,nt.spotLightMap.value=Z.state.spotLightMap,nt.pointShadowMap.value=Z.state.pointShadowMap,nt.pointShadowMatrix.value=Z.state.pointShadowMatrix),ee.currentProgram=Qe,ee.uniformsList=null,Qe}function Ea(I){if(I.uniformsList===null){const X=I.currentProgram.getUniforms();I.uniformsList=qc.seqWithValue(X.seq,I.uniforms)}return I.uniformsList}function ba(I,X){const Q=O.get(I);Q.outputColorSpace=X.outputColorSpace,Q.batching=X.batching,Q.instancing=X.instancing,Q.instancingColor=X.instancingColor,Q.instancingMorph=X.instancingMorph,Q.skinning=X.skinning,Q.morphTargets=X.morphTargets,Q.morphNormals=X.morphNormals,Q.morphColors=X.morphColors,Q.morphTargetsCount=X.morphTargetsCount,Q.numClippingPlanes=X.numClippingPlanes,Q.numIntersection=X.numClipIntersection,Q.vertexAlphas=X.vertexAlphas,Q.vertexTangents=X.vertexTangents,Q.toneMapping=X.toneMapping}function ml(I,X,Q,ee,Z){X.isScene!==!0&&(X=qe),A.resetTextureUnits();const Te=X.fog,Fe=ee.isMeshStandardMaterial?X.environment:null,ze=D===null?E.outputColorSpace:D.isXRRenderTarget===!0?D.texture.colorSpace:gn,Ke=(ee.isMeshStandardMaterial?oe:te).get(ee.envMap||Fe),Ze=ee.vertexColors===!0&&!!Q.attributes.color&&Q.attributes.color.itemSize===4,Qe=!!Q.attributes.tangent&&(!!ee.normalMap||ee.anisotropy>0),nt=!!Q.morphAttributes.position,Xt=!!Q.morphAttributes.normal,Sn=!!Q.morphAttributes.color;let Jt=lr;ee.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(Jt=E.toneMapping);const Qn=Q.morphAttributes.position||Q.morphAttributes.normal||Q.morphAttributes.color,kt=Qn!==void 0?Qn.length:0,rt=O.get(ee),To=x.state.lights;if(ie===!0&&(_e===!0||I!==C)){const Cn=I===C&&ee.id===k;be.setState(ee,I,Cn)}let Bt=!1;ee.version===rt.__version?(rt.needsLights&&rt.lightsStateVersion!==To.state.version||rt.outputColorSpace!==ze||Z.isBatchedMesh&&rt.batching===!1||!Z.isBatchedMesh&&rt.batching===!0||Z.isInstancedMesh&&rt.instancing===!1||!Z.isInstancedMesh&&rt.instancing===!0||Z.isSkinnedMesh&&rt.skinning===!1||!Z.isSkinnedMesh&&rt.skinning===!0||Z.isInstancedMesh&&rt.instancingColor===!0&&Z.instanceColor===null||Z.isInstancedMesh&&rt.instancingColor===!1&&Z.instanceColor!==null||Z.isInstancedMesh&&rt.instancingMorph===!0&&Z.morphTexture===null||Z.isInstancedMesh&&rt.instancingMorph===!1&&Z.morphTexture!==null||rt.envMap!==Ke||ee.fog===!0&&rt.fog!==Te||rt.numClippingPlanes!==void 0&&(rt.numClippingPlanes!==be.numPlanes||rt.numIntersection!==be.numIntersection)||rt.vertexAlphas!==Ze||rt.vertexTangents!==Qe||rt.morphTargets!==nt||rt.morphNormals!==Xt||rt.morphColors!==Sn||rt.toneMapping!==Jt||rt.morphTargetsCount!==kt)&&(Bt=!0):(Bt=!0,rt.__version=ee.version);let Ci=rt.currentProgram;Bt===!0&&(Ci=ms(ee,X,Z));let Ao=!1,ur=!1,zr=!1;const un=Ci.getUniforms(),fi=rt.uniforms;if(ke.useProgram(Ci.program)&&(Ao=!0,ur=!0,zr=!0),ee.id!==k&&(k=ee.id,ur=!0),Ao||C!==I){un.setValue(Y,"projectionMatrix",I.projectionMatrix),un.setValue(Y,"viewMatrix",I.matrixWorldInverse);const Cn=un.map.cameraPosition;Cn!==void 0&&Cn.setValue(Y,je.setFromMatrixPosition(I.matrixWorld)),Et.logarithmicDepthBuffer&&un.setValue(Y,"logDepthBufFC",2/(Math.log(I.far+1)/Math.LN2)),(ee.isMeshPhongMaterial||ee.isMeshToonMaterial||ee.isMeshLambertMaterial||ee.isMeshBasicMaterial||ee.isMeshStandardMaterial||ee.isShaderMaterial)&&un.setValue(Y,"isOrthographic",I.isOrthographicCamera===!0),C!==I&&(C=I,ur=!0,zr=!0)}if(Z.isSkinnedMesh){un.setOptional(Y,Z,"bindMatrix"),un.setOptional(Y,Z,"bindMatrixInverse");const Cn=Z.skeleton;Cn&&(Cn.boneTexture===null&&Cn.computeBoneTexture(),un.setValue(Y,"boneTexture",Cn.boneTexture,A))}Z.isBatchedMesh&&(un.setOptional(Y,Z,"batchingTexture"),un.setValue(Y,"batchingTexture",Z._matricesTexture,A));const fr=Q.morphAttributes;if((fr.position!==void 0||fr.normal!==void 0||fr.color!==void 0)&&Le.update(Z,Q,Ci),(ur||rt.receiveShadow!==Z.receiveShadow)&&(rt.receiveShadow=Z.receiveShadow,un.setValue(Y,"receiveShadow",Z.receiveShadow)),ee.isMeshGouraudMaterial&&ee.envMap!==null&&(fi.envMap.value=Ke,fi.flipEnvMap.value=Ke.isCubeTexture&&Ke.isRenderTargetTexture===!1?-1:1),ee.isMeshStandardMaterial&&ee.envMap===null&&X.environment!==null&&(fi.envMapIntensity.value=X.environmentIntensity),ur&&(un.setValue(Y,"toneMappingExposure",E.toneMappingExposure),rt.needsLights&&gl(fi,zr),Te&&ee.fog===!0&&De.refreshFogUniforms(fi,Te),De.refreshMaterialUniforms(fi,ee,me,he,x.state.transmissionRenderTarget),qc.upload(Y,Ea(rt),fi,A)),ee.isShaderMaterial&&ee.uniformsNeedUpdate===!0&&(qc.upload(Y,Ea(rt),fi,A),ee.uniformsNeedUpdate=!1),ee.isSpriteMaterial&&un.setValue(Y,"center",Z.center),un.setValue(Y,"modelViewMatrix",Z.modelViewMatrix),un.setValue(Y,"normalMatrix",Z.normalMatrix),un.setValue(Y,"modelMatrix",Z.matrixWorld),ee.isShaderMaterial||ee.isRawShaderMaterial){const Cn=ee.uniformsGroups;for(let wo=0,Ta=Cn.length;wo<Ta;wo++){const Ro=Cn[wo];St.update(Ro,Ci),St.bind(Ro,Ci)}}return Ci}function gl(I,X){I.ambientLightColor.needsUpdate=X,I.lightProbe.needsUpdate=X,I.directionalLights.needsUpdate=X,I.directionalLightShadows.needsUpdate=X,I.pointLights.needsUpdate=X,I.pointLightShadows.needsUpdate=X,I.spotLights.needsUpdate=X,I.spotLightShadows.needsUpdate=X,I.rectAreaLights.needsUpdate=X,I.hemisphereLights.needsUpdate=X}function _l(I){return I.isMeshLambertMaterial||I.isMeshToonMaterial||I.isMeshPhongMaterial||I.isMeshStandardMaterial||I.isShadowMaterial||I.isShaderMaterial&&I.lights===!0}this.getActiveCubeFace=function(){return B},this.getActiveMipmapLevel=function(){return N},this.getRenderTarget=function(){return D},this.setRenderTargetTextures=function(I,X,Q){O.get(I.texture).__webglTexture=X,O.get(I.depthTexture).__webglTexture=Q;const ee=O.get(I);ee.__hasExternalTextures=!0,ee.__autoAllocateDepthBuffer=Q===void 0,ee.__autoAllocateDepthBuffer||Ve.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ee.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(I,X){const Q=O.get(I);Q.__webglFramebuffer=X,Q.__useDefaultFramebuffer=X===void 0},this.setRenderTarget=function(I,X=0,Q=0){D=I,B=X,N=Q;let ee=!0,Z=null,Te=!1,Fe=!1;if(I){const Ke=O.get(I);Ke.__useDefaultFramebuffer!==void 0?(ke.bindFramebuffer(Y.FRAMEBUFFER,null),ee=!1):Ke.__webglFramebuffer===void 0?A.setupRenderTarget(I):Ke.__hasExternalTextures&&A.rebindTextures(I,O.get(I.texture).__webglTexture,O.get(I.depthTexture).__webglTexture);const Ze=I.texture;(Ze.isData3DTexture||Ze.isDataArrayTexture||Ze.isCompressedArrayTexture)&&(Fe=!0);const Qe=O.get(I).__webglFramebuffer;I.isWebGLCubeRenderTarget?(Array.isArray(Qe[X])?Z=Qe[X][Q]:Z=Qe[X],Te=!0):I.samples>0&&A.useMultisampledRTT(I)===!1?Z=O.get(I).__webglMultisampledFramebuffer:Array.isArray(Qe)?Z=Qe[Q]:Z=Qe,T.copy(I.viewport),W.copy(I.scissor),j=I.scissorTest}else T.copy(pe).multiplyScalar(me).floor(),W.copy(Ee).multiplyScalar(me).floor(),j=Je;if(ke.bindFramebuffer(Y.FRAMEBUFFER,Z)&&ee&&ke.drawBuffers(I,Z),ke.viewport(T),ke.scissor(W),ke.setScissorTest(j),Te){const Ke=O.get(I.texture);Y.framebufferTexture2D(Y.FRAMEBUFFER,Y.COLOR_ATTACHMENT0,Y.TEXTURE_CUBE_MAP_POSITIVE_X+X,Ke.__webglTexture,Q)}else if(Fe){const Ke=O.get(I.texture),Ze=X||0;Y.framebufferTextureLayer(Y.FRAMEBUFFER,Y.COLOR_ATTACHMENT0,Ke.__webglTexture,Q||0,Ze)}k=-1},this.readRenderTargetPixels=function(I,X,Q,ee,Z,Te,Fe){if(!(I&&I.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ze=O.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&Fe!==void 0&&(ze=ze[Fe]),ze){ke.bindFramebuffer(Y.FRAMEBUFFER,ze);try{const Ke=I.texture,Ze=Ke.format,Qe=Ke.type;if(Ze!==Ei&&yt.convert(Ze)!==Y.getParameter(Y.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const nt=Qe===el&&(Ve.has("EXT_color_buffer_half_float")||Ve.has("EXT_color_buffer_float"));if(Qe!==Fr&&yt.convert(Qe)!==Y.getParameter(Y.IMPLEMENTATION_COLOR_READ_TYPE)&&Qe!==Oi&&!nt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}X>=0&&X<=I.width-ee&&Q>=0&&Q<=I.height-Z&&Y.readPixels(X,Q,ee,Z,yt.convert(Ze),yt.convert(Qe),Te)}finally{const Ke=D!==null?O.get(D).__webglFramebuffer:null;ke.bindFramebuffer(Y.FRAMEBUFFER,Ke)}}},this.copyFramebufferToTexture=function(I,X,Q=0){const ee=Math.pow(2,-Q),Z=Math.floor(X.image.width*ee),Te=Math.floor(X.image.height*ee);A.setTexture2D(X,0),Y.copyTexSubImage2D(Y.TEXTURE_2D,Q,0,0,I.x,I.y,Z,Te),ke.unbindTexture()},this.copyTextureToTexture=function(I,X,Q,ee=0){const Z=X.image.width,Te=X.image.height,Fe=yt.convert(Q.format),ze=yt.convert(Q.type);A.setTexture2D(Q,0),Y.pixelStorei(Y.UNPACK_FLIP_Y_WEBGL,Q.flipY),Y.pixelStorei(Y.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Q.premultiplyAlpha),Y.pixelStorei(Y.UNPACK_ALIGNMENT,Q.unpackAlignment),X.isDataTexture?Y.texSubImage2D(Y.TEXTURE_2D,ee,I.x,I.y,Z,Te,Fe,ze,X.image.data):X.isCompressedTexture?Y.compressedTexSubImage2D(Y.TEXTURE_2D,ee,I.x,I.y,X.mipmaps[0].width,X.mipmaps[0].height,Fe,X.mipmaps[0].data):Y.texSubImage2D(Y.TEXTURE_2D,ee,I.x,I.y,Fe,ze,X.image),ee===0&&Q.generateMipmaps&&Y.generateMipmap(Y.TEXTURE_2D),ke.unbindTexture()},this.copyTextureToTexture3D=function(I,X,Q,ee,Z=0){const Te=Math.round(I.max.x-I.min.x),Fe=Math.round(I.max.y-I.min.y),ze=I.max.z-I.min.z+1,Ke=yt.convert(ee.format),Ze=yt.convert(ee.type);let Qe;if(ee.isData3DTexture)A.setTexture3D(ee,0),Qe=Y.TEXTURE_3D;else if(ee.isDataArrayTexture||ee.isCompressedArrayTexture)A.setTexture2DArray(ee,0),Qe=Y.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Y.pixelStorei(Y.UNPACK_FLIP_Y_WEBGL,ee.flipY),Y.pixelStorei(Y.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ee.premultiplyAlpha),Y.pixelStorei(Y.UNPACK_ALIGNMENT,ee.unpackAlignment);const nt=Y.getParameter(Y.UNPACK_ROW_LENGTH),Xt=Y.getParameter(Y.UNPACK_IMAGE_HEIGHT),Sn=Y.getParameter(Y.UNPACK_SKIP_PIXELS),Jt=Y.getParameter(Y.UNPACK_SKIP_ROWS),Qn=Y.getParameter(Y.UNPACK_SKIP_IMAGES),kt=Q.isCompressedTexture?Q.mipmaps[Z]:Q.image;Y.pixelStorei(Y.UNPACK_ROW_LENGTH,kt.width),Y.pixelStorei(Y.UNPACK_IMAGE_HEIGHT,kt.height),Y.pixelStorei(Y.UNPACK_SKIP_PIXELS,I.min.x),Y.pixelStorei(Y.UNPACK_SKIP_ROWS,I.min.y),Y.pixelStorei(Y.UNPACK_SKIP_IMAGES,I.min.z),Q.isDataTexture||Q.isData3DTexture?Y.texSubImage3D(Qe,Z,X.x,X.y,X.z,Te,Fe,ze,Ke,Ze,kt.data):ee.isCompressedArrayTexture?Y.compressedTexSubImage3D(Qe,Z,X.x,X.y,X.z,Te,Fe,ze,Ke,kt.data):Y.texSubImage3D(Qe,Z,X.x,X.y,X.z,Te,Fe,ze,Ke,Ze,kt),Y.pixelStorei(Y.UNPACK_ROW_LENGTH,nt),Y.pixelStorei(Y.UNPACK_IMAGE_HEIGHT,Xt),Y.pixelStorei(Y.UNPACK_SKIP_PIXELS,Sn),Y.pixelStorei(Y.UNPACK_SKIP_ROWS,Jt),Y.pixelStorei(Y.UNPACK_SKIP_IMAGES,Qn),Z===0&&ee.generateMipmaps&&Y.generateMipmap(Qe),ke.unbindTexture()},this.initTexture=function(I){I.isCubeTexture?A.setTextureCube(I,0):I.isData3DTexture?A.setTexture3D(I,0):I.isDataArrayTexture||I.isCompressedArrayTexture?A.setTexture2DArray(I,0):A.setTexture2D(I,0),ke.unbindTexture()},this.resetState=function(){B=0,N=0,D=null,ke.reset(),pt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ar}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Wu?"display-p3":"srgb",t.unpackColorSpace=Ct.workingColorSpace===hl?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class hC extends _t{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 Ti,this.environmentIntensity=1,this.environmentRotation=new Ti,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}}class v_{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=bu,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=bi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return t_("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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,o=this.stride;i<o;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=bi()),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=bi()),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 Dn=new U;class va{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++)Dn.fromBufferAttribute(this,t),Dn.applyMatrix4(e),this.setXYZ(t,Dn.x,Dn.y,Dn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Dn.fromBufferAttribute(this,t),Dn.applyNormalMatrix(e),this.setXYZ(t,Dn.x,Dn.y,Dn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Dn.fromBufferAttribute(this,t),Dn.transformDirection(e),this.setXYZ(t,Dn.x,Dn.y,Dn.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Si(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Lt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Lt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Lt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Lt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Lt(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=Si(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Si(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Si(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Si(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Lt(t,this.array),n=Lt(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=Lt(t,this.array),n=Lt(n,this.array),i=Lt(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,o){return e=e*this.data.stride+this.offset,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),i=Lt(i,this.array),o=Lt(o,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]=o,this}clone(e){if(e===void 0){console.log("THREE.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 o=0;o<this.itemSize;o++)t.push(this.data.array[i+o])}return new cn(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 va(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.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 o=0;o<this.itemSize;o++)t.push(this.data.array[i+o])}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}}}class x_ extends ui{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ne(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 Ks;const qo=new U,Zs=new U,$s=new U,Js=new Ie,Ko=new Ie,y_=new $e,Ic=new U,Zo=new U,Dc=new U,jm=new Ie,ru=new Ie,qm=new Ie;class uC extends _t{constructor(e=new x_){if(super(),this.isSprite=!0,this.type="Sprite",Ks===void 0){Ks=new $t;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 v_(t,5);Ks.setIndex([0,1,2,0,2,3]),Ks.setAttribute("position",new va(n,3,0,!1)),Ks.setAttribute("uv",new va(n,2,3,!1))}this.geometry=Ks,this.material=e,this.center=new Ie(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Zs.setFromMatrixScale(this.matrixWorld),y_.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),$s.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Zs.multiplyScalar(-$s.z);const n=this.material.rotation;let i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));const c=this.center;Uc(Ic.set(-.5,-.5,0),$s,c,Zs,i,o),Uc(Zo.set(.5,-.5,0),$s,c,Zs,i,o),Uc(Dc.set(.5,.5,0),$s,c,Zs,i,o),jm.set(0,0),ru.set(1,0),qm.set(1,1);let l=e.ray.intersectTriangle(Ic,Zo,Dc,!1,qo);if(l===null&&(Uc(Zo.set(-.5,.5,0),$s,c,Zs,i,o),ru.set(0,1),l=e.ray.intersectTriangle(Ic,Dc,Zo,!1,qo),l===null))return;const u=e.ray.origin.distanceTo(qo);u<e.near||u>e.far||t.push({distance:u,point:qo.clone(),uv:Mi.getInterpolation(qo,Ic,Zo,Dc,jm,ru,qm,new Ie),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 Uc(s,e,t,n,i,o){Js.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(Ko.x=o*Js.x-i*Js.y,Ko.y=i*Js.x+o*Js.y):Ko.copy(Js),s.copy(e),s.x+=Ko.x,s.y+=Ko.y,s.applyMatrix4(y_)}const Km=new U,Zm=new Dt,$m=new Dt,fC=new U,Jm=new $e,Oc=new U,su=new Hi,Qm=new $e,ou=new vo;class dC extends ye{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Rp,this.bindMatrix=new $e,this.bindMatrixInverse=new $e,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Ai),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Oc),this.boundingBox.expandByPoint(Oc)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Hi),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Oc),this.boundingSphere.expandByPoint(Oc)}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(),su.copy(this.boundingSphere),su.applyMatrix4(i),e.ray.intersectsSphere(su)!==!1&&(Qm.copy(i).invert(),ou.copy(e.ray).applyMatrix4(Qm),!(this.boundingBox!==null&&ou.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,ou)))}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 Dt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const o=1/e.manhattanLength();o!==1/0?e.multiplyScalar(o):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Rp?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===vb?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Zm.fromBufferAttribute(i.attributes.skinIndex,e),$m.fromBufferAttribute(i.attributes.skinWeight,e),Km.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let o=0;o<4;o++){const c=$m.getComponent(o);if(c!==0){const l=Zm.getComponent(o);Jm.multiplyMatrices(n.bones[l].matrixWorld,n.boneInverses[l]),t.addScaledVector(fC.copy(Km).applyMatrix4(Jm),c)}}return t.applyMatrix4(this.bindMatrixInverse)}}class S_ extends _t{constructor(){super(),this.isBone=!0,this.type="Bone"}}class M_ extends an{constructor(e=null,t=1,n=1,i,o,c,l,u,f=Nn,d=Nn,p,m){super(null,c,l,u,f,d,i,o,p,m),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const eg=new $e,pC=new $e;class Ku{constructor(e=[],t=[]){this.uuid=bi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=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){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new $e)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new $e;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 o=0,c=e.length;o<c;o++){const l=e[o]?e[o].matrixWorld:pC;eg.multiplyMatrices(l,t[o]),eg.toArray(n,o*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Ku(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 M_(t,e,e,Ei,Oi);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 o=e.bones[n];let c=t[o];c===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",o),c=new S_),this.bones.push(c),this.boneInverses.push(new $e().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,o=t.length;i<o;i++){const c=t[i];e.bones.push(c.uuid);const l=n[i];e.boneInverses.push(l.toArray())}return e}}class Au extends cn{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 Qs=new $e,tg=new $e,Nc=[],ng=new Ai,mC=new $e,$o=new ye,Jo=new Hi;class gC extends ye{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Au(new Float32Array(n*16),16),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,mC)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Ai),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Qs),ng.copy(e.boundingBox).applyMatrix4(Qs),this.boundingBox.union(ng)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Hi),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Qs),Jo.copy(e.boundingSphere).applyMatrix4(Qs),this.boundingSphere.union(Jo)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),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,o=n.length+1,c=e*o+1;for(let l=0;l<n.length;l++)n[l]=i[c+l]}raycast(e,t){const n=this.matrixWorld,i=this.count;if($o.geometry=this.geometry,$o.material=this.material,$o.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Jo.copy(this.boundingSphere),Jo.applyMatrix4(n),e.ray.intersectsSphere(Jo)!==!1))for(let o=0;o<i;o++){this.getMatrixAt(o,Qs),tg.multiplyMatrices(n,Qs),$o.matrixWorld=tg,$o.raycast(e,Nc);for(let c=0,l=Nc.length;c<l;c++){const u=Nc[c];u.instanceId=o,u.object=this,t.push(u)}Nc.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Au(new Float32Array(this.instanceMatrix.count*3),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 M_(new Float32Array(i*this.count),i,this.count,Yg,Oi));const o=this.morphTexture.source.data.data;let c=0;for(let f=0;f<n.length;f++)c+=n[f];const l=this.geometry.morphTargetsRelative?1:1-c,u=i*e;o[u]=l,o.set(n,u+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}class yo extends ui{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ne(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 ig=new U,rg=new U,sg=new $e,au=new vo,Fc=new Hi;class hi extends _t{constructor(e=new $t,t=new yo){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,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,o=t.count;i<o;i++)ig.fromBufferAttribute(t,i-1),rg.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=ig.distanceTo(rg);e.setAttribute("lineDistance",new Nt(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,o=e.params.Line.threshold,c=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Fc.copy(n.boundingSphere),Fc.applyMatrix4(i),Fc.radius+=o,e.ray.intersectsSphere(Fc)===!1)return;sg.copy(i).invert(),au.copy(e.ray).applyMatrix4(sg);const l=o/((this.scale.x+this.scale.y+this.scale.z)/3),u=l*l,f=new U,d=new U,p=new U,m=new U,v=this.isLineSegments?2:1,S=n.index,x=n.attributes.position;if(S!==null){const _=Math.max(0,c.start),R=Math.min(S.count,c.start+c.count);for(let E=_,L=R-1;E<L;E+=v){const B=S.getX(E),N=S.getX(E+1);if(f.fromBufferAttribute(x,B),d.fromBufferAttribute(x,N),au.distanceSqToSegment(f,d,m,p)>u)continue;m.applyMatrix4(this.matrixWorld);const k=e.ray.origin.distanceTo(m);k<e.near||k>e.far||t.push({distance:k,point:p.clone().applyMatrix4(this.matrixWorld),index:E,face:null,faceIndex:null,object:this})}}else{const _=Math.max(0,c.start),R=Math.min(x.count,c.start+c.count);for(let E=_,L=R-1;E<L;E+=v){if(f.fromBufferAttribute(x,E),d.fromBufferAttribute(x,E+1),au.distanceSqToSegment(f,d,m,p)>u)continue;m.applyMatrix4(this.matrixWorld);const N=e.ray.origin.distanceTo(m);N<e.near||N>e.far||t.push({distance:N,point:p.clone().applyMatrix4(this.matrixWorld),index:E,face:null,faceIndex:null,object: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 o=0,c=i.length;o<c;o++){const l=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=o}}}}}const og=new U,ag=new U;class Zu extends hi{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,o=t.count;i<o;i+=2)og.fromBufferAttribute(t,i),ag.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+og.distanceTo(ag);e.setAttribute("lineDistance",new Nt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class _C extends hi{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class E_ extends ui{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ne(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 cg=new $e,wu=new vo,Bc=new Hi,zc=new U;class vC extends _t{constructor(e=new $t,t=new E_){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,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,o=e.params.Points.threshold,c=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Bc.copy(n.boundingSphere),Bc.applyMatrix4(i),Bc.radius+=o,e.ray.intersectsSphere(Bc)===!1)return;cg.copy(i).invert(),wu.copy(e.ray).applyMatrix4(cg);const l=o/((this.scale.x+this.scale.y+this.scale.z)/3),u=l*l,f=n.index,p=n.attributes.position;if(f!==null){const m=Math.max(0,c.start),v=Math.min(f.count,c.start+c.count);for(let S=m,b=v;S<b;S++){const x=f.getX(S);zc.fromBufferAttribute(p,x),lg(zc,x,u,i,e,t,this)}}else{const m=Math.max(0,c.start),v=Math.min(p.count,c.start+c.count);for(let S=m,b=v;S<b;S++)zc.fromBufferAttribute(p,S),lg(zc,S,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 o=0,c=i.length;o<c;o++){const l=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=o}}}}}function lg(s,e,t,n,i,o,c){const l=wu.distanceSqToPoint(s);if(l<t){const u=new U;wu.closestPointToPoint(s,u),u.applyMatrix4(n);const f=i.ray.origin.distanceTo(u);if(f<i.near||f>i.far)return;o.push({distance:f,distanceToRay:Math.sqrt(l),point:u,index:e,face:null,object:c})}}class pn extends $t{constructor(e=1,t=1,n=1,i=32,o=1,c=!1,l=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:o,openEnded:c,thetaStart:l,thetaLength:u};const f=this;i=Math.floor(i),o=Math.floor(o);const d=[],p=[],m=[],v=[];let S=0;const b=[],x=n/2;let _=0;R(),c===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(d),this.setAttribute("position",new Nt(p,3)),this.setAttribute("normal",new Nt(m,3)),this.setAttribute("uv",new Nt(v,2));function R(){const L=new U,B=new U;let N=0;const D=(t-e)/n;for(let k=0;k<=o;k++){const C=[],T=k/o,W=T*(t-e)+e;for(let j=0;j<=i;j++){const H=j/i,K=H*u+l,ne=Math.sin(K),he=Math.cos(K);B.x=W*ne,B.y=-T*n+x,B.z=W*he,p.push(B.x,B.y,B.z),L.set(ne,D,he).normalize(),m.push(L.x,L.y,L.z),v.push(H,1-T),C.push(S++)}b.push(C)}for(let k=0;k<i;k++)for(let C=0;C<o;C++){const T=b[C][k],W=b[C+1][k],j=b[C+1][k+1],H=b[C][k+1];d.push(T,W,H),d.push(W,j,H),N+=6}f.addGroup(_,N,0),_+=N}function E(L){const B=S,N=new Ie,D=new U;let k=0;const C=L===!0?e:t,T=L===!0?1:-1;for(let j=1;j<=i;j++)p.push(0,x*T,0),m.push(0,T,0),v.push(.5,.5),S++;const W=S;for(let j=0;j<=i;j++){const K=j/i*u+l,ne=Math.cos(K),he=Math.sin(K);D.x=C*he,D.y=x*T,D.z=C*ne,p.push(D.x,D.y,D.z),m.push(0,T,0),N.x=ne*.5+.5,N.y=he*.5*T+.5,v.push(N.x,N.y),S++}for(let j=0;j<i;j++){const H=B+j,K=W+j;L===!0?d.push(K,K+1,H):d.push(K+1,K,H),k+=3}f.addGroup(_,k,L===!0?1:2),_+=k}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new pn(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class $u extends pn{constructor(e=1,t=1,n=32,i=1,o=!1,c=0,l=Math.PI*2){super(0,e,t,n,i,o,c,l),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:o,thetaStart:c,thetaLength:l}}static fromJSON(e){return new $u(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Ju extends $t{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const o=[],c=[];l(i),f(n),d(),this.setAttribute("position",new Nt(o,3)),this.setAttribute("normal",new Nt(o.slice(),3)),this.setAttribute("uv",new Nt(c,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function l(R){const E=new U,L=new U,B=new U;for(let N=0;N<t.length;N+=3)v(t[N+0],E),v(t[N+1],L),v(t[N+2],B),u(E,L,B,R)}function u(R,E,L,B){const N=B+1,D=[];for(let k=0;k<=N;k++){D[k]=[];const C=R.clone().lerp(L,k/N),T=E.clone().lerp(L,k/N),W=N-k;for(let j=0;j<=W;j++)j===0&&k===N?D[k][j]=C:D[k][j]=C.clone().lerp(T,j/W)}for(let k=0;k<N;k++)for(let C=0;C<2*(N-k)-1;C++){const T=Math.floor(C/2);C%2===0?(m(D[k][T+1]),m(D[k+1][T]),m(D[k][T])):(m(D[k][T+1]),m(D[k+1][T+1]),m(D[k+1][T]))}}function f(R){const E=new U;for(let L=0;L<o.length;L+=3)E.x=o[L+0],E.y=o[L+1],E.z=o[L+2],E.normalize().multiplyScalar(R),o[L+0]=E.x,o[L+1]=E.y,o[L+2]=E.z}function d(){const R=new U;for(let E=0;E<o.length;E+=3){R.x=o[E+0],R.y=o[E+1],R.z=o[E+2];const L=x(R)/2/Math.PI+.5,B=_(R)/Math.PI+.5;c.push(L,1-B)}S(),p()}function p(){for(let R=0;R<c.length;R+=6){const E=c[R+0],L=c[R+2],B=c[R+4],N=Math.max(E,L,B),D=Math.min(E,L,B);N>.9&&D<.1&&(E<.2&&(c[R+0]+=1),L<.2&&(c[R+2]+=1),B<.2&&(c[R+4]+=1))}}function m(R){o.push(R.x,R.y,R.z)}function v(R,E){const L=R*3;E.x=e[L+0],E.y=e[L+1],E.z=e[L+2]}function S(){const R=new U,E=new U,L=new U,B=new U,N=new Ie,D=new Ie,k=new Ie;for(let C=0,T=0;C<o.length;C+=9,T+=6){R.set(o[C+0],o[C+1],o[C+2]),E.set(o[C+3],o[C+4],o[C+5]),L.set(o[C+6],o[C+7],o[C+8]),N.set(c[T+0],c[T+1]),D.set(c[T+2],c[T+3]),k.set(c[T+4],c[T+5]),B.copy(R).add(E).add(L).divideScalar(3);const W=x(B);b(N,T+0,R,W),b(D,T+2,E,W),b(k,T+4,L,W)}}function b(R,E,L,B){B<0&&R.x===1&&(c[E]=R.x-1),L.x===0&&L.z===0&&(c[E]=B/2/Math.PI+.5)}function x(R){return Math.atan2(R.z,-R.x)}function _(R){return Math.atan2(-R.y,Math.sqrt(R.x*R.x+R.z*R.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ju(e.vertices,e.indices,e.radius,e.details)}}class no extends Ju{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 no(e.radius,e.detail)}}class ya extends $t{constructor(e=1,t=32,n=16,i=0,o=Math.PI*2,c=0,l=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:o,thetaStart:c,thetaLength:l},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const u=Math.min(c+l,Math.PI);let f=0;const d=[],p=new U,m=new U,v=[],S=[],b=[],x=[];for(let _=0;_<=n;_++){const R=[],E=_/n;let L=0;_===0&&c===0?L=.5/t:_===n&&u===Math.PI&&(L=-.5/t);for(let B=0;B<=t;B++){const N=B/t;p.x=-e*Math.cos(i+N*o)*Math.sin(c+E*l),p.y=e*Math.cos(c+E*l),p.z=e*Math.sin(i+N*o)*Math.sin(c+E*l),S.push(p.x,p.y,p.z),m.copy(p).normalize(),b.push(m.x,m.y,m.z),x.push(N+L,1-E),R.push(f++)}d.push(R)}for(let _=0;_<n;_++)for(let R=0;R<t;R++){const E=d[_][R+1],L=d[_][R],B=d[_+1][R],N=d[_+1][R+1];(_!==0||c>0)&&v.push(E,L,N),(_!==n-1||u<Math.PI)&&v.push(L,B,N)}this.setIndex(v),this.setAttribute("position",new Nt(S,3)),this.setAttribute("normal",new Nt(b,3)),this.setAttribute("uv",new Nt(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ya(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class cs extends $t{constructor(e=1,t=.4,n=12,i=48,o=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:o},n=Math.floor(n),i=Math.floor(i);const c=[],l=[],u=[],f=[],d=new U,p=new U,m=new U;for(let v=0;v<=n;v++)for(let S=0;S<=i;S++){const b=S/i*o,x=v/n*Math.PI*2;p.x=(e+t*Math.cos(x))*Math.cos(b),p.y=(e+t*Math.cos(x))*Math.sin(b),p.z=t*Math.sin(x),l.push(p.x,p.y,p.z),d.x=e*Math.cos(b),d.y=e*Math.sin(b),m.subVectors(p,d).normalize(),u.push(m.x,m.y,m.z),f.push(S/i),f.push(v/n)}for(let v=1;v<=n;v++)for(let S=1;S<=i;S++){const b=(i+1)*v+S-1,x=(i+1)*(v-1)+S-1,_=(i+1)*(v-1)+S,R=(i+1)*v+S;c.push(b,x,R),c.push(x,_,R)}this.setIndex(c),this.setAttribute("position",new Nt(l,3)),this.setAttribute("normal",new Nt(u,3)),this.setAttribute("uv",new Nt(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new cs(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class xC extends ui{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ne(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}}class So extends ui{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Ne(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 Ne(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Jg,this.normalScale=new Ie(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 Ti,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 hr extends So{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 Ie(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return xn(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 Ne(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 Ne(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ne(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=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 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.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 yC extends yo{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 kc(s,e,t){return!s||!t&&s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function SC(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function MC(s){function e(i,o){return s[i]-s[o]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function hg(s,e,t){const n=s.length,i=new s.constructor(n);for(let o=0,c=0;c!==n;++o){const l=t[o]*e;for(let u=0;u!==e;++u)i[c++]=s[l+u]}return i}function b_(s,e,t,n){let i=1,o=s[0];for(;o!==void 0&&o[n]===void 0;)o=s[i++];if(o===void 0)return;let c=o[n];if(c!==void 0)if(Array.isArray(c))do c=o[n],c!==void 0&&(e.push(o.time),t.push.apply(t,c)),o=s[i++];while(o!==void 0);else if(c.toArray!==void 0)do c=o[n],c!==void 0&&(e.push(o.time),c.toArray(t,t.length)),o=s[i++];while(o!==void 0);else do c=o[n],c!==void 0&&(e.push(o.time),t.push(c)),o=s[i++];while(o!==void 0)}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],o=t[n-1];e:{t:{let c;n:{i:if(!(e<i)){for(let l=n+2;;){if(i===void 0){if(e<o)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===l)break;if(o=i,i=t[++n],e<i)break t}c=t.length;break n}if(!(e>=o)){const l=t[1];e<l&&(n=2,o=l);for(let u=n-2;;){if(o===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===u)break;if(i=o,o=t[--n-1],e>=o)break t}c=n,n=0;break n}break e}for(;n<c;){const l=n+c>>>1;e<t[l]?c=l:n=l+1}if(i=t[n],o=t[n-1],o===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,o,i)}return this.interpolate_(n,o,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,o=e*i;for(let c=0;c!==i;++c)t[c]=n[o+c];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class EC 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:em,endingEnd:em}}intervalChanged_(e,t,n){const i=this.parameterPositions;let o=e-2,c=e+1,l=i[o],u=i[c];if(l===void 0)switch(this.getSettings_().endingStart){case tm:o=e,l=2*t-n;break;case nm:o=i.length-2,l=t+i[o]-i[o+1];break;default:o=e,l=n}if(u===void 0)switch(this.getSettings_().endingEnd){case tm:c=e,u=2*n-t;break;case nm:c=1,u=n+i[1]-i[0];break;default:c=e-1,u=t}const f=(n-t)*.5,d=this.valueSize;this._weightPrev=f/(t-l),this._weightNext=f/(u-n),this._offsetPrev=o*d,this._offsetNext=c*d}interpolate_(e,t,n,i){const o=this.resultBuffer,c=this.sampleValues,l=this.valueSize,u=e*l,f=u-l,d=this._offsetPrev,p=this._offsetNext,m=this._weightPrev,v=this._weightNext,S=(n-t)/(i-t),b=S*S,x=b*S,_=-m*x+2*m*b-m*S,R=(1+m)*x+(-1.5-2*m)*b+(-.5+m)*S+1,E=(-1-v)*x+(1.5+v)*b+.5*S,L=v*x-v*b;for(let B=0;B!==l;++B)o[B]=_*c[d+B]+R*c[f+B]+E*c[u+B]+L*c[p+B];return o}}class bC extends Sa{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,c=this.sampleValues,l=this.valueSize,u=e*l,f=u-l,d=(n-t)/(i-t),p=1-d;for(let m=0;m!==l;++m)o[m]=c[f+m]*p+c[u+m]*d;return o}}class TC extends Sa{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Gi{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=kc(t,this.TimeBufferType),this.values=kc(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:kc(e.times,Array),values:kc(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new TC(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new bC(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new EC(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case ga:t=this.InterpolantFactoryMethodDiscrete;break;case fo:t=this.InterpolantFactoryMethodLinear;break;case Ih:t=this.InterpolantFactoryMethodSmooth;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 console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ga;case this.InterpolantFactoryMethodLinear:return fo;case this.InterpolantFactoryMethodSmooth:return Ih}}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 o=0,c=i-1;for(;o!==i&&n[o]<e;)++o;for(;c!==-1&&n[c]>t;)--c;if(++c,o!==0||c!==i){o>=c&&(c=Math.max(c,1),o=c-1);const l=this.getValueSize();this.times=n.slice(o,c),this.values=this.values.slice(o*l,c*l)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,o=n.length;o===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let c=null;for(let l=0;l!==o;l++){const u=n[l];if(typeof u=="number"&&isNaN(u)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,l,u),e=!1;break}if(c!==null&&c>u){console.error("THREE.KeyframeTrack: Out of order keys.",this,l,u,c),e=!1;break}c=u}if(i!==void 0&&SC(i))for(let l=0,u=i.length;l!==u;++l){const f=i[l];if(isNaN(f)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,f),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Ih,o=e.length-1;let c=1;for(let l=1;l<o;++l){let u=!1;const f=e[l],d=e[l+1];if(f!==d&&(l!==1||f!==e[0]))if(i)u=!0;else{const p=l*n,m=p-n,v=p+n;for(let S=0;S!==n;++S){const b=t[p+S];if(b!==t[m+S]||b!==t[v+S]){u=!0;break}}}if(u){if(l!==c){e[c]=e[l];const p=l*n,m=c*n;for(let v=0;v!==n;++v)t[m+v]=t[p+v]}++c}}if(o>0){e[c]=e[o];for(let l=o*n,u=c*n,f=0;f!==n;++f)t[u+f]=t[l+f];++c}return c!==e.length?(this.times=e.slice(0,c),this.values=t.slice(0,c*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}}Gi.prototype.TimeBufferType=Float32Array;Gi.prototype.ValueBufferType=Float32Array;Gi.prototype.DefaultInterpolation=fo;class Mo extends Gi{}Mo.prototype.ValueTypeName="bool";Mo.prototype.ValueBufferType=Array;Mo.prototype.DefaultInterpolation=ga;Mo.prototype.InterpolantFactoryMethodLinear=void 0;Mo.prototype.InterpolantFactoryMethodSmooth=void 0;class T_ extends Gi{}T_.prototype.ValueTypeName="color";class go extends Gi{}go.prototype.ValueTypeName="number";class AC extends Sa{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const o=this.resultBuffer,c=this.sampleValues,l=this.valueSize,u=(n-t)/(i-t);let f=e*l;for(let d=f+l;f!==d;f+=4)rn.slerpFlat(o,0,c,f-l,c,f,u);return o}}class us extends Gi{InterpolantFactoryMethodLinear(e){return new AC(this.times,this.values,this.getValueSize(),e)}}us.prototype.ValueTypeName="quaternion";us.prototype.DefaultInterpolation=fo;us.prototype.InterpolantFactoryMethodSmooth=void 0;class Eo extends Gi{}Eo.prototype.ValueTypeName="string";Eo.prototype.ValueBufferType=Array;Eo.prototype.DefaultInterpolation=ga;Eo.prototype.InterpolantFactoryMethodLinear=void 0;Eo.prototype.InterpolantFactoryMethodSmooth=void 0;class _o extends Gi{}_o.prototype.ValueTypeName="vector";class wC{constructor(e="",t=-1,n=[],i=Rb){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=bi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let c=0,l=n.length;c!==l;++c)t.push(CC(n[c]).scale(i));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let o=0,c=n.length;o!==c;++o)t.push(Gi.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const o=t.length,c=[];for(let l=0;l<o;l++){let u=[],f=[];u.push((l+o-1)%o,l,(l+1)%o),f.push(0,1,0);const d=MC(u);u=hg(u,1,d),f=hg(f,1,d),!i&&u[0]===0&&(u.push(o),f.push(f[0])),c.push(new go(".morphTargetInfluences["+t[l].name+"]",u,f).scale(1/n))}return new this(e,-1,c)}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={},o=/^([\w-]*?)([\d]+)$/;for(let l=0,u=e.length;l<u;l++){const f=e[l],d=f.name.match(o);if(d&&d.length>1){const p=d[1];let m=i[p];m||(i[p]=m=[]),m.push(f)}}const c=[];for(const l in i)c.push(this.CreateFromMorphTargetSequence(l,i[l],t,n));return c}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(p,m,v,S,b){if(v.length!==0){const x=[],_=[];b_(v,x,_,S),x.length!==0&&b.push(new p(m,x,_))}},i=[],o=e.name||"default",c=e.fps||30,l=e.blendMode;let u=e.length||-1;const f=e.hierarchy||[];for(let p=0;p<f.length;p++){const m=f[p].keys;if(!(!m||m.length===0))if(m[0].morphTargets){const v={};let S;for(S=0;S<m.length;S++)if(m[S].morphTargets)for(let b=0;b<m[S].morphTargets.length;b++)v[m[S].morphTargets[b]]=-1;for(const b in v){const x=[],_=[];for(let R=0;R!==m[S].morphTargets.length;++R){const E=m[S];x.push(E.time),_.push(E.morphTarget===b?1:0)}i.push(new go(".morphTargetInfluence["+b+"]",x,_))}u=v.length*c}else{const v=".bones["+t[p].name+"]";n(_o,v+".position",m,"pos",i),n(us,v+".quaternion",m,"rot",i),n(_o,v+".scale",m,"scl",i)}}return i.length===0?null:new this(o,u,i,l)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const o=this.tracks[n];t=Math.max(t,o.times[o.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function RC(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return go;case"vector":case"vector2":case"vector3":case"vector4":return _o;case"color":return T_;case"quaternion":return us;case"bool":case"boolean":return Mo;case"string":return Eo}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function CC(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=RC(s.type);if(s.times===void 0){const t=[],n=[];b_(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const Or={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(this.files[s]=e)},get:function(s){if(this.enabled!==!1)return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};class PC{constructor(e,t,n){const i=this;let o=!1,c=0,l=0,u;const f=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(d){l++,o===!1&&i.onStart!==void 0&&i.onStart(d,c,l),o=!0},this.itemEnd=function(d){c++,i.onProgress!==void 0&&i.onProgress(d,c,l),c===l&&(o=!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,p){return f.push(d,p),this},this.removeHandler=function(d){const p=f.indexOf(d);return p!==-1&&f.splice(p,2),this},this.getHandler=function(d){for(let p=0,m=f.length;p<m;p+=2){const v=f[p],S=f[p+1];if(v.global&&(v.lastIndex=0),v.test(d))return S}return null}}}const LC=new PC;class ps{constructor(e){this.manager=e!==void 0?e:LC,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,o){n.load(e,i,t,o)})}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}}ps.DEFAULT_MATERIAL_NAME="__DEFAULT";const rr={};class IC extends Error{constructor(e,t){super(e),this.response=t}}class sl extends ps{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=Or.get(e);if(o!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(o),this.manager.itemEnd(e)},0),o;if(rr[e]!==void 0){rr[e].push({onLoad:t,onProgress:n,onError:i});return}rr[e]=[],rr[e].push({onLoad:t,onProgress:n,onError:i});const c=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),l=this.mimeType,u=this.responseType;fetch(c).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const d=rr[e],p=f.body.getReader(),m=f.headers.get("Content-Length")||f.headers.get("X-File-Size"),v=m?parseInt(m):0,S=v!==0;let b=0;const x=new ReadableStream({start(_){R();function R(){p.read().then(({done:E,value:L})=>{if(E)_.close();else{b+=L.byteLength;const B=new ProgressEvent("progress",{lengthComputable:S,loaded:b,total:v});for(let N=0,D=d.length;N<D;N++){const k=d[N];k.onProgress&&k.onProgress(B)}_.enqueue(L),R()}})}}});return new Response(x)}else throw new IC(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(u){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(d=>new DOMParser().parseFromString(d,l));case"json":return f.json();default:if(l===void 0)return f.text();{const p=/charset="?([^;"\s]*)"?/i.exec(l),m=p&&p[1]?p[1].toLowerCase():void 0,v=new TextDecoder(m);return f.arrayBuffer().then(S=>v.decode(S))}}}).then(f=>{Or.add(e,f);const d=rr[e];delete rr[e];for(let p=0,m=d.length;p<m;p++){const v=d[p];v.onLoad&&v.onLoad(f)}}).catch(f=>{const d=rr[e];if(d===void 0)throw this.manager.itemError(e),f;delete rr[e];for(let p=0,m=d.length;p<m;p++){const v=d[p];v.onError&&v.onError(f)}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}}class DC extends ps{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,c=Or.get(e);if(c!==void 0)return o.manager.itemStart(e),setTimeout(function(){t&&t(c),o.manager.itemEnd(e)},0),c;const l=_a("img");function u(){d(),Or.add(e,this),t&&t(this),o.manager.itemEnd(e)}function f(p){d(),i&&i(p),o.manager.itemError(e),o.manager.itemEnd(e)}function d(){l.removeEventListener("load",u,!1),l.removeEventListener("error",f,!1)}return l.addEventListener("load",u,!1),l.addEventListener("error",f,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(l.crossOrigin=this.crossOrigin),o.manager.itemStart(e),l.src=e,l}}class UC extends ps{constructor(e){super(e)}load(e,t,n,i){const o=new an,c=new DC(this.manager);return c.setCrossOrigin(this.crossOrigin),c.setPath(this.path),c.load(e,function(l){o.image=l,o.needsUpdate=!0,t!==void 0&&t(o)},n,i),o}}class bo extends _t{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ne(e),this.intensity=t}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,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class OC extends bo{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(_t.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ne(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const cu=new $e,ug=new U,fg=new U;class Qu{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ie(512,512),this.map=null,this.mapPass=null,this.matrix=new $e,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ju,this._frameExtents=new Ie(1,1),this._viewportCount=1,this._viewports=[new Dt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;ug.setFromMatrixPosition(e.matrixWorld),t.position.copy(ug),fg.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(fg),t.updateMatrixWorld(),cu.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(cu),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(cu)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class NC extends Qu{constructor(){super(new On(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=po*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,o=e.distance||t.far;(n!==t.fov||i!==t.aspect||o!==t.far)&&(t.fov=n,t.aspect=i,t.far=o,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class FC extends bo{constructor(e,t,n=0,i=Math.PI/3,o=0,c=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(_t.DEFAULT_UP),this.updateMatrix(),this.target=new _t,this.distance=n,this.angle=i,this.penumbra=o,this.decay=c,this.map=null,this.shadow=new NC}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}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.shadow=e.shadow.clone(),this}}const dg=new $e,Qo=new U,lu=new U;class BC extends Qu{constructor(){super(new On(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ie(4,2),this._viewportCount=6,this._viewports=[new Dt(2,1,1,1),new Dt(0,1,1,1),new Dt(3,1,1,1),new Dt(1,1,1,1),new Dt(3,0,1,1),new Dt(1,0,1,1)],this._cubeDirections=[new U(1,0,0),new U(-1,0,0),new U(0,0,1),new U(0,0,-1),new U(0,1,0),new U(0,-1,0)],this._cubeUps=[new U(0,1,0),new U(0,1,0),new U(0,1,0),new U(0,1,0),new U(0,0,1),new U(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,o=e.distance||n.far;o!==n.far&&(n.far=o,n.updateProjectionMatrix()),Qo.setFromMatrixPosition(e.matrixWorld),n.position.copy(Qo),lu.copy(n.position),lu.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(lu),n.updateMatrixWorld(),i.makeTranslation(-Qo.x,-Qo.y,-Qo.z),dg.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(dg)}}class A_ extends bo{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 BC}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}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}}class zC extends Qu{constructor(){super(new ul(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class ef extends bo{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(_t.DEFAULT_UP),this.updateMatrix(),this.target=new _t,this.shadow=new zC}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class kC extends bo{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class HC{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new U)}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,o=e.z,c=this.coefficients;return t.copy(c[0]).multiplyScalar(.282095),t.addScaledVector(c[1],.488603*i),t.addScaledVector(c[2],.488603*o),t.addScaledVector(c[3],.488603*n),t.addScaledVector(c[4],1.092548*(n*i)),t.addScaledVector(c[5],1.092548*(i*o)),t.addScaledVector(c[6],.315392*(3*o*o-1)),t.addScaledVector(c[7],1.092548*(n*o)),t.addScaledVector(c[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,o=e.z,c=this.coefficients;return t.copy(c[0]).multiplyScalar(.886227),t.addScaledVector(c[1],2*.511664*i),t.addScaledVector(c[2],2*.511664*o),t.addScaledVector(c[3],2*.511664*n),t.addScaledVector(c[4],2*.429043*n*i),t.addScaledVector(c[5],2*.429043*i*o),t.addScaledVector(c[6],.743125*o*o-.247708),t.addScaledVector(c[7],2*.429043*n*o),t.addScaledVector(c[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,o=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*o,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*o,t[6]=.315392*(3*o*o-1),t[7]=1.092548*n*o,t[8]=.546274*(n*n-i*i)}}class GC extends bo{constructor(e=new HC,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class da{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}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 VC extends ps{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,c=Or.get(e);if(c!==void 0){if(o.manager.itemStart(e),c.then){c.then(f=>{t&&t(f),o.manager.itemEnd(e)}).catch(f=>{i&&i(f)});return}return setTimeout(function(){t&&t(c),o.manager.itemEnd(e)},0),c}const l={};l.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",l.headers=this.requestHeader;const u=fetch(e,l).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(f){return Or.add(e,f),t&&t(f),o.manager.itemEnd(e),f}).catch(function(f){i&&i(f),Or.remove(e),o.manager.itemError(e),o.manager.itemEnd(e)});Or.add(e,u),o.manager.itemStart(e)}}const tf="\\[\\]\\.:\\/",WC=new RegExp("["+tf+"]","g"),nf="[^"+tf+"]",XC="[^"+tf.replace("\\.","")+"]",YC=/((?:WC+[\/:])*)/.source.replace("WC",nf),jC=/(WCOD+)?/.source.replace("WCOD",XC),qC=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",nf),KC=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",nf),ZC=new RegExp("^"+YC+jC+qC+KC+"$"),$C=["material","materials","bones","map"];class JC{constructor(e,t,n){const i=n||It.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_,o=n.length;i!==o;++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 It{constructor(e,t,n){this.path=t,this.parsedPath=n||It.parseTrackName(t),this.node=It.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 It.Composite(e,t,n):new It(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(WC,"")}static parseTrackName(e){const t=ZC.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 o=n.nodeName.substring(i+1);$C.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}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(o){for(let c=0;c<o.length;c++){const l=o[c];if(l.name===t||l.uuid===t)return l;const u=n(l.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,o=n.length;i!==o;++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,o=n.length;i!==o;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let o=t.propertyIndex;if(e||(e=It.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let f=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let d=0;d<e.length;d++)if(e[d].name===f){f=d;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.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){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(f!==void 0){if(e[f]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[f]}}const c=e[i];if(c===void 0){const f=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+f+"."+i+" but it wasn't found.",e);return}let l=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?l=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(l=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(o!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[o]!==void 0&&(o=e.morphTargetDictionary[o])}u=this.BindingType.ArrayElement,this.resolvedProperty=c,this.propertyIndex=o}else c.fromArray!==void 0&&c.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=c):Array.isArray(c)?(u=this.BindingType.EntireArray,this.resolvedProperty=c):this.propertyName=i;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}It.Composite=JC;It.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};It.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};It.prototype.GetterByBindingType=[It.prototype._getValue_direct,It.prototype._getValue_array,It.prototype._getValue_arrayElement,It.prototype._getValue_toArray];It.prototype.SetterByBindingTypeAndVersioning=[[It.prototype._setValue_direct,It.prototype._setValue_direct_setNeedsUpdate,It.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[It.prototype._setValue_array,It.prototype._setValue_array_setNeedsUpdate,It.prototype._setValue_array_setMatrixWorldNeedsUpdate],[It.prototype._setValue_arrayElement,It.prototype._setValue_arrayElement_setNeedsUpdate,It.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[It.prototype._setValue_fromArray,It.prototype._setValue_fromArray_setNeedsUpdate,It.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];const pg=new $e;class dl{constructor(e,t,n=0,i=1/0){this.ray=new vo(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Yu,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return pg.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(pg),this}intersectObject(e,t=!0,n=[]){return Ru(e,this,n,t),n.sort(mg),n}intersectObjects(e,t=!0,n=[]){for(let i=0,o=e.length;i<o;i++)Ru(e[i],this,n,t);return n.sort(mg),n}}function mg(s,e){return s.distance-e.distance}function Ru(s,e,t,n){if(s.layers.test(e.layers)&&s.raycast(e,t),n===!0){const i=s.children;for(let o=0,c=i.length;o<c;o++)Ru(i[o],e,t,!0)}}class gg{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,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(xn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class QC extends Zu{constructor(e=10,t=10,n=4473924,i=8947848){n=new Ne(n),i=new Ne(i);const o=t/2,c=e/t,l=e/2,u=[],f=[];for(let m=0,v=0,S=-l;m<=t;m++,S+=c){u.push(-l,0,S,l,0,S),u.push(S,0,-l,S,0,l);const b=m===o?n:i;b.toArray(f,v),v+=3,b.toArray(f,v),v+=3,b.toArray(f,v),v+=3,b.toArray(f,v),v+=3}const d=new $t;d.setAttribute("position",new Nt(u,3)),d.setAttribute("color",new Nt(f,3));const p=new yo({vertexColors:!0,toneMapped:!1});super(d,p),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class eP extends Zu{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 $t;i.setAttribute("position",new Nt(t,3)),i.setAttribute("color",new Nt(n,3));const o=new yo({vertexColors:!0,toneMapped:!1});super(i,o),this.type="AxesHelper"}setColors(e,t,n){const i=new Ne,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(t),i.toArray(o,6),i.toArray(o,9),i.set(n),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Vu}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Vu);const rs={antialias:!0,alpha:!0,stencil:!1,shadowMapEnabled:!0,shadowMapType:Bg,toneMapping:lr,canvas:void 0};class _g extends lC{constructor(e=rs){super({antialias:e.antialias||rs.antialias,alpha:e.alpha||rs.alpha,preserveDrawingBuffer:!0,canvas:e.canvas}),this.paused=!1,this.running=!1,this.force=!1,this.preRenderCallbacks=new Map,this.postRenderCallbacks=new Map,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=e.shadowMapEnabled||rs.shadowMapEnabled,this.shadowMap.type=e.shadowMapType||rs.shadowMapType,this.toneMapping=e.toneMapping||rs.toneMapping,this.debug.checkShaderErrors=!1}Dispose(){this.StopRenderer(),this.dispose()}StartRenderer(e,t){this.setAnimationLoop((n,i)=>{this.internal_render(e,t,n,i)}),this.running=!0}PauseRenderer(){this.paused=!0}ResumeRenderer(){this.paused=!1}StopRenderer(){this.setAnimationLoop(null),this.running=!1}OnResize(e,t){this.setSize(e,t)}AddPreRenderCallback(e){const t=Bi.generateUUID();return this.preRenderCallbacks.set(t,e),t}RemovePreRenderCallback(e){return this.preRenderCallbacks.has(e)?(this.preRenderCallbacks.delete(e),!0):!1}AddPostRenderCallback(e){const t=Bi.generateUUID();return this.postRenderCallbacks.set(t,e),t}RemovePostRenderCallback(e){return this.postRenderCallbacks.has(e)?(this.postRenderCallbacks.delete(e),!0):!1}ForceRendering(){this.force=!0}internal_render(e,t,n,i){(this.paused||!this.running)&&!this.force||(this.preRenderCallbacks.forEach(o=>{o(n,i)}),this.render(e,t),this.postRenderCallbacks.forEach(o=>{o(n,i)}),this.force=!1)}}const tP=1,ea=2,rf=4,w_=8,Jn=16;class nP extends _t{constructor(){super(),this.isDIVELight=!0,this.isDIVEAmbientLight=!0,this.name="DIVEAmbientLight",this._light=new kC(16777215,1),this._light.layers.mask=Jn,this.add(this._light)}SetColor(e){this._light.color=e}SetIntensity(e){this._light.intensity=e}SetEnabled(e){this._light.visible=e}}const An=["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","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];function iP(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(An[s&255]+An[s>>8&255]+An[s>>16&255]+An[s>>24&255]+"-"+An[e&255]+An[e>>8&255]+"-"+An[e>>16&15|64]+An[e>>24&255]+"-"+An[t&63|128]+An[t>>8&255]+"-"+An[t>>16&255]+An[t>>24&255]+An[n&255]+An[n>>8&255]+An[n>>16&255]+An[n>>24&255]).toLowerCase()}function Kc(s,e){return s?e in s:!1}function ol(s,e){if(s)return Kc(s,e)?s:ol(s.parent,e)}class rP{constructor(e,t){this.POINTER_DRAG_THRESHOLD=.001,this.name="BaseTool",this._canvas=t.domElement,this._scene=e,this._controller=t,this._pointer=new Ie,this._pointerPrimaryDown=!1,this._pointerMiddleDown=!1,this._pointerSecondaryDown=!1,this._lastPointerDown=new Ie,this._lastPointerUp=new Ie,this._raycaster=new dl,this._raycaster.layers.mask=Jn|rf,this._intersects=[],this._hovered=null,this._dragging=!1,this._dragStart=new U,this._dragCurrent=new U,this._dragEnd=new U,this._dragDelta=new U,this._draggable=null,this._dragRaycastOnObjects=null}get _pointerAnyDown(){return this._pointerPrimaryDown||this._pointerMiddleDown||this._pointerSecondaryDown}Activate(){}Deactivate(){}onPointerDown(e){var t;switch(e.button){case 0:{this._pointerPrimaryDown=!0;break}case 1:{this._pointerMiddleDown=!0;break}case 2:{this._pointerSecondaryDown=!0;break}default:console.warn("DIVEBaseTool.onPointerDown: Unknown button: "+e.button)}this._lastPointerDown.copy(this._pointer),this._draggable=ol((t=this._intersects[0])==null?void 0:t.object,"isDraggable")||null}onDragStart(e){this._draggable&&(this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0)),this._intersects.length!==0&&(this._dragStart.copy(this._intersects[0].point.clone()),this._dragCurrent.copy(this._intersects[0].point.clone()),this._dragEnd.copy(this._dragStart.clone()),this._dragDelta.set(0,0,0),this._draggable&&this._draggable.onDragStart&&(this._draggable.onDragStart({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._dragging=!0,this._controller.enabled=!1)))}onPointerMove(e){var n;this._pointer.x=e.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(e.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object),this._intersects=this.raycast(this._scene.children);const t=ol((n=this._intersects[0])==null?void 0:n.object,"isHoverable");if(this._intersects[0]&&t){if(!this._hovered){t.onPointerEnter&&t.onPointerEnter(this._intersects[0]),this._hovered=t;return}if(this._hovered.uuid!==t.uuid){this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),t.onPointerEnter&&t.onPointerEnter(this._intersects[0]),this._hovered=t;return}t.onPointerOver&&t.onPointerOver(this._intersects[0]),this._hovered=t}else this._hovered&&this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),this._hovered=null;this._pointerAnyDown&&(this._dragging||this.onDragStart(e),this.onDrag(e))}onDrag(e){this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0));const t=this._intersects[0];t&&(this._dragCurrent.copy(t.point.clone()),this._dragEnd.copy(t.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone()),this._draggable&&this._draggable.onDrag&&this._draggable.onDrag({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}))}onPointerUp(e){switch(this.pointerWasDragged()||this._dragging?this._draggable&&this.onDragEnd(e):this.onClick(e),e.button){case 0:this._pointerPrimaryDown=!1;break;case 1:this._pointerMiddleDown=!1;break;case 2:this._pointerSecondaryDown=!1;break}this._lastPointerUp.copy(this._pointer)}onClick(e){}onDragEnd(e){const t=this._intersects[0];t&&(this._dragEnd.copy(t.point.clone()),this._dragCurrent.copy(t.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone())),this._draggable&&this._draggable.onDragEnd&&this._draggable.onDragEnd({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._draggable=null,this._dragging=!1,this._dragStart.set(0,0,0),this._dragCurrent.set(0,0,0),this._dragEnd.set(0,0,0),this._dragDelta.set(0,0,0),this._controller.enabled=!0}onWheel(e){}raycast(e){return e!==void 0?this._raycaster.intersectObjects(e,!0).filter(t=>t.object.visible):this._raycaster.intersectObjects(this._scene.children,!0).filter(t=>t.object.visible)}pointerWasDragged(){return this._lastPointerDown.distanceTo(this._pointer)>this.POINTER_DRAG_THRESHOLD}}const ts=new dl,wn=new U,Rr=new U,Wt=new rn,vg={X:new U(1,0,0),Y:new U(0,1,0),Z:new U(0,0,1)},hu={type:"change"},xg={type:"mouseDown"},yg={type:"mouseUp",mode:null},Sg={type:"objectChange"};class sP extends _t{constructor(e,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const n=new uP;this._gizmo=n,this.add(n);const i=new fP;this._plane=i,this.add(i);const o=this;function c(R,E){let L=E;Object.defineProperty(o,R,{get:function(){return L!==void 0?L:E},set:function(B){L!==B&&(L=B,i[R]=B,n[R]=B,o.dispatchEvent({type:R+"-changed",value:B}),o.dispatchEvent(hu))}}),o[R]=E,i[R]=E,n[R]=E}c("camera",e),c("object",void 0),c("enabled",!0),c("axis",null),c("mode","translate"),c("translationSnap",null),c("rotationSnap",null),c("scaleSnap",null),c("space","world"),c("size",1),c("dragging",!1),c("showX",!0),c("showY",!0),c("showZ",!0);const l=new U,u=new U,f=new rn,d=new rn,p=new U,m=new rn,v=new U,S=new U,b=new U,x=0,_=new U;c("worldPosition",l),c("worldPositionStart",u),c("worldQuaternion",f),c("worldQuaternionStart",d),c("cameraPosition",p),c("cameraQuaternion",m),c("pointStart",v),c("pointEnd",S),c("rotationAxis",b),c("rotationAngle",x),c("eye",_),this._offset=new U,this._startNorm=new U,this._endNorm=new U,this._cameraScale=new U,this._parentPosition=new U,this._parentQuaternion=new rn,this._parentQuaternionInv=new rn,this._parentScale=new U,this._worldScaleStart=new U,this._worldQuaternionInv=new rn,this._worldScale=new U,this._positionStart=new U,this._quaternionStart=new rn,this._scaleStart=new U,this._getPointer=oP.bind(this),this._onPointerDown=cP.bind(this),this._onPointerHover=aP.bind(this),this._onPointerMove=lP.bind(this),this._onPointerUp=hP.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(e){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(e)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&ts.setFromCamera(e,this.camera);const t=uu(this._gizmo.picker[this.mode],ts);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e!=null&&e.button!==0)&&this.axis!==null){e!==null&&ts.setFromCamera(e,this.camera);const t=uu(this._plane,ts,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,xg.mode=this.mode,this.dispatchEvent(xg)}}pointerMove(e){const t=this.axis,n=this.mode,i=this.object;let o=this.space;if(n==="scale"?o="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(o="world"),i===void 0||t===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&ts.setFromCamera(e,this.camera);const c=uu(this._plane,ts,!0);if(c){if(this.pointEnd.copy(c.point).sub(this.worldPositionStart),n==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),o==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),o==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),i.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(o==="local"&&(i.position.applyQuaternion(Wt.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),o==="world"&&(i.parent&&i.position.add(wn.setFromMatrixPosition(i.parent.matrixWorld)),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(wn.setFromMatrixPosition(i.parent.matrixWorld))));else if(n==="scale"){if(t.search("XYZ")!==-1){let l=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(l*=-1),Rr.set(l,l,l)}else wn.copy(this.pointStart),Rr.copy(this.pointEnd),wn.applyQuaternion(this._worldQuaternionInv),Rr.applyQuaternion(this._worldQuaternionInv),Rr.divide(wn),t.search("X")===-1&&(Rr.x=1),t.search("Y")===-1&&(Rr.y=1),t.search("Z")===-1&&(Rr.z=1);i.scale.copy(this._scaleStart).multiply(Rr),this.scaleSnap&&(t.search("X")!==-1&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(n==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const l=20/this.worldPosition.distanceTo(wn.setFromMatrixPosition(this.camera.matrixWorld));let u=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(wn.copy(this.rotationAxis).cross(this.eye))*l):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(vg[t]),wn.copy(vg[t]),o==="local"&&wn.applyQuaternion(this.worldQuaternion),wn.cross(this.eye),wn.length()===0?u=!0:this.rotationAngle=this._offset.dot(wn.normalize())*l),(t==="E"||u)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),o==="local"&&t!=="E"&&t!=="XYZE"?(i.quaternion.copy(this._quaternionStart),i.quaternion.multiply(Wt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),i.quaternion.copy(Wt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(hu),this.dispatchEvent(Sg)}}pointerUp(e){e!==null&&e.button!==0||(this.dragging&&this.axis!==null&&(yg.mode=this.mode,this.dispatchEvent(yg)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(hu),this.dispatchEvent(Sg),this.pointStart.copy(this.pointEnd))}getRaycaster(){return ts}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function oP(s){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:s.button};{const e=this.domElement.getBoundingClientRect();return{x:(s.clientX-e.left)/e.width*2-1,y:-(s.clientY-e.top)/e.height*2+1,button:s.button}}}function aP(s){if(this.enabled)switch(s.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(s));break}}function cP(s){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(s.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(s)),this.pointerDown(this._getPointer(s)))}function lP(s){this.enabled&&this.pointerMove(this._getPointer(s))}function hP(s){this.enabled&&(this.domElement.releasePointerCapture(s.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(s)))}function uu(s,e,t){const n=e.intersectObject(s,!0);for(let i=0;i<n.length;i++)if(n[i].object.visible||t)return n[i];return!1}const Hc=new Ti,Ot=new U(0,1,0),Mg=new U(0,0,0),Eg=new $e,Gc=new rn,Zc=new rn,Di=new U,bg=new $e,oa=new U(1,0,0),ss=new U(0,1,0),aa=new U(0,0,1),Vc=new U,ta=new U,na=new U;class uP extends _t{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new Ni({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new yo({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),n=e.clone();n.opacity=.15;const i=t.clone();i.opacity=.5;const o=e.clone();o.color.setHex(16711680);const c=e.clone();c.color.setHex(65280);const l=e.clone();l.color.setHex(255);const u=e.clone();u.color.setHex(16711680),u.opacity=.5;const f=e.clone();f.color.setHex(65280),f.opacity=.5;const d=e.clone();d.color.setHex(255),d.opacity=.5;const p=e.clone();p.opacity=.25;const m=e.clone();m.color.setHex(16776960),m.opacity=.25,e.clone().color.setHex(16776960);const S=e.clone();S.color.setHex(7895160);const b=new pn(0,.04,.1,12);b.translate(0,.05,0);const x=new jt(.08,.08,.08);x.translate(0,.04,0);const _=new $t;_.setAttribute("position",new Nt([0,0,0,1,0,0],3));const R=new pn(.0075,.0075,.5,3);R.translate(0,.25,0);function E(ne,he){const me=new cs(ne,.0075,3,64,he*Math.PI*2);return me.rotateY(Math.PI/2),me.rotateX(Math.PI/2),me}function L(){const ne=new $t;return ne.setAttribute("position",new Nt([0,0,0,1,1,1],3)),ne}const B={X:[[new ye(b,o),[.5,0,0],[0,0,-Math.PI/2]],[new ye(b,o),[-.5,0,0],[0,0,Math.PI/2]],[new ye(R,o),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new ye(b,c),[0,.5,0]],[new ye(b,c),[0,-.5,0],[Math.PI,0,0]],[new ye(R,c)]],Z:[[new ye(b,l),[0,0,.5],[Math.PI/2,0,0]],[new ye(b,l),[0,0,-.5],[-Math.PI/2,0,0]],[new ye(R,l),null,[Math.PI/2,0,0]]],XYZ:[[new ye(new no(.1,0),p.clone()),[0,0,0]]],XY:[[new ye(new jt(.15,.15,.01),d.clone()),[.15,.15,0]]],YZ:[[new ye(new jt(.15,.15,.01),u.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new ye(new jt(.15,.15,.01),f.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},N={X:[[new ye(new pn(.2,0,.6,4),n),[.3,0,0],[0,0,-Math.PI/2]],[new ye(new pn(.2,0,.6,4),n),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new ye(new pn(.2,0,.6,4),n),[0,.3,0]],[new ye(new pn(.2,0,.6,4),n),[0,-.3,0],[0,0,Math.PI]]],Z:[[new ye(new pn(.2,0,.6,4),n),[0,0,.3],[Math.PI/2,0,0]],[new ye(new pn(.2,0,.6,4),n),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new ye(new no(.2,0),n)]],XY:[[new ye(new jt(.2,.2,.01),n),[.15,.15,0]]],YZ:[[new ye(new jt(.2,.2,.01),n),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new ye(new jt(.2,.2,.01),n),[.15,0,.15],[-Math.PI/2,0,0]]]},D={START:[[new ye(new no(.01,2),i),null,null,null,"helper"]],END:[[new ye(new no(.01,2),i),null,null,null,"helper"]],DELTA:[[new hi(L(),i),null,null,null,"helper"]],X:[[new hi(_,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new hi(_,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new hi(_,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},k={XYZE:[[new ye(E(.5,1),S),null,[0,Math.PI/2,0]]],X:[[new ye(E(.5,.5),o)]],Y:[[new ye(E(.5,.5),c),null,[0,0,-Math.PI/2]]],Z:[[new ye(E(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new ye(E(.75,1),m),null,[0,Math.PI/2,0]]]},C={AXIS:[[new hi(_,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},T={XYZE:[[new ye(new ya(.25,10,8),n)]],X:[[new ye(new cs(.5,.1,4,24),n),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new ye(new cs(.5,.1,4,24),n),[0,0,0],[Math.PI/2,0,0]]],Z:[[new ye(new cs(.5,.1,4,24),n),[0,0,0],[0,0,-Math.PI/2]]],E:[[new ye(new cs(.75,.1,2,24),n)]]},W={X:[[new ye(x,o),[.5,0,0],[0,0,-Math.PI/2]],[new ye(R,o),[0,0,0],[0,0,-Math.PI/2]],[new ye(x,o),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new ye(x,c),[0,.5,0]],[new ye(R,c)],[new ye(x,c),[0,-.5,0],[0,0,Math.PI]]],Z:[[new ye(x,l),[0,0,.5],[Math.PI/2,0,0]],[new ye(R,l),[0,0,0],[Math.PI/2,0,0]],[new ye(x,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new ye(new jt(.15,.15,.01),d),[.15,.15,0]]],YZ:[[new ye(new jt(.15,.15,.01),u),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new ye(new jt(.15,.15,.01),f),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new ye(new jt(.1,.1,.1),p.clone())]]},j={X:[[new ye(new pn(.2,0,.6,4),n),[.3,0,0],[0,0,-Math.PI/2]],[new ye(new pn(.2,0,.6,4),n),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new ye(new pn(.2,0,.6,4),n),[0,.3,0]],[new ye(new pn(.2,0,.6,4),n),[0,-.3,0],[0,0,Math.PI]]],Z:[[new ye(new pn(.2,0,.6,4),n),[0,0,.3],[Math.PI/2,0,0]],[new ye(new pn(.2,0,.6,4),n),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new ye(new jt(.2,.2,.01),n),[.15,.15,0]]],YZ:[[new ye(new jt(.2,.2,.01),n),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new ye(new jt(.2,.2,.01),n),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new ye(new jt(.2,.2,.2),n),[0,0,0]]]},H={X:[[new hi(_,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new hi(_,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new hi(_,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function K(ne){const he=new _t;for(const me in ne)for(let $=ne[me].length;$--;){const fe=ne[me][$][0].clone(),pe=ne[me][$][1],Ee=ne[me][$][2],Je=ne[me][$][3],bt=ne[me][$][4];fe.name=me,fe.tag=bt,pe&&fe.position.set(pe[0],pe[1],pe[2]),Ee&&fe.rotation.set(Ee[0],Ee[1],Ee[2]),Je&&fe.scale.set(Je[0],Je[1],Je[2]),fe.updateMatrix();const ie=fe.geometry.clone();ie.applyMatrix4(fe.matrix),fe.geometry=ie,fe.renderOrder=1/0,fe.position.set(0,0,0),fe.rotation.set(0,0,0),fe.scale.set(1,1,1),he.add(fe)}return he}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=K(B)),this.add(this.gizmo.rotate=K(k)),this.add(this.gizmo.scale=K(W)),this.add(this.picker.translate=K(N)),this.add(this.picker.rotate=K(T)),this.add(this.picker.scale=K(j)),this.add(this.helper.translate=K(D)),this.add(this.helper.rotate=K(C)),this.add(this.helper.scale=K(H)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const n=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:Zc;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children),i=i.concat(this.helper[this.mode].children);for(let o=0;o<i.length;o++){const c=i[o];c.visible=!0,c.rotation.set(0,0,0),c.position.copy(this.worldPosition);let l;if(this.camera.isOrthographicCamera?l=(this.camera.top-this.camera.bottom)/this.camera.zoom:l=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),c.scale.set(1,1,1).multiplyScalar(l*this.size/4),c.tag==="helper"){c.visible=!1,c.name==="AXIS"?(c.visible=!!this.axis,this.axis==="X"&&(Wt.setFromEuler(Hc.set(0,0,0)),c.quaternion.copy(n).multiply(Wt),Math.abs(Ot.copy(oa).applyQuaternion(n).dot(this.eye))>.9&&(c.visible=!1)),this.axis==="Y"&&(Wt.setFromEuler(Hc.set(0,0,Math.PI/2)),c.quaternion.copy(n).multiply(Wt),Math.abs(Ot.copy(ss).applyQuaternion(n).dot(this.eye))>.9&&(c.visible=!1)),this.axis==="Z"&&(Wt.setFromEuler(Hc.set(0,Math.PI/2,0)),c.quaternion.copy(n).multiply(Wt),Math.abs(Ot.copy(aa).applyQuaternion(n).dot(this.eye))>.9&&(c.visible=!1)),this.axis==="XYZE"&&(Wt.setFromEuler(Hc.set(0,Math.PI/2,0)),Ot.copy(this.rotationAxis),c.quaternion.setFromRotationMatrix(Eg.lookAt(Mg,Ot,ss)),c.quaternion.multiply(Wt),c.visible=this.dragging),this.axis==="E"&&(c.visible=!1)):c.name==="START"?(c.position.copy(this.worldPositionStart),c.visible=this.dragging):c.name==="END"?(c.position.copy(this.worldPosition),c.visible=this.dragging):c.name==="DELTA"?(c.position.copy(this.worldPositionStart),c.quaternion.copy(this.worldQuaternionStart),wn.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),wn.applyQuaternion(this.worldQuaternionStart.clone().invert()),c.scale.copy(wn),c.visible=this.dragging):(c.quaternion.copy(n),this.dragging?c.position.copy(this.worldPositionStart):c.position.copy(this.worldPosition),this.axis&&(c.visible=this.axis.search(c.name)!==-1));continue}c.quaternion.copy(n),this.mode==="translate"||this.mode==="scale"?(c.name==="X"&&Math.abs(Ot.copy(oa).applyQuaternion(n).dot(this.eye))>.99&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="Y"&&Math.abs(Ot.copy(ss).applyQuaternion(n).dot(this.eye))>.99&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="Z"&&Math.abs(Ot.copy(aa).applyQuaternion(n).dot(this.eye))>.99&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="XY"&&Math.abs(Ot.copy(aa).applyQuaternion(n).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="YZ"&&Math.abs(Ot.copy(oa).applyQuaternion(n).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="XZ"&&Math.abs(Ot.copy(ss).applyQuaternion(n).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1)):this.mode==="rotate"&&(Gc.copy(n),Ot.copy(this.eye).applyQuaternion(Wt.copy(n).invert()),c.name.search("E")!==-1&&c.quaternion.setFromRotationMatrix(Eg.lookAt(this.eye,Mg,ss)),c.name==="X"&&(Wt.setFromAxisAngle(oa,Math.atan2(-Ot.y,Ot.z)),Wt.multiplyQuaternions(Gc,Wt),c.quaternion.copy(Wt)),c.name==="Y"&&(Wt.setFromAxisAngle(ss,Math.atan2(Ot.x,Ot.z)),Wt.multiplyQuaternions(Gc,Wt),c.quaternion.copy(Wt)),c.name==="Z"&&(Wt.setFromAxisAngle(aa,Math.atan2(Ot.y,Ot.x)),Wt.multiplyQuaternions(Gc,Wt),c.quaternion.copy(Wt))),c.visible=c.visible&&(c.name.indexOf("X")===-1||this.showX),c.visible=c.visible&&(c.name.indexOf("Y")===-1||this.showY),c.visible=c.visible&&(c.name.indexOf("Z")===-1||this.showZ),c.visible=c.visible&&(c.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),c.material._color=c.material._color||c.material.color.clone(),c.material._opacity=c.material._opacity||c.material.opacity,c.material.color.copy(c.material._color),c.material.opacity=c.material._opacity,this.enabled&&this.axis&&(c.name===this.axis||this.axis.split("").some(function(u){return c.name===u}))&&(c.material.color.setHex(16776960),c.material.opacity=1)}super.updateMatrixWorld(e)}}class fP extends ye{constructor(){super(new ds(1e5,1e5,2,2),new Ni({visible:!1,wireframe:!0,side:yi,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),Vc.copy(oa).applyQuaternion(t==="local"?this.worldQuaternion:Zc),ta.copy(ss).applyQuaternion(t==="local"?this.worldQuaternion:Zc),na.copy(aa).applyQuaternion(t==="local"?this.worldQuaternion:Zc),Ot.copy(ta),this.mode){case"translate":case"scale":switch(this.axis){case"X":Ot.copy(this.eye).cross(Vc),Di.copy(Vc).cross(Ot);break;case"Y":Ot.copy(this.eye).cross(ta),Di.copy(ta).cross(Ot);break;case"Z":Ot.copy(this.eye).cross(na),Di.copy(na).cross(Ot);break;case"XY":Di.copy(na);break;case"YZ":Di.copy(Vc);break;case"XZ":Ot.copy(na),Di.copy(ta);break;case"XYZ":case"E":Di.set(0,0,0);break}break;case"rotate":default:Di.set(0,0,0)}Di.length()===0?this.quaternion.copy(this.cameraQuaternion):(bg.lookAt(wn.set(0,0,0),Di,Ot),this.quaternion.setFromRotationMatrix(bg)),super.updateMatrixWorld(e)}}const R_="#c20017",C_="#00ab26",P_="#0081d4",Cu=R_,Pu=C_,Lu=P_;class dP extends rP{constructor(e,t){super(e,t),this.isTransformTool=!0,this.name="DIVETransformTool",this._scaleLinked=!1,this._gizmo=this.initGizmo(),this._scene.add(this._gizmo)}Activate(){}SetGizmoMode(e){this._gizmo.mode=e}SetGizmoVisibility(e){const t=this._scene.children.includes(this._gizmo);e&&!t?(this._scene.add(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.enableAll()):!e&&t&&(this._scene.remove(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.disableAll())}SetGizmoScaleLinked(e){this._scaleLinked=e}initGizmo(){const e=new sP(this._controller.object,this._controller.domElement);return e.mode="translate",e.traverse(t=>{if(!("isMesh"in t))return;const n=t.material;t.name==="X"&&n.color.set(Cu),t.name==="Y"&&n.color.set(Pu),t.name==="Z"&&n.color.set(Lu),t.name==="XY"&&n.color.set(Lu),t.name==="YZ"&&n.color.set(Cu),t.name==="XZ"&&n.color.set(Pu)}),e.addEventListener("mouseDown",()=>{this._controller.enabled=!1,Kc(e.object,"isMovable")&&e.object.onMoveStart&&e.object.onMoveStart()}),e.addEventListener("objectChange",()=>{if(Kc(e.object,"isMovable")&&e.object.onMove&&(e.object.onMove(),this._scaleLinked)){const t=e.object.scale,n=(t.x+t.y+t.z)/3;e.object.scale.set(n,n,n)}}),e.addEventListener("mouseUp",()=>{this._controller.enabled=!0,Kc(e.object,"isMovable")&&e.object.onMoveEnd&&e.object.onMoveEnd()}),e}}const Tg=s=>s.isSelectTool!==void 0;class pP extends dP{constructor(e,t){super(e,t),this.isSelectTool=!0,this.name="SelectTool"}Activate(){}Select(e){this.AttachGizmo(e),e.onSelect&&e.onSelect()}Deselect(e){this.DetachGizmo(),e.onDeselect&&e.onDeselect()}AttachGizmo(e){if("isMovable"in e){const t=e;this._gizmo.attach(t),this.SetGizmoVisibility(t.visible)}}DetachGizmo(){this._gizmo.detach()}onClick(e){super.onClick(e);const t=this._raycaster.intersectObjects(this._scene.Root.children,!0).filter(i=>i.object.visible)[0],n=ol(t==null?void 0:t.object,"isSelectable");if(!t||!n){this._gizmo.object&&this.Deselect(this._gizmo.object);return}if(this._gizmo.object){if(this._gizmo.object.uuid===n.uuid)return;this.Deselect(this._gizmo.object)}this.Select(n)}}var Wc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ca={exports:{}};/**
|
|
3797
|
+
}`;class MC{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new un,o=e.properties.get(r);o.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}render(e,t){if(this.texture!==null){if(this.mesh===null){const n=t.cameras[0].viewport,r=new Yr({vertexShader:yC,fragmentShader:SC,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new ye(new Ss(20,20),r)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}}class EC extends ys{constructor(e,t){super();const n=this;let r=null,o=1,c=null,l="local-floor",h=1,f=null,d=null,p=null,m=null,x=null,M=null;const A=new MC,v=t.getContextAttributes();let _=null,C=null;const b=[],L=[],k=new Pe;let U=null;const O=new Bn;O.layers.enable(1),O.viewport=new Dt;const I=new Bn;I.layers.enable(2),I.viewport=new Dt;const E=[O,I],y=new vC;y.layers.enable(1),y.layers.enable(2);let F=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ie){let ge=b[ie];return ge===void 0&&(ge=new dh,b[ie]=ge),ge.getTargetRaySpace()},this.getControllerGrip=function(ie){let ge=b[ie];return ge===void 0&&(ge=new dh,b[ie]=ge),ge.getGripSpace()},this.getHand=function(ie){let ge=b[ie];return ge===void 0&&(ge=new dh,b[ie]=ge),ge.getHandSpace()};function G(ie){const ge=L.indexOf(ie.inputSource);if(ge===-1)return;const we=b[ge];we!==void 0&&(we.update(ie.inputSource,ie.frame,f||c),we.dispatchEvent({type:ie.type,data:ie.inputSource}))}function q(){r.removeEventListener("select",G),r.removeEventListener("selectstart",G),r.removeEventListener("selectend",G),r.removeEventListener("squeeze",G),r.removeEventListener("squeezestart",G),r.removeEventListener("squeezeend",G),r.removeEventListener("end",q),r.removeEventListener("inputsourceschange",ne);for(let ie=0;ie<b.length;ie++){const ge=L[ie];ge!==null&&(L[ie]=null,b[ie].disconnect(ge))}F=null,V=null,A.reset(),e.setRenderTarget(_),x=null,m=null,p=null,r=null,C=null,ot.stop(),n.isPresenting=!1,e.setPixelRatio(U),e.setSize(k.width,k.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ie){o=ie,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ie){l=ie,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return f||c},this.setReferenceSpace=function(ie){f=ie},this.getBaseLayer=function(){return m!==null?m:x},this.getBinding=function(){return p},this.getFrame=function(){return M},this.getSession=function(){return r},this.setSession=async function(ie){if(r=ie,r!==null){if(_=e.getRenderTarget(),r.addEventListener("select",G),r.addEventListener("selectstart",G),r.addEventListener("selectend",G),r.addEventListener("squeeze",G),r.addEventListener("squeezestart",G),r.addEventListener("squeezeend",G),r.addEventListener("end",q),r.addEventListener("inputsourceschange",ne),v.xrCompatible!==!0&&await t.makeXRCompatible(),U=e.getPixelRatio(),e.getSize(k),r.renderState.layers===void 0){const ge={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:o};x=new XRWebGLLayer(r,t,ge),r.updateRenderState({baseLayer:x}),e.setPixelRatio(1),e.setSize(x.framebufferWidth,x.framebufferHeight,!1),C=new vs(x.framebufferWidth,x.framebufferHeight,{format:Ci,type:Xr,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil})}else{let ge=null,we=null,Se=null;v.depth&&(Se=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ge=v.stencil?Ta:po,we=v.stencil?Ca:xo);const Ge={colorFormat:t.RGBA8,depthFormat:Se,scaleFactor:o};p=new XRWebGLBinding(r,t),m=p.createProjectionLayer(Ge),r.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),C=new vs(m.textureWidth,m.textureHeight,{format:Ci,type:Xr,depthTexture:new E_(m.textureWidth,m.textureHeight,we,void 0,void 0,void 0,void 0,void 0,void 0,ge),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:v.antialias?4:0});const Xe=e.properties.get(C);Xe.__ignoreDepthValues=m.ignoreDepthValues}C.isXRRenderTarget=!0,this.setFoveation(h),f=null,c=await r.requestReferenceSpace(l),ot.setContext(r),ot.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function ne(ie){for(let ge=0;ge<ie.removed.length;ge++){const we=ie.removed[ge],Se=L.indexOf(we);Se>=0&&(L[Se]=null,b[Se].disconnect(we))}for(let ge=0;ge<ie.added.length;ge++){const we=ie.added[ge];let Se=L.indexOf(we);if(Se===-1){for(let Xe=0;Xe<b.length;Xe++)if(Xe>=L.length){L.push(we),Se=Xe;break}else if(L[Xe]===null){L[Xe]=we,Se=Xe;break}if(Se===-1)break}const Ge=b[Se];Ge&&Ge.connect(we)}}const se=new N,pe=new N;function K(ie,ge,we){se.setFromMatrixPosition(ge.matrixWorld),pe.setFromMatrixPosition(we.matrixWorld);const Se=se.distanceTo(pe),Ge=ge.projectionMatrix.elements,Xe=we.projectionMatrix.elements,at=Ge[14]/(Ge[10]-1),j=Ge[14]/(Ge[10]+1),$e=(Ge[9]+1)/Ge[5],ze=(Ge[9]-1)/Ge[5],bt=(Ge[8]-1)/Ge[0],He=(Xe[8]+1)/Xe[0],Tt=at*bt,B=at*He,w=Se/(-bt+He),te=w*-bt;ge.matrixWorld.decompose(ie.position,ie.quaternion,ie.scale),ie.translateX(te),ie.translateZ(w),ie.matrixWorld.compose(ie.position,ie.quaternion,ie.scale),ie.matrixWorldInverse.copy(ie.matrixWorld).invert();const ae=at+w,ue=j+w,de=Tt-te,Be=B+(Se-te),_e=$e*j/ue*ae,De=ze*j/ue*ae;ie.projectionMatrix.makePerspective(de,Be,_e,De,ae,ue),ie.projectionMatrixInverse.copy(ie.projectionMatrix).invert()}function he(ie,ge){ge===null?ie.matrixWorld.copy(ie.matrix):ie.matrixWorld.multiplyMatrices(ge.matrixWorld,ie.matrix),ie.matrixWorldInverse.copy(ie.matrixWorld).invert()}this.updateCamera=function(ie){if(r===null)return;A.texture!==null&&(ie.near=A.depthNear,ie.far=A.depthFar),y.near=I.near=O.near=ie.near,y.far=I.far=O.far=ie.far,(F!==y.near||V!==y.far)&&(r.updateRenderState({depthNear:y.near,depthFar:y.far}),F=y.near,V=y.far,O.near=F,O.far=V,I.near=F,I.far=V,O.updateProjectionMatrix(),I.updateProjectionMatrix(),ie.updateProjectionMatrix());const ge=ie.parent,we=y.cameras;he(y,ge);for(let Se=0;Se<we.length;Se++)he(we[Se],ge);we.length===2?K(y,O,I):y.projectionMatrix.copy(O.projectionMatrix),me(ie,y,ge)};function me(ie,ge,we){we===null?ie.matrix.copy(ge.matrixWorld):(ie.matrix.copy(we.matrixWorld),ie.matrix.invert(),ie.matrix.multiply(ge.matrixWorld)),ie.matrix.decompose(ie.position,ie.quaternion,ie.scale),ie.updateMatrixWorld(!0),ie.projectionMatrix.copy(ge.projectionMatrix),ie.projectionMatrixInverse.copy(ge.projectionMatrixInverse),ie.isPerspectiveCamera&&(ie.fov=So*2*Math.atan(1/ie.projectionMatrix.elements[5]),ie.zoom=1)}this.getCamera=function(){return y},this.getFoveation=function(){if(!(m===null&&x===null))return h},this.setFoveation=function(ie){h=ie,m!==null&&(m.fixedFoveation=ie),x!==null&&x.fixedFoveation!==void 0&&(x.fixedFoveation=ie)},this.hasDepthSensing=function(){return A.texture!==null};let Me=null;function Ke(ie,ge){if(d=ge.getViewerPose(f||c),M=ge,d!==null){const we=d.views;x!==null&&(e.setRenderTargetFramebuffer(C,x.framebuffer),e.setRenderTarget(C));let Se=!1;we.length!==y.cameras.length&&(y.cameras.length=0,Se=!0);for(let Xe=0;Xe<we.length;Xe++){const at=we[Xe];let j=null;if(x!==null)j=x.getViewport(at);else{const ze=p.getViewSubImage(m,at);j=ze.viewport,Xe===0&&(e.setRenderTargetTextures(C,ze.colorTexture,m.ignoreDepthValues?void 0:ze.depthStencilTexture),e.setRenderTarget(C))}let $e=E[Xe];$e===void 0&&($e=new Bn,$e.layers.enable(Xe),$e.viewport=new Dt,E[Xe]=$e),$e.matrix.fromArray(at.transform.matrix),$e.matrix.decompose($e.position,$e.quaternion,$e.scale),$e.projectionMatrix.fromArray(at.projectionMatrix),$e.projectionMatrixInverse.copy($e.projectionMatrix).invert(),$e.viewport.set(j.x,j.y,j.width,j.height),Xe===0&&(y.matrix.copy($e.matrix),y.matrix.decompose(y.position,y.quaternion,y.scale)),Se===!0&&y.cameras.push($e)}const Ge=r.enabledFeatures;if(Ge&&Ge.includes("depth-sensing")){const Xe=p.getDepthInformation(we[0]);Xe&&Xe.isValid&&Xe.texture&&A.init(e,Xe,r.renderState)}}for(let we=0;we<b.length;we++){const Se=L[we],Ge=b[we];Se!==null&&Ge!==void 0&&Ge.update(Se,ge,f||c)}A.render(e,y),Me&&Me(ie,ge),ge.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ge}),M=null}const ot=new M_;ot.setAnimationLoop(Ke),this.setAnimationLoop=function(ie){Me=ie},this.dispose=function(){}}}const cs=new Li,bC=new Qe;function TC(i,e){function t(v,_){v.matrixAutoUpdate===!0&&v.updateMatrix(),_.value.copy(v.matrix)}function n(v,_){_.color.getRGB(v.fogColor.value,v_(i)),_.isFog?(v.fogNear.value=_.near,v.fogFar.value=_.far):_.isFogExp2&&(v.fogDensity.value=_.density)}function r(v,_,C,b,L){_.isMeshBasicMaterial||_.isMeshLambertMaterial?o(v,_):_.isMeshToonMaterial?(o(v,_),p(v,_)):_.isMeshPhongMaterial?(o(v,_),d(v,_)):_.isMeshStandardMaterial?(o(v,_),m(v,_),_.isMeshPhysicalMaterial&&x(v,_,L)):_.isMeshMatcapMaterial?(o(v,_),M(v,_)):_.isMeshDepthMaterial?o(v,_):_.isMeshDistanceMaterial?(o(v,_),A(v,_)):_.isMeshNormalMaterial?o(v,_):_.isLineBasicMaterial?(c(v,_),_.isLineDashedMaterial&&l(v,_)):_.isPointsMaterial?h(v,_,C,b):_.isSpriteMaterial?f(v,_):_.isShadowMaterial?(v.color.value.copy(_.color),v.opacity.value=_.opacity):_.isShaderMaterial&&(_.uniformsNeedUpdate=!1)}function o(v,_){v.opacity.value=_.opacity,_.color&&v.diffuse.value.copy(_.color),_.emissive&&v.emissive.value.copy(_.emissive).multiplyScalar(_.emissiveIntensity),_.map&&(v.map.value=_.map,t(_.map,v.mapTransform)),_.alphaMap&&(v.alphaMap.value=_.alphaMap,t(_.alphaMap,v.alphaMapTransform)),_.bumpMap&&(v.bumpMap.value=_.bumpMap,t(_.bumpMap,v.bumpMapTransform),v.bumpScale.value=_.bumpScale,_.side===Xn&&(v.bumpScale.value*=-1)),_.normalMap&&(v.normalMap.value=_.normalMap,t(_.normalMap,v.normalMapTransform),v.normalScale.value.copy(_.normalScale),_.side===Xn&&v.normalScale.value.negate()),_.displacementMap&&(v.displacementMap.value=_.displacementMap,t(_.displacementMap,v.displacementMapTransform),v.displacementScale.value=_.displacementScale,v.displacementBias.value=_.displacementBias),_.emissiveMap&&(v.emissiveMap.value=_.emissiveMap,t(_.emissiveMap,v.emissiveMapTransform)),_.specularMap&&(v.specularMap.value=_.specularMap,t(_.specularMap,v.specularMapTransform)),_.alphaTest>0&&(v.alphaTest.value=_.alphaTest);const C=e.get(_),b=C.envMap,L=C.envMapRotation;if(b&&(v.envMap.value=b,cs.copy(L),cs.x*=-1,cs.y*=-1,cs.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(cs.y*=-1,cs.z*=-1),v.envMapRotation.value.setFromMatrix4(bC.makeRotationFromEuler(cs)),v.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,v.reflectivity.value=_.reflectivity,v.ior.value=_.ior,v.refractionRatio.value=_.refractionRatio),_.lightMap){v.lightMap.value=_.lightMap;const k=i._useLegacyLights===!0?Math.PI:1;v.lightMapIntensity.value=_.lightMapIntensity*k,t(_.lightMap,v.lightMapTransform)}_.aoMap&&(v.aoMap.value=_.aoMap,v.aoMapIntensity.value=_.aoMapIntensity,t(_.aoMap,v.aoMapTransform))}function c(v,_){v.diffuse.value.copy(_.color),v.opacity.value=_.opacity,_.map&&(v.map.value=_.map,t(_.map,v.mapTransform))}function l(v,_){v.dashSize.value=_.dashSize,v.totalSize.value=_.dashSize+_.gapSize,v.scale.value=_.scale}function h(v,_,C,b){v.diffuse.value.copy(_.color),v.opacity.value=_.opacity,v.size.value=_.size*C,v.scale.value=b*.5,_.map&&(v.map.value=_.map,t(_.map,v.uvTransform)),_.alphaMap&&(v.alphaMap.value=_.alphaMap,t(_.alphaMap,v.alphaMapTransform)),_.alphaTest>0&&(v.alphaTest.value=_.alphaTest)}function f(v,_){v.diffuse.value.copy(_.color),v.opacity.value=_.opacity,v.rotation.value=_.rotation,_.map&&(v.map.value=_.map,t(_.map,v.mapTransform)),_.alphaMap&&(v.alphaMap.value=_.alphaMap,t(_.alphaMap,v.alphaMapTransform)),_.alphaTest>0&&(v.alphaTest.value=_.alphaTest)}function d(v,_){v.specular.value.copy(_.specular),v.shininess.value=Math.max(_.shininess,1e-4)}function p(v,_){_.gradientMap&&(v.gradientMap.value=_.gradientMap)}function m(v,_){v.metalness.value=_.metalness,_.metalnessMap&&(v.metalnessMap.value=_.metalnessMap,t(_.metalnessMap,v.metalnessMapTransform)),v.roughness.value=_.roughness,_.roughnessMap&&(v.roughnessMap.value=_.roughnessMap,t(_.roughnessMap,v.roughnessMapTransform)),_.envMap&&(v.envMapIntensity.value=_.envMapIntensity)}function x(v,_,C){v.ior.value=_.ior,_.sheen>0&&(v.sheenColor.value.copy(_.sheenColor).multiplyScalar(_.sheen),v.sheenRoughness.value=_.sheenRoughness,_.sheenColorMap&&(v.sheenColorMap.value=_.sheenColorMap,t(_.sheenColorMap,v.sheenColorMapTransform)),_.sheenRoughnessMap&&(v.sheenRoughnessMap.value=_.sheenRoughnessMap,t(_.sheenRoughnessMap,v.sheenRoughnessMapTransform))),_.clearcoat>0&&(v.clearcoat.value=_.clearcoat,v.clearcoatRoughness.value=_.clearcoatRoughness,_.clearcoatMap&&(v.clearcoatMap.value=_.clearcoatMap,t(_.clearcoatMap,v.clearcoatMapTransform)),_.clearcoatRoughnessMap&&(v.clearcoatRoughnessMap.value=_.clearcoatRoughnessMap,t(_.clearcoatRoughnessMap,v.clearcoatRoughnessMapTransform)),_.clearcoatNormalMap&&(v.clearcoatNormalMap.value=_.clearcoatNormalMap,t(_.clearcoatNormalMap,v.clearcoatNormalMapTransform),v.clearcoatNormalScale.value.copy(_.clearcoatNormalScale),_.side===Xn&&v.clearcoatNormalScale.value.negate())),_.iridescence>0&&(v.iridescence.value=_.iridescence,v.iridescenceIOR.value=_.iridescenceIOR,v.iridescenceThicknessMinimum.value=_.iridescenceThicknessRange[0],v.iridescenceThicknessMaximum.value=_.iridescenceThicknessRange[1],_.iridescenceMap&&(v.iridescenceMap.value=_.iridescenceMap,t(_.iridescenceMap,v.iridescenceMapTransform)),_.iridescenceThicknessMap&&(v.iridescenceThicknessMap.value=_.iridescenceThicknessMap,t(_.iridescenceThicknessMap,v.iridescenceThicknessMapTransform))),_.transmission>0&&(v.transmission.value=_.transmission,v.transmissionSamplerMap.value=C.texture,v.transmissionSamplerSize.value.set(C.width,C.height),_.transmissionMap&&(v.transmissionMap.value=_.transmissionMap,t(_.transmissionMap,v.transmissionMapTransform)),v.thickness.value=_.thickness,_.thicknessMap&&(v.thicknessMap.value=_.thicknessMap,t(_.thicknessMap,v.thicknessMapTransform)),v.attenuationDistance.value=_.attenuationDistance,v.attenuationColor.value.copy(_.attenuationColor)),_.anisotropy>0&&(v.anisotropyVector.value.set(_.anisotropy*Math.cos(_.anisotropyRotation),_.anisotropy*Math.sin(_.anisotropyRotation)),_.anisotropyMap&&(v.anisotropyMap.value=_.anisotropyMap,t(_.anisotropyMap,v.anisotropyMapTransform))),v.specularIntensity.value=_.specularIntensity,v.specularColor.value.copy(_.specularColor),_.specularColorMap&&(v.specularColorMap.value=_.specularColorMap,t(_.specularColorMap,v.specularColorMapTransform)),_.specularIntensityMap&&(v.specularIntensityMap.value=_.specularIntensityMap,t(_.specularIntensityMap,v.specularIntensityMapTransform))}function M(v,_){_.matcap&&(v.matcap.value=_.matcap)}function A(v,_){const C=e.get(_).light;v.referencePosition.value.setFromMatrixPosition(C.matrixWorld),v.nearDistance.value=C.shadow.camera.near,v.farDistance.value=C.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function AC(i,e,t,n){let r={},o={},c=[];const l=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function h(C,b){const L=b.program;n.uniformBlockBinding(C,L)}function f(C,b){let L=r[C.id];L===void 0&&(M(C),L=d(C),r[C.id]=L,C.addEventListener("dispose",v));const k=b.program;n.updateUBOMapping(C,k);const U=e.render.frame;o[C.id]!==U&&(m(C),o[C.id]=U)}function d(C){const b=p();C.__bindingPointIndex=b;const L=i.createBuffer(),k=C.__size,U=C.usage;return i.bindBuffer(i.UNIFORM_BUFFER,L),i.bufferData(i.UNIFORM_BUFFER,k,U),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,b,L),L}function p(){for(let C=0;C<l;C++)if(c.indexOf(C)===-1)return c.push(C),C;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(C){const b=r[C.id],L=C.uniforms,k=C.__cache;i.bindBuffer(i.UNIFORM_BUFFER,b);for(let U=0,O=L.length;U<O;U++){const I=Array.isArray(L[U])?L[U]:[L[U]];for(let E=0,y=I.length;E<y;E++){const F=I[E];if(x(F,U,E,k)===!0){const V=F.__offset,G=Array.isArray(F.value)?F.value:[F.value];let q=0;for(let ne=0;ne<G.length;ne++){const se=G[ne],pe=A(se);typeof se=="number"||typeof se=="boolean"?(F.__data[0]=se,i.bufferSubData(i.UNIFORM_BUFFER,V+q,F.__data)):se.isMatrix3?(F.__data[0]=se.elements[0],F.__data[1]=se.elements[1],F.__data[2]=se.elements[2],F.__data[3]=0,F.__data[4]=se.elements[3],F.__data[5]=se.elements[4],F.__data[6]=se.elements[5],F.__data[7]=0,F.__data[8]=se.elements[6],F.__data[9]=se.elements[7],F.__data[10]=se.elements[8],F.__data[11]=0):(se.toArray(F.__data,q),q+=pe.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,V,F.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function x(C,b,L,k){const U=C.value,O=b+"_"+L;if(k[O]===void 0)return typeof U=="number"||typeof U=="boolean"?k[O]=U:k[O]=U.clone(),!0;{const I=k[O];if(typeof U=="number"||typeof U=="boolean"){if(I!==U)return k[O]=U,!0}else if(I.equals(U)===!1)return I.copy(U),!0}return!1}function M(C){const b=C.uniforms;let L=0;const k=16;for(let O=0,I=b.length;O<I;O++){const E=Array.isArray(b[O])?b[O]:[b[O]];for(let y=0,F=E.length;y<F;y++){const V=E[y],G=Array.isArray(V.value)?V.value:[V.value];for(let q=0,ne=G.length;q<ne;q++){const se=G[q],pe=A(se),K=L%k;K!==0&&k-K<pe.boundary&&(L+=k-K),V.__data=new Float32Array(pe.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=L,L+=pe.storage}}}const U=L%k;return U>0&&(L+=k-U),C.__size=L,C.__cache={},this}function A(C){const b={boundary:0,storage:0};return typeof C=="number"||typeof C=="boolean"?(b.boundary=4,b.storage=4):C.isVector2?(b.boundary=8,b.storage=8):C.isVector3||C.isColor?(b.boundary=16,b.storage=12):C.isVector4?(b.boundary=16,b.storage=16):C.isMatrix3?(b.boundary=48,b.storage=48):C.isMatrix4?(b.boundary=64,b.storage=64):C.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",C),b}function v(C){const b=C.target;b.removeEventListener("dispose",v);const L=c.indexOf(b.__bindingPointIndex);c.splice(L,1),i.deleteBuffer(r[b.id]),delete r[b.id],delete o[b.id]}function _(){for(const C in r)i.deleteBuffer(r[C]);c=[],r={},o={}}return{bind:h,update:f,dispose:_}}class wC{constructor(e={}){const{canvas:t=yT(),context:n=null,depth:r=!0,stencil:o=!1,alpha:c=!1,antialias:l=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:f=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:p=!1}=e;this.isWebGLRenderer=!0;let m;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=n.getContextAttributes().alpha}else m=c;const x=new Uint32Array(4),M=new Int32Array(4);let A=null,v=null;const _=[],C=[];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._outputColorSpace=ln,this._useLegacyLights=!1,this.toneMapping=yr,this.toneMappingExposure=1;const b=this;let L=!1,k=0,U=0,O=null,I=-1,E=null;const y=new Dt,F=new Dt;let V=null;const G=new Ne(0);let q=0,ne=t.width,se=t.height,pe=1,K=null,he=null;const me=new Dt(0,0,ne,se),Me=new Dt(0,0,ne,se);let Ke=!1;const ot=new sf;let ie=!1,ge=!1;const we=new Qe,Se=new Pe,Ge=new N,Xe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function at(){return O===null?pe:1}let j=n;function $e(D,Y){const Q=t.getContext(D,Y);return Q!==null?Q:null}try{const D={alpha:!0,depth:r,stencil:o,antialias:l,premultipliedAlpha:h,preserveDrawingBuffer:f,powerPreference:d,failIfMajorPerformanceCaveat:p};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${ef}`),t.addEventListener("webglcontextlost",Z,!1),t.addEventListener("webglcontextrestored",oe,!1),t.addEventListener("webglcontextcreationerror",xe,!1),j===null){const Y="webgl2";if(j=$e(Y,D),j===null)throw $e(Y)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw console.error("THREE.WebGLRenderer: "+D.message),D}let ze,bt,He,Tt,B,w,te,ae,ue,de,Be,_e,De,Ve,ve,Te,qe,Le,Ie,ct,ft,St,gt,Mt;function Ue(){ze=new U1(j),ze.init(),bt=new C1(j,ze,e),St=new _C(j,ze),He=new mC(j),Tt=new B1(j),B=new tC,w=new gC(j,ze,He,B,bt,St,Tt),te=new L1(b),ae=new O1(b),ue=new WT(j),gt=new w1(j,ue),de=new N1(j,ue,Tt,gt),Be=new k1(j,de,ue,Tt),Ie=new z1(j,bt,w),Te=new P1(B),_e=new eC(b,te,ae,ze,bt,gt,Te),De=new TC(b,B),Ve=new iC,ve=new lC(ze),Le=new A1(b,te,ae,He,Be,m,h),qe=new pC(b,Be,bt),Mt=new AC(j,Tt,bt,He),ct=new R1(j,ze,Tt),ft=new F1(j,ze,Tt),Tt.programs=_e.programs,b.capabilities=bt,b.extensions=ze,b.properties=B,b.renderLists=Ve,b.shadowMap=qe,b.state=He,b.info=Tt}Ue();const S=new EC(b,j);this.xr=S,this.getContext=function(){return j},this.getContextAttributes=function(){return j.getContextAttributes()},this.forceContextLoss=function(){const D=ze.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=ze.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return pe},this.setPixelRatio=function(D){D!==void 0&&(pe=D,this.setSize(ne,se,!1))},this.getSize=function(D){return D.set(ne,se)},this.setSize=function(D,Y,Q=!0){if(S.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}ne=D,se=Y,t.width=Math.floor(D*pe),t.height=Math.floor(Y*pe),Q===!0&&(t.style.width=D+"px",t.style.height=Y+"px"),this.setViewport(0,0,D,Y)},this.getDrawingBufferSize=function(D){return D.set(ne*pe,se*pe).floor()},this.setDrawingBufferSize=function(D,Y,Q){ne=D,se=Y,pe=Q,t.width=Math.floor(D*Q),t.height=Math.floor(Y*Q),this.setViewport(0,0,D,Y)},this.getCurrentViewport=function(D){return D.copy(y)},this.getViewport=function(D){return D.copy(me)},this.setViewport=function(D,Y,Q,ee){D.isVector4?me.set(D.x,D.y,D.z,D.w):me.set(D,Y,Q,ee),He.viewport(y.copy(me).multiplyScalar(pe).round())},this.getScissor=function(D){return D.copy(Me)},this.setScissor=function(D,Y,Q,ee){D.isVector4?Me.set(D.x,D.y,D.z,D.w):Me.set(D,Y,Q,ee),He.scissor(F.copy(Me).multiplyScalar(pe).round())},this.getScissorTest=function(){return Ke},this.setScissorTest=function(D){He.setScissorTest(Ke=D)},this.setOpaqueSort=function(D){K=D},this.setTransparentSort=function(D){he=D},this.getClearColor=function(D){return D.copy(Le.getClearColor())},this.setClearColor=function(){Le.setClearColor.apply(Le,arguments)},this.getClearAlpha=function(){return Le.getClearAlpha()},this.setClearAlpha=function(){Le.setClearAlpha.apply(Le,arguments)},this.clear=function(D=!0,Y=!0,Q=!0){let ee=0;if(D){let $=!1;if(O!==null){const Ae=O.texture.format;$=Ae===o_||Ae===s_||Ae===r_}if($){const Ae=O.texture.type,Fe=Ae===Xr||Ae===xo||Ae===Qg||Ae===Ca||Ae===t_||Ae===n_,ke=Le.getClearColor(),Ze=Le.getClearAlpha(),Je=ke.r,et=ke.g,nt=ke.b;Fe?(x[0]=Je,x[1]=et,x[2]=nt,x[3]=Ze,j.clearBufferuiv(j.COLOR,0,x)):(M[0]=Je,M[1]=et,M[2]=nt,M[3]=Ze,j.clearBufferiv(j.COLOR,0,M))}else ee|=j.COLOR_BUFFER_BIT}Y&&(ee|=j.DEPTH_BUFFER_BIT),Q&&(ee|=j.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),j.clear(ee)},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",Z,!1),t.removeEventListener("webglcontextrestored",oe,!1),t.removeEventListener("webglcontextcreationerror",xe,!1),Ve.dispose(),ve.dispose(),B.dispose(),te.dispose(),ae.dispose(),Be.dispose(),gt.dispose(),Mt.dispose(),_e.dispose(),S.dispose(),S.removeEventListener("sessionstart",Kt),S.removeEventListener("sessionend",Zt),Pn.stop()};function Z(D){D.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),L=!0}function oe(){console.log("THREE.WebGLRenderer: Context Restored."),L=!1;const D=Tt.autoReset,Y=qe.enabled,Q=qe.autoUpdate,ee=qe.needsUpdate,$=qe.type;Ue(),Tt.autoReset=D,qe.enabled=Y,qe.autoUpdate=Q,qe.needsUpdate=ee,qe.type=$}function xe(D){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",D.statusMessage)}function Re(D){const Y=D.target;Y.removeEventListener("dispose",Re),_t(Y)}function _t(D){dt(D),B.remove(D)}function dt(D){const Y=B.get(D).programs;Y!==void 0&&(Y.forEach(function(Q){_e.releaseProgram(Q)}),D.isShaderMaterial&&_e.releaseShaderCache(D))}this.renderBufferDirect=function(D,Y,Q,ee,$,Ae){Y===null&&(Y=Xe);const Fe=$.isMesh&&$.matrixWorld.determinant()<0,ke=Tl(D,Y,Q,ee,$);He.setMaterial(ee,Fe);let Ze=Q.index,Je=1;if(ee.wireframe===!0){if(Ze=de.getWireframeAttribute(Q),Ze===void 0)return;Je=2}const et=Q.drawRange,nt=Q.attributes.position;let Yt=et.start*Je,Mn=(et.start+et.count)*Je;Ae!==null&&(Yt=Math.max(Yt,Ae.start*Je),Mn=Math.min(Mn,(Ae.start+Ae.count)*Je)),Ze!==null?(Yt=Math.max(Yt,0),Mn=Math.min(Mn,Ze.count)):nt!=null&&(Yt=Math.max(Yt,0),Mn=Math.min(Mn,nt.count));const Qt=Mn-Yt;if(Qt<0||Qt===1/0)return;gt.setup($,ee,ke,Q,Ze);let ni,kt=ct;if(Ze!==null&&(ni=ue.get(Ze),kt=ft,kt.setIndex(ni)),$.isMesh)ee.wireframe===!0?(He.setLineWidth(ee.wireframeLinewidth*at()),kt.setMode(j.LINES)):kt.setMode(j.TRIANGLES);else if($.isLine){let rt=ee.linewidth;rt===void 0&&(rt=1),He.setLineWidth(rt*at()),$.isLineSegments?kt.setMode(j.LINES):$.isLineLoop?kt.setMode(j.LINE_LOOP):kt.setMode(j.LINE_STRIP)}else $.isPoints?kt.setMode(j.POINTS):$.isSprite&&kt.setMode(j.TRIANGLES);if($.isBatchedMesh)kt.renderMultiDraw($._multiDrawStarts,$._multiDrawCounts,$._multiDrawCount);else if($.isInstancedMesh)kt.renderInstances(Yt,Qt,$.count);else if(Q.isInstancedBufferGeometry){const rt=Q._maxInstanceCount!==void 0?Q._maxInstanceCount:1/0,Io=Math.min(Q.instanceCount,rt);kt.renderInstances(Yt,Qt,Io)}else kt.render(Yt,Qt)};function Ft(D,Y,Q){D.transparent===!0&&D.side===Ai&&D.forceSinglePass===!1?(D.side=Xn,D.needsUpdate=!0,Es(D,Y,Q),D.side=Yi,D.needsUpdate=!0,Es(D,Y,Q),D.side=Ai):Es(D,Y,Q)}this.compile=function(D,Y,Q=null){Q===null&&(Q=D),v=ve.get(Q),v.init(),C.push(v),Q.traverseVisible(function($){$.isLight&&$.layers.test(Y.layers)&&(v.pushLight($),$.castShadow&&v.pushShadow($))}),D!==Q&&D.traverseVisible(function($){$.isLight&&$.layers.test(Y.layers)&&(v.pushLight($),$.castShadow&&v.pushShadow($))}),v.setupLights(b._useLegacyLights);const ee=new Set;return D.traverse(function($){const Ae=$.material;if(Ae)if(Array.isArray(Ae))for(let Fe=0;Fe<Ae.length;Fe++){const ke=Ae[Fe];Ft(ke,Q,$),ee.add(ke)}else Ft(Ae,Q,$),ee.add(Ae)}),C.pop(),v=null,ee},this.compileAsync=function(D,Y,Q=null){const ee=this.compile(D,Y,Q);return new Promise($=>{function Ae(){if(ee.forEach(function(Fe){B.get(Fe).currentProgram.isReady()&&ee.delete(Fe)}),ee.size===0){$(D);return}setTimeout(Ae,10)}ze.get("KHR_parallel_shader_compile")!==null?Ae():setTimeout(Ae,10)})};let rn=null;function At(D){rn&&rn(D)}function Kt(){Pn.stop()}function Zt(){Pn.start()}const Pn=new M_;Pn.setAnimationLoop(At),typeof self<"u"&&Pn.setContext(self),this.setAnimationLoop=function(D){rn=D,S.setAnimationLoop(D),D===null?Pn.stop():Pn.start()},S.addEventListener("sessionstart",Kt),S.addEventListener("sessionend",Zt),this.render=function(D,Y){if(Y!==void 0&&Y.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),S.enabled===!0&&S.isPresenting===!0&&(S.cameraAutoUpdate===!0&&S.updateCamera(Y),Y=S.getCamera()),D.isScene===!0&&D.onBeforeRender(b,D,Y,O),v=ve.get(D,C.length),v.init(),C.push(v),we.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),ot.setFromProjectionMatrix(we),ge=this.localClippingEnabled,ie=Te.init(this.clippingPlanes,ge),A=Ve.get(D,_.length),A.init(),_.push(A),Sn(D,Y,0,b.sortObjects),A.finish(),b.sortObjects===!0&&A.sort(K,he),this.info.render.frame++,ie===!0&&Te.beginShadows();const Q=v.state.shadowsArray;if(qe.render(Q,D,Y),ie===!0&&Te.endShadows(),this.info.autoReset===!0&&this.info.reset(),(S.enabled===!1||S.isPresenting===!1||S.hasDepthSensing()===!1)&&Le.render(A,D),v.setupLights(b._useLegacyLights),Y.isArrayCamera){const ee=Y.cameras;for(let $=0,Ae=ee.length;$<Ae;$++){const Fe=ee[$];Di(A,D,Fe,Fe.viewport)}}else Di(A,D,Y);O!==null&&(w.updateMultisampleRenderTarget(O),w.updateRenderTargetMipmap(O)),D.isScene===!0&&D.onAfterRender(b,D,Y),gt.resetDefaultState(),I=-1,E=null,C.pop(),C.length>0?v=C[C.length-1]:v=null,_.pop(),_.length>0?A=_[_.length-1]:A=null};function Sn(D,Y,Q,ee){if(D.visible===!1)return;if(D.layers.test(Y.layers)){if(D.isGroup)Q=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(Y);else if(D.isLight)v.pushLight(D),D.castShadow&&v.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||ot.intersectsSprite(D)){ee&&Ge.setFromMatrixPosition(D.matrixWorld).applyMatrix4(we);const Fe=Be.update(D),ke=D.material;ke.visible&&A.push(D,Fe,ke,Q,Ge.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||ot.intersectsObject(D))){const Fe=Be.update(D),ke=D.material;if(ee&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),Ge.copy(D.boundingSphere.center)):(Fe.boundingSphere===null&&Fe.computeBoundingSphere(),Ge.copy(Fe.boundingSphere.center)),Ge.applyMatrix4(D.matrixWorld).applyMatrix4(we)),Array.isArray(ke)){const Ze=Fe.groups;for(let Je=0,et=Ze.length;Je<et;Je++){const nt=Ze[Je],Yt=ke[nt.materialIndex];Yt&&Yt.visible&&A.push(D,Fe,Yt,Q,Ge.z,nt)}}else ke.visible&&A.push(D,Fe,ke,Q,Ge.z,null)}}const Ae=D.children;for(let Fe=0,ke=Ae.length;Fe<ke;Fe++)Sn(Ae[Fe],Y,Q,ee)}function Di(D,Y,Q,ee){const $=D.opaque,Ae=D.transmissive,Fe=D.transparent;v.setupLightsView(Q),ie===!0&&Te.setGlobalState(b.clippingPlanes,Q),Ae.length>0&&Oi($,Ae,Y,Q),ee&&He.viewport(y.copy(ee)),$.length>0&&Qi($,Y,Q),Ae.length>0&&Qi(Ae,Y,Q),Fe.length>0&&Qi(Fe,Y,Q),He.buffers.depth.setTest(!0),He.buffers.depth.setMask(!0),He.buffers.color.setMask(!0),He.setPolygonOffset(!1)}function Oi(D,Y,Q,ee){if((Q.isScene===!0?Q.overrideMaterial:null)!==null)return;if(v.state.transmissionRenderTarget===null){v.state.transmissionRenderTarget=new vs(1,1,{generateMipmaps:!0,type:ze.has("EXT_color_buffer_half_float")||ze.has("EXT_color_buffer_float")?ul:Xr,minFilter:_r,samples:4,stencilBuffer:o});const Je=B.get(v.state.transmissionRenderTarget);Je.__isTransmissionRenderTarget=!0}const Ae=v.state.transmissionRenderTarget;b.getDrawingBufferSize(Se),Ae.setSize(Se.x,Se.y);const Fe=b.getRenderTarget();b.setRenderTarget(Ae),b.getClearColor(G),q=b.getClearAlpha(),q<1&&b.setClearColor(16777215,.5),b.clear();const ke=b.toneMapping;b.toneMapping=yr,Qi(D,Q,ee),w.updateMultisampleRenderTarget(Ae),w.updateRenderTargetMipmap(Ae);let Ze=!1;for(let Je=0,et=Y.length;Je<et;Je++){const nt=Y[Je],Yt=nt.object,Mn=nt.geometry,Qt=nt.material,ni=nt.group;if(Qt.side===Ai&&Yt.layers.test(ee.layers)){const kt=Qt.side;Qt.side=Xn,Qt.needsUpdate=!0,Da(Yt,Q,ee,Mn,Qt,ni),Qt.side=kt,Qt.needsUpdate=!0,Ze=!0}}Ze===!0&&(w.updateMultisampleRenderTarget(Ae),w.updateRenderTargetMipmap(Ae)),b.setRenderTarget(Fe),b.setClearColor(G,q),b.toneMapping=ke}function Qi(D,Y,Q){const ee=Y.isScene===!0?Y.overrideMaterial:null;for(let $=0,Ae=D.length;$<Ae;$++){const Fe=D[$],ke=Fe.object,Ze=Fe.geometry,Je=ee===null?Fe.material:ee,et=Fe.group;ke.layers.test(Q.layers)&&Da(ke,Y,Q,Ze,Je,et)}}function Da(D,Y,Q,ee,$,Ae){D.onBeforeRender(b,Y,Q,ee,$,Ae),D.modelViewMatrix.multiplyMatrices(Q.matrixWorldInverse,D.matrixWorld),D.normalMatrix.getNormalMatrix(D.modelViewMatrix),$.onBeforeRender(b,Y,Q,ee,D,Ae),$.transparent===!0&&$.side===Ai&&$.forceSinglePass===!1?($.side=Xn,$.needsUpdate=!0,b.renderBufferDirect(Q,Y,ee,$,D,Ae),$.side=Yi,$.needsUpdate=!0,b.renderBufferDirect(Q,Y,ee,$,D,Ae),$.side=Ai):b.renderBufferDirect(Q,Y,ee,$,D,Ae),D.onAfterRender(b,Y,Q,ee,$,Ae)}function Es(D,Y,Q){Y.isScene!==!0&&(Y=Xe);const ee=B.get(D),$=v.state.lights,Ae=v.state.shadowsArray,Fe=$.state.version,ke=_e.getParameters(D,$.state,Ae,Y,Q),Ze=_e.getProgramCacheKey(ke);let Je=ee.programs;ee.environment=D.isMeshStandardMaterial?Y.environment:null,ee.fog=Y.fog,ee.envMap=(D.isMeshStandardMaterial?ae:te).get(D.envMap||ee.environment),ee.envMapRotation=ee.environment!==null&&D.envMap===null?Y.environmentRotation:D.envMapRotation,Je===void 0&&(D.addEventListener("dispose",Re),Je=new Map,ee.programs=Je);let et=Je.get(Ze);if(et!==void 0){if(ee.currentProgram===et&&ee.lightsStateVersion===Fe)return Ua(D,ke),et}else ke.uniforms=_e.getUniforms(D),D.onBuild(Q,ke,b),D.onBeforeCompile(ke,b),et=_e.acquireProgram(ke,Ze),Je.set(Ze,et),ee.uniforms=ke.uniforms;const nt=ee.uniforms;return(!D.isShaderMaterial&&!D.isRawShaderMaterial||D.clipping===!0)&&(nt.clippingPlanes=Te.uniform),Ua(D,ke),ee.needsLights=wl(D),ee.lightsStateVersion=Fe,ee.needsLights&&(nt.ambientLightColor.value=$.state.ambient,nt.lightProbe.value=$.state.probe,nt.directionalLights.value=$.state.directional,nt.directionalLightShadows.value=$.state.directionalShadow,nt.spotLights.value=$.state.spot,nt.spotLightShadows.value=$.state.spotShadow,nt.rectAreaLights.value=$.state.rectArea,nt.ltc_1.value=$.state.rectAreaLTC1,nt.ltc_2.value=$.state.rectAreaLTC2,nt.pointLights.value=$.state.point,nt.pointLightShadows.value=$.state.pointShadow,nt.hemisphereLights.value=$.state.hemi,nt.directionalShadowMap.value=$.state.directionalShadowMap,nt.directionalShadowMatrix.value=$.state.directionalShadowMatrix,nt.spotShadowMap.value=$.state.spotShadowMap,nt.spotLightMatrix.value=$.state.spotLightMatrix,nt.spotLightMap.value=$.state.spotLightMap,nt.pointShadowMap.value=$.state.pointShadowMap,nt.pointShadowMatrix.value=$.state.pointShadowMatrix),ee.currentProgram=et,ee.uniformsList=null,et}function Oa(D){if(D.uniformsList===null){const Y=D.currentProgram.getUniforms();D.uniformsList=sl.seqWithValue(Y.seq,D.uniforms)}return D.uniformsList}function Ua(D,Y){const Q=B.get(D);Q.outputColorSpace=Y.outputColorSpace,Q.batching=Y.batching,Q.instancing=Y.instancing,Q.instancingColor=Y.instancingColor,Q.instancingMorph=Y.instancingMorph,Q.skinning=Y.skinning,Q.morphTargets=Y.morphTargets,Q.morphNormals=Y.morphNormals,Q.morphColors=Y.morphColors,Q.morphTargetsCount=Y.morphTargetsCount,Q.numClippingPlanes=Y.numClippingPlanes,Q.numIntersection=Y.numClipIntersection,Q.vertexAlphas=Y.vertexAlphas,Q.vertexTangents=Y.vertexTangents,Q.toneMapping=Y.toneMapping}function Tl(D,Y,Q,ee,$){Y.isScene!==!0&&(Y=Xe),w.resetTextureUnits();const Ae=Y.fog,Fe=ee.isMeshStandardMaterial?Y.environment:null,ke=O===null?b.outputColorSpace:O.isXRRenderTarget===!0?O.texture.colorSpace:yn,Ze=(ee.isMeshStandardMaterial?ae:te).get(ee.envMap||Fe),Je=ee.vertexColors===!0&&!!Q.attributes.color&&Q.attributes.color.itemSize===4,et=!!Q.attributes.tangent&&(!!ee.normalMap||ee.anisotropy>0),nt=!!Q.morphAttributes.position,Yt=!!Q.morphAttributes.normal,Mn=!!Q.morphAttributes.color;let Qt=yr;ee.toneMapped&&(O===null||O.isXRRenderTarget===!0)&&(Qt=b.toneMapping);const ni=Q.morphAttributes.position||Q.morphAttributes.normal||Q.morphAttributes.color,kt=ni!==void 0?ni.length:0,rt=B.get(ee),Io=v.state.lights;if(ie===!0&&(ge===!0||D!==E)){const Ln=D===E&&ee.id===I;Te.setState(ee,D,Ln)}let Bt=!1;ee.version===rt.__version?(rt.needsLights&&rt.lightsStateVersion!==Io.state.version||rt.outputColorSpace!==ke||$.isBatchedMesh&&rt.batching===!1||!$.isBatchedMesh&&rt.batching===!0||$.isInstancedMesh&&rt.instancing===!1||!$.isInstancedMesh&&rt.instancing===!0||$.isSkinnedMesh&&rt.skinning===!1||!$.isSkinnedMesh&&rt.skinning===!0||$.isInstancedMesh&&rt.instancingColor===!0&&$.instanceColor===null||$.isInstancedMesh&&rt.instancingColor===!1&&$.instanceColor!==null||$.isInstancedMesh&&rt.instancingMorph===!0&&$.morphTexture===null||$.isInstancedMesh&&rt.instancingMorph===!1&&$.morphTexture!==null||rt.envMap!==Ze||ee.fog===!0&&rt.fog!==Ae||rt.numClippingPlanes!==void 0&&(rt.numClippingPlanes!==Te.numPlanes||rt.numIntersection!==Te.numIntersection)||rt.vertexAlphas!==Je||rt.vertexTangents!==et||rt.morphTargets!==nt||rt.morphNormals!==Yt||rt.morphColors!==Mn||rt.toneMapping!==Qt||rt.morphTargetsCount!==kt)&&(Bt=!0):(Bt=!0,rt.__version=ee.version);let Ui=rt.currentProgram;Bt===!0&&(Ui=Es(ee,Y,$));let Do=!1,Sr=!1,jr=!1;const dn=Ui.getUniforms(),gi=rt.uniforms;if(He.useProgram(Ui.program)&&(Do=!0,Sr=!0,jr=!0),ee.id!==I&&(I=ee.id,Sr=!0),Do||E!==D){dn.setValue(j,"projectionMatrix",D.projectionMatrix),dn.setValue(j,"viewMatrix",D.matrixWorldInverse);const Ln=dn.map.cameraPosition;Ln!==void 0&&Ln.setValue(j,Ge.setFromMatrixPosition(D.matrixWorld)),bt.logarithmicDepthBuffer&&dn.setValue(j,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(ee.isMeshPhongMaterial||ee.isMeshToonMaterial||ee.isMeshLambertMaterial||ee.isMeshBasicMaterial||ee.isMeshStandardMaterial||ee.isShaderMaterial)&&dn.setValue(j,"isOrthographic",D.isOrthographicCamera===!0),E!==D&&(E=D,Sr=!0,jr=!0)}if($.isSkinnedMesh){dn.setOptional(j,$,"bindMatrix"),dn.setOptional(j,$,"bindMatrixInverse");const Ln=$.skeleton;Ln&&(Ln.boneTexture===null&&Ln.computeBoneTexture(),dn.setValue(j,"boneTexture",Ln.boneTexture,w))}$.isBatchedMesh&&(dn.setOptional(j,$,"batchingTexture"),dn.setValue(j,"batchingTexture",$._matricesTexture,w));const Mr=Q.morphAttributes;if((Mr.position!==void 0||Mr.normal!==void 0||Mr.color!==void 0)&&Ie.update($,Q,Ui),(Sr||rt.receiveShadow!==$.receiveShadow)&&(rt.receiveShadow=$.receiveShadow,dn.setValue(j,"receiveShadow",$.receiveShadow)),ee.isMeshGouraudMaterial&&ee.envMap!==null&&(gi.envMap.value=Ze,gi.flipEnvMap.value=Ze.isCubeTexture&&Ze.isRenderTargetTexture===!1?-1:1),ee.isMeshStandardMaterial&&ee.envMap===null&&Y.environment!==null&&(gi.envMapIntensity.value=Y.environmentIntensity),Sr&&(dn.setValue(j,"toneMappingExposure",b.toneMappingExposure),rt.needsLights&&Al(gi,jr),Ae&&ee.fog===!0&&De.refreshFogUniforms(gi,Ae),De.refreshMaterialUniforms(gi,ee,pe,se,v.state.transmissionRenderTarget),sl.upload(j,Oa(rt),gi,w)),ee.isShaderMaterial&&ee.uniformsNeedUpdate===!0&&(sl.upload(j,Oa(rt),gi,w),ee.uniformsNeedUpdate=!1),ee.isSpriteMaterial&&dn.setValue(j,"center",$.center),dn.setValue(j,"modelViewMatrix",$.modelViewMatrix),dn.setValue(j,"normalMatrix",$.normalMatrix),dn.setValue(j,"modelMatrix",$.matrixWorld),ee.isShaderMaterial||ee.isRawShaderMaterial){const Ln=ee.uniformsGroups;for(let Oo=0,Na=Ln.length;Oo<Na;Oo++){const Uo=Ln[Oo];Mt.update(Uo,Ui),Mt.bind(Uo,Ui)}}return Ui}function Al(D,Y){D.ambientLightColor.needsUpdate=Y,D.lightProbe.needsUpdate=Y,D.directionalLights.needsUpdate=Y,D.directionalLightShadows.needsUpdate=Y,D.pointLights.needsUpdate=Y,D.pointLightShadows.needsUpdate=Y,D.spotLights.needsUpdate=Y,D.spotLightShadows.needsUpdate=Y,D.rectAreaLights.needsUpdate=Y,D.hemisphereLights.needsUpdate=Y}function wl(D){return D.isMeshLambertMaterial||D.isMeshToonMaterial||D.isMeshPhongMaterial||D.isMeshStandardMaterial||D.isShadowMaterial||D.isShaderMaterial&&D.lights===!0}this.getActiveCubeFace=function(){return k},this.getActiveMipmapLevel=function(){return U},this.getRenderTarget=function(){return O},this.setRenderTargetTextures=function(D,Y,Q){B.get(D.texture).__webglTexture=Y,B.get(D.depthTexture).__webglTexture=Q;const ee=B.get(D);ee.__hasExternalTextures=!0,ee.__autoAllocateDepthBuffer=Q===void 0,ee.__autoAllocateDepthBuffer||ze.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ee.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(D,Y){const Q=B.get(D);Q.__webglFramebuffer=Y,Q.__useDefaultFramebuffer=Y===void 0},this.setRenderTarget=function(D,Y=0,Q=0){O=D,k=Y,U=Q;let ee=!0,$=null,Ae=!1,Fe=!1;if(D){const Ze=B.get(D);Ze.__useDefaultFramebuffer!==void 0?(He.bindFramebuffer(j.FRAMEBUFFER,null),ee=!1):Ze.__webglFramebuffer===void 0?w.setupRenderTarget(D):Ze.__hasExternalTextures&&w.rebindTextures(D,B.get(D.texture).__webglTexture,B.get(D.depthTexture).__webglTexture);const Je=D.texture;(Je.isData3DTexture||Je.isDataArrayTexture||Je.isCompressedArrayTexture)&&(Fe=!0);const et=B.get(D).__webglFramebuffer;D.isWebGLCubeRenderTarget?(Array.isArray(et[Y])?$=et[Y][Q]:$=et[Y],Ae=!0):D.samples>0&&w.useMultisampledRTT(D)===!1?$=B.get(D).__webglMultisampledFramebuffer:Array.isArray(et)?$=et[Q]:$=et,y.copy(D.viewport),F.copy(D.scissor),V=D.scissorTest}else y.copy(me).multiplyScalar(pe).floor(),F.copy(Me).multiplyScalar(pe).floor(),V=Ke;if(He.bindFramebuffer(j.FRAMEBUFFER,$)&&ee&&He.drawBuffers(D,$),He.viewport(y),He.scissor(F),He.setScissorTest(V),Ae){const Ze=B.get(D.texture);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_CUBE_MAP_POSITIVE_X+Y,Ze.__webglTexture,Q)}else if(Fe){const Ze=B.get(D.texture),Je=Y||0;j.framebufferTextureLayer(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,Ze.__webglTexture,Q||0,Je)}I=-1},this.readRenderTargetPixels=function(D,Y,Q,ee,$,Ae,Fe){if(!(D&&D.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ke=B.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Fe!==void 0&&(ke=ke[Fe]),ke){He.bindFramebuffer(j.FRAMEBUFFER,ke);try{const Ze=D.texture,Je=Ze.format,et=Ze.type;if(Je!==Ci&&St.convert(Je)!==j.getParameter(j.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const nt=et===ul&&(ze.has("EXT_color_buffer_half_float")||ze.has("EXT_color_buffer_float"));if(et!==Xr&&St.convert(et)!==j.getParameter(j.IMPLEMENTATION_COLOR_READ_TYPE)&&et!==Vi&&!nt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=D.width-ee&&Q>=0&&Q<=D.height-$&&j.readPixels(Y,Q,ee,$,St.convert(Je),St.convert(et),Ae)}finally{const Ze=O!==null?B.get(O).__webglFramebuffer:null;He.bindFramebuffer(j.FRAMEBUFFER,Ze)}}},this.copyFramebufferToTexture=function(D,Y,Q=0){const ee=Math.pow(2,-Q),$=Math.floor(Y.image.width*ee),Ae=Math.floor(Y.image.height*ee);w.setTexture2D(Y,0),j.copyTexSubImage2D(j.TEXTURE_2D,Q,0,0,D.x,D.y,$,Ae),He.unbindTexture()},this.copyTextureToTexture=function(D,Y,Q,ee=0){const $=Y.image.width,Ae=Y.image.height,Fe=St.convert(Q.format),ke=St.convert(Q.type);w.setTexture2D(Q,0),j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,Q.flipY),j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Q.premultiplyAlpha),j.pixelStorei(j.UNPACK_ALIGNMENT,Q.unpackAlignment),Y.isDataTexture?j.texSubImage2D(j.TEXTURE_2D,ee,D.x,D.y,$,Ae,Fe,ke,Y.image.data):Y.isCompressedTexture?j.compressedTexSubImage2D(j.TEXTURE_2D,ee,D.x,D.y,Y.mipmaps[0].width,Y.mipmaps[0].height,Fe,Y.mipmaps[0].data):j.texSubImage2D(j.TEXTURE_2D,ee,D.x,D.y,Fe,ke,Y.image),ee===0&&Q.generateMipmaps&&j.generateMipmap(j.TEXTURE_2D),He.unbindTexture()},this.copyTextureToTexture3D=function(D,Y,Q,ee,$=0){const Ae=Math.round(D.max.x-D.min.x),Fe=Math.round(D.max.y-D.min.y),ke=D.max.z-D.min.z+1,Ze=St.convert(ee.format),Je=St.convert(ee.type);let et;if(ee.isData3DTexture)w.setTexture3D(ee,0),et=j.TEXTURE_3D;else if(ee.isDataArrayTexture||ee.isCompressedArrayTexture)w.setTexture2DArray(ee,0),et=j.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,ee.flipY),j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ee.premultiplyAlpha),j.pixelStorei(j.UNPACK_ALIGNMENT,ee.unpackAlignment);const nt=j.getParameter(j.UNPACK_ROW_LENGTH),Yt=j.getParameter(j.UNPACK_IMAGE_HEIGHT),Mn=j.getParameter(j.UNPACK_SKIP_PIXELS),Qt=j.getParameter(j.UNPACK_SKIP_ROWS),ni=j.getParameter(j.UNPACK_SKIP_IMAGES),kt=Q.isCompressedTexture?Q.mipmaps[$]:Q.image;j.pixelStorei(j.UNPACK_ROW_LENGTH,kt.width),j.pixelStorei(j.UNPACK_IMAGE_HEIGHT,kt.height),j.pixelStorei(j.UNPACK_SKIP_PIXELS,D.min.x),j.pixelStorei(j.UNPACK_SKIP_ROWS,D.min.y),j.pixelStorei(j.UNPACK_SKIP_IMAGES,D.min.z),Q.isDataTexture||Q.isData3DTexture?j.texSubImage3D(et,$,Y.x,Y.y,Y.z,Ae,Fe,ke,Ze,Je,kt.data):ee.isCompressedArrayTexture?j.compressedTexSubImage3D(et,$,Y.x,Y.y,Y.z,Ae,Fe,ke,Ze,kt.data):j.texSubImage3D(et,$,Y.x,Y.y,Y.z,Ae,Fe,ke,Ze,Je,kt),j.pixelStorei(j.UNPACK_ROW_LENGTH,nt),j.pixelStorei(j.UNPACK_IMAGE_HEIGHT,Yt),j.pixelStorei(j.UNPACK_SKIP_PIXELS,Mn),j.pixelStorei(j.UNPACK_SKIP_ROWS,Qt),j.pixelStorei(j.UNPACK_SKIP_IMAGES,ni),$===0&&ee.generateMipmaps&&j.generateMipmap(et),He.unbindTexture()},this.initTexture=function(D){D.isCubeTexture?w.setTextureCube(D,0):D.isData3DTexture?w.setTexture3D(D,0):D.isDataArrayTexture||D.isCompressedArrayTexture?w.setTexture2DArray(D,0):w.setTexture2D(D,0),He.unbindTexture()},this.resetState=function(){k=0,U=0,O=null,He.reset(),gt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return vr}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===tf?"display-p3":"srgb",t.unpackColorSpace=Ct.workingColorSpace===yl?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class RC extends mt{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 Li,this.environmentIntensity=1,this.environmentRotation=new Li,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}}class C_{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Nh,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Pi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return f_("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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 r=0,o=this.stride;r<o;r++)this.array[e+r]=t.array[n+r];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=Pi()),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=Pi()),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 Un=new N;class Ra{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}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++)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}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=wi(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Lt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Lt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Lt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Lt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Lt(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=wi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=wi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=wi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=wi(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),r=Lt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,o){return e=e*this.data.stride+this.offset,this.normalized&&(t=Lt(t,this.array),n=Lt(n,this.array),r=Lt(r,this.array),o=Lt(o,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=o,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)t.push(this.data.array[r+o])}return new nn(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 Ra(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)t.push(this.data.array[r+o])}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}}}class P_ extends mi{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ne(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 io;const ta=new N,ro=new N,so=new N,oo=new Pe,na=new Pe,L_=new Qe,Vc=new N,ia=new N,Wc=new N,rg=new Pe,ph=new Pe,sg=new Pe;class CC extends mt{constructor(e=new P_){if(super(),this.isSprite=!0,this.type="Sprite",io===void 0){io=new Jt;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 C_(t,5);io.setIndex([0,1,2,0,2,3]),io.setAttribute("position",new Ra(n,3,0,!1)),io.setAttribute("uv",new Ra(n,2,3,!1))}this.geometry=io,this.material=e,this.center=new Pe(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ro.setFromMatrixScale(this.matrixWorld),L_.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),so.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&ro.multiplyScalar(-so.z);const n=this.material.rotation;let r,o;n!==0&&(o=Math.cos(n),r=Math.sin(n));const c=this.center;Xc(Vc.set(-.5,-.5,0),so,c,ro,r,o),Xc(ia.set(.5,-.5,0),so,c,ro,r,o),Xc(Wc.set(.5,.5,0),so,c,ro,r,o),rg.set(0,0),ph.set(1,0),sg.set(1,1);let l=e.ray.intersectTriangle(Vc,ia,Wc,!1,ta);if(l===null&&(Xc(ia.set(-.5,.5,0),so,c,ro,r,o),ph.set(0,1),l=e.ray.intersectTriangle(Vc,Wc,ia,!1,ta),l===null))return;const h=e.ray.origin.distanceTo(ta);h<e.near||h>e.far||t.push({distance:h,point:ta.clone(),uv:Ri.getInterpolation(ta,Vc,ia,Wc,rg,ph,sg,new Pe),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 Xc(i,e,t,n,r,o){oo.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(na.x=o*oo.x-r*oo.y,na.y=r*oo.x+o*oo.y):na.copy(oo),i.copy(e),i.x+=na.x,i.y+=na.y,i.applyMatrix4(L_)}const og=new N,ag=new Dt,cg=new Dt,PC=new N,lg=new Qe,Yc=new N,mh=new Zi,ug=new Qe,gh=new To;class LC extends ye{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=zp,this.bindMatrix=new Qe,this.bindMatrixInverse=new Qe,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Ii),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Yc),this.boundingBox.expandByPoint(Yc)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Zi),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Yc),this.boundingSphere.expandByPoint(Yc)}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,r=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),mh.copy(this.boundingSphere),mh.applyMatrix4(r),e.ray.intersectsSphere(mh)!==!1&&(ug.copy(r).invert(),gh.copy(e.ray).applyMatrix4(ug),!(this.boundingBox!==null&&gh.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,gh)))}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 Dt,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);const o=1/e.manhattanLength();o!==1/0?e.multiplyScalar(o):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===zp?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Nb?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,r=this.geometry;ag.fromBufferAttribute(r.attributes.skinIndex,e),cg.fromBufferAttribute(r.attributes.skinWeight,e),og.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let o=0;o<4;o++){const c=cg.getComponent(o);if(c!==0){const l=ag.getComponent(o);lg.multiplyMatrices(n.bones[l].matrixWorld,n.boneInverses[l]),t.addScaledVector(PC.copy(og).applyMatrix4(lg),c)}}return t.applyMatrix4(this.bindMatrixInverse)}}class I_ extends mt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class D_ extends un{constructor(e=null,t=1,n=1,r,o,c,l,h,f=zn,d=zn,p,m){super(null,c,l,h,f,d,r,o,p,m),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const hg=new Qe,IC=new Qe;class af{constructor(e=[],t=[]){this.uuid=Pi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=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){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new Qe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Qe;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,r=this.boneTexture;for(let o=0,c=e.length;o<c;o++){const l=e[o]?e[o].matrixWorld:IC;hg.multiplyMatrices(l,t[o]),hg.toArray(n,o*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new af(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 D_(t,e,e,Ci,Vi);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 r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){const o=e.bones[n];let c=t[o];c===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",o),c=new I_),this.bones.push(c),this.boneInverses.push(new Qe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let r=0,o=t.length;r<o;r++){const c=t[r];e.bones.push(c.uuid);const l=n[r];e.boneInverses.push(l.toArray())}return e}}class Bh extends nn{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}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 ao=new Qe,fg=new Qe,jc=[],dg=new Ii,DC=new Qe,ra=new ye,sa=new Zi;class OC extends ye{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Bh(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<n;r++)this.setMatrixAt(r,DC)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Ii),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ao),dg.copy(e.boundingBox).applyMatrix4(ao),this.boundingBox.union(dg)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Zi),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ao),sa.copy(e.boundingSphere).applyMatrix4(ao),this.boundingSphere.union(sa)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),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,r=this.morphTexture.source.data.data,o=n.length+1,c=e*o+1;for(let l=0;l<n.length;l++)n[l]=r[c+l]}raycast(e,t){const n=this.matrixWorld,r=this.count;if(ra.geometry=this.geometry,ra.material=this.material,ra.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),sa.copy(this.boundingSphere),sa.applyMatrix4(n),e.ray.intersectsSphere(sa)!==!1))for(let o=0;o<r;o++){this.getMatrixAt(o,ao),fg.multiplyMatrices(n,ao),ra.matrixWorld=fg,ra.raycast(e,jc);for(let c=0,l=jc.length;c<l;c++){const h=jc[c];h.instanceId=o,h.object=this,t.push(h)}jc.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Bh(new Float32Array(this.instanceMatrix.count*3),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,r=n.length+1;this.morphTexture===null&&(this.morphTexture=new D_(new Float32Array(r*this.count),r,this.count,i_,Vi));const o=this.morphTexture.source.data.data;let c=0;for(let f=0;f<n.length;f++)c+=n[f];const l=this.geometry.morphTargetsRelative?1:1-c,h=r*e;o[h]=l,o.set(n,h+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null),this}}class wo extends mi{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ne(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 pg=new N,mg=new N,gg=new Qe,_h=new To,qc=new Zi;class di extends mt{constructor(e=new Jt,t=new wo){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,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 r=1,o=t.count;r<o;r++)pg.fromBufferAttribute(t,r-1),mg.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=pg.distanceTo(mg);e.setAttribute("lineDistance",new Nt(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,o=e.params.Line.threshold,c=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),qc.copy(n.boundingSphere),qc.applyMatrix4(r),qc.radius+=o,e.ray.intersectsSphere(qc)===!1)return;gg.copy(r).invert(),_h.copy(e.ray).applyMatrix4(gg);const l=o/((this.scale.x+this.scale.y+this.scale.z)/3),h=l*l,f=new N,d=new N,p=new N,m=new N,x=this.isLineSegments?2:1,M=n.index,v=n.attributes.position;if(M!==null){const _=Math.max(0,c.start),C=Math.min(M.count,c.start+c.count);for(let b=_,L=C-1;b<L;b+=x){const k=M.getX(b),U=M.getX(b+1);if(f.fromBufferAttribute(v,k),d.fromBufferAttribute(v,U),_h.distanceSqToSegment(f,d,m,p)>h)continue;m.applyMatrix4(this.matrixWorld);const I=e.ray.origin.distanceTo(m);I<e.near||I>e.far||t.push({distance:I,point:p.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else{const _=Math.max(0,c.start),C=Math.min(v.count,c.start+c.count);for(let b=_,L=C-1;b<L;b+=x){if(f.fromBufferAttribute(v,b),d.fromBufferAttribute(v,b+1),_h.distanceSqToSegment(f,d,m,p)>h)continue;m.applyMatrix4(this.matrixWorld);const U=e.ray.origin.distanceTo(m);U<e.near||U>e.far||t.push({distance:U,point:p.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,c=r.length;o<c;o++){const l=r[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=o}}}}}const _g=new N,vg=new N;class cf extends di{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 r=0,o=t.count;r<o;r+=2)_g.fromBufferAttribute(t,r),vg.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+_g.distanceTo(vg);e.setAttribute("lineDistance",new Nt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class UC extends di{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class O_ extends mi{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ne(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 xg=new Qe,zh=new To,Kc=new Zi,Zc=new N;class NC extends mt{constructor(e=new Jt,t=new O_){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,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,r=this.matrixWorld,o=e.params.Points.threshold,c=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Kc.copy(n.boundingSphere),Kc.applyMatrix4(r),Kc.radius+=o,e.ray.intersectsSphere(Kc)===!1)return;xg.copy(r).invert(),zh.copy(e.ray).applyMatrix4(xg);const l=o/((this.scale.x+this.scale.y+this.scale.z)/3),h=l*l,f=n.index,p=n.attributes.position;if(f!==null){const m=Math.max(0,c.start),x=Math.min(f.count,c.start+c.count);for(let M=m,A=x;M<A;M++){const v=f.getX(M);Zc.fromBufferAttribute(p,v),yg(Zc,v,h,r,e,t,this)}}else{const m=Math.max(0,c.start),x=Math.min(p.count,c.start+c.count);for(let M=m,A=x;M<A;M++)Zc.fromBufferAttribute(p,M),yg(Zc,M,h,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,c=r.length;o<c;o++){const l=r[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=o}}}}}function yg(i,e,t,n,r,o,c){const l=zh.distanceSqToPoint(i);if(l<t){const h=new N;zh.closestPointToPoint(i,h),h.applyMatrix4(n);const f=r.ray.origin.distanceTo(h);if(f<r.near||f>r.far)return;o.push({distance:f,distanceToRay:Math.sqrt(l),point:h,index:e,face:null,object:c})}}class gn extends Jt{constructor(e=1,t=1,n=1,r=32,o=1,c=!1,l=0,h=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:o,openEnded:c,thetaStart:l,thetaLength:h};const f=this;r=Math.floor(r),o=Math.floor(o);const d=[],p=[],m=[],x=[];let M=0;const A=[],v=n/2;let _=0;C(),c===!1&&(e>0&&b(!0),t>0&&b(!1)),this.setIndex(d),this.setAttribute("position",new Nt(p,3)),this.setAttribute("normal",new Nt(m,3)),this.setAttribute("uv",new Nt(x,2));function C(){const L=new N,k=new N;let U=0;const O=(t-e)/n;for(let I=0;I<=o;I++){const E=[],y=I/o,F=y*(t-e)+e;for(let V=0;V<=r;V++){const G=V/r,q=G*h+l,ne=Math.sin(q),se=Math.cos(q);k.x=F*ne,k.y=-y*n+v,k.z=F*se,p.push(k.x,k.y,k.z),L.set(ne,O,se).normalize(),m.push(L.x,L.y,L.z),x.push(G,1-y),E.push(M++)}A.push(E)}for(let I=0;I<r;I++)for(let E=0;E<o;E++){const y=A[E][I],F=A[E+1][I],V=A[E+1][I+1],G=A[E][I+1];d.push(y,F,G),d.push(F,V,G),U+=6}f.addGroup(_,U,0),_+=U}function b(L){const k=M,U=new Pe,O=new N;let I=0;const E=L===!0?e:t,y=L===!0?1:-1;for(let V=1;V<=r;V++)p.push(0,v*y,0),m.push(0,y,0),x.push(.5,.5),M++;const F=M;for(let V=0;V<=r;V++){const q=V/r*h+l,ne=Math.cos(q),se=Math.sin(q);O.x=E*se,O.y=v*y,O.z=E*ne,p.push(O.x,O.y,O.z),m.push(0,y,0),U.x=ne*.5+.5,U.y=se*.5*y+.5,x.push(U.x,U.y),M++}for(let V=0;V<r;V++){const G=k+V,q=F+V;L===!0?d.push(q,q+1,G):d.push(q+1,q,G),I+=3}f.addGroup(_,I,L===!0?1:2),_+=I}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gn(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class lf extends gn{constructor(e=1,t=1,n=32,r=1,o=!1,c=0,l=Math.PI*2){super(0,e,t,n,r,o,c,l),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:o,thetaStart:c,thetaLength:l}}static fromJSON(e){return new lf(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class uf extends Jt{constructor(e=[],t=[],n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r};const o=[],c=[];l(r),f(n),d(),this.setAttribute("position",new Nt(o,3)),this.setAttribute("normal",new Nt(o.slice(),3)),this.setAttribute("uv",new Nt(c,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function l(C){const b=new N,L=new N,k=new N;for(let U=0;U<t.length;U+=3)x(t[U+0],b),x(t[U+1],L),x(t[U+2],k),h(b,L,k,C)}function h(C,b,L,k){const U=k+1,O=[];for(let I=0;I<=U;I++){O[I]=[];const E=C.clone().lerp(L,I/U),y=b.clone().lerp(L,I/U),F=U-I;for(let V=0;V<=F;V++)V===0&&I===U?O[I][V]=E:O[I][V]=E.clone().lerp(y,V/F)}for(let I=0;I<U;I++)for(let E=0;E<2*(U-I)-1;E++){const y=Math.floor(E/2);E%2===0?(m(O[I][y+1]),m(O[I+1][y]),m(O[I][y])):(m(O[I][y+1]),m(O[I+1][y+1]),m(O[I+1][y]))}}function f(C){const b=new N;for(let L=0;L<o.length;L+=3)b.x=o[L+0],b.y=o[L+1],b.z=o[L+2],b.normalize().multiplyScalar(C),o[L+0]=b.x,o[L+1]=b.y,o[L+2]=b.z}function d(){const C=new N;for(let b=0;b<o.length;b+=3){C.x=o[b+0],C.y=o[b+1],C.z=o[b+2];const L=v(C)/2/Math.PI+.5,k=_(C)/Math.PI+.5;c.push(L,1-k)}M(),p()}function p(){for(let C=0;C<c.length;C+=6){const b=c[C+0],L=c[C+2],k=c[C+4],U=Math.max(b,L,k),O=Math.min(b,L,k);U>.9&&O<.1&&(b<.2&&(c[C+0]+=1),L<.2&&(c[C+2]+=1),k<.2&&(c[C+4]+=1))}}function m(C){o.push(C.x,C.y,C.z)}function x(C,b){const L=C*3;b.x=e[L+0],b.y=e[L+1],b.z=e[L+2]}function M(){const C=new N,b=new N,L=new N,k=new N,U=new Pe,O=new Pe,I=new Pe;for(let E=0,y=0;E<o.length;E+=9,y+=6){C.set(o[E+0],o[E+1],o[E+2]),b.set(o[E+3],o[E+4],o[E+5]),L.set(o[E+6],o[E+7],o[E+8]),U.set(c[y+0],c[y+1]),O.set(c[y+2],c[y+3]),I.set(c[y+4],c[y+5]),k.copy(C).add(b).add(L).divideScalar(3);const F=v(k);A(U,y+0,C,F),A(O,y+2,b,F),A(I,y+4,L,F)}}function A(C,b,L,k){k<0&&C.x===1&&(c[b]=C.x-1),L.x===0&&L.z===0&&(c[b]=k/2/Math.PI+.5)}function v(C){return Math.atan2(C.z,-C.x)}function _(C){return Math.atan2(-C.y,Math.sqrt(C.x*C.x+C.z*C.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new uf(e.vertices,e.indices,e.radius,e.details)}}class uo extends uf{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],r=[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,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new uo(e.radius,e.detail)}}class Pa extends Jt{constructor(e=1,t=32,n=16,r=0,o=Math.PI*2,c=0,l=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:o,thetaStart:c,thetaLength:l},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const h=Math.min(c+l,Math.PI);let f=0;const d=[],p=new N,m=new N,x=[],M=[],A=[],v=[];for(let _=0;_<=n;_++){const C=[],b=_/n;let L=0;_===0&&c===0?L=.5/t:_===n&&h===Math.PI&&(L=-.5/t);for(let k=0;k<=t;k++){const U=k/t;p.x=-e*Math.cos(r+U*o)*Math.sin(c+b*l),p.y=e*Math.cos(c+b*l),p.z=e*Math.sin(r+U*o)*Math.sin(c+b*l),M.push(p.x,p.y,p.z),m.copy(p).normalize(),A.push(m.x,m.y,m.z),v.push(U+L,1-b),C.push(f++)}d.push(C)}for(let _=0;_<n;_++)for(let C=0;C<t;C++){const b=d[_][C+1],L=d[_][C],k=d[_+1][C],U=d[_+1][C+1];(_!==0||c>0)&&x.push(b,L,U),(_!==n-1||h<Math.PI)&&x.push(L,k,U)}this.setIndex(x),this.setAttribute("position",new Nt(M,3)),this.setAttribute("normal",new Nt(A,3)),this.setAttribute("uv",new Nt(v,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Pa(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class gs extends Jt{constructor(e=1,t=.4,n=12,r=48,o=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:o},n=Math.floor(n),r=Math.floor(r);const c=[],l=[],h=[],f=[],d=new N,p=new N,m=new N;for(let x=0;x<=n;x++)for(let M=0;M<=r;M++){const A=M/r*o,v=x/n*Math.PI*2;p.x=(e+t*Math.cos(v))*Math.cos(A),p.y=(e+t*Math.cos(v))*Math.sin(A),p.z=t*Math.sin(v),l.push(p.x,p.y,p.z),d.x=e*Math.cos(A),d.y=e*Math.sin(A),m.subVectors(p,d).normalize(),h.push(m.x,m.y,m.z),f.push(M/r),f.push(x/n)}for(let x=1;x<=n;x++)for(let M=1;M<=r;M++){const A=(r+1)*x+M-1,v=(r+1)*(x-1)+M-1,_=(r+1)*(x-1)+M,C=(r+1)*x+M;c.push(A,v,C),c.push(v,_,C)}this.setIndex(c),this.setAttribute("position",new Nt(l,3)),this.setAttribute("normal",new Nt(h,3)),this.setAttribute("uv",new Nt(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gs(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class FC extends mi{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ne(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}}class Ro extends mi{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Ne(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 Ne(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=l_,this.normalScale=new Pe(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 Li,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 $i extends Ro{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 Pe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return xn(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 Ne(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 Ne(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ne(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=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 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.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 BC extends wo{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 $c(i,e,t){return!i||!t&&i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function zC(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function kC(i){function e(r,o){return i[r]-i[o]}const t=i.length,n=new Array(t);for(let r=0;r!==t;++r)n[r]=r;return n.sort(e),n}function Sg(i,e,t){const n=i.length,r=new i.constructor(n);for(let o=0,c=0;c!==n;++o){const l=t[o]*e;for(let h=0;h!==e;++h)r[c++]=i[l+h]}return r}function U_(i,e,t,n){let r=1,o=i[0];for(;o!==void 0&&o[n]===void 0;)o=i[r++];if(o===void 0)return;let c=o[n];if(c!==void 0)if(Array.isArray(c))do c=o[n],c!==void 0&&(e.push(o.time),t.push.apply(t,c)),o=i[r++];while(o!==void 0);else if(c.toArray!==void 0)do c=o[n],c!==void 0&&(e.push(o.time),c.toArray(t,t.length)),o=i[r++];while(o!==void 0);else do c=o[n],c!==void 0&&(e.push(o.time),t.push(c)),o=i[r++];while(o!==void 0)}class La{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r: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,r=t[n],o=t[n-1];e:{t:{let c;n:{i:if(!(e<r)){for(let l=n+2;;){if(r===void 0){if(e<o)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===l)break;if(o=r,r=t[++n],e<r)break t}c=t.length;break n}if(!(e>=o)){const l=t[1];e<l&&(n=2,o=l);for(let h=n-2;;){if(o===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===h)break;if(r=o,o=t[--n-1],e>=o)break t}c=n,n=0;break n}break e}for(;n<c;){const l=n+c>>>1;e<t[l]?c=l:n=l+1}if(r=t[n],o=t[n-1],o===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,o,r)}return this.interpolate_(n,o,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,o=e*r;for(let c=0;c!==r;++c)t[c]=n[o+c];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class HC extends La{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:hm,endingEnd:hm}}intervalChanged_(e,t,n){const r=this.parameterPositions;let o=e-2,c=e+1,l=r[o],h=r[c];if(l===void 0)switch(this.getSettings_().endingStart){case fm:o=e,l=2*t-n;break;case dm:o=r.length-2,l=t+r[o]-r[o+1];break;default:o=e,l=n}if(h===void 0)switch(this.getSettings_().endingEnd){case fm:c=e,h=2*n-t;break;case dm:c=1,h=n+r[1]-r[0];break;default:c=e-1,h=t}const f=(n-t)*.5,d=this.valueSize;this._weightPrev=f/(t-l),this._weightNext=f/(h-n),this._offsetPrev=o*d,this._offsetNext=c*d}interpolate_(e,t,n,r){const o=this.resultBuffer,c=this.sampleValues,l=this.valueSize,h=e*l,f=h-l,d=this._offsetPrev,p=this._offsetNext,m=this._weightPrev,x=this._weightNext,M=(n-t)/(r-t),A=M*M,v=A*M,_=-m*v+2*m*A-m*M,C=(1+m)*v+(-1.5-2*m)*A+(-.5+m)*M+1,b=(-1-x)*v+(1.5+x)*A+.5*M,L=x*v-x*A;for(let k=0;k!==l;++k)o[k]=_*c[d+k]+C*c[f+k]+b*c[h+k]+L*c[p+k];return o}}class GC extends La{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const o=this.resultBuffer,c=this.sampleValues,l=this.valueSize,h=e*l,f=h-l,d=(n-t)/(r-t),p=1-d;for(let m=0;m!==l;++m)o[m]=c[f+m]*p+c[h+m]*d;return o}}class VC extends La{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class Ji{constructor(e,t,n,r){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=$c(t,this.TimeBufferType),this.values=$c(n,this.ValueBufferType),this.setInterpolation(r||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:$c(e.times,Array),values:$c(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new VC(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new GC(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new HC(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Aa:t=this.InterpolantFactoryMethodDiscrete;break;case yo:t=this.InterpolantFactoryMethodLinear;break;case Gu:t=this.InterpolantFactoryMethodSmooth;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 console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Aa;case this.InterpolantFactoryMethodLinear:return yo;case this.InterpolantFactoryMethodSmooth:return Gu}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){const n=this.times,r=n.length;let o=0,c=r-1;for(;o!==r&&n[o]<e;)++o;for(;c!==-1&&n[c]>t;)--c;if(++c,o!==0||c!==r){o>=c&&(c=Math.max(c,1),o=c-1);const l=this.getValueSize();this.times=n.slice(o,c),this.values=this.values.slice(o*l,c*l)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,r=this.values,o=n.length;o===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let c=null;for(let l=0;l!==o;l++){const h=n[l];if(typeof h=="number"&&isNaN(h)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,l,h),e=!1;break}if(c!==null&&c>h){console.error("THREE.KeyframeTrack: Out of order keys.",this,l,h,c),e=!1;break}c=h}if(r!==void 0&&zC(r))for(let l=0,h=r.length;l!==h;++l){const f=r[l];if(isNaN(f)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,f),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===Gu,o=e.length-1;let c=1;for(let l=1;l<o;++l){let h=!1;const f=e[l],d=e[l+1];if(f!==d&&(l!==1||f!==e[0]))if(r)h=!0;else{const p=l*n,m=p-n,x=p+n;for(let M=0;M!==n;++M){const A=t[p+M];if(A!==t[m+M]||A!==t[x+M]){h=!0;break}}}if(h){if(l!==c){e[c]=e[l];const p=l*n,m=c*n;for(let x=0;x!==n;++x)t[m+x]=t[p+x]}++c}}if(o>0){e[c]=e[o];for(let l=o*n,h=c*n,f=0;f!==n;++f)t[h+f]=t[l+f];++c}return c!==e.length?(this.times=e.slice(0,c),this.values=t.slice(0,c*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}Ji.prototype.TimeBufferType=Float32Array;Ji.prototype.ValueBufferType=Float32Array;Ji.prototype.DefaultInterpolation=yo;class Co extends Ji{}Co.prototype.ValueTypeName="bool";Co.prototype.ValueBufferType=Array;Co.prototype.DefaultInterpolation=Aa;Co.prototype.InterpolantFactoryMethodLinear=void 0;Co.prototype.InterpolantFactoryMethodSmooth=void 0;class N_ extends Ji{}N_.prototype.ValueTypeName="color";class Eo extends Ji{}Eo.prototype.ValueTypeName="number";class WC extends La{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const o=this.resultBuffer,c=this.sampleValues,l=this.valueSize,h=(n-t)/(r-t);let f=e*l;for(let d=f+l;f!==d;f+=4)on.slerpFlat(o,0,c,f-l,c,f,h);return o}}class xs extends Ji{InterpolantFactoryMethodLinear(e){return new WC(this.times,this.values,this.getValueSize(),e)}}xs.prototype.ValueTypeName="quaternion";xs.prototype.DefaultInterpolation=yo;xs.prototype.InterpolantFactoryMethodSmooth=void 0;class Po extends Ji{}Po.prototype.ValueTypeName="string";Po.prototype.ValueBufferType=Array;Po.prototype.DefaultInterpolation=Aa;Po.prototype.InterpolantFactoryMethodLinear=void 0;Po.prototype.InterpolantFactoryMethodSmooth=void 0;class bo extends Ji{}bo.prototype.ValueTypeName="vector";class XC{constructor(e="",t=-1,n=[],r=Yb){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=Pi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,r=1/(e.fps||1);for(let c=0,l=n.length;c!==l;++c)t.push(jC(n[c]).scale(r));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o}static toJSON(e){const t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let o=0,c=n.length;o!==c;++o)t.push(Ji.toJSON(n[o]));return r}static CreateFromMorphTargetSequence(e,t,n,r){const o=t.length,c=[];for(let l=0;l<o;l++){let h=[],f=[];h.push((l+o-1)%o,l,(l+1)%o),f.push(0,1,0);const d=kC(h);h=Sg(h,1,d),f=Sg(f,1,d),!r&&h[0]===0&&(h.push(o),f.push(f[0])),c.push(new Eo(".morphTargetInfluences["+t[l].name+"]",h,f).scale(1/n))}return new this(e,-1,c)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const r=e;n=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const r={},o=/^([\w-]*?)([\d]+)$/;for(let l=0,h=e.length;l<h;l++){const f=e[l],d=f.name.match(o);if(d&&d.length>1){const p=d[1];let m=r[p];m||(r[p]=m=[]),m.push(f)}}const c=[];for(const l in r)c.push(this.CreateFromMorphTargetSequence(l,r[l],t,n));return c}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(p,m,x,M,A){if(x.length!==0){const v=[],_=[];U_(x,v,_,M),v.length!==0&&A.push(new p(m,v,_))}},r=[],o=e.name||"default",c=e.fps||30,l=e.blendMode;let h=e.length||-1;const f=e.hierarchy||[];for(let p=0;p<f.length;p++){const m=f[p].keys;if(!(!m||m.length===0))if(m[0].morphTargets){const x={};let M;for(M=0;M<m.length;M++)if(m[M].morphTargets)for(let A=0;A<m[M].morphTargets.length;A++)x[m[M].morphTargets[A]]=-1;for(const A in x){const v=[],_=[];for(let C=0;C!==m[M].morphTargets.length;++C){const b=m[M];v.push(b.time),_.push(b.morphTarget===A?1:0)}r.push(new Eo(".morphTargetInfluence["+A+"]",v,_))}h=x.length*c}else{const x=".bones["+t[p].name+"]";n(bo,x+".position",m,"pos",r),n(xs,x+".quaternion",m,"rot",r),n(bo,x+".scale",m,"scl",r)}}return r.length===0?null:new this(o,h,r,l)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,r=e.length;n!==r;++n){const o=this.tracks[n];t=Math.max(t,o.times[o.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function YC(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Eo;case"vector":case"vector2":case"vector3":case"vector4":return bo;case"color":return N_;case"quaternion":return xs;case"bool":case"boolean":return Co;case"string":return Po}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function jC(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=YC(i.type);if(i.times===void 0){const t=[],n=[];U_(i.keys,t,n,"value"),i.times=t,i.values=n}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}const Vr={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class qC{constructor(e,t,n){const r=this;let o=!1,c=0,l=0,h;const f=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(d){l++,o===!1&&r.onStart!==void 0&&r.onStart(d,c,l),o=!0},this.itemEnd=function(d){c++,r.onProgress!==void 0&&r.onProgress(d,c,l),c===l&&(o=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(d){r.onError!==void 0&&r.onError(d)},this.resolveURL=function(d){return h?h(d):d},this.setURLModifier=function(d){return h=d,this},this.addHandler=function(d,p){return f.push(d,p),this},this.removeHandler=function(d){const p=f.indexOf(d);return p!==-1&&f.splice(p,2),this},this.getHandler=function(d){for(let p=0,m=f.length;p<m;p+=2){const x=f[p],M=f[p+1];if(x.global&&(x.lastIndex=0),x.test(d))return M}return null}}}const KC=new qC;let Ms=class{constructor(e){this.manager=e!==void 0?e:KC,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(r,o){n.load(e,r,t,o)})}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}};Ms.DEFAULT_MATERIAL_NAME="__DEFAULT";const pr={};class ZC extends Error{constructor(e,t){super(e),this.response=t}}class ml extends Ms{constructor(e){super(e)}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=Vr.get(e);if(o!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(o),this.manager.itemEnd(e)},0),o;if(pr[e]!==void 0){pr[e].push({onLoad:t,onProgress:n,onError:r});return}pr[e]=[],pr[e].push({onLoad:t,onProgress:n,onError:r});const c=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),l=this.mimeType,h=this.responseType;fetch(c).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const d=pr[e],p=f.body.getReader(),m=f.headers.get("Content-Length")||f.headers.get("X-File-Size"),x=m?parseInt(m):0,M=x!==0;let A=0;const v=new ReadableStream({start(_){C();function C(){p.read().then(({done:b,value:L})=>{if(b)_.close();else{A+=L.byteLength;const k=new ProgressEvent("progress",{lengthComputable:M,loaded:A,total:x});for(let U=0,O=d.length;U<O;U++){const I=d[U];I.onProgress&&I.onProgress(k)}_.enqueue(L),C()}})}}});return new Response(v)}else throw new ZC(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(h){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(d=>new DOMParser().parseFromString(d,l));case"json":return f.json();default:if(l===void 0)return f.text();{const p=/charset="?([^;"\s]*)"?/i.exec(l),m=p&&p[1]?p[1].toLowerCase():void 0,x=new TextDecoder(m);return f.arrayBuffer().then(M=>x.decode(M))}}}).then(f=>{Vr.add(e,f);const d=pr[e];delete pr[e];for(let p=0,m=d.length;p<m;p++){const x=d[p];x.onLoad&&x.onLoad(f)}}).catch(f=>{const d=pr[e];if(d===void 0)throw this.manager.itemError(e),f;delete pr[e];for(let p=0,m=d.length;p<m;p++){const x=d[p];x.onError&&x.onError(f)}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}}class $C extends Ms{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,c=Vr.get(e);if(c!==void 0)return o.manager.itemStart(e),setTimeout(function(){t&&t(c),o.manager.itemEnd(e)},0),c;const l=wa("img");function h(){d(),Vr.add(e,this),t&&t(this),o.manager.itemEnd(e)}function f(p){d(),r&&r(p),o.manager.itemError(e),o.manager.itemEnd(e)}function d(){l.removeEventListener("load",h,!1),l.removeEventListener("error",f,!1)}return l.addEventListener("load",h,!1),l.addEventListener("error",f,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(l.crossOrigin=this.crossOrigin),o.manager.itemStart(e),l.src=e,l}}class F_ extends Ms{constructor(e){super(e)}load(e,t,n,r){const o=new un,c=new $C(this.manager);return c.setCrossOrigin(this.crossOrigin),c.setPath(this.path),c.load(e,function(l){o.image=l,o.needsUpdate=!0,t!==void 0&&t(o)},n,r),o}}class Lo extends mt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ne(e),this.intensity=t}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,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class JC extends Lo{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(mt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ne(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const vh=new Qe,Mg=new N,Eg=new N;class hf{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Pe(512,512),this.map=null,this.mapPass=null,this.matrix=new Qe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new sf,this._frameExtents=new Pe(1,1),this._viewportCount=1,this._viewports=[new Dt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Mg.setFromMatrixPosition(e.matrixWorld),t.position.copy(Mg),Eg.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Eg),t.updateMatrixWorld(),vh.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(vh),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(vh)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class QC extends hf{constructor(){super(new Bn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=So*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,o=e.distance||t.far;(n!==t.fov||r!==t.aspect||o!==t.far)&&(t.fov=n,t.aspect=r,t.far=o,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class eP extends Lo{constructor(e,t,n=0,r=Math.PI/3,o=0,c=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(mt.DEFAULT_UP),this.updateMatrix(),this.target=new mt,this.distance=n,this.angle=r,this.penumbra=o,this.decay=c,this.map=null,this.shadow=new QC}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}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.shadow=e.shadow.clone(),this}}const bg=new Qe,oa=new N,xh=new N;class tP extends hf{constructor(){super(new Bn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Pe(4,2),this._viewportCount=6,this._viewports=[new Dt(2,1,1,1),new Dt(0,1,1,1),new Dt(3,1,1,1),new Dt(1,1,1,1),new Dt(3,0,1,1),new Dt(1,0,1,1)],this._cubeDirections=[new N(1,0,0),new N(-1,0,0),new N(0,0,1),new N(0,0,-1),new N(0,1,0),new N(0,-1,0)],this._cubeUps=[new N(0,1,0),new N(0,1,0),new N(0,1,0),new N(0,1,0),new N(0,0,1),new N(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,r=this.matrix,o=e.distance||n.far;o!==n.far&&(n.far=o,n.updateProjectionMatrix()),oa.setFromMatrixPosition(e.matrixWorld),n.position.copy(oa),xh.copy(n.position),xh.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(xh),n.updateMatrixWorld(),r.makeTranslation(-oa.x,-oa.y,-oa.z),bg.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(bg)}}class B_ extends Lo{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new tP}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}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}}class nP extends hf{constructor(){super(new Sl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class ff extends Lo{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(mt.DEFAULT_UP),this.updateMatrix(),this.target=new mt,this.shadow=new nP}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class iP extends Lo{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class rP{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new N)}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,r=e.y,o=e.z,c=this.coefficients;return t.copy(c[0]).multiplyScalar(.282095),t.addScaledVector(c[1],.488603*r),t.addScaledVector(c[2],.488603*o),t.addScaledVector(c[3],.488603*n),t.addScaledVector(c[4],1.092548*(n*r)),t.addScaledVector(c[5],1.092548*(r*o)),t.addScaledVector(c[6],.315392*(3*o*o-1)),t.addScaledVector(c[7],1.092548*(n*o)),t.addScaledVector(c[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){const n=e.x,r=e.y,o=e.z,c=this.coefficients;return t.copy(c[0]).multiplyScalar(.886227),t.addScaledVector(c[1],2*.511664*r),t.addScaledVector(c[2],2*.511664*o),t.addScaledVector(c[3],2*.511664*n),t.addScaledVector(c[4],2*.429043*n*r),t.addScaledVector(c[5],2*.429043*r*o),t.addScaledVector(c[6],.743125*o*o-.247708),t.addScaledVector(c[7],2*.429043*n*o),t.addScaledVector(c[8],.429043*(n*n-r*r)),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 r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const n=e.x,r=e.y,o=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*o,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*o,t[6]=.315392*(3*o*o-1),t[7]=1.092548*n*o,t[8]=.546274*(n*n-r*r)}}class sP extends Lo{constructor(e=new rP,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Sa{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}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 oP extends Ms{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,c=Vr.get(e);if(c!==void 0){if(o.manager.itemStart(e),c.then){c.then(f=>{t&&t(f),o.manager.itemEnd(e)}).catch(f=>{r&&r(f)});return}return setTimeout(function(){t&&t(c),o.manager.itemEnd(e)},0),c}const l={};l.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",l.headers=this.requestHeader;const h=fetch(e,l).then(function(f){return f.blob()}).then(function(f){return createImageBitmap(f,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(f){return Vr.add(e,f),t&&t(f),o.manager.itemEnd(e),f}).catch(function(f){r&&r(f),Vr.remove(e),o.manager.itemError(e),o.manager.itemEnd(e)});Vr.add(e,h),o.manager.itemStart(e)}}const df="\\[\\]\\.:\\/",aP=new RegExp("["+df+"]","g"),pf="[^"+df+"]",cP="[^"+df.replace("\\.","")+"]",lP=/((?:WC+[\/:])*)/.source.replace("WC",pf),uP=/(WCOD+)?/.source.replace("WCOD",cP),hP=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",pf),fP=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",pf),dP=new RegExp("^"+lP+uP+hP+fP+"$"),pP=["material","materials","bones","map"];class mP{constructor(e,t,n){const r=n||It.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,o=n.length;r!==o;++r)n[r].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 It{constructor(e,t,n){this.path=t,this.parsedPath=n||It.parseTrackName(t),this.node=It.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 It.Composite(e,t,n):new It(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(aP,"")}static parseTrackName(e){const t=dP.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]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const o=n.nodeName.substring(r+1);pP.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=o)}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(o){for(let c=0;c<o.length;c++){const l=o[c];if(l.name===t||l.uuid===t)return l;const h=n(l.children);if(h)return h}return null},r=n(e.children);if(r)return r}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 r=0,o=n.length;r!==o;++r)e[t++]=n[r]}_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 r=0,o=n.length;r!==o;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,o=n.length;r!==o;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,o=n.length;r!==o;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,r=t.propertyName;let o=t.propertyIndex;if(e||(e=It.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let f=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let d=0;d<e.length;d++)if(e[d].name===f){f=d;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.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){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(f!==void 0){if(e[f]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[f]}}const c=e[r];if(c===void 0){const f=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+f+"."+r+" but it wasn't found.",e);return}let l=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?l=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(l=this.Versioning.MatrixWorldNeedsUpdate);let h=this.BindingType.Direct;if(o!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[o]!==void 0&&(o=e.morphTargetDictionary[o])}h=this.BindingType.ArrayElement,this.resolvedProperty=c,this.propertyIndex=o}else c.fromArray!==void 0&&c.toArray!==void 0?(h=this.BindingType.HasFromToArray,this.resolvedProperty=c):Array.isArray(c)?(h=this.BindingType.EntireArray,this.resolvedProperty=c):this.propertyName=r;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][l]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}It.Composite=mP;It.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};It.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};It.prototype.GetterByBindingType=[It.prototype._getValue_direct,It.prototype._getValue_array,It.prototype._getValue_arrayElement,It.prototype._getValue_toArray];It.prototype.SetterByBindingTypeAndVersioning=[[It.prototype._setValue_direct,It.prototype._setValue_direct_setNeedsUpdate,It.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[It.prototype._setValue_array,It.prototype._setValue_array_setNeedsUpdate,It.prototype._setValue_array_setMatrixWorldNeedsUpdate],[It.prototype._setValue_arrayElement,It.prototype._setValue_arrayElement_setNeedsUpdate,It.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[It.prototype._setValue_fromArray,It.prototype._setValue_fromArray_setNeedsUpdate,It.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];const Tg=new Qe;class El{constructor(e,t,n=0,r=1/0){this.ray=new To(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new rf,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Tg.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Tg),this}intersectObject(e,t=!0,n=[]){return kh(e,this,n,t),n.sort(Ag),n}intersectObjects(e,t=!0,n=[]){for(let r=0,o=e.length;r<o;r++)kh(e[r],this,n,t);return n.sort(Ag),n}}function Ag(i,e){return i.distance-e.distance}function kh(i,e,t,n){if(i.layers.test(e.layers)&&i.raycast(e,t),n===!0){const r=i.children;for(let o=0,c=r.length;o<c;o++)kh(r[o],e,t,!0)}}class wg{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,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(xn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class gP extends cf{constructor(e=10,t=10,n=4473924,r=8947848){n=new Ne(n),r=new Ne(r);const o=t/2,c=e/t,l=e/2,h=[],f=[];for(let m=0,x=0,M=-l;m<=t;m++,M+=c){h.push(-l,0,M,l,0,M),h.push(M,0,-l,M,0,l);const A=m===o?n:r;A.toArray(f,x),x+=3,A.toArray(f,x),x+=3,A.toArray(f,x),x+=3,A.toArray(f,x),x+=3}const d=new Jt;d.setAttribute("position",new Nt(h,3)),d.setAttribute("color",new Nt(f,3));const p=new wo({vertexColors:!0,toneMapped:!1});super(d,p),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class _P extends cf{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],r=new Jt;r.setAttribute("position",new Nt(t,3)),r.setAttribute("color",new Nt(n,3));const o=new wo({vertexColors:!0,toneMapped:!1});super(r,o),this.type="AxesHelper"}setColors(e,t,n){const r=new Ne,o=this.geometry.attributes.color.array;return r.set(e),r.toArray(o,0),r.toArray(o,3),r.set(t),r.toArray(o,6),r.toArray(o,9),r.set(n),r.toArray(o,12),r.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ef}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ef);const fs={antialias:!0,alpha:!0,stencil:!1,shadowMapEnabled:!0,shadowMapType:Kg,toneMapping:yr,canvas:void 0};class Rg extends wC{paused=!1;running=!1;force=!1;preRenderCallbacks=new Map;postRenderCallbacks=new Map;constructor(e=fs){super({antialias:e.antialias||fs.antialias,alpha:e.alpha||fs.alpha,preserveDrawingBuffer:!0,canvas:e.canvas}),this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=e.shadowMapEnabled||fs.shadowMapEnabled,this.shadowMap.type=e.shadowMapType||fs.shadowMapType,this.toneMapping=e.toneMapping||fs.toneMapping,this.debug.checkShaderErrors=!1}Dispose(){this.StopRenderer(),this.dispose()}StartRenderer(e,t){this.setAnimationLoop((n,r)=>{this.internal_render(e,t,n,r)}),this.running=!0}PauseRenderer(){this.paused=!0}ResumeRenderer(){this.paused=!1}StopRenderer(){this.setAnimationLoop(null),this.running=!1}OnResize(e,t){this.setSize(e,t)}AddPreRenderCallback(e){const t=ji.generateUUID();return this.preRenderCallbacks.set(t,e),t}RemovePreRenderCallback(e){return this.preRenderCallbacks.has(e)?(this.preRenderCallbacks.delete(e),!0):!1}AddPostRenderCallback(e){const t=ji.generateUUID();return this.postRenderCallbacks.set(t,e),t}RemovePostRenderCallback(e){return this.postRenderCallbacks.has(e)?(this.postRenderCallbacks.delete(e),!0):!1}ForceRendering(){this.force=!0}internal_render(e,t,n,r){(this.paused||!this.running)&&!this.force||(this.preRenderCallbacks.forEach(o=>{o(n,r)}),this.render(e,t),this.postRenderCallbacks.forEach(o=>{o(n,r)}),this.force=!1)}}const vP=1,aa=2,mf=4,z_=8,ti=16;class xP extends mt{isDIVELight=!0;isDIVEAmbientLight=!0;_light;constructor(){super(),this.name="DIVEAmbientLight",this._light=new iP(16777215,1),this._light.layers.mask=ti,this.add(this._light)}SetColor(e){this._light.color=e}SetIntensity(e){this._light.intensity=e}SetEnabled(e){this._light.visible=e}}const wn=["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","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];function yP(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(wn[i&255]+wn[i>>8&255]+wn[i>>16&255]+wn[i>>24&255]+"-"+wn[e&255]+wn[e>>8&255]+"-"+wn[e>>16&15|64]+wn[e>>24&255]+"-"+wn[t&63|128]+wn[t>>8&255]+"-"+wn[t>>16&255]+wn[t>>24&255]+wn[n&255]+wn[n>>8&255]+wn[n>>16&255]+wn[n>>24&255]).toLowerCase()}function ol(i,e){return i?e in i:!1}function gl(i,e){if(i)return ol(i,e)?i:gl(i.parent,e)}class SP{POINTER_DRAG_THRESHOLD=.001;name;_canvas;_scene;_controller;_pointer;get _pointerAnyDown(){return this._pointerPrimaryDown||this._pointerMiddleDown||this._pointerSecondaryDown}_pointerPrimaryDown;_pointerMiddleDown;_pointerSecondaryDown;_lastPointerDown;_lastPointerUp;_raycaster;_intersects;_hovered;_dragging;_dragStart;_dragCurrent;_dragEnd;_dragDelta;_draggable;_dragRaycastOnObjects;constructor(e,t){this.name="BaseTool",this._canvas=t.domElement,this._scene=e,this._controller=t,this._pointer=new Pe,this._pointerPrimaryDown=!1,this._pointerMiddleDown=!1,this._pointerSecondaryDown=!1,this._lastPointerDown=new Pe,this._lastPointerUp=new Pe,this._raycaster=new El,this._raycaster.layers.mask=ti|mf,this._intersects=[],this._hovered=null,this._dragging=!1,this._dragStart=new N,this._dragCurrent=new N,this._dragEnd=new N,this._dragDelta=new N,this._draggable=null,this._dragRaycastOnObjects=null}Activate(){}Deactivate(){}onPointerDown(e){switch(e.button){case 0:{this._pointerPrimaryDown=!0;break}case 1:{this._pointerMiddleDown=!0;break}case 2:{this._pointerSecondaryDown=!0;break}default:console.warn("DIVEBaseTool.onPointerDown: Unknown button: "+e.button)}this._lastPointerDown.copy(this._pointer),this._draggable=gl(this._intersects[0]?.object,"isDraggable")||null}onDragStart(e){this._draggable&&(this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0)),this._intersects.length!==0&&(this._dragStart.copy(this._intersects[0].point.clone()),this._dragCurrent.copy(this._intersects[0].point.clone()),this._dragEnd.copy(this._dragStart.clone()),this._dragDelta.set(0,0,0),this._draggable&&this._draggable.onDragStart&&(this._draggable.onDragStart({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._dragging=!0,this._controller.enabled=!1)))}onPointerMove(e){this._pointer.x=e.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(e.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object),this._intersects=this.raycast(this._scene.children);const t=gl(this._intersects[0]?.object,"isHoverable");if(this._intersects[0]&&t){if(!this._hovered){t.onPointerEnter&&t.onPointerEnter(this._intersects[0]),this._hovered=t;return}if(this._hovered.uuid!==t.uuid){this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),t.onPointerEnter&&t.onPointerEnter(this._intersects[0]),this._hovered=t;return}t.onPointerOver&&t.onPointerOver(this._intersects[0]),this._hovered=t}else this._hovered&&this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),this._hovered=null;this._pointerAnyDown&&(this._dragging||this.onDragStart(e),this.onDrag(e))}onDrag(e){this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0));const t=this._intersects[0];t&&(this._dragCurrent.copy(t.point.clone()),this._dragEnd.copy(t.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone()),this._draggable&&this._draggable.onDrag&&this._draggable.onDrag({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}))}onPointerUp(e){switch(this.pointerWasDragged()||this._dragging?this._draggable&&this.onDragEnd(e):this.onClick(e),e.button){case 0:this._pointerPrimaryDown=!1;break;case 1:this._pointerMiddleDown=!1;break;case 2:this._pointerSecondaryDown=!1;break}this._lastPointerUp.copy(this._pointer)}onClick(e){}onDragEnd(e){const t=this._intersects[0];t&&(this._dragEnd.copy(t.point.clone()),this._dragCurrent.copy(t.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone())),this._draggable&&this._draggable.onDragEnd&&this._draggable.onDragEnd({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._draggable=null,this._dragging=!1,this._dragStart.set(0,0,0),this._dragCurrent.set(0,0,0),this._dragEnd.set(0,0,0),this._dragDelta.set(0,0,0),this._controller.enabled=!0}onWheel(e){}raycast(e){return e!==void 0?this._raycaster.intersectObjects(e,!0).filter(t=>t.object.visible):this._raycaster.intersectObjects(this._scene.children,!0).filter(t=>t.object.visible)}pointerWasDragged(){return this._lastPointerDown.distanceTo(this._pointer)>this.POINTER_DRAG_THRESHOLD}}const ls=new El,Rn=new N,Br=new N,Xt=new on,Cg={X:new N(1,0,0),Y:new N(0,1,0),Z:new N(0,0,1)},yh={type:"change"},Pg={type:"mouseDown"},Lg={type:"mouseUp",mode:null},Ig={type:"objectChange"};class MP extends mt{constructor(e,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const n=new RP;this._gizmo=n,this.add(n);const r=new CP;this._plane=r,this.add(r);const o=this;function c(C,b){let L=b;Object.defineProperty(o,C,{get:function(){return L!==void 0?L:b},set:function(k){L!==k&&(L=k,r[C]=k,n[C]=k,o.dispatchEvent({type:C+"-changed",value:k}),o.dispatchEvent(yh))}}),o[C]=b,r[C]=b,n[C]=b}c("camera",e),c("object",void 0),c("enabled",!0),c("axis",null),c("mode","translate"),c("translationSnap",null),c("rotationSnap",null),c("scaleSnap",null),c("space","world"),c("size",1),c("dragging",!1),c("showX",!0),c("showY",!0),c("showZ",!0);const l=new N,h=new N,f=new on,d=new on,p=new N,m=new on,x=new N,M=new N,A=new N,v=0,_=new N;c("worldPosition",l),c("worldPositionStart",h),c("worldQuaternion",f),c("worldQuaternionStart",d),c("cameraPosition",p),c("cameraQuaternion",m),c("pointStart",x),c("pointEnd",M),c("rotationAxis",A),c("rotationAngle",v),c("eye",_),this._offset=new N,this._startNorm=new N,this._endNorm=new N,this._cameraScale=new N,this._parentPosition=new N,this._parentQuaternion=new on,this._parentQuaternionInv=new on,this._parentScale=new N,this._worldScaleStart=new N,this._worldQuaternionInv=new on,this._worldScale=new N,this._positionStart=new N,this._quaternionStart=new on,this._scaleStart=new N,this._getPointer=EP.bind(this),this._onPointerDown=TP.bind(this),this._onPointerHover=bP.bind(this),this._onPointerMove=AP.bind(this),this._onPointerUp=wP.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(e){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(e)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&ls.setFromCamera(e,this.camera);const t=Sh(this._gizmo.picker[this.mode],ls);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e!=null&&e.button!==0)&&this.axis!==null){e!==null&&ls.setFromCamera(e,this.camera);const t=Sh(this._plane,ls,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,Pg.mode=this.mode,this.dispatchEvent(Pg)}}pointerMove(e){const t=this.axis,n=this.mode,r=this.object;let o=this.space;if(n==="scale"?o="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(o="world"),r===void 0||t===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&ls.setFromCamera(e,this.camera);const c=Sh(this._plane,ls,!0);if(c){if(this.pointEnd.copy(c.point).sub(this.worldPositionStart),n==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),o==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),o==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),r.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(o==="local"&&(r.position.applyQuaternion(Xt.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.position.applyQuaternion(this._quaternionStart)),o==="world"&&(r.parent&&r.position.add(Rn.setFromMatrixPosition(r.parent.matrixWorld)),t.search("X")!==-1&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.parent&&r.position.sub(Rn.setFromMatrixPosition(r.parent.matrixWorld))));else if(n==="scale"){if(t.search("XYZ")!==-1){let l=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(l*=-1),Br.set(l,l,l)}else Rn.copy(this.pointStart),Br.copy(this.pointEnd),Rn.applyQuaternion(this._worldQuaternionInv),Br.applyQuaternion(this._worldQuaternionInv),Br.divide(Rn),t.search("X")===-1&&(Br.x=1),t.search("Y")===-1&&(Br.y=1),t.search("Z")===-1&&(Br.z=1);r.scale.copy(this._scaleStart).multiply(Br),this.scaleSnap&&(t.search("X")!==-1&&(r.scale.x=Math.round(r.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(r.scale.y=Math.round(r.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(r.scale.z=Math.round(r.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(n==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const l=20/this.worldPosition.distanceTo(Rn.setFromMatrixPosition(this.camera.matrixWorld));let h=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Rn.copy(this.rotationAxis).cross(this.eye))*l):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(Cg[t]),Rn.copy(Cg[t]),o==="local"&&Rn.applyQuaternion(this.worldQuaternion),Rn.cross(this.eye),Rn.length()===0?h=!0:this.rotationAngle=this._offset.dot(Rn.normalize())*l),(t==="E"||h)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),o==="local"&&t!=="E"&&t!=="XYZE"?(r.quaternion.copy(this._quaternionStart),r.quaternion.multiply(Xt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),r.quaternion.copy(Xt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),r.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(yh),this.dispatchEvent(Ig)}}pointerUp(e){e!==null&&e.button!==0||(this.dragging&&this.axis!==null&&(Lg.mode=this.mode,this.dispatchEvent(Lg)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(yh),this.dispatchEvent(Ig),this.pointStart.copy(this.pointEnd))}getRaycaster(){return ls}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function EP(i){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:i.button};{const e=this.domElement.getBoundingClientRect();return{x:(i.clientX-e.left)/e.width*2-1,y:-(i.clientY-e.top)/e.height*2+1,button:i.button}}}function bP(i){if(this.enabled)switch(i.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(i));break}}function TP(i){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(i.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(i)),this.pointerDown(this._getPointer(i)))}function AP(i){this.enabled&&this.pointerMove(this._getPointer(i))}function wP(i){this.enabled&&(this.domElement.releasePointerCapture(i.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(i)))}function Sh(i,e,t){const n=e.intersectObject(i,!0);for(let r=0;r<n.length;r++)if(n[r].object.visible||t)return n[r];return!1}const Jc=new Li,Ut=new N(0,1,0),Dg=new N(0,0,0),Og=new Qe,Qc=new on,al=new on,zi=new N,Ug=new Qe,da=new N(1,0,0),ds=new N(0,1,0),pa=new N(0,0,1),el=new N,ca=new N,la=new N;class RP extends mt{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new Wi({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new wo({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),n=e.clone();n.opacity=.15;const r=t.clone();r.opacity=.5;const o=e.clone();o.color.setHex(16711680);const c=e.clone();c.color.setHex(65280);const l=e.clone();l.color.setHex(255);const h=e.clone();h.color.setHex(16711680),h.opacity=.5;const f=e.clone();f.color.setHex(65280),f.opacity=.5;const d=e.clone();d.color.setHex(255),d.opacity=.5;const p=e.clone();p.opacity=.25;const m=e.clone();m.color.setHex(16776960),m.opacity=.25,e.clone().color.setHex(16776960);const M=e.clone();M.color.setHex(7895160);const A=new gn(0,.04,.1,12);A.translate(0,.05,0);const v=new qt(.08,.08,.08);v.translate(0,.04,0);const _=new Jt;_.setAttribute("position",new Nt([0,0,0,1,0,0],3));const C=new gn(.0075,.0075,.5,3);C.translate(0,.25,0);function b(ne,se){const pe=new gs(ne,.0075,3,64,se*Math.PI*2);return pe.rotateY(Math.PI/2),pe.rotateX(Math.PI/2),pe}function L(){const ne=new Jt;return ne.setAttribute("position",new Nt([0,0,0,1,1,1],3)),ne}const k={X:[[new ye(A,o),[.5,0,0],[0,0,-Math.PI/2]],[new ye(A,o),[-.5,0,0],[0,0,Math.PI/2]],[new ye(C,o),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new ye(A,c),[0,.5,0]],[new ye(A,c),[0,-.5,0],[Math.PI,0,0]],[new ye(C,c)]],Z:[[new ye(A,l),[0,0,.5],[Math.PI/2,0,0]],[new ye(A,l),[0,0,-.5],[-Math.PI/2,0,0]],[new ye(C,l),null,[Math.PI/2,0,0]]],XYZ:[[new ye(new uo(.1,0),p.clone()),[0,0,0]]],XY:[[new ye(new qt(.15,.15,.01),d.clone()),[.15,.15,0]]],YZ:[[new ye(new qt(.15,.15,.01),h.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new ye(new qt(.15,.15,.01),f.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},U={X:[[new ye(new gn(.2,0,.6,4),n),[.3,0,0],[0,0,-Math.PI/2]],[new ye(new gn(.2,0,.6,4),n),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new ye(new gn(.2,0,.6,4),n),[0,.3,0]],[new ye(new gn(.2,0,.6,4),n),[0,-.3,0],[0,0,Math.PI]]],Z:[[new ye(new gn(.2,0,.6,4),n),[0,0,.3],[Math.PI/2,0,0]],[new ye(new gn(.2,0,.6,4),n),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new ye(new uo(.2,0),n)]],XY:[[new ye(new qt(.2,.2,.01),n),[.15,.15,0]]],YZ:[[new ye(new qt(.2,.2,.01),n),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new ye(new qt(.2,.2,.01),n),[.15,0,.15],[-Math.PI/2,0,0]]]},O={START:[[new ye(new uo(.01,2),r),null,null,null,"helper"]],END:[[new ye(new uo(.01,2),r),null,null,null,"helper"]],DELTA:[[new di(L(),r),null,null,null,"helper"]],X:[[new di(_,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new di(_,r.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new di(_,r.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},I={XYZE:[[new ye(b(.5,1),M),null,[0,Math.PI/2,0]]],X:[[new ye(b(.5,.5),o)]],Y:[[new ye(b(.5,.5),c),null,[0,0,-Math.PI/2]]],Z:[[new ye(b(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new ye(b(.75,1),m),null,[0,Math.PI/2,0]]]},E={AXIS:[[new di(_,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},y={XYZE:[[new ye(new Pa(.25,10,8),n)]],X:[[new ye(new gs(.5,.1,4,24),n),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new ye(new gs(.5,.1,4,24),n),[0,0,0],[Math.PI/2,0,0]]],Z:[[new ye(new gs(.5,.1,4,24),n),[0,0,0],[0,0,-Math.PI/2]]],E:[[new ye(new gs(.75,.1,2,24),n)]]},F={X:[[new ye(v,o),[.5,0,0],[0,0,-Math.PI/2]],[new ye(C,o),[0,0,0],[0,0,-Math.PI/2]],[new ye(v,o),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new ye(v,c),[0,.5,0]],[new ye(C,c)],[new ye(v,c),[0,-.5,0],[0,0,Math.PI]]],Z:[[new ye(v,l),[0,0,.5],[Math.PI/2,0,0]],[new ye(C,l),[0,0,0],[Math.PI/2,0,0]],[new ye(v,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new ye(new qt(.15,.15,.01),d),[.15,.15,0]]],YZ:[[new ye(new qt(.15,.15,.01),h),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new ye(new qt(.15,.15,.01),f),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new ye(new qt(.1,.1,.1),p.clone())]]},V={X:[[new ye(new gn(.2,0,.6,4),n),[.3,0,0],[0,0,-Math.PI/2]],[new ye(new gn(.2,0,.6,4),n),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new ye(new gn(.2,0,.6,4),n),[0,.3,0]],[new ye(new gn(.2,0,.6,4),n),[0,-.3,0],[0,0,Math.PI]]],Z:[[new ye(new gn(.2,0,.6,4),n),[0,0,.3],[Math.PI/2,0,0]],[new ye(new gn(.2,0,.6,4),n),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new ye(new qt(.2,.2,.01),n),[.15,.15,0]]],YZ:[[new ye(new qt(.2,.2,.01),n),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new ye(new qt(.2,.2,.01),n),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new ye(new qt(.2,.2,.2),n),[0,0,0]]]},G={X:[[new di(_,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new di(_,r.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new di(_,r.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function q(ne){const se=new mt;for(const pe in ne)for(let K=ne[pe].length;K--;){const he=ne[pe][K][0].clone(),me=ne[pe][K][1],Me=ne[pe][K][2],Ke=ne[pe][K][3],ot=ne[pe][K][4];he.name=pe,he.tag=ot,me&&he.position.set(me[0],me[1],me[2]),Me&&he.rotation.set(Me[0],Me[1],Me[2]),Ke&&he.scale.set(Ke[0],Ke[1],Ke[2]),he.updateMatrix();const ie=he.geometry.clone();ie.applyMatrix4(he.matrix),he.geometry=ie,he.renderOrder=1/0,he.position.set(0,0,0),he.rotation.set(0,0,0),he.scale.set(1,1,1),se.add(he)}return se}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=q(k)),this.add(this.gizmo.rotate=q(I)),this.add(this.gizmo.scale=q(F)),this.add(this.picker.translate=q(U)),this.add(this.picker.rotate=q(y)),this.add(this.picker.scale=q(V)),this.add(this.helper.translate=q(O)),this.add(this.helper.rotate=q(E)),this.add(this.helper.scale=q(G)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const n=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:al;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let r=[];r=r.concat(this.picker[this.mode].children),r=r.concat(this.gizmo[this.mode].children),r=r.concat(this.helper[this.mode].children);for(let o=0;o<r.length;o++){const c=r[o];c.visible=!0,c.rotation.set(0,0,0),c.position.copy(this.worldPosition);let l;if(this.camera.isOrthographicCamera?l=(this.camera.top-this.camera.bottom)/this.camera.zoom:l=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),c.scale.set(1,1,1).multiplyScalar(l*this.size/4),c.tag==="helper"){c.visible=!1,c.name==="AXIS"?(c.visible=!!this.axis,this.axis==="X"&&(Xt.setFromEuler(Jc.set(0,0,0)),c.quaternion.copy(n).multiply(Xt),Math.abs(Ut.copy(da).applyQuaternion(n).dot(this.eye))>.9&&(c.visible=!1)),this.axis==="Y"&&(Xt.setFromEuler(Jc.set(0,0,Math.PI/2)),c.quaternion.copy(n).multiply(Xt),Math.abs(Ut.copy(ds).applyQuaternion(n).dot(this.eye))>.9&&(c.visible=!1)),this.axis==="Z"&&(Xt.setFromEuler(Jc.set(0,Math.PI/2,0)),c.quaternion.copy(n).multiply(Xt),Math.abs(Ut.copy(pa).applyQuaternion(n).dot(this.eye))>.9&&(c.visible=!1)),this.axis==="XYZE"&&(Xt.setFromEuler(Jc.set(0,Math.PI/2,0)),Ut.copy(this.rotationAxis),c.quaternion.setFromRotationMatrix(Og.lookAt(Dg,Ut,ds)),c.quaternion.multiply(Xt),c.visible=this.dragging),this.axis==="E"&&(c.visible=!1)):c.name==="START"?(c.position.copy(this.worldPositionStart),c.visible=this.dragging):c.name==="END"?(c.position.copy(this.worldPosition),c.visible=this.dragging):c.name==="DELTA"?(c.position.copy(this.worldPositionStart),c.quaternion.copy(this.worldQuaternionStart),Rn.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Rn.applyQuaternion(this.worldQuaternionStart.clone().invert()),c.scale.copy(Rn),c.visible=this.dragging):(c.quaternion.copy(n),this.dragging?c.position.copy(this.worldPositionStart):c.position.copy(this.worldPosition),this.axis&&(c.visible=this.axis.search(c.name)!==-1));continue}c.quaternion.copy(n),this.mode==="translate"||this.mode==="scale"?(c.name==="X"&&Math.abs(Ut.copy(da).applyQuaternion(n).dot(this.eye))>.99&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="Y"&&Math.abs(Ut.copy(ds).applyQuaternion(n).dot(this.eye))>.99&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="Z"&&Math.abs(Ut.copy(pa).applyQuaternion(n).dot(this.eye))>.99&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="XY"&&Math.abs(Ut.copy(pa).applyQuaternion(n).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="YZ"&&Math.abs(Ut.copy(da).applyQuaternion(n).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1),c.name==="XZ"&&Math.abs(Ut.copy(ds).applyQuaternion(n).dot(this.eye))<.2&&(c.scale.set(1e-10,1e-10,1e-10),c.visible=!1)):this.mode==="rotate"&&(Qc.copy(n),Ut.copy(this.eye).applyQuaternion(Xt.copy(n).invert()),c.name.search("E")!==-1&&c.quaternion.setFromRotationMatrix(Og.lookAt(this.eye,Dg,ds)),c.name==="X"&&(Xt.setFromAxisAngle(da,Math.atan2(-Ut.y,Ut.z)),Xt.multiplyQuaternions(Qc,Xt),c.quaternion.copy(Xt)),c.name==="Y"&&(Xt.setFromAxisAngle(ds,Math.atan2(Ut.x,Ut.z)),Xt.multiplyQuaternions(Qc,Xt),c.quaternion.copy(Xt)),c.name==="Z"&&(Xt.setFromAxisAngle(pa,Math.atan2(Ut.y,Ut.x)),Xt.multiplyQuaternions(Qc,Xt),c.quaternion.copy(Xt))),c.visible=c.visible&&(c.name.indexOf("X")===-1||this.showX),c.visible=c.visible&&(c.name.indexOf("Y")===-1||this.showY),c.visible=c.visible&&(c.name.indexOf("Z")===-1||this.showZ),c.visible=c.visible&&(c.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),c.material._color=c.material._color||c.material.color.clone(),c.material._opacity=c.material._opacity||c.material.opacity,c.material.color.copy(c.material._color),c.material.opacity=c.material._opacity,this.enabled&&this.axis&&(c.name===this.axis||this.axis.split("").some(function(h){return c.name===h}))&&(c.material.color.setHex(16776960),c.material.opacity=1)}super.updateMatrixWorld(e)}}class CP extends ye{constructor(){super(new Ss(1e5,1e5,2,2),new Wi({visible:!1,wireframe:!0,side:Ai,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),el.copy(da).applyQuaternion(t==="local"?this.worldQuaternion:al),ca.copy(ds).applyQuaternion(t==="local"?this.worldQuaternion:al),la.copy(pa).applyQuaternion(t==="local"?this.worldQuaternion:al),Ut.copy(ca),this.mode){case"translate":case"scale":switch(this.axis){case"X":Ut.copy(this.eye).cross(el),zi.copy(el).cross(Ut);break;case"Y":Ut.copy(this.eye).cross(ca),zi.copy(ca).cross(Ut);break;case"Z":Ut.copy(this.eye).cross(la),zi.copy(la).cross(Ut);break;case"XY":zi.copy(la);break;case"YZ":zi.copy(el);break;case"XZ":Ut.copy(la),zi.copy(ca);break;case"XYZ":case"E":zi.set(0,0,0);break}break;case"rotate":default:zi.set(0,0,0)}zi.length()===0?this.quaternion.copy(this.cameraQuaternion):(Ug.lookAt(Rn.set(0,0,0),zi,Ut),this.quaternion.setFromRotationMatrix(Ug)),super.updateMatrixWorld(e)}}const k_="#c20017",H_="#00ab26",G_="#0081d4",Hh=k_,Gh=H_,Vh=G_;class PP extends SP{isTransformTool=!0;_scaleLinked;_gizmo;constructor(e,t){super(e,t),this.name="DIVETransformTool",this._scaleLinked=!1,this._gizmo=this.initGizmo(),this._scene.add(this._gizmo)}Activate(){}SetGizmoMode(e){this._gizmo.mode=e}SetGizmoVisibility(e){const t=this._scene.children.includes(this._gizmo);e&&!t?(this._scene.add(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.enableAll()):!e&&t&&(this._scene.remove(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.disableAll())}SetGizmoScaleLinked(e){this._scaleLinked=e}initGizmo(){const e=new MP(this._controller.object,this._controller.domElement);return e.mode="translate",e.traverse(t=>{if(!("isMesh"in t))return;const n=t.material;t.name==="X"&&n.color.set(Hh),t.name==="Y"&&n.color.set(Gh),t.name==="Z"&&n.color.set(Vh),t.name==="XY"&&n.color.set(Vh),t.name==="YZ"&&n.color.set(Hh),t.name==="XZ"&&n.color.set(Gh)}),e.addEventListener("mouseDown",()=>{this._controller.enabled=!1,ol(e.object,"isMovable")&&e.object.onMoveStart&&e.object.onMoveStart()}),e.addEventListener("objectChange",()=>{if(ol(e.object,"isMovable")&&e.object.onMove&&(e.object.onMove(),this._scaleLinked)){const t=e.object.scale,n=(t.x+t.y+t.z)/3;e.object.scale.set(n,n,n)}}),e.addEventListener("mouseUp",()=>{this._controller.enabled=!0,ol(e.object,"isMovable")&&e.object.onMoveEnd&&e.object.onMoveEnd()}),e}}const Ng=i=>i.isSelectTool!==void 0;class LP extends PP{isSelectTool=!0;constructor(e,t){super(e,t),this.name="SelectTool"}Activate(){}Select(e){this.AttachGizmo(e),e.onSelect&&e.onSelect()}Deselect(e){this.DetachGizmo(),e.onDeselect&&e.onDeselect()}AttachGizmo(e){if("isMovable"in e){const t=e;this._gizmo.attach(t),this.SetGizmoVisibility(t.visible)}}DetachGizmo(){this._gizmo.detach()}onClick(e){super.onClick(e);const t=this._raycaster.intersectObjects(this._scene.Root.children,!0).filter(r=>r.object.visible)[0],n=gl(t?.object,"isSelectable");if(!t||!n){this._gizmo.object&&this.Deselect(this._gizmo.object);return}if(this._gizmo.object){if(this._gizmo.object.uuid===n.uuid)return;this.Deselect(this._gizmo.object)}this.Select(n)}}var tl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ma={exports:{}};/**
|
|
3798
3798
|
* @license
|
|
3799
3799
|
* Lodash <https://lodash.com/>
|
|
3800
3800
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
3801
3801
|
* Released under MIT license <https://lodash.com/license>
|
|
3802
3802
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
3803
3803
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
3804
|
-
*/var mP=ca.exports,Ag;function gP(){return Ag||(Ag=1,function(s,e){(function(){var t,n="4.17.21",i=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",f=500,d="__lodash_placeholder__",p=1,m=2,v=4,S=1,b=2,x=1,_=2,R=4,E=8,L=16,B=32,N=64,D=128,k=256,C=512,T=30,W="...",j=800,H=16,K=1,ne=2,he=3,me=1/0,$=9007199254740991,fe=17976931348623157e292,pe=NaN,Ee=4294967295,Je=Ee-1,bt=Ee>>>1,ie=[["ary",D],["bind",x],["bindKey",_],["curry",E],["curryRight",L],["flip",C],["partial",B],["partialRight",N],["rearg",k]],_e="[object Arguments]",Ce="[object Array]",Ae="[object AsyncFunction]",je="[object Boolean]",qe="[object Date]",dt="[object DOMException]",Y="[object Error]",tt="[object Function]",Ve="[object GeneratorFunction]",Et="[object Map]",ke="[object Number]",Tt="[object Null]",O="[object Object]",A="[object Promise]",te="[object Proxy]",oe="[object RegExp]",le="[object Set]",de="[object String]",Be="[object Symbol]",ge="[object Undefined]",De="[object WeakMap]",He="[object WeakSet]",ve="[object ArrayBuffer]",be="[object DataView]",Ye="[object Float32Array]",Pe="[object Float64Array]",Le="[object Int8Array]",ot="[object Int16Array]",ht="[object Int32Array]",yt="[object Uint8Array]",pt="[object Uint8ClampedArray]",St="[object Uint16Array]",Oe="[object Uint32Array]",y=/\b__p \+= '';/g,q=/\b(__p \+=) '' \+/g,se=/(__e\(.*?\)|\b__t\)) \+\n'';/g,xe=/&(?:amp|lt|gt|quot|#39);/g,we=/[&<>"']/g,mt=RegExp(xe.source),ut=RegExp(we.source),Ft=/<%-([\s\S]+?)%>/g,tn=/<%([\s\S]+?)%>/g,At=/<%=([\s\S]+?)%>/g,qt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Kt=/^\w*$/,Rn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,yn=/[\\^$.*+?()[\]{}|]/g,wi=RegExp(yn.source),Ri=/^\s+/,Vi=/\s/,Ma=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ms=/\{\n\/\* \[wrapped with (.+)\] \*/,Ea=/,? & /,ba=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ml=/[()=,{}\[\]\/\s]/,gl=/\\(\\)?/g,_l=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,I=/\w*$/,X=/^[-+]0x[0-9a-f]+$/i,Q=/^0b[01]+$/i,ee=/^\[object .+?Constructor\]$/,Z=/^0o[0-7]+$/i,Te=/^(?:0|[1-9]\d*)$/,Fe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ze=/($^)/,Ke=/['\n\r\u2028\u2029\\]/g,Ze="\\ud800-\\udfff",Qe="\\u0300-\\u036f",nt="\\ufe20-\\ufe2f",Xt="\\u20d0-\\u20ff",Sn=Qe+nt+Xt,Jt="\\u2700-\\u27bf",Qn="a-z\\xdf-\\xf6\\xf8-\\xff",kt="\\xac\\xb1\\xd7\\xf7",rt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",To="\\u2000-\\u206f",Bt=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ci="A-Z\\xc0-\\xd6\\xd8-\\xde",Ao="\\ufe0e\\ufe0f",ur=kt+rt+To+Bt,zr="['’]",un="["+Ze+"]",fi="["+ur+"]",fr="["+Sn+"]",Cn="\\d+",wo="["+Jt+"]",Ta="["+Qn+"]",Ro="[^"+Ze+ur+Cn+Jt+Qn+Ci+"]",vl="\\ud83c[\\udffb-\\udfff]",B_="(?:"+fr+"|"+vl+")",lf="[^"+Ze+"]",xl="(?:\\ud83c[\\udde6-\\uddff]){2}",yl="[\\ud800-\\udbff][\\udc00-\\udfff]",gs="["+Ci+"]",hf="\\u200d",uf="(?:"+Ta+"|"+Ro+")",z_="(?:"+gs+"|"+Ro+")",ff="(?:"+zr+"(?:d|ll|m|re|s|t|ve))?",df="(?:"+zr+"(?:D|LL|M|RE|S|T|VE))?",pf=B_+"?",mf="["+Ao+"]?",k_="(?:"+hf+"(?:"+[lf,xl,yl].join("|")+")"+mf+pf+")*",H_="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",G_="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",gf=mf+pf+k_,V_="(?:"+[wo,xl,yl].join("|")+")"+gf,W_="(?:"+[lf+fr+"?",fr,xl,yl,un].join("|")+")",X_=RegExp(zr,"g"),Y_=RegExp(fr,"g"),Sl=RegExp(vl+"(?="+vl+")|"+W_+gf,"g"),j_=RegExp([gs+"?"+Ta+"+"+ff+"(?="+[fi,gs,"$"].join("|")+")",z_+"+"+df+"(?="+[fi,gs+uf,"$"].join("|")+")",gs+"?"+uf+"+"+ff,gs+"+"+df,G_,H_,Cn,V_].join("|"),"g"),q_=RegExp("["+hf+Ze+Sn+Ao+"]"),K_=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Z_=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],$_=-1,Ht={};Ht[Ye]=Ht[Pe]=Ht[Le]=Ht[ot]=Ht[ht]=Ht[yt]=Ht[pt]=Ht[St]=Ht[Oe]=!0,Ht[_e]=Ht[Ce]=Ht[ve]=Ht[je]=Ht[be]=Ht[qe]=Ht[Y]=Ht[tt]=Ht[Et]=Ht[ke]=Ht[O]=Ht[oe]=Ht[le]=Ht[de]=Ht[De]=!1;var zt={};zt[_e]=zt[Ce]=zt[ve]=zt[be]=zt[je]=zt[qe]=zt[Ye]=zt[Pe]=zt[Le]=zt[ot]=zt[ht]=zt[Et]=zt[ke]=zt[O]=zt[oe]=zt[le]=zt[de]=zt[Be]=zt[yt]=zt[pt]=zt[St]=zt[Oe]=!0,zt[Y]=zt[tt]=zt[De]=!1;var J_={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Q_={"&":"&","<":"<",">":">",'"':""","'":"'"},e0={"&":"&","<":"<",">":">",""":'"',"'":"'"},t0={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},n0=parseFloat,i0=parseInt,_f=typeof Wc=="object"&&Wc&&Wc.Object===Object&&Wc,r0=typeof self=="object"&&self&&self.Object===Object&&self,_n=_f||r0||Function("return this")(),Ml=e&&!e.nodeType&&e,kr=Ml&&!0&&s&&!s.nodeType&&s,vf=kr&&kr.exports===Ml,El=vf&&_f.process,ei=function(){try{var G=kr&&kr.require&&kr.require("util").types;return G||El&&El.binding&&El.binding("util")}catch{}}(),xf=ei&&ei.isArrayBuffer,yf=ei&&ei.isDate,Sf=ei&&ei.isMap,Mf=ei&&ei.isRegExp,Ef=ei&&ei.isSet,bf=ei&&ei.isTypedArray;function Wn(G,re,J){switch(J.length){case 0:return G.call(re);case 1:return G.call(re,J[0]);case 2:return G.call(re,J[0],J[1]);case 3:return G.call(re,J[0],J[1],J[2])}return G.apply(re,J)}function s0(G,re,J,Re){for(var et=-1,wt=G==null?0:G.length;++et<wt;){var sn=G[et];re(Re,sn,J(sn),G)}return Re}function ti(G,re){for(var J=-1,Re=G==null?0:G.length;++J<Re&&re(G[J],J,G)!==!1;);return G}function o0(G,re){for(var J=G==null?0:G.length;J--&&re(G[J],J,G)!==!1;);return G}function Tf(G,re){for(var J=-1,Re=G==null?0:G.length;++J<Re;)if(!re(G[J],J,G))return!1;return!0}function dr(G,re){for(var J=-1,Re=G==null?0:G.length,et=0,wt=[];++J<Re;){var sn=G[J];re(sn,J,G)&&(wt[et++]=sn)}return wt}function Aa(G,re){var J=G==null?0:G.length;return!!J&&_s(G,re,0)>-1}function bl(G,re,J){for(var Re=-1,et=G==null?0:G.length;++Re<et;)if(J(re,G[Re]))return!0;return!1}function Vt(G,re){for(var J=-1,Re=G==null?0:G.length,et=Array(Re);++J<Re;)et[J]=re(G[J],J,G);return et}function pr(G,re){for(var J=-1,Re=re.length,et=G.length;++J<Re;)G[et+J]=re[J];return G}function Tl(G,re,J,Re){var et=-1,wt=G==null?0:G.length;for(Re&&wt&&(J=G[++et]);++et<wt;)J=re(J,G[et],et,G);return J}function a0(G,re,J,Re){var et=G==null?0:G.length;for(Re&&et&&(J=G[--et]);et--;)J=re(J,G[et],et,G);return J}function Al(G,re){for(var J=-1,Re=G==null?0:G.length;++J<Re;)if(re(G[J],J,G))return!0;return!1}var c0=wl("length");function l0(G){return G.split("")}function h0(G){return G.match(ba)||[]}function Af(G,re,J){var Re;return J(G,function(et,wt,sn){if(re(et,wt,sn))return Re=wt,!1}),Re}function wa(G,re,J,Re){for(var et=G.length,wt=J+(Re?1:-1);Re?wt--:++wt<et;)if(re(G[wt],wt,G))return wt;return-1}function _s(G,re,J){return re===re?M0(G,re,J):wa(G,wf,J)}function u0(G,re,J,Re){for(var et=J-1,wt=G.length;++et<wt;)if(Re(G[et],re))return et;return-1}function wf(G){return G!==G}function Rf(G,re){var J=G==null?0:G.length;return J?Cl(G,re)/J:pe}function wl(G){return function(re){return re==null?t:re[G]}}function Rl(G){return function(re){return G==null?t:G[re]}}function Cf(G,re,J,Re,et){return et(G,function(wt,sn,Ut){J=Re?(Re=!1,wt):re(J,wt,sn,Ut)}),J}function f0(G,re){var J=G.length;for(G.sort(re);J--;)G[J]=G[J].value;return G}function Cl(G,re){for(var J,Re=-1,et=G.length;++Re<et;){var wt=re(G[Re]);wt!==t&&(J=J===t?wt:J+wt)}return J}function Pl(G,re){for(var J=-1,Re=Array(G);++J<G;)Re[J]=re(J);return Re}function d0(G,re){return Vt(re,function(J){return[J,G[J]]})}function Pf(G){return G&&G.slice(0,Uf(G)+1).replace(Ri,"")}function Xn(G){return function(re){return G(re)}}function Ll(G,re){return Vt(re,function(J){return G[J]})}function Co(G,re){return G.has(re)}function Lf(G,re){for(var J=-1,Re=G.length;++J<Re&&_s(re,G[J],0)>-1;);return J}function If(G,re){for(var J=G.length;J--&&_s(re,G[J],0)>-1;);return J}function p0(G,re){for(var J=G.length,Re=0;J--;)G[J]===re&&++Re;return Re}var m0=Rl(J_),g0=Rl(Q_);function _0(G){return"\\"+t0[G]}function v0(G,re){return G==null?t:G[re]}function vs(G){return q_.test(G)}function x0(G){return K_.test(G)}function y0(G){for(var re,J=[];!(re=G.next()).done;)J.push(re.value);return J}function Il(G){var re=-1,J=Array(G.size);return G.forEach(function(Re,et){J[++re]=[et,Re]}),J}function Df(G,re){return function(J){return G(re(J))}}function mr(G,re){for(var J=-1,Re=G.length,et=0,wt=[];++J<Re;){var sn=G[J];(sn===re||sn===d)&&(G[J]=d,wt[et++]=J)}return wt}function Ra(G){var re=-1,J=Array(G.size);return G.forEach(function(Re){J[++re]=Re}),J}function S0(G){var re=-1,J=Array(G.size);return G.forEach(function(Re){J[++re]=[Re,Re]}),J}function M0(G,re,J){for(var Re=J-1,et=G.length;++Re<et;)if(G[Re]===re)return Re;return-1}function E0(G,re,J){for(var Re=J+1;Re--;)if(G[Re]===re)return Re;return Re}function xs(G){return vs(G)?T0(G):c0(G)}function di(G){return vs(G)?A0(G):l0(G)}function Uf(G){for(var re=G.length;re--&&Vi.test(G.charAt(re)););return re}var b0=Rl(e0);function T0(G){for(var re=Sl.lastIndex=0;Sl.test(G);)++re;return re}function A0(G){return G.match(Sl)||[]}function w0(G){return G.match(j_)||[]}var R0=function G(re){re=re==null?_n:ys.defaults(_n.Object(),re,ys.pick(_n,Z_));var J=re.Array,Re=re.Date,et=re.Error,wt=re.Function,sn=re.Math,Ut=re.Object,Dl=re.RegExp,C0=re.String,ni=re.TypeError,Ca=J.prototype,P0=wt.prototype,Ss=Ut.prototype,Pa=re["__core-js_shared__"],La=P0.toString,Pt=Ss.hasOwnProperty,L0=0,Of=function(){var r=/[^.]+$/.exec(Pa&&Pa.keys&&Pa.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Ia=Ss.toString,I0=La.call(Ut),D0=_n._,U0=Dl("^"+La.call(Pt).replace(yn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Da=vf?re.Buffer:t,gr=re.Symbol,Ua=re.Uint8Array,Nf=Da?Da.allocUnsafe:t,Oa=Df(Ut.getPrototypeOf,Ut),Ff=Ut.create,Bf=Ss.propertyIsEnumerable,Na=Ca.splice,zf=gr?gr.isConcatSpreadable:t,Po=gr?gr.iterator:t,Hr=gr?gr.toStringTag:t,Fa=function(){try{var r=Yr(Ut,"defineProperty");return r({},"",{}),r}catch{}}(),O0=re.clearTimeout!==_n.clearTimeout&&re.clearTimeout,N0=Re&&Re.now!==_n.Date.now&&Re.now,F0=re.setTimeout!==_n.setTimeout&&re.setTimeout,Ba=sn.ceil,za=sn.floor,Ul=Ut.getOwnPropertySymbols,B0=Da?Da.isBuffer:t,kf=re.isFinite,z0=Ca.join,k0=Df(Ut.keys,Ut),on=sn.max,Mn=sn.min,H0=Re.now,G0=re.parseInt,Hf=sn.random,V0=Ca.reverse,Ol=Yr(re,"DataView"),Lo=Yr(re,"Map"),Nl=Yr(re,"Promise"),Ms=Yr(re,"Set"),Io=Yr(re,"WeakMap"),Do=Yr(Ut,"create"),ka=Io&&new Io,Es={},W0=jr(Ol),X0=jr(Lo),Y0=jr(Nl),j0=jr(Ms),q0=jr(Io),Ha=gr?gr.prototype:t,Uo=Ha?Ha.valueOf:t,Gf=Ha?Ha.toString:t;function w(r){if(Zt(r)&&!it(r)&&!(r instanceof vt)){if(r instanceof ii)return r;if(Pt.call(r,"__wrapped__"))return Vd(r)}return new ii(r)}var bs=function(){function r(){}return function(a){if(!Yt(a))return{};if(Ff)return Ff(a);r.prototype=a;var h=new r;return r.prototype=t,h}}();function Ga(){}function ii(r,a){this.__wrapped__=r,this.__actions__=[],this.__chain__=!!a,this.__index__=0,this.__values__=t}w.templateSettings={escape:Ft,evaluate:tn,interpolate:At,variable:"",imports:{_:w}},w.prototype=Ga.prototype,w.prototype.constructor=w,ii.prototype=bs(Ga.prototype),ii.prototype.constructor=ii;function vt(r){this.__wrapped__=r,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Ee,this.__views__=[]}function K0(){var r=new vt(this.__wrapped__);return r.__actions__=Fn(this.__actions__),r.__dir__=this.__dir__,r.__filtered__=this.__filtered__,r.__iteratees__=Fn(this.__iteratees__),r.__takeCount__=this.__takeCount__,r.__views__=Fn(this.__views__),r}function Z0(){if(this.__filtered__){var r=new vt(this);r.__dir__=-1,r.__filtered__=!0}else r=this.clone(),r.__dir__*=-1;return r}function $0(){var r=this.__wrapped__.value(),a=this.__dir__,h=it(r),g=a<0,M=h?r.length:0,P=lx(0,M,this.__views__),F=P.start,z=P.end,V=z-F,ae=g?z:F-1,ce=this.__iteratees__,ue=ce.length,Se=0,Ue=Mn(V,this.__takeCount__);if(!h||!g&&M==V&&Ue==V)return fd(r,this.__actions__);var We=[];e:for(;V--&&Se<Ue;){ae+=a;for(var at=-1,Xe=r[ae];++at<ue;){var gt=ce[at],Mt=gt.iteratee,qn=gt.type,In=Mt(Xe);if(qn==ne)Xe=In;else if(!In){if(qn==K)continue e;break e}}We[Se++]=Xe}return We}vt.prototype=bs(Ga.prototype),vt.prototype.constructor=vt;function Gr(r){var a=-1,h=r==null?0:r.length;for(this.clear();++a<h;){var g=r[a];this.set(g[0],g[1])}}function J0(){this.__data__=Do?Do(null):{},this.size=0}function Q0(r){var a=this.has(r)&&delete this.__data__[r];return this.size-=a?1:0,a}function ev(r){var a=this.__data__;if(Do){var h=a[r];return h===u?t:h}return Pt.call(a,r)?a[r]:t}function tv(r){var a=this.__data__;return Do?a[r]!==t:Pt.call(a,r)}function nv(r,a){var h=this.__data__;return this.size+=this.has(r)?0:1,h[r]=Do&&a===t?u:a,this}Gr.prototype.clear=J0,Gr.prototype.delete=Q0,Gr.prototype.get=ev,Gr.prototype.has=tv,Gr.prototype.set=nv;function Wi(r){var a=-1,h=r==null?0:r.length;for(this.clear();++a<h;){var g=r[a];this.set(g[0],g[1])}}function iv(){this.__data__=[],this.size=0}function rv(r){var a=this.__data__,h=Va(a,r);if(h<0)return!1;var g=a.length-1;return h==g?a.pop():Na.call(a,h,1),--this.size,!0}function sv(r){var a=this.__data__,h=Va(a,r);return h<0?t:a[h][1]}function ov(r){return Va(this.__data__,r)>-1}function av(r,a){var h=this.__data__,g=Va(h,r);return g<0?(++this.size,h.push([r,a])):h[g][1]=a,this}Wi.prototype.clear=iv,Wi.prototype.delete=rv,Wi.prototype.get=sv,Wi.prototype.has=ov,Wi.prototype.set=av;function Xi(r){var a=-1,h=r==null?0:r.length;for(this.clear();++a<h;){var g=r[a];this.set(g[0],g[1])}}function cv(){this.size=0,this.__data__={hash:new Gr,map:new(Lo||Wi),string:new Gr}}function lv(r){var a=tc(this,r).delete(r);return this.size-=a?1:0,a}function hv(r){return tc(this,r).get(r)}function uv(r){return tc(this,r).has(r)}function fv(r,a){var h=tc(this,r),g=h.size;return h.set(r,a),this.size+=h.size==g?0:1,this}Xi.prototype.clear=cv,Xi.prototype.delete=lv,Xi.prototype.get=hv,Xi.prototype.has=uv,Xi.prototype.set=fv;function Vr(r){var a=-1,h=r==null?0:r.length;for(this.__data__=new Xi;++a<h;)this.add(r[a])}function dv(r){return this.__data__.set(r,u),this}function pv(r){return this.__data__.has(r)}Vr.prototype.add=Vr.prototype.push=dv,Vr.prototype.has=pv;function pi(r){var a=this.__data__=new Wi(r);this.size=a.size}function mv(){this.__data__=new Wi,this.size=0}function gv(r){var a=this.__data__,h=a.delete(r);return this.size=a.size,h}function _v(r){return this.__data__.get(r)}function vv(r){return this.__data__.has(r)}function xv(r,a){var h=this.__data__;if(h instanceof Wi){var g=h.__data__;if(!Lo||g.length<i-1)return g.push([r,a]),this.size=++h.size,this;h=this.__data__=new Xi(g)}return h.set(r,a),this.size=h.size,this}pi.prototype.clear=mv,pi.prototype.delete=gv,pi.prototype.get=_v,pi.prototype.has=vv,pi.prototype.set=xv;function Vf(r,a){var h=it(r),g=!h&&qr(r),M=!h&&!g&&Sr(r),P=!h&&!g&&!M&&Rs(r),F=h||g||M||P,z=F?Pl(r.length,C0):[],V=z.length;for(var ae in r)(a||Pt.call(r,ae))&&!(F&&(ae=="length"||M&&(ae=="offset"||ae=="parent")||P&&(ae=="buffer"||ae=="byteLength"||ae=="byteOffset")||Ki(ae,V)))&&z.push(ae);return z}function Wf(r){var a=r.length;return a?r[jl(0,a-1)]:t}function yv(r,a){return nc(Fn(r),Wr(a,0,r.length))}function Sv(r){return nc(Fn(r))}function Fl(r,a,h){(h!==t&&!mi(r[a],h)||h===t&&!(a in r))&&Yi(r,a,h)}function Oo(r,a,h){var g=r[a];(!(Pt.call(r,a)&&mi(g,h))||h===t&&!(a in r))&&Yi(r,a,h)}function Va(r,a){for(var h=r.length;h--;)if(mi(r[h][0],a))return h;return-1}function Mv(r,a,h,g){return _r(r,function(M,P,F){a(g,M,h(M),F)}),g}function Xf(r,a){return r&&Li(a,fn(a),r)}function Ev(r,a){return r&&Li(a,zn(a),r)}function Yi(r,a,h){a=="__proto__"&&Fa?Fa(r,a,{configurable:!0,enumerable:!0,value:h,writable:!0}):r[a]=h}function Bl(r,a){for(var h=-1,g=a.length,M=J(g),P=r==null;++h<g;)M[h]=P?t:vh(r,a[h]);return M}function Wr(r,a,h){return r===r&&(h!==t&&(r=r<=h?r:h),a!==t&&(r=r>=a?r:a)),r}function ri(r,a,h,g,M,P){var F,z=a&p,V=a&m,ae=a&v;if(h&&(F=M?h(r,g,M,P):h(r)),F!==t)return F;if(!Yt(r))return r;var ce=it(r);if(ce){if(F=ux(r),!z)return Fn(r,F)}else{var ue=En(r),Se=ue==tt||ue==Ve;if(Sr(r))return md(r,z);if(ue==O||ue==_e||Se&&!M){if(F=V||Se?{}:Ud(r),!z)return V?ex(r,Ev(F,r)):Qv(r,Xf(F,r))}else{if(!zt[ue])return M?r:{};F=fx(r,ue,z)}}P||(P=new pi);var Ue=P.get(r);if(Ue)return Ue;P.set(r,F),lp(r)?r.forEach(function(Xe){F.add(ri(Xe,a,h,Xe,r,P))}):ap(r)&&r.forEach(function(Xe,gt){F.set(gt,ri(Xe,a,h,gt,r,P))});var We=ae?V?rh:ih:V?zn:fn,at=ce?t:We(r);return ti(at||r,function(Xe,gt){at&&(gt=Xe,Xe=r[gt]),Oo(F,gt,ri(Xe,a,h,gt,r,P))}),F}function bv(r){var a=fn(r);return function(h){return Yf(h,r,a)}}function Yf(r,a,h){var g=h.length;if(r==null)return!g;for(r=Ut(r);g--;){var M=h[g],P=a[M],F=r[M];if(F===t&&!(M in r)||!P(F))return!1}return!0}function jf(r,a,h){if(typeof r!="function")throw new ni(c);return Go(function(){r.apply(t,h)},a)}function No(r,a,h,g){var M=-1,P=Aa,F=!0,z=r.length,V=[],ae=a.length;if(!z)return V;h&&(a=Vt(a,Xn(h))),g?(P=bl,F=!1):a.length>=i&&(P=Co,F=!1,a=new Vr(a));e:for(;++M<z;){var ce=r[M],ue=h==null?ce:h(ce);if(ce=g||ce!==0?ce:0,F&&ue===ue){for(var Se=ae;Se--;)if(a[Se]===ue)continue e;V.push(ce)}else P(a,ue,g)||V.push(ce)}return V}var _r=yd(Pi),qf=yd(kl,!0);function Tv(r,a){var h=!0;return _r(r,function(g,M,P){return h=!!a(g,M,P),h}),h}function Wa(r,a,h){for(var g=-1,M=r.length;++g<M;){var P=r[g],F=a(P);if(F!=null&&(z===t?F===F&&!jn(F):h(F,z)))var z=F,V=P}return V}function Av(r,a,h,g){var M=r.length;for(h=st(h),h<0&&(h=-h>M?0:M+h),g=g===t||g>M?M:st(g),g<0&&(g+=M),g=h>g?0:up(g);h<g;)r[h++]=a;return r}function Kf(r,a){var h=[];return _r(r,function(g,M,P){a(g,M,P)&&h.push(g)}),h}function vn(r,a,h,g,M){var P=-1,F=r.length;for(h||(h=px),M||(M=[]);++P<F;){var z=r[P];a>0&&h(z)?a>1?vn(z,a-1,h,g,M):pr(M,z):g||(M[M.length]=z)}return M}var zl=Sd(),Zf=Sd(!0);function Pi(r,a){return r&&zl(r,a,fn)}function kl(r,a){return r&&Zf(r,a,fn)}function Xa(r,a){return dr(a,function(h){return Zi(r[h])})}function Xr(r,a){a=xr(a,r);for(var h=0,g=a.length;r!=null&&h<g;)r=r[Ii(a[h++])];return h&&h==g?r:t}function $f(r,a,h){var g=a(r);return it(r)?g:pr(g,h(r))}function Pn(r){return r==null?r===t?ge:Tt:Hr&&Hr in Ut(r)?cx(r):Sx(r)}function Hl(r,a){return r>a}function wv(r,a){return r!=null&&Pt.call(r,a)}function Rv(r,a){return r!=null&&a in Ut(r)}function Cv(r,a,h){return r>=Mn(a,h)&&r<on(a,h)}function Gl(r,a,h){for(var g=h?bl:Aa,M=r[0].length,P=r.length,F=P,z=J(P),V=1/0,ae=[];F--;){var ce=r[F];F&&a&&(ce=Vt(ce,Xn(a))),V=Mn(ce.length,V),z[F]=!h&&(a||M>=120&&ce.length>=120)?new Vr(F&&ce):t}ce=r[0];var ue=-1,Se=z[0];e:for(;++ue<M&&ae.length<V;){var Ue=ce[ue],We=a?a(Ue):Ue;if(Ue=h||Ue!==0?Ue:0,!(Se?Co(Se,We):g(ae,We,h))){for(F=P;--F;){var at=z[F];if(!(at?Co(at,We):g(r[F],We,h)))continue e}Se&&Se.push(We),ae.push(Ue)}}return ae}function Pv(r,a,h,g){return Pi(r,function(M,P,F){a(g,h(M),P,F)}),g}function Fo(r,a,h){a=xr(a,r),r=Bd(r,a);var g=r==null?r:r[Ii(oi(a))];return g==null?t:Wn(g,r,h)}function Jf(r){return Zt(r)&&Pn(r)==_e}function Lv(r){return Zt(r)&&Pn(r)==ve}function Iv(r){return Zt(r)&&Pn(r)==qe}function Bo(r,a,h,g,M){return r===a?!0:r==null||a==null||!Zt(r)&&!Zt(a)?r!==r&&a!==a:Dv(r,a,h,g,Bo,M)}function Dv(r,a,h,g,M,P){var F=it(r),z=it(a),V=F?Ce:En(r),ae=z?Ce:En(a);V=V==_e?O:V,ae=ae==_e?O:ae;var ce=V==O,ue=ae==O,Se=V==ae;if(Se&&Sr(r)){if(!Sr(a))return!1;F=!0,ce=!1}if(Se&&!ce)return P||(P=new pi),F||Rs(r)?Ld(r,a,h,g,M,P):ox(r,a,V,h,g,M,P);if(!(h&S)){var Ue=ce&&Pt.call(r,"__wrapped__"),We=ue&&Pt.call(a,"__wrapped__");if(Ue||We){var at=Ue?r.value():r,Xe=We?a.value():a;return P||(P=new pi),M(at,Xe,h,g,P)}}return Se?(P||(P=new pi),ax(r,a,h,g,M,P)):!1}function Uv(r){return Zt(r)&&En(r)==Et}function Vl(r,a,h,g){var M=h.length,P=M,F=!g;if(r==null)return!P;for(r=Ut(r);M--;){var z=h[M];if(F&&z[2]?z[1]!==r[z[0]]:!(z[0]in r))return!1}for(;++M<P;){z=h[M];var V=z[0],ae=r[V],ce=z[1];if(F&&z[2]){if(ae===t&&!(V in r))return!1}else{var ue=new pi;if(g)var Se=g(ae,ce,V,r,a,ue);if(!(Se===t?Bo(ce,ae,S|b,g,ue):Se))return!1}}return!0}function Qf(r){if(!Yt(r)||gx(r))return!1;var a=Zi(r)?U0:ee;return a.test(jr(r))}function Ov(r){return Zt(r)&&Pn(r)==oe}function Nv(r){return Zt(r)&&En(r)==le}function Fv(r){return Zt(r)&&cc(r.length)&&!!Ht[Pn(r)]}function ed(r){return typeof r=="function"?r:r==null?kn:typeof r=="object"?it(r)?id(r[0],r[1]):nd(r):Mp(r)}function Wl(r){if(!Ho(r))return k0(r);var a=[];for(var h in Ut(r))Pt.call(r,h)&&h!="constructor"&&a.push(h);return a}function Bv(r){if(!Yt(r))return yx(r);var a=Ho(r),h=[];for(var g in r)g=="constructor"&&(a||!Pt.call(r,g))||h.push(g);return h}function Xl(r,a){return r<a}function td(r,a){var h=-1,g=Bn(r)?J(r.length):[];return _r(r,function(M,P,F){g[++h]=a(M,P,F)}),g}function nd(r){var a=oh(r);return a.length==1&&a[0][2]?Nd(a[0][0],a[0][1]):function(h){return h===r||Vl(h,r,a)}}function id(r,a){return ch(r)&&Od(a)?Nd(Ii(r),a):function(h){var g=vh(h,r);return g===t&&g===a?xh(h,r):Bo(a,g,S|b)}}function Ya(r,a,h,g,M){r!==a&&zl(a,function(P,F){if(M||(M=new pi),Yt(P))zv(r,a,F,h,Ya,g,M);else{var z=g?g(hh(r,F),P,F+"",r,a,M):t;z===t&&(z=P),Fl(r,F,z)}},zn)}function zv(r,a,h,g,M,P,F){var z=hh(r,h),V=hh(a,h),ae=F.get(V);if(ae){Fl(r,h,ae);return}var ce=P?P(z,V,h+"",r,a,F):t,ue=ce===t;if(ue){var Se=it(V),Ue=!Se&&Sr(V),We=!Se&&!Ue&&Rs(V);ce=V,Se||Ue||We?it(z)?ce=z:Qt(z)?ce=Fn(z):Ue?(ue=!1,ce=md(V,!0)):We?(ue=!1,ce=gd(V,!0)):ce=[]:Vo(V)||qr(V)?(ce=z,qr(z)?ce=fp(z):(!Yt(z)||Zi(z))&&(ce=Ud(V))):ue=!1}ue&&(F.set(V,ce),M(ce,V,g,P,F),F.delete(V)),Fl(r,h,ce)}function rd(r,a){var h=r.length;if(h)return a+=a<0?h:0,Ki(a,h)?r[a]:t}function sd(r,a,h){a.length?a=Vt(a,function(P){return it(P)?function(F){return Xr(F,P.length===1?P[0]:P)}:P}):a=[kn];var g=-1;a=Vt(a,Xn(Ge()));var M=td(r,function(P,F,z){var V=Vt(a,function(ae){return ae(P)});return{criteria:V,index:++g,value:P}});return f0(M,function(P,F){return Jv(P,F,h)})}function kv(r,a){return od(r,a,function(h,g){return xh(r,g)})}function od(r,a,h){for(var g=-1,M=a.length,P={};++g<M;){var F=a[g],z=Xr(r,F);h(z,F)&&zo(P,xr(F,r),z)}return P}function Hv(r){return function(a){return Xr(a,r)}}function Yl(r,a,h,g){var M=g?u0:_s,P=-1,F=a.length,z=r;for(r===a&&(a=Fn(a)),h&&(z=Vt(r,Xn(h)));++P<F;)for(var V=0,ae=a[P],ce=h?h(ae):ae;(V=M(z,ce,V,g))>-1;)z!==r&&Na.call(z,V,1),Na.call(r,V,1);return r}function ad(r,a){for(var h=r?a.length:0,g=h-1;h--;){var M=a[h];if(h==g||M!==P){var P=M;Ki(M)?Na.call(r,M,1):Zl(r,M)}}return r}function jl(r,a){return r+za(Hf()*(a-r+1))}function Gv(r,a,h,g){for(var M=-1,P=on(Ba((a-r)/(h||1)),0),F=J(P);P--;)F[g?P:++M]=r,r+=h;return F}function ql(r,a){var h="";if(!r||a<1||a>$)return h;do a%2&&(h+=r),a=za(a/2),a&&(r+=r);while(a);return h}function ft(r,a){return uh(Fd(r,a,kn),r+"")}function Vv(r){return Wf(Cs(r))}function Wv(r,a){var h=Cs(r);return nc(h,Wr(a,0,h.length))}function zo(r,a,h,g){if(!Yt(r))return r;a=xr(a,r);for(var M=-1,P=a.length,F=P-1,z=r;z!=null&&++M<P;){var V=Ii(a[M]),ae=h;if(V==="__proto__"||V==="constructor"||V==="prototype")return r;if(M!=F){var ce=z[V];ae=g?g(ce,V,z):t,ae===t&&(ae=Yt(ce)?ce:Ki(a[M+1])?[]:{})}Oo(z,V,ae),z=z[V]}return r}var cd=ka?function(r,a){return ka.set(r,a),r}:kn,Xv=Fa?function(r,a){return Fa(r,"toString",{configurable:!0,enumerable:!1,value:Sh(a),writable:!0})}:kn;function Yv(r){return nc(Cs(r))}function si(r,a,h){var g=-1,M=r.length;a<0&&(a=-a>M?0:M+a),h=h>M?M:h,h<0&&(h+=M),M=a>h?0:h-a>>>0,a>>>=0;for(var P=J(M);++g<M;)P[g]=r[g+a];return P}function jv(r,a){var h;return _r(r,function(g,M,P){return h=a(g,M,P),!h}),!!h}function ja(r,a,h){var g=0,M=r==null?g:r.length;if(typeof a=="number"&&a===a&&M<=bt){for(;g<M;){var P=g+M>>>1,F=r[P];F!==null&&!jn(F)&&(h?F<=a:F<a)?g=P+1:M=P}return M}return Kl(r,a,kn,h)}function Kl(r,a,h,g){var M=0,P=r==null?0:r.length;if(P===0)return 0;a=h(a);for(var F=a!==a,z=a===null,V=jn(a),ae=a===t;M<P;){var ce=za((M+P)/2),ue=h(r[ce]),Se=ue!==t,Ue=ue===null,We=ue===ue,at=jn(ue);if(F)var Xe=g||We;else ae?Xe=We&&(g||Se):z?Xe=We&&Se&&(g||!Ue):V?Xe=We&&Se&&!Ue&&(g||!at):Ue||at?Xe=!1:Xe=g?ue<=a:ue<a;Xe?M=ce+1:P=ce}return Mn(P,Je)}function ld(r,a){for(var h=-1,g=r.length,M=0,P=[];++h<g;){var F=r[h],z=a?a(F):F;if(!h||!mi(z,V)){var V=z;P[M++]=F===0?0:F}}return P}function hd(r){return typeof r=="number"?r:jn(r)?pe:+r}function Yn(r){if(typeof r=="string")return r;if(it(r))return Vt(r,Yn)+"";if(jn(r))return Gf?Gf.call(r):"";var a=r+"";return a=="0"&&1/r==-1/0?"-0":a}function vr(r,a,h){var g=-1,M=Aa,P=r.length,F=!0,z=[],V=z;if(h)F=!1,M=bl;else if(P>=i){var ae=a?null:rx(r);if(ae)return Ra(ae);F=!1,M=Co,V=new Vr}else V=a?[]:z;e:for(;++g<P;){var ce=r[g],ue=a?a(ce):ce;if(ce=h||ce!==0?ce:0,F&&ue===ue){for(var Se=V.length;Se--;)if(V[Se]===ue)continue e;a&&V.push(ue),z.push(ce)}else M(V,ue,h)||(V!==z&&V.push(ue),z.push(ce))}return z}function Zl(r,a){return a=xr(a,r),r=Bd(r,a),r==null||delete r[Ii(oi(a))]}function ud(r,a,h,g){return zo(r,a,h(Xr(r,a)),g)}function qa(r,a,h,g){for(var M=r.length,P=g?M:-1;(g?P--:++P<M)&&a(r[P],P,r););return h?si(r,g?0:P,g?P+1:M):si(r,g?P+1:0,g?M:P)}function fd(r,a){var h=r;return h instanceof vt&&(h=h.value()),Tl(a,function(g,M){return M.func.apply(M.thisArg,pr([g],M.args))},h)}function $l(r,a,h){var g=r.length;if(g<2)return g?vr(r[0]):[];for(var M=-1,P=J(g);++M<g;)for(var F=r[M],z=-1;++z<g;)z!=M&&(P[M]=No(P[M]||F,r[z],a,h));return vr(vn(P,1),a,h)}function dd(r,a,h){for(var g=-1,M=r.length,P=a.length,F={};++g<M;){var z=g<P?a[g]:t;h(F,r[g],z)}return F}function Jl(r){return Qt(r)?r:[]}function Ql(r){return typeof r=="function"?r:kn}function xr(r,a){return it(r)?r:ch(r,a)?[r]:Gd(Rt(r))}var qv=ft;function yr(r,a,h){var g=r.length;return h=h===t?g:h,!a&&h>=g?r:si(r,a,h)}var pd=O0||function(r){return _n.clearTimeout(r)};function md(r,a){if(a)return r.slice();var h=r.length,g=Nf?Nf(h):new r.constructor(h);return r.copy(g),g}function eh(r){var a=new r.constructor(r.byteLength);return new Ua(a).set(new Ua(r)),a}function Kv(r,a){var h=a?eh(r.buffer):r.buffer;return new r.constructor(h,r.byteOffset,r.byteLength)}function Zv(r){var a=new r.constructor(r.source,I.exec(r));return a.lastIndex=r.lastIndex,a}function $v(r){return Uo?Ut(Uo.call(r)):{}}function gd(r,a){var h=a?eh(r.buffer):r.buffer;return new r.constructor(h,r.byteOffset,r.length)}function _d(r,a){if(r!==a){var h=r!==t,g=r===null,M=r===r,P=jn(r),F=a!==t,z=a===null,V=a===a,ae=jn(a);if(!z&&!ae&&!P&&r>a||P&&F&&V&&!z&&!ae||g&&F&&V||!h&&V||!M)return 1;if(!g&&!P&&!ae&&r<a||ae&&h&&M&&!g&&!P||z&&h&&M||!F&&M||!V)return-1}return 0}function Jv(r,a,h){for(var g=-1,M=r.criteria,P=a.criteria,F=M.length,z=h.length;++g<F;){var V=_d(M[g],P[g]);if(V){if(g>=z)return V;var ae=h[g];return V*(ae=="desc"?-1:1)}}return r.index-a.index}function vd(r,a,h,g){for(var M=-1,P=r.length,F=h.length,z=-1,V=a.length,ae=on(P-F,0),ce=J(V+ae),ue=!g;++z<V;)ce[z]=a[z];for(;++M<F;)(ue||M<P)&&(ce[h[M]]=r[M]);for(;ae--;)ce[z++]=r[M++];return ce}function xd(r,a,h,g){for(var M=-1,P=r.length,F=-1,z=h.length,V=-1,ae=a.length,ce=on(P-z,0),ue=J(ce+ae),Se=!g;++M<ce;)ue[M]=r[M];for(var Ue=M;++V<ae;)ue[Ue+V]=a[V];for(;++F<z;)(Se||M<P)&&(ue[Ue+h[F]]=r[M++]);return ue}function Fn(r,a){var h=-1,g=r.length;for(a||(a=J(g));++h<g;)a[h]=r[h];return a}function Li(r,a,h,g){var M=!h;h||(h={});for(var P=-1,F=a.length;++P<F;){var z=a[P],V=g?g(h[z],r[z],z,h,r):t;V===t&&(V=r[z]),M?Yi(h,z,V):Oo(h,z,V)}return h}function Qv(r,a){return Li(r,ah(r),a)}function ex(r,a){return Li(r,Id(r),a)}function Ka(r,a){return function(h,g){var M=it(h)?s0:Mv,P=a?a():{};return M(h,r,Ge(g,2),P)}}function Ts(r){return ft(function(a,h){var g=-1,M=h.length,P=M>1?h[M-1]:t,F=M>2?h[2]:t;for(P=r.length>3&&typeof P=="function"?(M--,P):t,F&&Ln(h[0],h[1],F)&&(P=M<3?t:P,M=1),a=Ut(a);++g<M;){var z=h[g];z&&r(a,z,g,P)}return a})}function yd(r,a){return function(h,g){if(h==null)return h;if(!Bn(h))return r(h,g);for(var M=h.length,P=a?M:-1,F=Ut(h);(a?P--:++P<M)&&g(F[P],P,F)!==!1;);return h}}function Sd(r){return function(a,h,g){for(var M=-1,P=Ut(a),F=g(a),z=F.length;z--;){var V=F[r?z:++M];if(h(P[V],V,P)===!1)break}return a}}function tx(r,a,h){var g=a&x,M=ko(r);function P(){var F=this&&this!==_n&&this instanceof P?M:r;return F.apply(g?h:this,arguments)}return P}function Md(r){return function(a){a=Rt(a);var h=vs(a)?di(a):t,g=h?h[0]:a.charAt(0),M=h?yr(h,1).join(""):a.slice(1);return g[r]()+M}}function As(r){return function(a){return Tl(yp(xp(a).replace(X_,"")),r,"")}}function ko(r){return function(){var a=arguments;switch(a.length){case 0:return new r;case 1:return new r(a[0]);case 2:return new r(a[0],a[1]);case 3:return new r(a[0],a[1],a[2]);case 4:return new r(a[0],a[1],a[2],a[3]);case 5:return new r(a[0],a[1],a[2],a[3],a[4]);case 6:return new r(a[0],a[1],a[2],a[3],a[4],a[5]);case 7:return new r(a[0],a[1],a[2],a[3],a[4],a[5],a[6])}var h=bs(r.prototype),g=r.apply(h,a);return Yt(g)?g:h}}function nx(r,a,h){var g=ko(r);function M(){for(var P=arguments.length,F=J(P),z=P,V=ws(M);z--;)F[z]=arguments[z];var ae=P<3&&F[0]!==V&&F[P-1]!==V?[]:mr(F,V);if(P-=ae.length,P<h)return wd(r,a,Za,M.placeholder,t,F,ae,t,t,h-P);var ce=this&&this!==_n&&this instanceof M?g:r;return Wn(ce,this,F)}return M}function Ed(r){return function(a,h,g){var M=Ut(a);if(!Bn(a)){var P=Ge(h,3);a=fn(a),h=function(z){return P(M[z],z,M)}}var F=r(a,h,g);return F>-1?M[P?a[F]:F]:t}}function bd(r){return qi(function(a){var h=a.length,g=h,M=ii.prototype.thru;for(r&&a.reverse();g--;){var P=a[g];if(typeof P!="function")throw new ni(c);if(M&&!F&&ec(P)=="wrapper")var F=new ii([],!0)}for(g=F?g:h;++g<h;){P=a[g];var z=ec(P),V=z=="wrapper"?sh(P):t;V&&lh(V[0])&&V[1]==(D|E|B|k)&&!V[4].length&&V[9]==1?F=F[ec(V[0])].apply(F,V[3]):F=P.length==1&&lh(P)?F[z]():F.thru(P)}return function(){var ae=arguments,ce=ae[0];if(F&&ae.length==1&&it(ce))return F.plant(ce).value();for(var ue=0,Se=h?a[ue].apply(this,ae):ce;++ue<h;)Se=a[ue].call(this,Se);return Se}})}function Za(r,a,h,g,M,P,F,z,V,ae){var ce=a&D,ue=a&x,Se=a&_,Ue=a&(E|L),We=a&C,at=Se?t:ko(r);function Xe(){for(var gt=arguments.length,Mt=J(gt),qn=gt;qn--;)Mt[qn]=arguments[qn];if(Ue)var In=ws(Xe),Kn=p0(Mt,In);if(g&&(Mt=vd(Mt,g,M,Ue)),P&&(Mt=xd(Mt,P,F,Ue)),gt-=Kn,Ue&><ae){var en=mr(Mt,In);return wd(r,a,Za,Xe.placeholder,h,Mt,en,z,V,ae-gt)}var gi=ue?h:this,Ji=Se?gi[r]:r;return gt=Mt.length,z?Mt=Mx(Mt,z):We&>>1&&Mt.reverse(),ce&&V<gt&&(Mt.length=V),this&&this!==_n&&this instanceof Xe&&(Ji=at||ko(Ji)),Ji.apply(gi,Mt)}return Xe}function Td(r,a){return function(h,g){return Pv(h,r,a(g),{})}}function $a(r,a){return function(h,g){var M;if(h===t&&g===t)return a;if(h!==t&&(M=h),g!==t){if(M===t)return g;typeof h=="string"||typeof g=="string"?(h=Yn(h),g=Yn(g)):(h=hd(h),g=hd(g)),M=r(h,g)}return M}}function th(r){return qi(function(a){return a=Vt(a,Xn(Ge())),ft(function(h){var g=this;return r(a,function(M){return Wn(M,g,h)})})})}function Ja(r,a){a=a===t?" ":Yn(a);var h=a.length;if(h<2)return h?ql(a,r):a;var g=ql(a,Ba(r/xs(a)));return vs(a)?yr(di(g),0,r).join(""):g.slice(0,r)}function ix(r,a,h,g){var M=a&x,P=ko(r);function F(){for(var z=-1,V=arguments.length,ae=-1,ce=g.length,ue=J(ce+V),Se=this&&this!==_n&&this instanceof F?P:r;++ae<ce;)ue[ae]=g[ae];for(;V--;)ue[ae++]=arguments[++z];return Wn(Se,M?h:this,ue)}return F}function Ad(r){return function(a,h,g){return g&&typeof g!="number"&&Ln(a,h,g)&&(h=g=t),a=$i(a),h===t?(h=a,a=0):h=$i(h),g=g===t?a<h?1:-1:$i(g),Gv(a,h,g,r)}}function Qa(r){return function(a,h){return typeof a=="string"&&typeof h=="string"||(a=ai(a),h=ai(h)),r(a,h)}}function wd(r,a,h,g,M,P,F,z,V,ae){var ce=a&E,ue=ce?F:t,Se=ce?t:F,Ue=ce?P:t,We=ce?t:P;a|=ce?B:N,a&=~(ce?N:B),a&R||(a&=-4);var at=[r,a,M,Ue,ue,We,Se,z,V,ae],Xe=h.apply(t,at);return lh(r)&&zd(Xe,at),Xe.placeholder=g,kd(Xe,r,a)}function nh(r){var a=sn[r];return function(h,g){if(h=ai(h),g=g==null?0:Mn(st(g),292),g&&kf(h)){var M=(Rt(h)+"e").split("e"),P=a(M[0]+"e"+(+M[1]+g));return M=(Rt(P)+"e").split("e"),+(M[0]+"e"+(+M[1]-g))}return a(h)}}var rx=Ms&&1/Ra(new Ms([,-0]))[1]==me?function(r){return new Ms(r)}:bh;function Rd(r){return function(a){var h=En(a);return h==Et?Il(a):h==le?S0(a):d0(a,r(a))}}function ji(r,a,h,g,M,P,F,z){var V=a&_;if(!V&&typeof r!="function")throw new ni(c);var ae=g?g.length:0;if(ae||(a&=-97,g=M=t),F=F===t?F:on(st(F),0),z=z===t?z:st(z),ae-=M?M.length:0,a&N){var ce=g,ue=M;g=M=t}var Se=V?t:sh(r),Ue=[r,a,h,g,M,ce,ue,P,F,z];if(Se&&xx(Ue,Se),r=Ue[0],a=Ue[1],h=Ue[2],g=Ue[3],M=Ue[4],z=Ue[9]=Ue[9]===t?V?0:r.length:on(Ue[9]-ae,0),!z&&a&(E|L)&&(a&=-25),!a||a==x)var We=tx(r,a,h);else a==E||a==L?We=nx(r,a,z):(a==B||a==(x|B))&&!M.length?We=ix(r,a,h,g):We=Za.apply(t,Ue);var at=Se?cd:zd;return kd(at(We,Ue),r,a)}function Cd(r,a,h,g){return r===t||mi(r,Ss[h])&&!Pt.call(g,h)?a:r}function Pd(r,a,h,g,M,P){return Yt(r)&&Yt(a)&&(P.set(a,r),Ya(r,a,t,Pd,P),P.delete(a)),r}function sx(r){return Vo(r)?t:r}function Ld(r,a,h,g,M,P){var F=h&S,z=r.length,V=a.length;if(z!=V&&!(F&&V>z))return!1;var ae=P.get(r),ce=P.get(a);if(ae&&ce)return ae==a&&ce==r;var ue=-1,Se=!0,Ue=h&b?new Vr:t;for(P.set(r,a),P.set(a,r);++ue<z;){var We=r[ue],at=a[ue];if(g)var Xe=F?g(at,We,ue,a,r,P):g(We,at,ue,r,a,P);if(Xe!==t){if(Xe)continue;Se=!1;break}if(Ue){if(!Al(a,function(gt,Mt){if(!Co(Ue,Mt)&&(We===gt||M(We,gt,h,g,P)))return Ue.push(Mt)})){Se=!1;break}}else if(!(We===at||M(We,at,h,g,P))){Se=!1;break}}return P.delete(r),P.delete(a),Se}function ox(r,a,h,g,M,P,F){switch(h){case be:if(r.byteLength!=a.byteLength||r.byteOffset!=a.byteOffset)return!1;r=r.buffer,a=a.buffer;case ve:return!(r.byteLength!=a.byteLength||!P(new Ua(r),new Ua(a)));case je:case qe:case ke:return mi(+r,+a);case Y:return r.name==a.name&&r.message==a.message;case oe:case de:return r==a+"";case Et:var z=Il;case le:var V=g&S;if(z||(z=Ra),r.size!=a.size&&!V)return!1;var ae=F.get(r);if(ae)return ae==a;g|=b,F.set(r,a);var ce=Ld(z(r),z(a),g,M,P,F);return F.delete(r),ce;case Be:if(Uo)return Uo.call(r)==Uo.call(a)}return!1}function ax(r,a,h,g,M,P){var F=h&S,z=ih(r),V=z.length,ae=ih(a),ce=ae.length;if(V!=ce&&!F)return!1;for(var ue=V;ue--;){var Se=z[ue];if(!(F?Se in a:Pt.call(a,Se)))return!1}var Ue=P.get(r),We=P.get(a);if(Ue&&We)return Ue==a&&We==r;var at=!0;P.set(r,a),P.set(a,r);for(var Xe=F;++ue<V;){Se=z[ue];var gt=r[Se],Mt=a[Se];if(g)var qn=F?g(Mt,gt,Se,a,r,P):g(gt,Mt,Se,r,a,P);if(!(qn===t?gt===Mt||M(gt,Mt,h,g,P):qn)){at=!1;break}Xe||(Xe=Se=="constructor")}if(at&&!Xe){var In=r.constructor,Kn=a.constructor;In!=Kn&&"constructor"in r&&"constructor"in a&&!(typeof In=="function"&&In instanceof In&&typeof Kn=="function"&&Kn instanceof Kn)&&(at=!1)}return P.delete(r),P.delete(a),at}function qi(r){return uh(Fd(r,t,Yd),r+"")}function ih(r){return $f(r,fn,ah)}function rh(r){return $f(r,zn,Id)}var sh=ka?function(r){return ka.get(r)}:bh;function ec(r){for(var a=r.name+"",h=Es[a],g=Pt.call(Es,a)?h.length:0;g--;){var M=h[g],P=M.func;if(P==null||P==r)return M.name}return a}function ws(r){var a=Pt.call(w,"placeholder")?w:r;return a.placeholder}function Ge(){var r=w.iteratee||Mh;return r=r===Mh?ed:r,arguments.length?r(arguments[0],arguments[1]):r}function tc(r,a){var h=r.__data__;return mx(a)?h[typeof a=="string"?"string":"hash"]:h.map}function oh(r){for(var a=fn(r),h=a.length;h--;){var g=a[h],M=r[g];a[h]=[g,M,Od(M)]}return a}function Yr(r,a){var h=v0(r,a);return Qf(h)?h:t}function cx(r){var a=Pt.call(r,Hr),h=r[Hr];try{r[Hr]=t;var g=!0}catch{}var M=Ia.call(r);return g&&(a?r[Hr]=h:delete r[Hr]),M}var ah=Ul?function(r){return r==null?[]:(r=Ut(r),dr(Ul(r),function(a){return Bf.call(r,a)}))}:Th,Id=Ul?function(r){for(var a=[];r;)pr(a,ah(r)),r=Oa(r);return a}:Th,En=Pn;(Ol&&En(new Ol(new ArrayBuffer(1)))!=be||Lo&&En(new Lo)!=Et||Nl&&En(Nl.resolve())!=A||Ms&&En(new Ms)!=le||Io&&En(new Io)!=De)&&(En=function(r){var a=Pn(r),h=a==O?r.constructor:t,g=h?jr(h):"";if(g)switch(g){case W0:return be;case X0:return Et;case Y0:return A;case j0:return le;case q0:return De}return a});function lx(r,a,h){for(var g=-1,M=h.length;++g<M;){var P=h[g],F=P.size;switch(P.type){case"drop":r+=F;break;case"dropRight":a-=F;break;case"take":a=Mn(a,r+F);break;case"takeRight":r=on(r,a-F);break}}return{start:r,end:a}}function hx(r){var a=r.match(ms);return a?a[1].split(Ea):[]}function Dd(r,a,h){a=xr(a,r);for(var g=-1,M=a.length,P=!1;++g<M;){var F=Ii(a[g]);if(!(P=r!=null&&h(r,F)))break;r=r[F]}return P||++g!=M?P:(M=r==null?0:r.length,!!M&&cc(M)&&Ki(F,M)&&(it(r)||qr(r)))}function ux(r){var a=r.length,h=new r.constructor(a);return a&&typeof r[0]=="string"&&Pt.call(r,"index")&&(h.index=r.index,h.input=r.input),h}function Ud(r){return typeof r.constructor=="function"&&!Ho(r)?bs(Oa(r)):{}}function fx(r,a,h){var g=r.constructor;switch(a){case ve:return eh(r);case je:case qe:return new g(+r);case be:return Kv(r,h);case Ye:case Pe:case Le:case ot:case ht:case yt:case pt:case St:case Oe:return gd(r,h);case Et:return new g;case ke:case de:return new g(r);case oe:return Zv(r);case le:return new g;case Be:return $v(r)}}function dx(r,a){var h=a.length;if(!h)return r;var g=h-1;return a[g]=(h>1?"& ":"")+a[g],a=a.join(h>2?", ":" "),r.replace(Ma,`{
|
|
3804
|
+
*/var IP=ma.exports,Fg;function DP(){return Fg||(Fg=1,function(i,e){(function(){var t,n="4.17.21",r=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",f=500,d="__lodash_placeholder__",p=1,m=2,x=4,M=1,A=2,v=1,_=2,C=4,b=8,L=16,k=32,U=64,O=128,I=256,E=512,y=30,F="...",V=800,G=16,q=1,ne=2,se=3,pe=1/0,K=9007199254740991,he=17976931348623157e292,me=NaN,Me=4294967295,Ke=Me-1,ot=Me>>>1,ie=[["ary",O],["bind",v],["bindKey",_],["curry",b],["curryRight",L],["flip",E],["partial",k],["partialRight",U],["rearg",I]],ge="[object Arguments]",we="[object Array]",Se="[object AsyncFunction]",Ge="[object Boolean]",Xe="[object Date]",at="[object DOMException]",j="[object Error]",$e="[object Function]",ze="[object GeneratorFunction]",bt="[object Map]",He="[object Number]",Tt="[object Null]",B="[object Object]",w="[object Promise]",te="[object Proxy]",ae="[object RegExp]",ue="[object Set]",de="[object String]",Be="[object Symbol]",_e="[object Undefined]",De="[object WeakMap]",Ve="[object WeakSet]",ve="[object ArrayBuffer]",Te="[object DataView]",qe="[object Float32Array]",Le="[object Float64Array]",Ie="[object Int8Array]",ct="[object Int16Array]",ft="[object Int32Array]",St="[object Uint8Array]",gt="[object Uint8ClampedArray]",Mt="[object Uint16Array]",Ue="[object Uint32Array]",S=/\b__p \+= '';/g,Z=/\b(__p \+=) '' \+/g,oe=/(__e\(.*?\)|\b__t\)) \+\n'';/g,xe=/&(?:amp|lt|gt|quot|#39);/g,Re=/[&<>"']/g,_t=RegExp(xe.source),dt=RegExp(Re.source),Ft=/<%-([\s\S]+?)%>/g,rn=/<%([\s\S]+?)%>/g,At=/<%=([\s\S]+?)%>/g,Kt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Zt=/^\w*$/,Pn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Sn=/[\\^$.*+?()[\]{}|]/g,Di=RegExp(Sn.source),Oi=/^\s+/,Qi=/\s/,Da=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Es=/\{\n\/\* \[wrapped with (.+)\] \*/,Oa=/,? & /,Ua=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Tl=/[()=,{}\[\]\/\s]/,Al=/\\(\\)?/g,wl=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,D=/\w*$/,Y=/^[-+]0x[0-9a-f]+$/i,Q=/^0b[01]+$/i,ee=/^\[object .+?Constructor\]$/,$=/^0o[0-7]+$/i,Ae=/^(?:0|[1-9]\d*)$/,Fe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ke=/($^)/,Ze=/['\n\r\u2028\u2029\\]/g,Je="\\ud800-\\udfff",et="\\u0300-\\u036f",nt="\\ufe20-\\ufe2f",Yt="\\u20d0-\\u20ff",Mn=et+nt+Yt,Qt="\\u2700-\\u27bf",ni="a-z\\xdf-\\xf6\\xf8-\\xff",kt="\\xac\\xb1\\xd7\\xf7",rt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Io="\\u2000-\\u206f",Bt=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ui="A-Z\\xc0-\\xd6\\xd8-\\xde",Do="\\ufe0e\\ufe0f",Sr=kt+rt+Io+Bt,jr="['’]",dn="["+Je+"]",gi="["+Sr+"]",Mr="["+Mn+"]",Ln="\\d+",Oo="["+Qt+"]",Na="["+ni+"]",Uo="[^"+Je+Sr+Ln+Qt+ni+Ui+"]",Rl="\\ud83c[\\udffb-\\udfff]",n0="(?:"+Mr+"|"+Rl+")",yf="[^"+Je+"]",Cl="(?:\\ud83c[\\udde6-\\uddff]){2}",Pl="[\\ud800-\\udbff][\\udc00-\\udfff]",bs="["+Ui+"]",Sf="\\u200d",Mf="(?:"+Na+"|"+Uo+")",i0="(?:"+bs+"|"+Uo+")",Ef="(?:"+jr+"(?:d|ll|m|re|s|t|ve))?",bf="(?:"+jr+"(?:D|LL|M|RE|S|T|VE))?",Tf=n0+"?",Af="["+Do+"]?",r0="(?:"+Sf+"(?:"+[yf,Cl,Pl].join("|")+")"+Af+Tf+")*",s0="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",o0="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",wf=Af+Tf+r0,a0="(?:"+[Oo,Cl,Pl].join("|")+")"+wf,c0="(?:"+[yf+Mr+"?",Mr,Cl,Pl,dn].join("|")+")",l0=RegExp(jr,"g"),u0=RegExp(Mr,"g"),Ll=RegExp(Rl+"(?="+Rl+")|"+c0+wf,"g"),h0=RegExp([bs+"?"+Na+"+"+Ef+"(?="+[gi,bs,"$"].join("|")+")",i0+"+"+bf+"(?="+[gi,bs+Mf,"$"].join("|")+")",bs+"?"+Mf+"+"+Ef,bs+"+"+bf,o0,s0,Ln,a0].join("|"),"g"),f0=RegExp("["+Sf+Je+Mn+Do+"]"),d0=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,p0=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],m0=-1,Ht={};Ht[qe]=Ht[Le]=Ht[Ie]=Ht[ct]=Ht[ft]=Ht[St]=Ht[gt]=Ht[Mt]=Ht[Ue]=!0,Ht[ge]=Ht[we]=Ht[ve]=Ht[Ge]=Ht[Te]=Ht[Xe]=Ht[j]=Ht[$e]=Ht[bt]=Ht[He]=Ht[B]=Ht[ae]=Ht[ue]=Ht[de]=Ht[De]=!1;var zt={};zt[ge]=zt[we]=zt[ve]=zt[Te]=zt[Ge]=zt[Xe]=zt[qe]=zt[Le]=zt[Ie]=zt[ct]=zt[ft]=zt[bt]=zt[He]=zt[B]=zt[ae]=zt[ue]=zt[de]=zt[Be]=zt[St]=zt[gt]=zt[Mt]=zt[Ue]=!0,zt[j]=zt[$e]=zt[De]=!1;var g0={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},_0={"&":"&","<":"<",">":">",'"':""","'":"'"},v0={"&":"&","<":"<",">":">",""":'"',"'":"'"},x0={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},y0=parseFloat,S0=parseInt,Rf=typeof tl=="object"&&tl&&tl.Object===Object&&tl,M0=typeof self=="object"&&self&&self.Object===Object&&self,_n=Rf||M0||Function("return this")(),Il=e&&!e.nodeType&&e,qr=Il&&!0&&i&&!i.nodeType&&i,Cf=qr&&qr.exports===Il,Dl=Cf&&Rf.process,ii=function(){try{var W=qr&&qr.require&&qr.require("util").types;return W||Dl&&Dl.binding&&Dl.binding("util")}catch{}}(),Pf=ii&&ii.isArrayBuffer,Lf=ii&&ii.isDate,If=ii&&ii.isMap,Df=ii&&ii.isRegExp,Of=ii&&ii.isSet,Uf=ii&&ii.isTypedArray;function Yn(W,re,J){switch(J.length){case 0:return W.call(re);case 1:return W.call(re,J[0]);case 2:return W.call(re,J[0],J[1]);case 3:return W.call(re,J[0],J[1],J[2])}return W.apply(re,J)}function E0(W,re,J,Ce){for(var tt=-1,wt=W==null?0:W.length;++tt<wt;){var an=W[tt];re(Ce,an,J(an),W)}return Ce}function ri(W,re){for(var J=-1,Ce=W==null?0:W.length;++J<Ce&&re(W[J],J,W)!==!1;);return W}function b0(W,re){for(var J=W==null?0:W.length;J--&&re(W[J],J,W)!==!1;);return W}function Nf(W,re){for(var J=-1,Ce=W==null?0:W.length;++J<Ce;)if(!re(W[J],J,W))return!1;return!0}function Er(W,re){for(var J=-1,Ce=W==null?0:W.length,tt=0,wt=[];++J<Ce;){var an=W[J];re(an,J,W)&&(wt[tt++]=an)}return wt}function Fa(W,re){var J=W==null?0:W.length;return!!J&&Ts(W,re,0)>-1}function Ol(W,re,J){for(var Ce=-1,tt=W==null?0:W.length;++Ce<tt;)if(J(re,W[Ce]))return!0;return!1}function Wt(W,re){for(var J=-1,Ce=W==null?0:W.length,tt=Array(Ce);++J<Ce;)tt[J]=re(W[J],J,W);return tt}function br(W,re){for(var J=-1,Ce=re.length,tt=W.length;++J<Ce;)W[tt+J]=re[J];return W}function Ul(W,re,J,Ce){var tt=-1,wt=W==null?0:W.length;for(Ce&&wt&&(J=W[++tt]);++tt<wt;)J=re(J,W[tt],tt,W);return J}function T0(W,re,J,Ce){var tt=W==null?0:W.length;for(Ce&&tt&&(J=W[--tt]);tt--;)J=re(J,W[tt],tt,W);return J}function Nl(W,re){for(var J=-1,Ce=W==null?0:W.length;++J<Ce;)if(re(W[J],J,W))return!0;return!1}var A0=Fl("length");function w0(W){return W.split("")}function R0(W){return W.match(Ua)||[]}function Ff(W,re,J){var Ce;return J(W,function(tt,wt,an){if(re(tt,wt,an))return Ce=wt,!1}),Ce}function Ba(W,re,J,Ce){for(var tt=W.length,wt=J+(Ce?1:-1);Ce?wt--:++wt<tt;)if(re(W[wt],wt,W))return wt;return-1}function Ts(W,re,J){return re===re?k0(W,re,J):Ba(W,Bf,J)}function C0(W,re,J,Ce){for(var tt=J-1,wt=W.length;++tt<wt;)if(Ce(W[tt],re))return tt;return-1}function Bf(W){return W!==W}function zf(W,re){var J=W==null?0:W.length;return J?zl(W,re)/J:me}function Fl(W){return function(re){return re==null?t:re[W]}}function Bl(W){return function(re){return W==null?t:W[re]}}function kf(W,re,J,Ce,tt){return tt(W,function(wt,an,Ot){J=Ce?(Ce=!1,wt):re(J,wt,an,Ot)}),J}function P0(W,re){var J=W.length;for(W.sort(re);J--;)W[J]=W[J].value;return W}function zl(W,re){for(var J,Ce=-1,tt=W.length;++Ce<tt;){var wt=re(W[Ce]);wt!==t&&(J=J===t?wt:J+wt)}return J}function kl(W,re){for(var J=-1,Ce=Array(W);++J<W;)Ce[J]=re(J);return Ce}function L0(W,re){return Wt(re,function(J){return[J,W[J]]})}function Hf(W){return W&&W.slice(0,Xf(W)+1).replace(Oi,"")}function jn(W){return function(re){return W(re)}}function Hl(W,re){return Wt(re,function(J){return W[J]})}function No(W,re){return W.has(re)}function Gf(W,re){for(var J=-1,Ce=W.length;++J<Ce&&Ts(re,W[J],0)>-1;);return J}function Vf(W,re){for(var J=W.length;J--&&Ts(re,W[J],0)>-1;);return J}function I0(W,re){for(var J=W.length,Ce=0;J--;)W[J]===re&&++Ce;return Ce}var D0=Bl(g0),O0=Bl(_0);function U0(W){return"\\"+x0[W]}function N0(W,re){return W==null?t:W[re]}function As(W){return f0.test(W)}function F0(W){return d0.test(W)}function B0(W){for(var re,J=[];!(re=W.next()).done;)J.push(re.value);return J}function Gl(W){var re=-1,J=Array(W.size);return W.forEach(function(Ce,tt){J[++re]=[tt,Ce]}),J}function Wf(W,re){return function(J){return W(re(J))}}function Tr(W,re){for(var J=-1,Ce=W.length,tt=0,wt=[];++J<Ce;){var an=W[J];(an===re||an===d)&&(W[J]=d,wt[tt++]=J)}return wt}function za(W){var re=-1,J=Array(W.size);return W.forEach(function(Ce){J[++re]=Ce}),J}function z0(W){var re=-1,J=Array(W.size);return W.forEach(function(Ce){J[++re]=[Ce,Ce]}),J}function k0(W,re,J){for(var Ce=J-1,tt=W.length;++Ce<tt;)if(W[Ce]===re)return Ce;return-1}function H0(W,re,J){for(var Ce=J+1;Ce--;)if(W[Ce]===re)return Ce;return Ce}function ws(W){return As(W)?V0(W):A0(W)}function _i(W){return As(W)?W0(W):w0(W)}function Xf(W){for(var re=W.length;re--&&Qi.test(W.charAt(re)););return re}var G0=Bl(v0);function V0(W){for(var re=Ll.lastIndex=0;Ll.test(W);)++re;return re}function W0(W){return W.match(Ll)||[]}function X0(W){return W.match(h0)||[]}var Y0=function W(re){re=re==null?_n:Rs.defaults(_n.Object(),re,Rs.pick(_n,p0));var J=re.Array,Ce=re.Date,tt=re.Error,wt=re.Function,an=re.Math,Ot=re.Object,Vl=re.RegExp,j0=re.String,si=re.TypeError,ka=J.prototype,q0=wt.prototype,Cs=Ot.prototype,Ha=re["__core-js_shared__"],Ga=q0.toString,Pt=Cs.hasOwnProperty,K0=0,Yf=function(){var s=/[^.]+$/.exec(Ha&&Ha.keys&&Ha.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),Va=Cs.toString,Z0=Ga.call(Ot),$0=_n._,J0=Vl("^"+Ga.call(Pt).replace(Sn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Wa=Cf?re.Buffer:t,Ar=re.Symbol,Xa=re.Uint8Array,jf=Wa?Wa.allocUnsafe:t,Ya=Wf(Ot.getPrototypeOf,Ot),qf=Ot.create,Kf=Cs.propertyIsEnumerable,ja=ka.splice,Zf=Ar?Ar.isConcatSpreadable:t,Fo=Ar?Ar.iterator:t,Kr=Ar?Ar.toStringTag:t,qa=function(){try{var s=es(Ot,"defineProperty");return s({},"",{}),s}catch{}}(),Q0=re.clearTimeout!==_n.clearTimeout&&re.clearTimeout,ev=Ce&&Ce.now!==_n.Date.now&&Ce.now,tv=re.setTimeout!==_n.setTimeout&&re.setTimeout,Ka=an.ceil,Za=an.floor,Wl=Ot.getOwnPropertySymbols,nv=Wa?Wa.isBuffer:t,$f=re.isFinite,iv=ka.join,rv=Wf(Ot.keys,Ot),cn=an.max,En=an.min,sv=Ce.now,ov=re.parseInt,Jf=an.random,av=ka.reverse,Xl=es(re,"DataView"),Bo=es(re,"Map"),Yl=es(re,"Promise"),Ps=es(re,"Set"),zo=es(re,"WeakMap"),ko=es(Ot,"create"),$a=zo&&new zo,Ls={},cv=ts(Xl),lv=ts(Bo),uv=ts(Yl),hv=ts(Ps),fv=ts(zo),Ja=Ar?Ar.prototype:t,Ho=Ja?Ja.valueOf:t,Qf=Ja?Ja.toString:t;function R(s){if($t(s)&&!it(s)&&!(s instanceof xt)){if(s instanceof oi)return s;if(Pt.call(s,"__wrapped__"))return ep(s)}return new oi(s)}var Is=function(){function s(){}return function(a){if(!jt(a))return{};if(qf)return qf(a);s.prototype=a;var u=new s;return s.prototype=t,u}}();function Qa(){}function oi(s,a){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!a,this.__index__=0,this.__values__=t}R.templateSettings={escape:Ft,evaluate:rn,interpolate:At,variable:"",imports:{_:R}},R.prototype=Qa.prototype,R.prototype.constructor=R,oi.prototype=Is(Qa.prototype),oi.prototype.constructor=oi;function xt(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Me,this.__views__=[]}function dv(){var s=new xt(this.__wrapped__);return s.__actions__=kn(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=kn(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=kn(this.__views__),s}function pv(){if(this.__filtered__){var s=new xt(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function mv(){var s=this.__wrapped__.value(),a=this.__dir__,u=it(s),g=a<0,T=u?s.length:0,P=wx(0,T,this.__views__),z=P.start,H=P.end,X=H-z,ce=g?H:z-1,le=this.__iteratees__,fe=le.length,Ee=0,Oe=En(X,this.__takeCount__);if(!u||!g&&T==X&&Oe==X)return Ed(s,this.__actions__);var Ye=[];e:for(;X--&&Ee<Oe;){ce+=a;for(var lt=-1,je=s[ce];++lt<fe;){var vt=le[lt],Et=vt.iteratee,Zn=vt.type,On=Et(je);if(Zn==ne)je=On;else if(!On){if(Zn==q)continue e;break e}}Ye[Ee++]=je}return Ye}xt.prototype=Is(Qa.prototype),xt.prototype.constructor=xt;function Zr(s){var a=-1,u=s==null?0:s.length;for(this.clear();++a<u;){var g=s[a];this.set(g[0],g[1])}}function gv(){this.__data__=ko?ko(null):{},this.size=0}function _v(s){var a=this.has(s)&&delete this.__data__[s];return this.size-=a?1:0,a}function vv(s){var a=this.__data__;if(ko){var u=a[s];return u===h?t:u}return Pt.call(a,s)?a[s]:t}function xv(s){var a=this.__data__;return ko?a[s]!==t:Pt.call(a,s)}function yv(s,a){var u=this.__data__;return this.size+=this.has(s)?0:1,u[s]=ko&&a===t?h:a,this}Zr.prototype.clear=gv,Zr.prototype.delete=_v,Zr.prototype.get=vv,Zr.prototype.has=xv,Zr.prototype.set=yv;function er(s){var a=-1,u=s==null?0:s.length;for(this.clear();++a<u;){var g=s[a];this.set(g[0],g[1])}}function Sv(){this.__data__=[],this.size=0}function Mv(s){var a=this.__data__,u=ec(a,s);if(u<0)return!1;var g=a.length-1;return u==g?a.pop():ja.call(a,u,1),--this.size,!0}function Ev(s){var a=this.__data__,u=ec(a,s);return u<0?t:a[u][1]}function bv(s){return ec(this.__data__,s)>-1}function Tv(s,a){var u=this.__data__,g=ec(u,s);return g<0?(++this.size,u.push([s,a])):u[g][1]=a,this}er.prototype.clear=Sv,er.prototype.delete=Mv,er.prototype.get=Ev,er.prototype.has=bv,er.prototype.set=Tv;function tr(s){var a=-1,u=s==null?0:s.length;for(this.clear();++a<u;){var g=s[a];this.set(g[0],g[1])}}function Av(){this.size=0,this.__data__={hash:new Zr,map:new(Bo||er),string:new Zr}}function wv(s){var a=fc(this,s).delete(s);return this.size-=a?1:0,a}function Rv(s){return fc(this,s).get(s)}function Cv(s){return fc(this,s).has(s)}function Pv(s,a){var u=fc(this,s),g=u.size;return u.set(s,a),this.size+=u.size==g?0:1,this}tr.prototype.clear=Av,tr.prototype.delete=wv,tr.prototype.get=Rv,tr.prototype.has=Cv,tr.prototype.set=Pv;function $r(s){var a=-1,u=s==null?0:s.length;for(this.__data__=new tr;++a<u;)this.add(s[a])}function Lv(s){return this.__data__.set(s,h),this}function Iv(s){return this.__data__.has(s)}$r.prototype.add=$r.prototype.push=Lv,$r.prototype.has=Iv;function vi(s){var a=this.__data__=new er(s);this.size=a.size}function Dv(){this.__data__=new er,this.size=0}function Ov(s){var a=this.__data__,u=a.delete(s);return this.size=a.size,u}function Uv(s){return this.__data__.get(s)}function Nv(s){return this.__data__.has(s)}function Fv(s,a){var u=this.__data__;if(u instanceof er){var g=u.__data__;if(!Bo||g.length<r-1)return g.push([s,a]),this.size=++u.size,this;u=this.__data__=new tr(g)}return u.set(s,a),this.size=u.size,this}vi.prototype.clear=Dv,vi.prototype.delete=Ov,vi.prototype.get=Uv,vi.prototype.has=Nv,vi.prototype.set=Fv;function ed(s,a){var u=it(s),g=!u&&ns(s),T=!u&&!g&&Lr(s),P=!u&&!g&&!T&&Ns(s),z=u||g||T||P,H=z?kl(s.length,j0):[],X=H.length;for(var ce in s)(a||Pt.call(s,ce))&&!(z&&(ce=="length"||T&&(ce=="offset"||ce=="parent")||P&&(ce=="buffer"||ce=="byteLength"||ce=="byteOffset")||sr(ce,X)))&&H.push(ce);return H}function td(s){var a=s.length;return a?s[iu(0,a-1)]:t}function Bv(s,a){return dc(kn(s),Jr(a,0,s.length))}function zv(s){return dc(kn(s))}function jl(s,a,u){(u!==t&&!xi(s[a],u)||u===t&&!(a in s))&&nr(s,a,u)}function Go(s,a,u){var g=s[a];(!(Pt.call(s,a)&&xi(g,u))||u===t&&!(a in s))&&nr(s,a,u)}function ec(s,a){for(var u=s.length;u--;)if(xi(s[u][0],a))return u;return-1}function kv(s,a,u,g){return wr(s,function(T,P,z){a(g,T,u(T),z)}),g}function nd(s,a){return s&&Fi(a,pn(a),s)}function Hv(s,a){return s&&Fi(a,Gn(a),s)}function nr(s,a,u){a=="__proto__"&&qa?qa(s,a,{configurable:!0,enumerable:!0,value:u,writable:!0}):s[a]=u}function ql(s,a){for(var u=-1,g=a.length,T=J(g),P=s==null;++u<g;)T[u]=P?t:Ru(s,a[u]);return T}function Jr(s,a,u){return s===s&&(u!==t&&(s=s<=u?s:u),a!==t&&(s=s>=a?s:a)),s}function ai(s,a,u,g,T,P){var z,H=a&p,X=a&m,ce=a&x;if(u&&(z=T?u(s,g,T,P):u(s)),z!==t)return z;if(!jt(s))return s;var le=it(s);if(le){if(z=Cx(s),!H)return kn(s,z)}else{var fe=bn(s),Ee=fe==$e||fe==ze;if(Lr(s))return Ad(s,H);if(fe==B||fe==ge||Ee&&!T){if(z=X||Ee?{}:Xd(s),!H)return X?vx(s,Hv(z,s)):_x(s,nd(z,s))}else{if(!zt[fe])return T?s:{};z=Px(s,fe,H)}}P||(P=new vi);var Oe=P.get(s);if(Oe)return Oe;P.set(s,z),yp(s)?s.forEach(function(je){z.add(ai(je,a,u,je,s,P))}):vp(s)&&s.forEach(function(je,vt){z.set(vt,ai(je,a,u,vt,s,P))});var Ye=ce?X?pu:du:X?Gn:pn,lt=le?t:Ye(s);return ri(lt||s,function(je,vt){lt&&(vt=je,je=s[vt]),Go(z,vt,ai(je,a,u,vt,s,P))}),z}function Gv(s){var a=pn(s);return function(u){return id(u,s,a)}}function id(s,a,u){var g=u.length;if(s==null)return!g;for(s=Ot(s);g--;){var T=u[g],P=a[T],z=s[T];if(z===t&&!(T in s)||!P(z))return!1}return!0}function rd(s,a,u){if(typeof s!="function")throw new si(c);return Ko(function(){s.apply(t,u)},a)}function Vo(s,a,u,g){var T=-1,P=Fa,z=!0,H=s.length,X=[],ce=a.length;if(!H)return X;u&&(a=Wt(a,jn(u))),g?(P=Ol,z=!1):a.length>=r&&(P=No,z=!1,a=new $r(a));e:for(;++T<H;){var le=s[T],fe=u==null?le:u(le);if(le=g||le!==0?le:0,z&&fe===fe){for(var Ee=ce;Ee--;)if(a[Ee]===fe)continue e;X.push(le)}else P(a,fe,g)||X.push(le)}return X}var wr=Ld(Ni),sd=Ld(Zl,!0);function Vv(s,a){var u=!0;return wr(s,function(g,T,P){return u=!!a(g,T,P),u}),u}function tc(s,a,u){for(var g=-1,T=s.length;++g<T;){var P=s[g],z=a(P);if(z!=null&&(H===t?z===z&&!Kn(z):u(z,H)))var H=z,X=P}return X}function Wv(s,a,u,g){var T=s.length;for(u=st(u),u<0&&(u=-u>T?0:T+u),g=g===t||g>T?T:st(g),g<0&&(g+=T),g=u>g?0:Mp(g);u<g;)s[u++]=a;return s}function od(s,a){var u=[];return wr(s,function(g,T,P){a(g,T,P)&&u.push(g)}),u}function vn(s,a,u,g,T){var P=-1,z=s.length;for(u||(u=Ix),T||(T=[]);++P<z;){var H=s[P];a>0&&u(H)?a>1?vn(H,a-1,u,g,T):br(T,H):g||(T[T.length]=H)}return T}var Kl=Id(),ad=Id(!0);function Ni(s,a){return s&&Kl(s,a,pn)}function Zl(s,a){return s&&ad(s,a,pn)}function nc(s,a){return Er(a,function(u){return or(s[u])})}function Qr(s,a){a=Cr(a,s);for(var u=0,g=a.length;s!=null&&u<g;)s=s[Bi(a[u++])];return u&&u==g?s:t}function cd(s,a,u){var g=a(s);return it(s)?g:br(g,u(s))}function In(s){return s==null?s===t?_e:Tt:Kr&&Kr in Ot(s)?Ax(s):zx(s)}function $l(s,a){return s>a}function Xv(s,a){return s!=null&&Pt.call(s,a)}function Yv(s,a){return s!=null&&a in Ot(s)}function jv(s,a,u){return s>=En(a,u)&&s<cn(a,u)}function Jl(s,a,u){for(var g=u?Ol:Fa,T=s[0].length,P=s.length,z=P,H=J(P),X=1/0,ce=[];z--;){var le=s[z];z&&a&&(le=Wt(le,jn(a))),X=En(le.length,X),H[z]=!u&&(a||T>=120&&le.length>=120)?new $r(z&&le):t}le=s[0];var fe=-1,Ee=H[0];e:for(;++fe<T&&ce.length<X;){var Oe=le[fe],Ye=a?a(Oe):Oe;if(Oe=u||Oe!==0?Oe:0,!(Ee?No(Ee,Ye):g(ce,Ye,u))){for(z=P;--z;){var lt=H[z];if(!(lt?No(lt,Ye):g(s[z],Ye,u)))continue e}Ee&&Ee.push(Ye),ce.push(Oe)}}return ce}function qv(s,a,u,g){return Ni(s,function(T,P,z){a(g,u(T),P,z)}),g}function Wo(s,a,u){a=Cr(a,s),s=Kd(s,a);var g=s==null?s:s[Bi(li(a))];return g==null?t:Yn(g,s,u)}function ld(s){return $t(s)&&In(s)==ge}function Kv(s){return $t(s)&&In(s)==ve}function Zv(s){return $t(s)&&In(s)==Xe}function Xo(s,a,u,g,T){return s===a?!0:s==null||a==null||!$t(s)&&!$t(a)?s!==s&&a!==a:$v(s,a,u,g,Xo,T)}function $v(s,a,u,g,T,P){var z=it(s),H=it(a),X=z?we:bn(s),ce=H?we:bn(a);X=X==ge?B:X,ce=ce==ge?B:ce;var le=X==B,fe=ce==B,Ee=X==ce;if(Ee&&Lr(s)){if(!Lr(a))return!1;z=!0,le=!1}if(Ee&&!le)return P||(P=new vi),z||Ns(s)?Gd(s,a,u,g,T,P):bx(s,a,X,u,g,T,P);if(!(u&M)){var Oe=le&&Pt.call(s,"__wrapped__"),Ye=fe&&Pt.call(a,"__wrapped__");if(Oe||Ye){var lt=Oe?s.value():s,je=Ye?a.value():a;return P||(P=new vi),T(lt,je,u,g,P)}}return Ee?(P||(P=new vi),Tx(s,a,u,g,T,P)):!1}function Jv(s){return $t(s)&&bn(s)==bt}function Ql(s,a,u,g){var T=u.length,P=T,z=!g;if(s==null)return!P;for(s=Ot(s);T--;){var H=u[T];if(z&&H[2]?H[1]!==s[H[0]]:!(H[0]in s))return!1}for(;++T<P;){H=u[T];var X=H[0],ce=s[X],le=H[1];if(z&&H[2]){if(ce===t&&!(X in s))return!1}else{var fe=new vi;if(g)var Ee=g(ce,le,X,s,a,fe);if(!(Ee===t?Xo(le,ce,M|A,g,fe):Ee))return!1}}return!0}function ud(s){if(!jt(s)||Ox(s))return!1;var a=or(s)?J0:ee;return a.test(ts(s))}function Qv(s){return $t(s)&&In(s)==ae}function ex(s){return $t(s)&&bn(s)==ue}function tx(s){return $t(s)&&xc(s.length)&&!!Ht[In(s)]}function hd(s){return typeof s=="function"?s:s==null?Vn:typeof s=="object"?it(s)?pd(s[0],s[1]):dd(s):Dp(s)}function eu(s){if(!qo(s))return rv(s);var a=[];for(var u in Ot(s))Pt.call(s,u)&&u!="constructor"&&a.push(u);return a}function nx(s){if(!jt(s))return Bx(s);var a=qo(s),u=[];for(var g in s)g=="constructor"&&(a||!Pt.call(s,g))||u.push(g);return u}function tu(s,a){return s<a}function fd(s,a){var u=-1,g=Hn(s)?J(s.length):[];return wr(s,function(T,P,z){g[++u]=a(T,P,z)}),g}function dd(s){var a=gu(s);return a.length==1&&a[0][2]?jd(a[0][0],a[0][1]):function(u){return u===s||Ql(u,s,a)}}function pd(s,a){return vu(s)&&Yd(a)?jd(Bi(s),a):function(u){var g=Ru(u,s);return g===t&&g===a?Cu(u,s):Xo(a,g,M|A)}}function ic(s,a,u,g,T){s!==a&&Kl(a,function(P,z){if(T||(T=new vi),jt(P))ix(s,a,z,u,ic,g,T);else{var H=g?g(yu(s,z),P,z+"",s,a,T):t;H===t&&(H=P),jl(s,z,H)}},Gn)}function ix(s,a,u,g,T,P,z){var H=yu(s,u),X=yu(a,u),ce=z.get(X);if(ce){jl(s,u,ce);return}var le=P?P(H,X,u+"",s,a,z):t,fe=le===t;if(fe){var Ee=it(X),Oe=!Ee&&Lr(X),Ye=!Ee&&!Oe&&Ns(X);le=X,Ee||Oe||Ye?it(H)?le=H:en(H)?le=kn(H):Oe?(fe=!1,le=Ad(X,!0)):Ye?(fe=!1,le=wd(X,!0)):le=[]:Zo(X)||ns(X)?(le=H,ns(H)?le=Ep(H):(!jt(H)||or(H))&&(le=Xd(X))):fe=!1}fe&&(z.set(X,le),T(le,X,g,P,z),z.delete(X)),jl(s,u,le)}function md(s,a){var u=s.length;if(u)return a+=a<0?u:0,sr(a,u)?s[a]:t}function gd(s,a,u){a.length?a=Wt(a,function(P){return it(P)?function(z){return Qr(z,P.length===1?P[0]:P)}:P}):a=[Vn];var g=-1;a=Wt(a,jn(We()));var T=fd(s,function(P,z,H){var X=Wt(a,function(ce){return ce(P)});return{criteria:X,index:++g,value:P}});return P0(T,function(P,z){return gx(P,z,u)})}function rx(s,a){return _d(s,a,function(u,g){return Cu(s,g)})}function _d(s,a,u){for(var g=-1,T=a.length,P={};++g<T;){var z=a[g],H=Qr(s,z);u(H,z)&&Yo(P,Cr(z,s),H)}return P}function sx(s){return function(a){return Qr(a,s)}}function nu(s,a,u,g){var T=g?C0:Ts,P=-1,z=a.length,H=s;for(s===a&&(a=kn(a)),u&&(H=Wt(s,jn(u)));++P<z;)for(var X=0,ce=a[P],le=u?u(ce):ce;(X=T(H,le,X,g))>-1;)H!==s&&ja.call(H,X,1),ja.call(s,X,1);return s}function vd(s,a){for(var u=s?a.length:0,g=u-1;u--;){var T=a[u];if(u==g||T!==P){var P=T;sr(T)?ja.call(s,T,1):ou(s,T)}}return s}function iu(s,a){return s+Za(Jf()*(a-s+1))}function ox(s,a,u,g){for(var T=-1,P=cn(Ka((a-s)/(u||1)),0),z=J(P);P--;)z[g?P:++T]=s,s+=u;return z}function ru(s,a){var u="";if(!s||a<1||a>K)return u;do a%2&&(u+=s),a=Za(a/2),a&&(s+=s);while(a);return u}function pt(s,a){return Su(qd(s,a,Vn),s+"")}function ax(s){return td(Fs(s))}function cx(s,a){var u=Fs(s);return dc(u,Jr(a,0,u.length))}function Yo(s,a,u,g){if(!jt(s))return s;a=Cr(a,s);for(var T=-1,P=a.length,z=P-1,H=s;H!=null&&++T<P;){var X=Bi(a[T]),ce=u;if(X==="__proto__"||X==="constructor"||X==="prototype")return s;if(T!=z){var le=H[X];ce=g?g(le,X,H):t,ce===t&&(ce=jt(le)?le:sr(a[T+1])?[]:{})}Go(H,X,ce),H=H[X]}return s}var xd=$a?function(s,a){return $a.set(s,a),s}:Vn,lx=qa?function(s,a){return qa(s,"toString",{configurable:!0,enumerable:!1,value:Lu(a),writable:!0})}:Vn;function ux(s){return dc(Fs(s))}function ci(s,a,u){var g=-1,T=s.length;a<0&&(a=-a>T?0:T+a),u=u>T?T:u,u<0&&(u+=T),T=a>u?0:u-a>>>0,a>>>=0;for(var P=J(T);++g<T;)P[g]=s[g+a];return P}function hx(s,a){var u;return wr(s,function(g,T,P){return u=a(g,T,P),!u}),!!u}function rc(s,a,u){var g=0,T=s==null?g:s.length;if(typeof a=="number"&&a===a&&T<=ot){for(;g<T;){var P=g+T>>>1,z=s[P];z!==null&&!Kn(z)&&(u?z<=a:z<a)?g=P+1:T=P}return T}return su(s,a,Vn,u)}function su(s,a,u,g){var T=0,P=s==null?0:s.length;if(P===0)return 0;a=u(a);for(var z=a!==a,H=a===null,X=Kn(a),ce=a===t;T<P;){var le=Za((T+P)/2),fe=u(s[le]),Ee=fe!==t,Oe=fe===null,Ye=fe===fe,lt=Kn(fe);if(z)var je=g||Ye;else ce?je=Ye&&(g||Ee):H?je=Ye&&Ee&&(g||!Oe):X?je=Ye&&Ee&&!Oe&&(g||!lt):Oe||lt?je=!1:je=g?fe<=a:fe<a;je?T=le+1:P=le}return En(P,Ke)}function yd(s,a){for(var u=-1,g=s.length,T=0,P=[];++u<g;){var z=s[u],H=a?a(z):z;if(!u||!xi(H,X)){var X=H;P[T++]=z===0?0:z}}return P}function Sd(s){return typeof s=="number"?s:Kn(s)?me:+s}function qn(s){if(typeof s=="string")return s;if(it(s))return Wt(s,qn)+"";if(Kn(s))return Qf?Qf.call(s):"";var a=s+"";return a=="0"&&1/s==-1/0?"-0":a}function Rr(s,a,u){var g=-1,T=Fa,P=s.length,z=!0,H=[],X=H;if(u)z=!1,T=Ol;else if(P>=r){var ce=a?null:Mx(s);if(ce)return za(ce);z=!1,T=No,X=new $r}else X=a?[]:H;e:for(;++g<P;){var le=s[g],fe=a?a(le):le;if(le=u||le!==0?le:0,z&&fe===fe){for(var Ee=X.length;Ee--;)if(X[Ee]===fe)continue e;a&&X.push(fe),H.push(le)}else T(X,fe,u)||(X!==H&&X.push(fe),H.push(le))}return H}function ou(s,a){return a=Cr(a,s),s=Kd(s,a),s==null||delete s[Bi(li(a))]}function Md(s,a,u,g){return Yo(s,a,u(Qr(s,a)),g)}function sc(s,a,u,g){for(var T=s.length,P=g?T:-1;(g?P--:++P<T)&&a(s[P],P,s););return u?ci(s,g?0:P,g?P+1:T):ci(s,g?P+1:0,g?T:P)}function Ed(s,a){var u=s;return u instanceof xt&&(u=u.value()),Ul(a,function(g,T){return T.func.apply(T.thisArg,br([g],T.args))},u)}function au(s,a,u){var g=s.length;if(g<2)return g?Rr(s[0]):[];for(var T=-1,P=J(g);++T<g;)for(var z=s[T],H=-1;++H<g;)H!=T&&(P[T]=Vo(P[T]||z,s[H],a,u));return Rr(vn(P,1),a,u)}function bd(s,a,u){for(var g=-1,T=s.length,P=a.length,z={};++g<T;){var H=g<P?a[g]:t;u(z,s[g],H)}return z}function cu(s){return en(s)?s:[]}function lu(s){return typeof s=="function"?s:Vn}function Cr(s,a){return it(s)?s:vu(s,a)?[s]:Qd(Rt(s))}var fx=pt;function Pr(s,a,u){var g=s.length;return u=u===t?g:u,!a&&u>=g?s:ci(s,a,u)}var Td=Q0||function(s){return _n.clearTimeout(s)};function Ad(s,a){if(a)return s.slice();var u=s.length,g=jf?jf(u):new s.constructor(u);return s.copy(g),g}function uu(s){var a=new s.constructor(s.byteLength);return new Xa(a).set(new Xa(s)),a}function dx(s,a){var u=a?uu(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.byteLength)}function px(s){var a=new s.constructor(s.source,D.exec(s));return a.lastIndex=s.lastIndex,a}function mx(s){return Ho?Ot(Ho.call(s)):{}}function wd(s,a){var u=a?uu(s.buffer):s.buffer;return new s.constructor(u,s.byteOffset,s.length)}function Rd(s,a){if(s!==a){var u=s!==t,g=s===null,T=s===s,P=Kn(s),z=a!==t,H=a===null,X=a===a,ce=Kn(a);if(!H&&!ce&&!P&&s>a||P&&z&&X&&!H&&!ce||g&&z&&X||!u&&X||!T)return 1;if(!g&&!P&&!ce&&s<a||ce&&u&&T&&!g&&!P||H&&u&&T||!z&&T||!X)return-1}return 0}function gx(s,a,u){for(var g=-1,T=s.criteria,P=a.criteria,z=T.length,H=u.length;++g<z;){var X=Rd(T[g],P[g]);if(X){if(g>=H)return X;var ce=u[g];return X*(ce=="desc"?-1:1)}}return s.index-a.index}function Cd(s,a,u,g){for(var T=-1,P=s.length,z=u.length,H=-1,X=a.length,ce=cn(P-z,0),le=J(X+ce),fe=!g;++H<X;)le[H]=a[H];for(;++T<z;)(fe||T<P)&&(le[u[T]]=s[T]);for(;ce--;)le[H++]=s[T++];return le}function Pd(s,a,u,g){for(var T=-1,P=s.length,z=-1,H=u.length,X=-1,ce=a.length,le=cn(P-H,0),fe=J(le+ce),Ee=!g;++T<le;)fe[T]=s[T];for(var Oe=T;++X<ce;)fe[Oe+X]=a[X];for(;++z<H;)(Ee||T<P)&&(fe[Oe+u[z]]=s[T++]);return fe}function kn(s,a){var u=-1,g=s.length;for(a||(a=J(g));++u<g;)a[u]=s[u];return a}function Fi(s,a,u,g){var T=!u;u||(u={});for(var P=-1,z=a.length;++P<z;){var H=a[P],X=g?g(u[H],s[H],H,u,s):t;X===t&&(X=s[H]),T?nr(u,H,X):Go(u,H,X)}return u}function _x(s,a){return Fi(s,_u(s),a)}function vx(s,a){return Fi(s,Vd(s),a)}function oc(s,a){return function(u,g){var T=it(u)?E0:kv,P=a?a():{};return T(u,s,We(g,2),P)}}function Ds(s){return pt(function(a,u){var g=-1,T=u.length,P=T>1?u[T-1]:t,z=T>2?u[2]:t;for(P=s.length>3&&typeof P=="function"?(T--,P):t,z&&Dn(u[0],u[1],z)&&(P=T<3?t:P,T=1),a=Ot(a);++g<T;){var H=u[g];H&&s(a,H,g,P)}return a})}function Ld(s,a){return function(u,g){if(u==null)return u;if(!Hn(u))return s(u,g);for(var T=u.length,P=a?T:-1,z=Ot(u);(a?P--:++P<T)&&g(z[P],P,z)!==!1;);return u}}function Id(s){return function(a,u,g){for(var T=-1,P=Ot(a),z=g(a),H=z.length;H--;){var X=z[s?H:++T];if(u(P[X],X,P)===!1)break}return a}}function xx(s,a,u){var g=a&v,T=jo(s);function P(){var z=this&&this!==_n&&this instanceof P?T:s;return z.apply(g?u:this,arguments)}return P}function Dd(s){return function(a){a=Rt(a);var u=As(a)?_i(a):t,g=u?u[0]:a.charAt(0),T=u?Pr(u,1).join(""):a.slice(1);return g[s]()+T}}function Os(s){return function(a){return Ul(Lp(Pp(a).replace(l0,"")),s,"")}}function jo(s){return function(){var a=arguments;switch(a.length){case 0:return new s;case 1:return new s(a[0]);case 2:return new s(a[0],a[1]);case 3:return new s(a[0],a[1],a[2]);case 4:return new s(a[0],a[1],a[2],a[3]);case 5:return new s(a[0],a[1],a[2],a[3],a[4]);case 6:return new s(a[0],a[1],a[2],a[3],a[4],a[5]);case 7:return new s(a[0],a[1],a[2],a[3],a[4],a[5],a[6])}var u=Is(s.prototype),g=s.apply(u,a);return jt(g)?g:u}}function yx(s,a,u){var g=jo(s);function T(){for(var P=arguments.length,z=J(P),H=P,X=Us(T);H--;)z[H]=arguments[H];var ce=P<3&&z[0]!==X&&z[P-1]!==X?[]:Tr(z,X);if(P-=ce.length,P<u)return Bd(s,a,ac,T.placeholder,t,z,ce,t,t,u-P);var le=this&&this!==_n&&this instanceof T?g:s;return Yn(le,this,z)}return T}function Od(s){return function(a,u,g){var T=Ot(a);if(!Hn(a)){var P=We(u,3);a=pn(a),u=function(H){return P(T[H],H,T)}}var z=s(a,u,g);return z>-1?T[P?a[z]:z]:t}}function Ud(s){return rr(function(a){var u=a.length,g=u,T=oi.prototype.thru;for(s&&a.reverse();g--;){var P=a[g];if(typeof P!="function")throw new si(c);if(T&&!z&&hc(P)=="wrapper")var z=new oi([],!0)}for(g=z?g:u;++g<u;){P=a[g];var H=hc(P),X=H=="wrapper"?mu(P):t;X&&xu(X[0])&&X[1]==(O|b|k|I)&&!X[4].length&&X[9]==1?z=z[hc(X[0])].apply(z,X[3]):z=P.length==1&&xu(P)?z[H]():z.thru(P)}return function(){var ce=arguments,le=ce[0];if(z&&ce.length==1&&it(le))return z.plant(le).value();for(var fe=0,Ee=u?a[fe].apply(this,ce):le;++fe<u;)Ee=a[fe].call(this,Ee);return Ee}})}function ac(s,a,u,g,T,P,z,H,X,ce){var le=a&O,fe=a&v,Ee=a&_,Oe=a&(b|L),Ye=a&E,lt=Ee?t:jo(s);function je(){for(var vt=arguments.length,Et=J(vt),Zn=vt;Zn--;)Et[Zn]=arguments[Zn];if(Oe)var On=Us(je),$n=I0(Et,On);if(g&&(Et=Cd(Et,g,T,Oe)),P&&(Et=Pd(Et,P,z,Oe)),vt-=$n,Oe&&vt<ce){var tn=Tr(Et,On);return Bd(s,a,ac,je.placeholder,u,Et,tn,H,X,ce-vt)}var yi=fe?u:this,cr=Ee?yi[s]:s;return vt=Et.length,H?Et=kx(Et,H):Ye&&vt>1&&Et.reverse(),le&&X<vt&&(Et.length=X),this&&this!==_n&&this instanceof je&&(cr=lt||jo(cr)),cr.apply(yi,Et)}return je}function Nd(s,a){return function(u,g){return qv(u,s,a(g),{})}}function cc(s,a){return function(u,g){var T;if(u===t&&g===t)return a;if(u!==t&&(T=u),g!==t){if(T===t)return g;typeof u=="string"||typeof g=="string"?(u=qn(u),g=qn(g)):(u=Sd(u),g=Sd(g)),T=s(u,g)}return T}}function hu(s){return rr(function(a){return a=Wt(a,jn(We())),pt(function(u){var g=this;return s(a,function(T){return Yn(T,g,u)})})})}function lc(s,a){a=a===t?" ":qn(a);var u=a.length;if(u<2)return u?ru(a,s):a;var g=ru(a,Ka(s/ws(a)));return As(a)?Pr(_i(g),0,s).join(""):g.slice(0,s)}function Sx(s,a,u,g){var T=a&v,P=jo(s);function z(){for(var H=-1,X=arguments.length,ce=-1,le=g.length,fe=J(le+X),Ee=this&&this!==_n&&this instanceof z?P:s;++ce<le;)fe[ce]=g[ce];for(;X--;)fe[ce++]=arguments[++H];return Yn(Ee,T?u:this,fe)}return z}function Fd(s){return function(a,u,g){return g&&typeof g!="number"&&Dn(a,u,g)&&(u=g=t),a=ar(a),u===t?(u=a,a=0):u=ar(u),g=g===t?a<u?1:-1:ar(g),ox(a,u,g,s)}}function uc(s){return function(a,u){return typeof a=="string"&&typeof u=="string"||(a=ui(a),u=ui(u)),s(a,u)}}function Bd(s,a,u,g,T,P,z,H,X,ce){var le=a&b,fe=le?z:t,Ee=le?t:z,Oe=le?P:t,Ye=le?t:P;a|=le?k:U,a&=~(le?U:k),a&C||(a&=-4);var lt=[s,a,T,Oe,fe,Ye,Ee,H,X,ce],je=u.apply(t,lt);return xu(s)&&Zd(je,lt),je.placeholder=g,$d(je,s,a)}function fu(s){var a=an[s];return function(u,g){if(u=ui(u),g=g==null?0:En(st(g),292),g&&$f(u)){var T=(Rt(u)+"e").split("e"),P=a(T[0]+"e"+(+T[1]+g));return T=(Rt(P)+"e").split("e"),+(T[0]+"e"+(+T[1]-g))}return a(u)}}var Mx=Ps&&1/za(new Ps([,-0]))[1]==pe?function(s){return new Ps(s)}:Ou;function zd(s){return function(a){var u=bn(a);return u==bt?Gl(a):u==ue?z0(a):L0(a,s(a))}}function ir(s,a,u,g,T,P,z,H){var X=a&_;if(!X&&typeof s!="function")throw new si(c);var ce=g?g.length:0;if(ce||(a&=-97,g=T=t),z=z===t?z:cn(st(z),0),H=H===t?H:st(H),ce-=T?T.length:0,a&U){var le=g,fe=T;g=T=t}var Ee=X?t:mu(s),Oe=[s,a,u,g,T,le,fe,P,z,H];if(Ee&&Fx(Oe,Ee),s=Oe[0],a=Oe[1],u=Oe[2],g=Oe[3],T=Oe[4],H=Oe[9]=Oe[9]===t?X?0:s.length:cn(Oe[9]-ce,0),!H&&a&(b|L)&&(a&=-25),!a||a==v)var Ye=xx(s,a,u);else a==b||a==L?Ye=yx(s,a,H):(a==k||a==(v|k))&&!T.length?Ye=Sx(s,a,u,g):Ye=ac.apply(t,Oe);var lt=Ee?xd:Zd;return $d(lt(Ye,Oe),s,a)}function kd(s,a,u,g){return s===t||xi(s,Cs[u])&&!Pt.call(g,u)?a:s}function Hd(s,a,u,g,T,P){return jt(s)&&jt(a)&&(P.set(a,s),ic(s,a,t,Hd,P),P.delete(a)),s}function Ex(s){return Zo(s)?t:s}function Gd(s,a,u,g,T,P){var z=u&M,H=s.length,X=a.length;if(H!=X&&!(z&&X>H))return!1;var ce=P.get(s),le=P.get(a);if(ce&&le)return ce==a&&le==s;var fe=-1,Ee=!0,Oe=u&A?new $r:t;for(P.set(s,a),P.set(a,s);++fe<H;){var Ye=s[fe],lt=a[fe];if(g)var je=z?g(lt,Ye,fe,a,s,P):g(Ye,lt,fe,s,a,P);if(je!==t){if(je)continue;Ee=!1;break}if(Oe){if(!Nl(a,function(vt,Et){if(!No(Oe,Et)&&(Ye===vt||T(Ye,vt,u,g,P)))return Oe.push(Et)})){Ee=!1;break}}else if(!(Ye===lt||T(Ye,lt,u,g,P))){Ee=!1;break}}return P.delete(s),P.delete(a),Ee}function bx(s,a,u,g,T,P,z){switch(u){case Te:if(s.byteLength!=a.byteLength||s.byteOffset!=a.byteOffset)return!1;s=s.buffer,a=a.buffer;case ve:return!(s.byteLength!=a.byteLength||!P(new Xa(s),new Xa(a)));case Ge:case Xe:case He:return xi(+s,+a);case j:return s.name==a.name&&s.message==a.message;case ae:case de:return s==a+"";case bt:var H=Gl;case ue:var X=g&M;if(H||(H=za),s.size!=a.size&&!X)return!1;var ce=z.get(s);if(ce)return ce==a;g|=A,z.set(s,a);var le=Gd(H(s),H(a),g,T,P,z);return z.delete(s),le;case Be:if(Ho)return Ho.call(s)==Ho.call(a)}return!1}function Tx(s,a,u,g,T,P){var z=u&M,H=du(s),X=H.length,ce=du(a),le=ce.length;if(X!=le&&!z)return!1;for(var fe=X;fe--;){var Ee=H[fe];if(!(z?Ee in a:Pt.call(a,Ee)))return!1}var Oe=P.get(s),Ye=P.get(a);if(Oe&&Ye)return Oe==a&&Ye==s;var lt=!0;P.set(s,a),P.set(a,s);for(var je=z;++fe<X;){Ee=H[fe];var vt=s[Ee],Et=a[Ee];if(g)var Zn=z?g(Et,vt,Ee,a,s,P):g(vt,Et,Ee,s,a,P);if(!(Zn===t?vt===Et||T(vt,Et,u,g,P):Zn)){lt=!1;break}je||(je=Ee=="constructor")}if(lt&&!je){var On=s.constructor,$n=a.constructor;On!=$n&&"constructor"in s&&"constructor"in a&&!(typeof On=="function"&&On instanceof On&&typeof $n=="function"&&$n instanceof $n)&&(lt=!1)}return P.delete(s),P.delete(a),lt}function rr(s){return Su(qd(s,t,ip),s+"")}function du(s){return cd(s,pn,_u)}function pu(s){return cd(s,Gn,Vd)}var mu=$a?function(s){return $a.get(s)}:Ou;function hc(s){for(var a=s.name+"",u=Ls[a],g=Pt.call(Ls,a)?u.length:0;g--;){var T=u[g],P=T.func;if(P==null||P==s)return T.name}return a}function Us(s){var a=Pt.call(R,"placeholder")?R:s;return a.placeholder}function We(){var s=R.iteratee||Iu;return s=s===Iu?hd:s,arguments.length?s(arguments[0],arguments[1]):s}function fc(s,a){var u=s.__data__;return Dx(a)?u[typeof a=="string"?"string":"hash"]:u.map}function gu(s){for(var a=pn(s),u=a.length;u--;){var g=a[u],T=s[g];a[u]=[g,T,Yd(T)]}return a}function es(s,a){var u=N0(s,a);return ud(u)?u:t}function Ax(s){var a=Pt.call(s,Kr),u=s[Kr];try{s[Kr]=t;var g=!0}catch{}var T=Va.call(s);return g&&(a?s[Kr]=u:delete s[Kr]),T}var _u=Wl?function(s){return s==null?[]:(s=Ot(s),Er(Wl(s),function(a){return Kf.call(s,a)}))}:Uu,Vd=Wl?function(s){for(var a=[];s;)br(a,_u(s)),s=Ya(s);return a}:Uu,bn=In;(Xl&&bn(new Xl(new ArrayBuffer(1)))!=Te||Bo&&bn(new Bo)!=bt||Yl&&bn(Yl.resolve())!=w||Ps&&bn(new Ps)!=ue||zo&&bn(new zo)!=De)&&(bn=function(s){var a=In(s),u=a==B?s.constructor:t,g=u?ts(u):"";if(g)switch(g){case cv:return Te;case lv:return bt;case uv:return w;case hv:return ue;case fv:return De}return a});function wx(s,a,u){for(var g=-1,T=u.length;++g<T;){var P=u[g],z=P.size;switch(P.type){case"drop":s+=z;break;case"dropRight":a-=z;break;case"take":a=En(a,s+z);break;case"takeRight":s=cn(s,a-z);break}}return{start:s,end:a}}function Rx(s){var a=s.match(Es);return a?a[1].split(Oa):[]}function Wd(s,a,u){a=Cr(a,s);for(var g=-1,T=a.length,P=!1;++g<T;){var z=Bi(a[g]);if(!(P=s!=null&&u(s,z)))break;s=s[z]}return P||++g!=T?P:(T=s==null?0:s.length,!!T&&xc(T)&&sr(z,T)&&(it(s)||ns(s)))}function Cx(s){var a=s.length,u=new s.constructor(a);return a&&typeof s[0]=="string"&&Pt.call(s,"index")&&(u.index=s.index,u.input=s.input),u}function Xd(s){return typeof s.constructor=="function"&&!qo(s)?Is(Ya(s)):{}}function Px(s,a,u){var g=s.constructor;switch(a){case ve:return uu(s);case Ge:case Xe:return new g(+s);case Te:return dx(s,u);case qe:case Le:case Ie:case ct:case ft:case St:case gt:case Mt:case Ue:return wd(s,u);case bt:return new g;case He:case de:return new g(s);case ae:return px(s);case ue:return new g;case Be:return mx(s)}}function Lx(s,a){var u=a.length;if(!u)return s;var g=u-1;return a[g]=(u>1?"& ":"")+a[g],a=a.join(u>2?", ":" "),s.replace(Da,`{
|
|
3805
3805
|
/* [wrapped with `+a+`] */
|
|
3806
|
-
`)}function px(r){return it(r)||qr(r)||!!(zf&&r&&r[zf])}function Ki(r,a){var h=typeof r;return a=a??$,!!a&&(h=="number"||h!="symbol"&&Te.test(r))&&r>-1&&r%1==0&&r<a}function Ln(r,a,h){if(!Yt(h))return!1;var g=typeof a;return(g=="number"?Bn(h)&&Ki(a,h.length):g=="string"&&a in h)?mi(h[a],r):!1}function ch(r,a){if(it(r))return!1;var h=typeof r;return h=="number"||h=="symbol"||h=="boolean"||r==null||jn(r)?!0:Kt.test(r)||!qt.test(r)||a!=null&&r in Ut(a)}function mx(r){var a=typeof r;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?r!=="__proto__":r===null}function lh(r){var a=ec(r),h=w[a];if(typeof h!="function"||!(a in vt.prototype))return!1;if(r===h)return!0;var g=sh(h);return!!g&&r===g[0]}function gx(r){return!!Of&&Of in r}var _x=Pa?Zi:Ah;function Ho(r){var a=r&&r.constructor,h=typeof a=="function"&&a.prototype||Ss;return r===h}function Od(r){return r===r&&!Yt(r)}function Nd(r,a){return function(h){return h==null?!1:h[r]===a&&(a!==t||r in Ut(h))}}function vx(r){var a=oc(r,function(g){return h.size===f&&h.clear(),g}),h=a.cache;return a}function xx(r,a){var h=r[1],g=a[1],M=h|g,P=M<(x|_|D),F=g==D&&h==E||g==D&&h==k&&r[7].length<=a[8]||g==(D|k)&&a[7].length<=a[8]&&h==E;if(!(P||F))return r;g&x&&(r[2]=a[2],M|=h&x?0:R);var z=a[3];if(z){var V=r[3];r[3]=V?vd(V,z,a[4]):z,r[4]=V?mr(r[3],d):a[4]}return z=a[5],z&&(V=r[5],r[5]=V?xd(V,z,a[6]):z,r[6]=V?mr(r[5],d):a[6]),z=a[7],z&&(r[7]=z),g&D&&(r[8]=r[8]==null?a[8]:Mn(r[8],a[8])),r[9]==null&&(r[9]=a[9]),r[0]=a[0],r[1]=M,r}function yx(r){var a=[];if(r!=null)for(var h in Ut(r))a.push(h);return a}function Sx(r){return Ia.call(r)}function Fd(r,a,h){return a=on(a===t?r.length-1:a,0),function(){for(var g=arguments,M=-1,P=on(g.length-a,0),F=J(P);++M<P;)F[M]=g[a+M];M=-1;for(var z=J(a+1);++M<a;)z[M]=g[M];return z[a]=h(F),Wn(r,this,z)}}function Bd(r,a){return a.length<2?r:Xr(r,si(a,0,-1))}function Mx(r,a){for(var h=r.length,g=Mn(a.length,h),M=Fn(r);g--;){var P=a[g];r[g]=Ki(P,h)?M[P]:t}return r}function hh(r,a){if(!(a==="constructor"&&typeof r[a]=="function")&&a!="__proto__")return r[a]}var zd=Hd(cd),Go=F0||function(r,a){return _n.setTimeout(r,a)},uh=Hd(Xv);function kd(r,a,h){var g=a+"";return uh(r,dx(g,Ex(hx(g),h)))}function Hd(r){var a=0,h=0;return function(){var g=H0(),M=H-(g-h);if(h=g,M>0){if(++a>=j)return arguments[0]}else a=0;return r.apply(t,arguments)}}function nc(r,a){var h=-1,g=r.length,M=g-1;for(a=a===t?g:a;++h<a;){var P=jl(h,M),F=r[P];r[P]=r[h],r[h]=F}return r.length=a,r}var Gd=vx(function(r){var a=[];return r.charCodeAt(0)===46&&a.push(""),r.replace(Rn,function(h,g,M,P){a.push(M?P.replace(gl,"$1"):g||h)}),a});function Ii(r){if(typeof r=="string"||jn(r))return r;var a=r+"";return a=="0"&&1/r==-1/0?"-0":a}function jr(r){if(r!=null){try{return La.call(r)}catch{}try{return r+""}catch{}}return""}function Ex(r,a){return ti(ie,function(h){var g="_."+h[0];a&h[1]&&!Aa(r,g)&&r.push(g)}),r.sort()}function Vd(r){if(r instanceof vt)return r.clone();var a=new ii(r.__wrapped__,r.__chain__);return a.__actions__=Fn(r.__actions__),a.__index__=r.__index__,a.__values__=r.__values__,a}function bx(r,a,h){(h?Ln(r,a,h):a===t)?a=1:a=on(st(a),0);var g=r==null?0:r.length;if(!g||a<1)return[];for(var M=0,P=0,F=J(Ba(g/a));M<g;)F[P++]=si(r,M,M+=a);return F}function Tx(r){for(var a=-1,h=r==null?0:r.length,g=0,M=[];++a<h;){var P=r[a];P&&(M[g++]=P)}return M}function Ax(){var r=arguments.length;if(!r)return[];for(var a=J(r-1),h=arguments[0],g=r;g--;)a[g-1]=arguments[g];return pr(it(h)?Fn(h):[h],vn(a,1))}var wx=ft(function(r,a){return Qt(r)?No(r,vn(a,1,Qt,!0)):[]}),Rx=ft(function(r,a){var h=oi(a);return Qt(h)&&(h=t),Qt(r)?No(r,vn(a,1,Qt,!0),Ge(h,2)):[]}),Cx=ft(function(r,a){var h=oi(a);return Qt(h)&&(h=t),Qt(r)?No(r,vn(a,1,Qt,!0),t,h):[]});function Px(r,a,h){var g=r==null?0:r.length;return g?(a=h||a===t?1:st(a),si(r,a<0?0:a,g)):[]}function Lx(r,a,h){var g=r==null?0:r.length;return g?(a=h||a===t?1:st(a),a=g-a,si(r,0,a<0?0:a)):[]}function Ix(r,a){return r&&r.length?qa(r,Ge(a,3),!0,!0):[]}function Dx(r,a){return r&&r.length?qa(r,Ge(a,3),!0):[]}function Ux(r,a,h,g){var M=r==null?0:r.length;return M?(h&&typeof h!="number"&&Ln(r,a,h)&&(h=0,g=M),Av(r,a,h,g)):[]}function Wd(r,a,h){var g=r==null?0:r.length;if(!g)return-1;var M=h==null?0:st(h);return M<0&&(M=on(g+M,0)),wa(r,Ge(a,3),M)}function Xd(r,a,h){var g=r==null?0:r.length;if(!g)return-1;var M=g-1;return h!==t&&(M=st(h),M=h<0?on(g+M,0):Mn(M,g-1)),wa(r,Ge(a,3),M,!0)}function Yd(r){var a=r==null?0:r.length;return a?vn(r,1):[]}function Ox(r){var a=r==null?0:r.length;return a?vn(r,me):[]}function Nx(r,a){var h=r==null?0:r.length;return h?(a=a===t?1:st(a),vn(r,a)):[]}function Fx(r){for(var a=-1,h=r==null?0:r.length,g={};++a<h;){var M=r[a];g[M[0]]=M[1]}return g}function jd(r){return r&&r.length?r[0]:t}function Bx(r,a,h){var g=r==null?0:r.length;if(!g)return-1;var M=h==null?0:st(h);return M<0&&(M=on(g+M,0)),_s(r,a,M)}function zx(r){var a=r==null?0:r.length;return a?si(r,0,-1):[]}var kx=ft(function(r){var a=Vt(r,Jl);return a.length&&a[0]===r[0]?Gl(a):[]}),Hx=ft(function(r){var a=oi(r),h=Vt(r,Jl);return a===oi(h)?a=t:h.pop(),h.length&&h[0]===r[0]?Gl(h,Ge(a,2)):[]}),Gx=ft(function(r){var a=oi(r),h=Vt(r,Jl);return a=typeof a=="function"?a:t,a&&h.pop(),h.length&&h[0]===r[0]?Gl(h,t,a):[]});function Vx(r,a){return r==null?"":z0.call(r,a)}function oi(r){var a=r==null?0:r.length;return a?r[a-1]:t}function Wx(r,a,h){var g=r==null?0:r.length;if(!g)return-1;var M=g;return h!==t&&(M=st(h),M=M<0?on(g+M,0):Mn(M,g-1)),a===a?E0(r,a,M):wa(r,wf,M,!0)}function Xx(r,a){return r&&r.length?rd(r,st(a)):t}var Yx=ft(qd);function qd(r,a){return r&&r.length&&a&&a.length?Yl(r,a):r}function jx(r,a,h){return r&&r.length&&a&&a.length?Yl(r,a,Ge(h,2)):r}function qx(r,a,h){return r&&r.length&&a&&a.length?Yl(r,a,t,h):r}var Kx=qi(function(r,a){var h=r==null?0:r.length,g=Bl(r,a);return ad(r,Vt(a,function(M){return Ki(M,h)?+M:M}).sort(_d)),g});function Zx(r,a){var h=[];if(!(r&&r.length))return h;var g=-1,M=[],P=r.length;for(a=Ge(a,3);++g<P;){var F=r[g];a(F,g,r)&&(h.push(F),M.push(g))}return ad(r,M),h}function fh(r){return r==null?r:V0.call(r)}function $x(r,a,h){var g=r==null?0:r.length;return g?(h&&typeof h!="number"&&Ln(r,a,h)?(a=0,h=g):(a=a==null?0:st(a),h=h===t?g:st(h)),si(r,a,h)):[]}function Jx(r,a){return ja(r,a)}function Qx(r,a,h){return Kl(r,a,Ge(h,2))}function ey(r,a){var h=r==null?0:r.length;if(h){var g=ja(r,a);if(g<h&&mi(r[g],a))return g}return-1}function ty(r,a){return ja(r,a,!0)}function ny(r,a,h){return Kl(r,a,Ge(h,2),!0)}function iy(r,a){var h=r==null?0:r.length;if(h){var g=ja(r,a,!0)-1;if(mi(r[g],a))return g}return-1}function ry(r){return r&&r.length?ld(r):[]}function sy(r,a){return r&&r.length?ld(r,Ge(a,2)):[]}function oy(r){var a=r==null?0:r.length;return a?si(r,1,a):[]}function ay(r,a,h){return r&&r.length?(a=h||a===t?1:st(a),si(r,0,a<0?0:a)):[]}function cy(r,a,h){var g=r==null?0:r.length;return g?(a=h||a===t?1:st(a),a=g-a,si(r,a<0?0:a,g)):[]}function ly(r,a){return r&&r.length?qa(r,Ge(a,3),!1,!0):[]}function hy(r,a){return r&&r.length?qa(r,Ge(a,3)):[]}var uy=ft(function(r){return vr(vn(r,1,Qt,!0))}),fy=ft(function(r){var a=oi(r);return Qt(a)&&(a=t),vr(vn(r,1,Qt,!0),Ge(a,2))}),dy=ft(function(r){var a=oi(r);return a=typeof a=="function"?a:t,vr(vn(r,1,Qt,!0),t,a)});function py(r){return r&&r.length?vr(r):[]}function my(r,a){return r&&r.length?vr(r,Ge(a,2)):[]}function gy(r,a){return a=typeof a=="function"?a:t,r&&r.length?vr(r,t,a):[]}function dh(r){if(!(r&&r.length))return[];var a=0;return r=dr(r,function(h){if(Qt(h))return a=on(h.length,a),!0}),Pl(a,function(h){return Vt(r,wl(h))})}function Kd(r,a){if(!(r&&r.length))return[];var h=dh(r);return a==null?h:Vt(h,function(g){return Wn(a,t,g)})}var _y=ft(function(r,a){return Qt(r)?No(r,a):[]}),vy=ft(function(r){return $l(dr(r,Qt))}),xy=ft(function(r){var a=oi(r);return Qt(a)&&(a=t),$l(dr(r,Qt),Ge(a,2))}),yy=ft(function(r){var a=oi(r);return a=typeof a=="function"?a:t,$l(dr(r,Qt),t,a)}),Sy=ft(dh);function My(r,a){return dd(r||[],a||[],Oo)}function Ey(r,a){return dd(r||[],a||[],zo)}var by=ft(function(r){var a=r.length,h=a>1?r[a-1]:t;return h=typeof h=="function"?(r.pop(),h):t,Kd(r,h)});function Zd(r){var a=w(r);return a.__chain__=!0,a}function Ty(r,a){return a(r),r}function ic(r,a){return a(r)}var Ay=qi(function(r){var a=r.length,h=a?r[0]:0,g=this.__wrapped__,M=function(P){return Bl(P,r)};return a>1||this.__actions__.length||!(g instanceof vt)||!Ki(h)?this.thru(M):(g=g.slice(h,+h+(a?1:0)),g.__actions__.push({func:ic,args:[M],thisArg:t}),new ii(g,this.__chain__).thru(function(P){return a&&!P.length&&P.push(t),P}))});function wy(){return Zd(this)}function Ry(){return new ii(this.value(),this.__chain__)}function Cy(){this.__values__===t&&(this.__values__=hp(this.value()));var r=this.__index__>=this.__values__.length,a=r?t:this.__values__[this.__index__++];return{done:r,value:a}}function Py(){return this}function Ly(r){for(var a,h=this;h instanceof Ga;){var g=Vd(h);g.__index__=0,g.__values__=t,a?M.__wrapped__=g:a=g;var M=g;h=h.__wrapped__}return M.__wrapped__=r,a}function Iy(){var r=this.__wrapped__;if(r instanceof vt){var a=r;return this.__actions__.length&&(a=new vt(this)),a=a.reverse(),a.__actions__.push({func:ic,args:[fh],thisArg:t}),new ii(a,this.__chain__)}return this.thru(fh)}function Dy(){return fd(this.__wrapped__,this.__actions__)}var Uy=Ka(function(r,a,h){Pt.call(r,h)?++r[h]:Yi(r,h,1)});function Oy(r,a,h){var g=it(r)?Tf:Tv;return h&&Ln(r,a,h)&&(a=t),g(r,Ge(a,3))}function Ny(r,a){var h=it(r)?dr:Kf;return h(r,Ge(a,3))}var Fy=Ed(Wd),By=Ed(Xd);function zy(r,a){return vn(rc(r,a),1)}function ky(r,a){return vn(rc(r,a),me)}function Hy(r,a,h){return h=h===t?1:st(h),vn(rc(r,a),h)}function $d(r,a){var h=it(r)?ti:_r;return h(r,Ge(a,3))}function Jd(r,a){var h=it(r)?o0:qf;return h(r,Ge(a,3))}var Gy=Ka(function(r,a,h){Pt.call(r,h)?r[h].push(a):Yi(r,h,[a])});function Vy(r,a,h,g){r=Bn(r)?r:Cs(r),h=h&&!g?st(h):0;var M=r.length;return h<0&&(h=on(M+h,0)),lc(r)?h<=M&&r.indexOf(a,h)>-1:!!M&&_s(r,a,h)>-1}var Wy=ft(function(r,a,h){var g=-1,M=typeof a=="function",P=Bn(r)?J(r.length):[];return _r(r,function(F){P[++g]=M?Wn(a,F,h):Fo(F,a,h)}),P}),Xy=Ka(function(r,a,h){Yi(r,h,a)});function rc(r,a){var h=it(r)?Vt:td;return h(r,Ge(a,3))}function Yy(r,a,h,g){return r==null?[]:(it(a)||(a=a==null?[]:[a]),h=g?t:h,it(h)||(h=h==null?[]:[h]),sd(r,a,h))}var jy=Ka(function(r,a,h){r[h?0:1].push(a)},function(){return[[],[]]});function qy(r,a,h){var g=it(r)?Tl:Cf,M=arguments.length<3;return g(r,Ge(a,4),h,M,_r)}function Ky(r,a,h){var g=it(r)?a0:Cf,M=arguments.length<3;return g(r,Ge(a,4),h,M,qf)}function Zy(r,a){var h=it(r)?dr:Kf;return h(r,ac(Ge(a,3)))}function $y(r){var a=it(r)?Wf:Vv;return a(r)}function Jy(r,a,h){(h?Ln(r,a,h):a===t)?a=1:a=st(a);var g=it(r)?yv:Wv;return g(r,a)}function Qy(r){var a=it(r)?Sv:Yv;return a(r)}function eS(r){if(r==null)return 0;if(Bn(r))return lc(r)?xs(r):r.length;var a=En(r);return a==Et||a==le?r.size:Wl(r).length}function tS(r,a,h){var g=it(r)?Al:jv;return h&&Ln(r,a,h)&&(a=t),g(r,Ge(a,3))}var nS=ft(function(r,a){if(r==null)return[];var h=a.length;return h>1&&Ln(r,a[0],a[1])?a=[]:h>2&&Ln(a[0],a[1],a[2])&&(a=[a[0]]),sd(r,vn(a,1),[])}),sc=N0||function(){return _n.Date.now()};function iS(r,a){if(typeof a!="function")throw new ni(c);return r=st(r),function(){if(--r<1)return a.apply(this,arguments)}}function Qd(r,a,h){return a=h?t:a,a=r&&a==null?r.length:a,ji(r,D,t,t,t,t,a)}function ep(r,a){var h;if(typeof a!="function")throw new ni(c);return r=st(r),function(){return--r>0&&(h=a.apply(this,arguments)),r<=1&&(a=t),h}}var ph=ft(function(r,a,h){var g=x;if(h.length){var M=mr(h,ws(ph));g|=B}return ji(r,g,a,h,M)}),tp=ft(function(r,a,h){var g=x|_;if(h.length){var M=mr(h,ws(tp));g|=B}return ji(a,g,r,h,M)});function np(r,a,h){a=h?t:a;var g=ji(r,E,t,t,t,t,t,a);return g.placeholder=np.placeholder,g}function ip(r,a,h){a=h?t:a;var g=ji(r,L,t,t,t,t,t,a);return g.placeholder=ip.placeholder,g}function rp(r,a,h){var g,M,P,F,z,V,ae=0,ce=!1,ue=!1,Se=!0;if(typeof r!="function")throw new ni(c);a=ai(a)||0,Yt(h)&&(ce=!!h.leading,ue="maxWait"in h,P=ue?on(ai(h.maxWait)||0,a):P,Se="trailing"in h?!!h.trailing:Se);function Ue(en){var gi=g,Ji=M;return g=M=t,ae=en,F=r.apply(Ji,gi),F}function We(en){return ae=en,z=Go(gt,a),ce?Ue(en):F}function at(en){var gi=en-V,Ji=en-ae,Ep=a-gi;return ue?Mn(Ep,P-Ji):Ep}function Xe(en){var gi=en-V,Ji=en-ae;return V===t||gi>=a||gi<0||ue&&Ji>=P}function gt(){var en=sc();if(Xe(en))return Mt(en);z=Go(gt,at(en))}function Mt(en){return z=t,Se&&g?Ue(en):(g=M=t,F)}function qn(){z!==t&&pd(z),ae=0,g=V=M=z=t}function In(){return z===t?F:Mt(sc())}function Kn(){var en=sc(),gi=Xe(en);if(g=arguments,M=this,V=en,gi){if(z===t)return We(V);if(ue)return pd(z),z=Go(gt,a),Ue(V)}return z===t&&(z=Go(gt,a)),F}return Kn.cancel=qn,Kn.flush=In,Kn}var rS=ft(function(r,a){return jf(r,1,a)}),sS=ft(function(r,a,h){return jf(r,ai(a)||0,h)});function oS(r){return ji(r,C)}function oc(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new ni(c);var h=function(){var g=arguments,M=a?a.apply(this,g):g[0],P=h.cache;if(P.has(M))return P.get(M);var F=r.apply(this,g);return h.cache=P.set(M,F)||P,F};return h.cache=new(oc.Cache||Xi),h}oc.Cache=Xi;function ac(r){if(typeof r!="function")throw new ni(c);return function(){var a=arguments;switch(a.length){case 0:return!r.call(this);case 1:return!r.call(this,a[0]);case 2:return!r.call(this,a[0],a[1]);case 3:return!r.call(this,a[0],a[1],a[2])}return!r.apply(this,a)}}function aS(r){return ep(2,r)}var cS=qv(function(r,a){a=a.length==1&&it(a[0])?Vt(a[0],Xn(Ge())):Vt(vn(a,1),Xn(Ge()));var h=a.length;return ft(function(g){for(var M=-1,P=Mn(g.length,h);++M<P;)g[M]=a[M].call(this,g[M]);return Wn(r,this,g)})}),mh=ft(function(r,a){var h=mr(a,ws(mh));return ji(r,B,t,a,h)}),sp=ft(function(r,a){var h=mr(a,ws(sp));return ji(r,N,t,a,h)}),lS=qi(function(r,a){return ji(r,k,t,t,t,a)});function hS(r,a){if(typeof r!="function")throw new ni(c);return a=a===t?a:st(a),ft(r,a)}function uS(r,a){if(typeof r!="function")throw new ni(c);return a=a==null?0:on(st(a),0),ft(function(h){var g=h[a],M=yr(h,0,a);return g&&pr(M,g),Wn(r,this,M)})}function fS(r,a,h){var g=!0,M=!0;if(typeof r!="function")throw new ni(c);return Yt(h)&&(g="leading"in h?!!h.leading:g,M="trailing"in h?!!h.trailing:M),rp(r,a,{leading:g,maxWait:a,trailing:M})}function dS(r){return Qd(r,1)}function pS(r,a){return mh(Ql(a),r)}function mS(){if(!arguments.length)return[];var r=arguments[0];return it(r)?r:[r]}function gS(r){return ri(r,v)}function _S(r,a){return a=typeof a=="function"?a:t,ri(r,v,a)}function vS(r){return ri(r,p|v)}function xS(r,a){return a=typeof a=="function"?a:t,ri(r,p|v,a)}function yS(r,a){return a==null||Yf(r,a,fn(a))}function mi(r,a){return r===a||r!==r&&a!==a}var SS=Qa(Hl),MS=Qa(function(r,a){return r>=a}),qr=Jf(function(){return arguments}())?Jf:function(r){return Zt(r)&&Pt.call(r,"callee")&&!Bf.call(r,"callee")},it=J.isArray,ES=xf?Xn(xf):Lv;function Bn(r){return r!=null&&cc(r.length)&&!Zi(r)}function Qt(r){return Zt(r)&&Bn(r)}function bS(r){return r===!0||r===!1||Zt(r)&&Pn(r)==je}var Sr=B0||Ah,TS=yf?Xn(yf):Iv;function AS(r){return Zt(r)&&r.nodeType===1&&!Vo(r)}function wS(r){if(r==null)return!0;if(Bn(r)&&(it(r)||typeof r=="string"||typeof r.splice=="function"||Sr(r)||Rs(r)||qr(r)))return!r.length;var a=En(r);if(a==Et||a==le)return!r.size;if(Ho(r))return!Wl(r).length;for(var h in r)if(Pt.call(r,h))return!1;return!0}function RS(r,a){return Bo(r,a)}function CS(r,a,h){h=typeof h=="function"?h:t;var g=h?h(r,a):t;return g===t?Bo(r,a,t,h):!!g}function gh(r){if(!Zt(r))return!1;var a=Pn(r);return a==Y||a==dt||typeof r.message=="string"&&typeof r.name=="string"&&!Vo(r)}function PS(r){return typeof r=="number"&&kf(r)}function Zi(r){if(!Yt(r))return!1;var a=Pn(r);return a==tt||a==Ve||a==Ae||a==te}function op(r){return typeof r=="number"&&r==st(r)}function cc(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=$}function Yt(r){var a=typeof r;return r!=null&&(a=="object"||a=="function")}function Zt(r){return r!=null&&typeof r=="object"}var ap=Sf?Xn(Sf):Uv;function LS(r,a){return r===a||Vl(r,a,oh(a))}function IS(r,a,h){return h=typeof h=="function"?h:t,Vl(r,a,oh(a),h)}function DS(r){return cp(r)&&r!=+r}function US(r){if(_x(r))throw new et(o);return Qf(r)}function OS(r){return r===null}function NS(r){return r==null}function cp(r){return typeof r=="number"||Zt(r)&&Pn(r)==ke}function Vo(r){if(!Zt(r)||Pn(r)!=O)return!1;var a=Oa(r);if(a===null)return!0;var h=Pt.call(a,"constructor")&&a.constructor;return typeof h=="function"&&h instanceof h&&La.call(h)==I0}var _h=Mf?Xn(Mf):Ov;function FS(r){return op(r)&&r>=-9007199254740991&&r<=$}var lp=Ef?Xn(Ef):Nv;function lc(r){return typeof r=="string"||!it(r)&&Zt(r)&&Pn(r)==de}function jn(r){return typeof r=="symbol"||Zt(r)&&Pn(r)==Be}var Rs=bf?Xn(bf):Fv;function BS(r){return r===t}function zS(r){return Zt(r)&&En(r)==De}function kS(r){return Zt(r)&&Pn(r)==He}var HS=Qa(Xl),GS=Qa(function(r,a){return r<=a});function hp(r){if(!r)return[];if(Bn(r))return lc(r)?di(r):Fn(r);if(Po&&r[Po])return y0(r[Po]());var a=En(r),h=a==Et?Il:a==le?Ra:Cs;return h(r)}function $i(r){if(!r)return r===0?r:0;if(r=ai(r),r===me||r===-1/0){var a=r<0?-1:1;return a*fe}return r===r?r:0}function st(r){var a=$i(r),h=a%1;return a===a?h?a-h:a:0}function up(r){return r?Wr(st(r),0,Ee):0}function ai(r){if(typeof r=="number")return r;if(jn(r))return pe;if(Yt(r)){var a=typeof r.valueOf=="function"?r.valueOf():r;r=Yt(a)?a+"":a}if(typeof r!="string")return r===0?r:+r;r=Pf(r);var h=Q.test(r);return h||Z.test(r)?i0(r.slice(2),h?2:8):X.test(r)?pe:+r}function fp(r){return Li(r,zn(r))}function VS(r){return r?Wr(st(r),-9007199254740991,$):r===0?r:0}function Rt(r){return r==null?"":Yn(r)}var WS=Ts(function(r,a){if(Ho(a)||Bn(a)){Li(a,fn(a),r);return}for(var h in a)Pt.call(a,h)&&Oo(r,h,a[h])}),dp=Ts(function(r,a){Li(a,zn(a),r)}),hc=Ts(function(r,a,h,g){Li(a,zn(a),r,g)}),XS=Ts(function(r,a,h,g){Li(a,fn(a),r,g)}),YS=qi(Bl);function jS(r,a){var h=bs(r);return a==null?h:Xf(h,a)}var qS=ft(function(r,a){r=Ut(r);var h=-1,g=a.length,M=g>2?a[2]:t;for(M&&Ln(a[0],a[1],M)&&(g=1);++h<g;)for(var P=a[h],F=zn(P),z=-1,V=F.length;++z<V;){var ae=F[z],ce=r[ae];(ce===t||mi(ce,Ss[ae])&&!Pt.call(r,ae))&&(r[ae]=P[ae])}return r}),KS=ft(function(r){return r.push(t,Pd),Wn(pp,t,r)});function ZS(r,a){return Af(r,Ge(a,3),Pi)}function $S(r,a){return Af(r,Ge(a,3),kl)}function JS(r,a){return r==null?r:zl(r,Ge(a,3),zn)}function QS(r,a){return r==null?r:Zf(r,Ge(a,3),zn)}function eM(r,a){return r&&Pi(r,Ge(a,3))}function tM(r,a){return r&&kl(r,Ge(a,3))}function nM(r){return r==null?[]:Xa(r,fn(r))}function iM(r){return r==null?[]:Xa(r,zn(r))}function vh(r,a,h){var g=r==null?t:Xr(r,a);return g===t?h:g}function rM(r,a){return r!=null&&Dd(r,a,wv)}function xh(r,a){return r!=null&&Dd(r,a,Rv)}var sM=Td(function(r,a,h){a!=null&&typeof a.toString!="function"&&(a=Ia.call(a)),r[a]=h},Sh(kn)),oM=Td(function(r,a,h){a!=null&&typeof a.toString!="function"&&(a=Ia.call(a)),Pt.call(r,a)?r[a].push(h):r[a]=[h]},Ge),aM=ft(Fo);function fn(r){return Bn(r)?Vf(r):Wl(r)}function zn(r){return Bn(r)?Vf(r,!0):Bv(r)}function cM(r,a){var h={};return a=Ge(a,3),Pi(r,function(g,M,P){Yi(h,a(g,M,P),g)}),h}function lM(r,a){var h={};return a=Ge(a,3),Pi(r,function(g,M,P){Yi(h,M,a(g,M,P))}),h}var hM=Ts(function(r,a,h){Ya(r,a,h)}),pp=Ts(function(r,a,h,g){Ya(r,a,h,g)}),uM=qi(function(r,a){var h={};if(r==null)return h;var g=!1;a=Vt(a,function(P){return P=xr(P,r),g||(g=P.length>1),P}),Li(r,rh(r),h),g&&(h=ri(h,p|m|v,sx));for(var M=a.length;M--;)Zl(h,a[M]);return h});function fM(r,a){return mp(r,ac(Ge(a)))}var dM=qi(function(r,a){return r==null?{}:kv(r,a)});function mp(r,a){if(r==null)return{};var h=Vt(rh(r),function(g){return[g]});return a=Ge(a),od(r,h,function(g,M){return a(g,M[0])})}function pM(r,a,h){a=xr(a,r);var g=-1,M=a.length;for(M||(M=1,r=t);++g<M;){var P=r==null?t:r[Ii(a[g])];P===t&&(g=M,P=h),r=Zi(P)?P.call(r):P}return r}function mM(r,a,h){return r==null?r:zo(r,a,h)}function gM(r,a,h,g){return g=typeof g=="function"?g:t,r==null?r:zo(r,a,h,g)}var gp=Rd(fn),_p=Rd(zn);function _M(r,a,h){var g=it(r),M=g||Sr(r)||Rs(r);if(a=Ge(a,4),h==null){var P=r&&r.constructor;M?h=g?new P:[]:Yt(r)?h=Zi(P)?bs(Oa(r)):{}:h={}}return(M?ti:Pi)(r,function(F,z,V){return a(h,F,z,V)}),h}function vM(r,a){return r==null?!0:Zl(r,a)}function xM(r,a,h){return r==null?r:ud(r,a,Ql(h))}function yM(r,a,h,g){return g=typeof g=="function"?g:t,r==null?r:ud(r,a,Ql(h),g)}function Cs(r){return r==null?[]:Ll(r,fn(r))}function SM(r){return r==null?[]:Ll(r,zn(r))}function MM(r,a,h){return h===t&&(h=a,a=t),h!==t&&(h=ai(h),h=h===h?h:0),a!==t&&(a=ai(a),a=a===a?a:0),Wr(ai(r),a,h)}function EM(r,a,h){return a=$i(a),h===t?(h=a,a=0):h=$i(h),r=ai(r),Cv(r,a,h)}function bM(r,a,h){if(h&&typeof h!="boolean"&&Ln(r,a,h)&&(a=h=t),h===t&&(typeof a=="boolean"?(h=a,a=t):typeof r=="boolean"&&(h=r,r=t)),r===t&&a===t?(r=0,a=1):(r=$i(r),a===t?(a=r,r=0):a=$i(a)),r>a){var g=r;r=a,a=g}if(h||r%1||a%1){var M=Hf();return Mn(r+M*(a-r+n0("1e-"+((M+"").length-1))),a)}return jl(r,a)}var TM=As(function(r,a,h){return a=a.toLowerCase(),r+(h?vp(a):a)});function vp(r){return yh(Rt(r).toLowerCase())}function xp(r){return r=Rt(r),r&&r.replace(Fe,m0).replace(Y_,"")}function AM(r,a,h){r=Rt(r),a=Yn(a);var g=r.length;h=h===t?g:Wr(st(h),0,g);var M=h;return h-=a.length,h>=0&&r.slice(h,M)==a}function wM(r){return r=Rt(r),r&&ut.test(r)?r.replace(we,g0):r}function RM(r){return r=Rt(r),r&&wi.test(r)?r.replace(yn,"\\$&"):r}var CM=As(function(r,a,h){return r+(h?"-":"")+a.toLowerCase()}),PM=As(function(r,a,h){return r+(h?" ":"")+a.toLowerCase()}),LM=Md("toLowerCase");function IM(r,a,h){r=Rt(r),a=st(a);var g=a?xs(r):0;if(!a||g>=a)return r;var M=(a-g)/2;return Ja(za(M),h)+r+Ja(Ba(M),h)}function DM(r,a,h){r=Rt(r),a=st(a);var g=a?xs(r):0;return a&&g<a?r+Ja(a-g,h):r}function UM(r,a,h){r=Rt(r),a=st(a);var g=a?xs(r):0;return a&&g<a?Ja(a-g,h)+r:r}function OM(r,a,h){return h||a==null?a=0:a&&(a=+a),G0(Rt(r).replace(Ri,""),a||0)}function NM(r,a,h){return(h?Ln(r,a,h):a===t)?a=1:a=st(a),ql(Rt(r),a)}function FM(){var r=arguments,a=Rt(r[0]);return r.length<3?a:a.replace(r[1],r[2])}var BM=As(function(r,a,h){return r+(h?"_":"")+a.toLowerCase()});function zM(r,a,h){return h&&typeof h!="number"&&Ln(r,a,h)&&(a=h=t),h=h===t?Ee:h>>>0,h?(r=Rt(r),r&&(typeof a=="string"||a!=null&&!_h(a))&&(a=Yn(a),!a&&vs(r))?yr(di(r),0,h):r.split(a,h)):[]}var kM=As(function(r,a,h){return r+(h?" ":"")+yh(a)});function HM(r,a,h){return r=Rt(r),h=h==null?0:Wr(st(h),0,r.length),a=Yn(a),r.slice(h,h+a.length)==a}function GM(r,a,h){var g=w.templateSettings;h&&Ln(r,a,h)&&(a=t),r=Rt(r),a=hc({},a,g,Cd);var M=hc({},a.imports,g.imports,Cd),P=fn(M),F=Ll(M,P),z,V,ae=0,ce=a.interpolate||ze,ue="__p += '",Se=Dl((a.escape||ze).source+"|"+ce.source+"|"+(ce===At?_l:ze).source+"|"+(a.evaluate||ze).source+"|$","g"),Ue="//# sourceURL="+(Pt.call(a,"sourceURL")?(a.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++$_+"]")+`
|
|
3807
|
-
`;
|
|
3808
|
-
__e(`+
|
|
3809
|
-
'`),
|
|
3810
|
-
`+
|
|
3811
|
-
__p += '`),
|
|
3812
|
-
((__t = (`+
|
|
3813
|
-
'`),
|
|
3814
|
-
`;var
|
|
3815
|
-
`+
|
|
3816
|
-
}
|
|
3817
|
-
`;else if(
|
|
3818
|
-
`+(
|
|
3819
|
-
`)+"var __t, __p = ''"+(
|
|
3806
|
+
`)}function Ix(s){return it(s)||ns(s)||!!(Zf&&s&&s[Zf])}function sr(s,a){var u=typeof s;return a=a??K,!!a&&(u=="number"||u!="symbol"&&Ae.test(s))&&s>-1&&s%1==0&&s<a}function Dn(s,a,u){if(!jt(u))return!1;var g=typeof a;return(g=="number"?Hn(u)&&sr(a,u.length):g=="string"&&a in u)?xi(u[a],s):!1}function vu(s,a){if(it(s))return!1;var u=typeof s;return u=="number"||u=="symbol"||u=="boolean"||s==null||Kn(s)?!0:Zt.test(s)||!Kt.test(s)||a!=null&&s in Ot(a)}function Dx(s){var a=typeof s;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?s!=="__proto__":s===null}function xu(s){var a=hc(s),u=R[a];if(typeof u!="function"||!(a in xt.prototype))return!1;if(s===u)return!0;var g=mu(u);return!!g&&s===g[0]}function Ox(s){return!!Yf&&Yf in s}var Ux=Ha?or:Nu;function qo(s){var a=s&&s.constructor,u=typeof a=="function"&&a.prototype||Cs;return s===u}function Yd(s){return s===s&&!jt(s)}function jd(s,a){return function(u){return u==null?!1:u[s]===a&&(a!==t||s in Ot(u))}}function Nx(s){var a=_c(s,function(g){return u.size===f&&u.clear(),g}),u=a.cache;return a}function Fx(s,a){var u=s[1],g=a[1],T=u|g,P=T<(v|_|O),z=g==O&&u==b||g==O&&u==I&&s[7].length<=a[8]||g==(O|I)&&a[7].length<=a[8]&&u==b;if(!(P||z))return s;g&v&&(s[2]=a[2],T|=u&v?0:C);var H=a[3];if(H){var X=s[3];s[3]=X?Cd(X,H,a[4]):H,s[4]=X?Tr(s[3],d):a[4]}return H=a[5],H&&(X=s[5],s[5]=X?Pd(X,H,a[6]):H,s[6]=X?Tr(s[5],d):a[6]),H=a[7],H&&(s[7]=H),g&O&&(s[8]=s[8]==null?a[8]:En(s[8],a[8])),s[9]==null&&(s[9]=a[9]),s[0]=a[0],s[1]=T,s}function Bx(s){var a=[];if(s!=null)for(var u in Ot(s))a.push(u);return a}function zx(s){return Va.call(s)}function qd(s,a,u){return a=cn(a===t?s.length-1:a,0),function(){for(var g=arguments,T=-1,P=cn(g.length-a,0),z=J(P);++T<P;)z[T]=g[a+T];T=-1;for(var H=J(a+1);++T<a;)H[T]=g[T];return H[a]=u(z),Yn(s,this,H)}}function Kd(s,a){return a.length<2?s:Qr(s,ci(a,0,-1))}function kx(s,a){for(var u=s.length,g=En(a.length,u),T=kn(s);g--;){var P=a[g];s[g]=sr(P,u)?T[P]:t}return s}function yu(s,a){if(!(a==="constructor"&&typeof s[a]=="function")&&a!="__proto__")return s[a]}var Zd=Jd(xd),Ko=tv||function(s,a){return _n.setTimeout(s,a)},Su=Jd(lx);function $d(s,a,u){var g=a+"";return Su(s,Lx(g,Hx(Rx(g),u)))}function Jd(s){var a=0,u=0;return function(){var g=sv(),T=G-(g-u);if(u=g,T>0){if(++a>=V)return arguments[0]}else a=0;return s.apply(t,arguments)}}function dc(s,a){var u=-1,g=s.length,T=g-1;for(a=a===t?g:a;++u<a;){var P=iu(u,T),z=s[P];s[P]=s[u],s[u]=z}return s.length=a,s}var Qd=Nx(function(s){var a=[];return s.charCodeAt(0)===46&&a.push(""),s.replace(Pn,function(u,g,T,P){a.push(T?P.replace(Al,"$1"):g||u)}),a});function Bi(s){if(typeof s=="string"||Kn(s))return s;var a=s+"";return a=="0"&&1/s==-1/0?"-0":a}function ts(s){if(s!=null){try{return Ga.call(s)}catch{}try{return s+""}catch{}}return""}function Hx(s,a){return ri(ie,function(u){var g="_."+u[0];a&u[1]&&!Fa(s,g)&&s.push(g)}),s.sort()}function ep(s){if(s instanceof xt)return s.clone();var a=new oi(s.__wrapped__,s.__chain__);return a.__actions__=kn(s.__actions__),a.__index__=s.__index__,a.__values__=s.__values__,a}function Gx(s,a,u){(u?Dn(s,a,u):a===t)?a=1:a=cn(st(a),0);var g=s==null?0:s.length;if(!g||a<1)return[];for(var T=0,P=0,z=J(Ka(g/a));T<g;)z[P++]=ci(s,T,T+=a);return z}function Vx(s){for(var a=-1,u=s==null?0:s.length,g=0,T=[];++a<u;){var P=s[a];P&&(T[g++]=P)}return T}function Wx(){var s=arguments.length;if(!s)return[];for(var a=J(s-1),u=arguments[0],g=s;g--;)a[g-1]=arguments[g];return br(it(u)?kn(u):[u],vn(a,1))}var Xx=pt(function(s,a){return en(s)?Vo(s,vn(a,1,en,!0)):[]}),Yx=pt(function(s,a){var u=li(a);return en(u)&&(u=t),en(s)?Vo(s,vn(a,1,en,!0),We(u,2)):[]}),jx=pt(function(s,a){var u=li(a);return en(u)&&(u=t),en(s)?Vo(s,vn(a,1,en,!0),t,u):[]});function qx(s,a,u){var g=s==null?0:s.length;return g?(a=u||a===t?1:st(a),ci(s,a<0?0:a,g)):[]}function Kx(s,a,u){var g=s==null?0:s.length;return g?(a=u||a===t?1:st(a),a=g-a,ci(s,0,a<0?0:a)):[]}function Zx(s,a){return s&&s.length?sc(s,We(a,3),!0,!0):[]}function $x(s,a){return s&&s.length?sc(s,We(a,3),!0):[]}function Jx(s,a,u,g){var T=s==null?0:s.length;return T?(u&&typeof u!="number"&&Dn(s,a,u)&&(u=0,g=T),Wv(s,a,u,g)):[]}function tp(s,a,u){var g=s==null?0:s.length;if(!g)return-1;var T=u==null?0:st(u);return T<0&&(T=cn(g+T,0)),Ba(s,We(a,3),T)}function np(s,a,u){var g=s==null?0:s.length;if(!g)return-1;var T=g-1;return u!==t&&(T=st(u),T=u<0?cn(g+T,0):En(T,g-1)),Ba(s,We(a,3),T,!0)}function ip(s){var a=s==null?0:s.length;return a?vn(s,1):[]}function Qx(s){var a=s==null?0:s.length;return a?vn(s,pe):[]}function ey(s,a){var u=s==null?0:s.length;return u?(a=a===t?1:st(a),vn(s,a)):[]}function ty(s){for(var a=-1,u=s==null?0:s.length,g={};++a<u;){var T=s[a];g[T[0]]=T[1]}return g}function rp(s){return s&&s.length?s[0]:t}function ny(s,a,u){var g=s==null?0:s.length;if(!g)return-1;var T=u==null?0:st(u);return T<0&&(T=cn(g+T,0)),Ts(s,a,T)}function iy(s){var a=s==null?0:s.length;return a?ci(s,0,-1):[]}var ry=pt(function(s){var a=Wt(s,cu);return a.length&&a[0]===s[0]?Jl(a):[]}),sy=pt(function(s){var a=li(s),u=Wt(s,cu);return a===li(u)?a=t:u.pop(),u.length&&u[0]===s[0]?Jl(u,We(a,2)):[]}),oy=pt(function(s){var a=li(s),u=Wt(s,cu);return a=typeof a=="function"?a:t,a&&u.pop(),u.length&&u[0]===s[0]?Jl(u,t,a):[]});function ay(s,a){return s==null?"":iv.call(s,a)}function li(s){var a=s==null?0:s.length;return a?s[a-1]:t}function cy(s,a,u){var g=s==null?0:s.length;if(!g)return-1;var T=g;return u!==t&&(T=st(u),T=T<0?cn(g+T,0):En(T,g-1)),a===a?H0(s,a,T):Ba(s,Bf,T,!0)}function ly(s,a){return s&&s.length?md(s,st(a)):t}var uy=pt(sp);function sp(s,a){return s&&s.length&&a&&a.length?nu(s,a):s}function hy(s,a,u){return s&&s.length&&a&&a.length?nu(s,a,We(u,2)):s}function fy(s,a,u){return s&&s.length&&a&&a.length?nu(s,a,t,u):s}var dy=rr(function(s,a){var u=s==null?0:s.length,g=ql(s,a);return vd(s,Wt(a,function(T){return sr(T,u)?+T:T}).sort(Rd)),g});function py(s,a){var u=[];if(!(s&&s.length))return u;var g=-1,T=[],P=s.length;for(a=We(a,3);++g<P;){var z=s[g];a(z,g,s)&&(u.push(z),T.push(g))}return vd(s,T),u}function Mu(s){return s==null?s:av.call(s)}function my(s,a,u){var g=s==null?0:s.length;return g?(u&&typeof u!="number"&&Dn(s,a,u)?(a=0,u=g):(a=a==null?0:st(a),u=u===t?g:st(u)),ci(s,a,u)):[]}function gy(s,a){return rc(s,a)}function _y(s,a,u){return su(s,a,We(u,2))}function vy(s,a){var u=s==null?0:s.length;if(u){var g=rc(s,a);if(g<u&&xi(s[g],a))return g}return-1}function xy(s,a){return rc(s,a,!0)}function yy(s,a,u){return su(s,a,We(u,2),!0)}function Sy(s,a){var u=s==null?0:s.length;if(u){var g=rc(s,a,!0)-1;if(xi(s[g],a))return g}return-1}function My(s){return s&&s.length?yd(s):[]}function Ey(s,a){return s&&s.length?yd(s,We(a,2)):[]}function by(s){var a=s==null?0:s.length;return a?ci(s,1,a):[]}function Ty(s,a,u){return s&&s.length?(a=u||a===t?1:st(a),ci(s,0,a<0?0:a)):[]}function Ay(s,a,u){var g=s==null?0:s.length;return g?(a=u||a===t?1:st(a),a=g-a,ci(s,a<0?0:a,g)):[]}function wy(s,a){return s&&s.length?sc(s,We(a,3),!1,!0):[]}function Ry(s,a){return s&&s.length?sc(s,We(a,3)):[]}var Cy=pt(function(s){return Rr(vn(s,1,en,!0))}),Py=pt(function(s){var a=li(s);return en(a)&&(a=t),Rr(vn(s,1,en,!0),We(a,2))}),Ly=pt(function(s){var a=li(s);return a=typeof a=="function"?a:t,Rr(vn(s,1,en,!0),t,a)});function Iy(s){return s&&s.length?Rr(s):[]}function Dy(s,a){return s&&s.length?Rr(s,We(a,2)):[]}function Oy(s,a){return a=typeof a=="function"?a:t,s&&s.length?Rr(s,t,a):[]}function Eu(s){if(!(s&&s.length))return[];var a=0;return s=Er(s,function(u){if(en(u))return a=cn(u.length,a),!0}),kl(a,function(u){return Wt(s,Fl(u))})}function op(s,a){if(!(s&&s.length))return[];var u=Eu(s);return a==null?u:Wt(u,function(g){return Yn(a,t,g)})}var Uy=pt(function(s,a){return en(s)?Vo(s,a):[]}),Ny=pt(function(s){return au(Er(s,en))}),Fy=pt(function(s){var a=li(s);return en(a)&&(a=t),au(Er(s,en),We(a,2))}),By=pt(function(s){var a=li(s);return a=typeof a=="function"?a:t,au(Er(s,en),t,a)}),zy=pt(Eu);function ky(s,a){return bd(s||[],a||[],Go)}function Hy(s,a){return bd(s||[],a||[],Yo)}var Gy=pt(function(s){var a=s.length,u=a>1?s[a-1]:t;return u=typeof u=="function"?(s.pop(),u):t,op(s,u)});function ap(s){var a=R(s);return a.__chain__=!0,a}function Vy(s,a){return a(s),s}function pc(s,a){return a(s)}var Wy=rr(function(s){var a=s.length,u=a?s[0]:0,g=this.__wrapped__,T=function(P){return ql(P,s)};return a>1||this.__actions__.length||!(g instanceof xt)||!sr(u)?this.thru(T):(g=g.slice(u,+u+(a?1:0)),g.__actions__.push({func:pc,args:[T],thisArg:t}),new oi(g,this.__chain__).thru(function(P){return a&&!P.length&&P.push(t),P}))});function Xy(){return ap(this)}function Yy(){return new oi(this.value(),this.__chain__)}function jy(){this.__values__===t&&(this.__values__=Sp(this.value()));var s=this.__index__>=this.__values__.length,a=s?t:this.__values__[this.__index__++];return{done:s,value:a}}function qy(){return this}function Ky(s){for(var a,u=this;u instanceof Qa;){var g=ep(u);g.__index__=0,g.__values__=t,a?T.__wrapped__=g:a=g;var T=g;u=u.__wrapped__}return T.__wrapped__=s,a}function Zy(){var s=this.__wrapped__;if(s instanceof xt){var a=s;return this.__actions__.length&&(a=new xt(this)),a=a.reverse(),a.__actions__.push({func:pc,args:[Mu],thisArg:t}),new oi(a,this.__chain__)}return this.thru(Mu)}function $y(){return Ed(this.__wrapped__,this.__actions__)}var Jy=oc(function(s,a,u){Pt.call(s,u)?++s[u]:nr(s,u,1)});function Qy(s,a,u){var g=it(s)?Nf:Vv;return u&&Dn(s,a,u)&&(a=t),g(s,We(a,3))}function eS(s,a){var u=it(s)?Er:od;return u(s,We(a,3))}var tS=Od(tp),nS=Od(np);function iS(s,a){return vn(mc(s,a),1)}function rS(s,a){return vn(mc(s,a),pe)}function sS(s,a,u){return u=u===t?1:st(u),vn(mc(s,a),u)}function cp(s,a){var u=it(s)?ri:wr;return u(s,We(a,3))}function lp(s,a){var u=it(s)?b0:sd;return u(s,We(a,3))}var oS=oc(function(s,a,u){Pt.call(s,u)?s[u].push(a):nr(s,u,[a])});function aS(s,a,u,g){s=Hn(s)?s:Fs(s),u=u&&!g?st(u):0;var T=s.length;return u<0&&(u=cn(T+u,0)),yc(s)?u<=T&&s.indexOf(a,u)>-1:!!T&&Ts(s,a,u)>-1}var cS=pt(function(s,a,u){var g=-1,T=typeof a=="function",P=Hn(s)?J(s.length):[];return wr(s,function(z){P[++g]=T?Yn(a,z,u):Wo(z,a,u)}),P}),lS=oc(function(s,a,u){nr(s,u,a)});function mc(s,a){var u=it(s)?Wt:fd;return u(s,We(a,3))}function uS(s,a,u,g){return s==null?[]:(it(a)||(a=a==null?[]:[a]),u=g?t:u,it(u)||(u=u==null?[]:[u]),gd(s,a,u))}var hS=oc(function(s,a,u){s[u?0:1].push(a)},function(){return[[],[]]});function fS(s,a,u){var g=it(s)?Ul:kf,T=arguments.length<3;return g(s,We(a,4),u,T,wr)}function dS(s,a,u){var g=it(s)?T0:kf,T=arguments.length<3;return g(s,We(a,4),u,T,sd)}function pS(s,a){var u=it(s)?Er:od;return u(s,vc(We(a,3)))}function mS(s){var a=it(s)?td:ax;return a(s)}function gS(s,a,u){(u?Dn(s,a,u):a===t)?a=1:a=st(a);var g=it(s)?Bv:cx;return g(s,a)}function _S(s){var a=it(s)?zv:ux;return a(s)}function vS(s){if(s==null)return 0;if(Hn(s))return yc(s)?ws(s):s.length;var a=bn(s);return a==bt||a==ue?s.size:eu(s).length}function xS(s,a,u){var g=it(s)?Nl:hx;return u&&Dn(s,a,u)&&(a=t),g(s,We(a,3))}var yS=pt(function(s,a){if(s==null)return[];var u=a.length;return u>1&&Dn(s,a[0],a[1])?a=[]:u>2&&Dn(a[0],a[1],a[2])&&(a=[a[0]]),gd(s,vn(a,1),[])}),gc=ev||function(){return _n.Date.now()};function SS(s,a){if(typeof a!="function")throw new si(c);return s=st(s),function(){if(--s<1)return a.apply(this,arguments)}}function up(s,a,u){return a=u?t:a,a=s&&a==null?s.length:a,ir(s,O,t,t,t,t,a)}function hp(s,a){var u;if(typeof a!="function")throw new si(c);return s=st(s),function(){return--s>0&&(u=a.apply(this,arguments)),s<=1&&(a=t),u}}var bu=pt(function(s,a,u){var g=v;if(u.length){var T=Tr(u,Us(bu));g|=k}return ir(s,g,a,u,T)}),fp=pt(function(s,a,u){var g=v|_;if(u.length){var T=Tr(u,Us(fp));g|=k}return ir(a,g,s,u,T)});function dp(s,a,u){a=u?t:a;var g=ir(s,b,t,t,t,t,t,a);return g.placeholder=dp.placeholder,g}function pp(s,a,u){a=u?t:a;var g=ir(s,L,t,t,t,t,t,a);return g.placeholder=pp.placeholder,g}function mp(s,a,u){var g,T,P,z,H,X,ce=0,le=!1,fe=!1,Ee=!0;if(typeof s!="function")throw new si(c);a=ui(a)||0,jt(u)&&(le=!!u.leading,fe="maxWait"in u,P=fe?cn(ui(u.maxWait)||0,a):P,Ee="trailing"in u?!!u.trailing:Ee);function Oe(tn){var yi=g,cr=T;return g=T=t,ce=tn,z=s.apply(cr,yi),z}function Ye(tn){return ce=tn,H=Ko(vt,a),le?Oe(tn):z}function lt(tn){var yi=tn-X,cr=tn-ce,Op=a-yi;return fe?En(Op,P-cr):Op}function je(tn){var yi=tn-X,cr=tn-ce;return X===t||yi>=a||yi<0||fe&&cr>=P}function vt(){var tn=gc();if(je(tn))return Et(tn);H=Ko(vt,lt(tn))}function Et(tn){return H=t,Ee&&g?Oe(tn):(g=T=t,z)}function Zn(){H!==t&&Td(H),ce=0,g=X=T=H=t}function On(){return H===t?z:Et(gc())}function $n(){var tn=gc(),yi=je(tn);if(g=arguments,T=this,X=tn,yi){if(H===t)return Ye(X);if(fe)return Td(H),H=Ko(vt,a),Oe(X)}return H===t&&(H=Ko(vt,a)),z}return $n.cancel=Zn,$n.flush=On,$n}var MS=pt(function(s,a){return rd(s,1,a)}),ES=pt(function(s,a,u){return rd(s,ui(a)||0,u)});function bS(s){return ir(s,E)}function _c(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new si(c);var u=function(){var g=arguments,T=a?a.apply(this,g):g[0],P=u.cache;if(P.has(T))return P.get(T);var z=s.apply(this,g);return u.cache=P.set(T,z)||P,z};return u.cache=new(_c.Cache||tr),u}_c.Cache=tr;function vc(s){if(typeof s!="function")throw new si(c);return function(){var a=arguments;switch(a.length){case 0:return!s.call(this);case 1:return!s.call(this,a[0]);case 2:return!s.call(this,a[0],a[1]);case 3:return!s.call(this,a[0],a[1],a[2])}return!s.apply(this,a)}}function TS(s){return hp(2,s)}var AS=fx(function(s,a){a=a.length==1&&it(a[0])?Wt(a[0],jn(We())):Wt(vn(a,1),jn(We()));var u=a.length;return pt(function(g){for(var T=-1,P=En(g.length,u);++T<P;)g[T]=a[T].call(this,g[T]);return Yn(s,this,g)})}),Tu=pt(function(s,a){var u=Tr(a,Us(Tu));return ir(s,k,t,a,u)}),gp=pt(function(s,a){var u=Tr(a,Us(gp));return ir(s,U,t,a,u)}),wS=rr(function(s,a){return ir(s,I,t,t,t,a)});function RS(s,a){if(typeof s!="function")throw new si(c);return a=a===t?a:st(a),pt(s,a)}function CS(s,a){if(typeof s!="function")throw new si(c);return a=a==null?0:cn(st(a),0),pt(function(u){var g=u[a],T=Pr(u,0,a);return g&&br(T,g),Yn(s,this,T)})}function PS(s,a,u){var g=!0,T=!0;if(typeof s!="function")throw new si(c);return jt(u)&&(g="leading"in u?!!u.leading:g,T="trailing"in u?!!u.trailing:T),mp(s,a,{leading:g,maxWait:a,trailing:T})}function LS(s){return up(s,1)}function IS(s,a){return Tu(lu(a),s)}function DS(){if(!arguments.length)return[];var s=arguments[0];return it(s)?s:[s]}function OS(s){return ai(s,x)}function US(s,a){return a=typeof a=="function"?a:t,ai(s,x,a)}function NS(s){return ai(s,p|x)}function FS(s,a){return a=typeof a=="function"?a:t,ai(s,p|x,a)}function BS(s,a){return a==null||id(s,a,pn(a))}function xi(s,a){return s===a||s!==s&&a!==a}var zS=uc($l),kS=uc(function(s,a){return s>=a}),ns=ld(function(){return arguments}())?ld:function(s){return $t(s)&&Pt.call(s,"callee")&&!Kf.call(s,"callee")},it=J.isArray,HS=Pf?jn(Pf):Kv;function Hn(s){return s!=null&&xc(s.length)&&!or(s)}function en(s){return $t(s)&&Hn(s)}function GS(s){return s===!0||s===!1||$t(s)&&In(s)==Ge}var Lr=nv||Nu,VS=Lf?jn(Lf):Zv;function WS(s){return $t(s)&&s.nodeType===1&&!Zo(s)}function XS(s){if(s==null)return!0;if(Hn(s)&&(it(s)||typeof s=="string"||typeof s.splice=="function"||Lr(s)||Ns(s)||ns(s)))return!s.length;var a=bn(s);if(a==bt||a==ue)return!s.size;if(qo(s))return!eu(s).length;for(var u in s)if(Pt.call(s,u))return!1;return!0}function YS(s,a){return Xo(s,a)}function jS(s,a,u){u=typeof u=="function"?u:t;var g=u?u(s,a):t;return g===t?Xo(s,a,t,u):!!g}function Au(s){if(!$t(s))return!1;var a=In(s);return a==j||a==at||typeof s.message=="string"&&typeof s.name=="string"&&!Zo(s)}function qS(s){return typeof s=="number"&&$f(s)}function or(s){if(!jt(s))return!1;var a=In(s);return a==$e||a==ze||a==Se||a==te}function _p(s){return typeof s=="number"&&s==st(s)}function xc(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=K}function jt(s){var a=typeof s;return s!=null&&(a=="object"||a=="function")}function $t(s){return s!=null&&typeof s=="object"}var vp=If?jn(If):Jv;function KS(s,a){return s===a||Ql(s,a,gu(a))}function ZS(s,a,u){return u=typeof u=="function"?u:t,Ql(s,a,gu(a),u)}function $S(s){return xp(s)&&s!=+s}function JS(s){if(Ux(s))throw new tt(o);return ud(s)}function QS(s){return s===null}function eM(s){return s==null}function xp(s){return typeof s=="number"||$t(s)&&In(s)==He}function Zo(s){if(!$t(s)||In(s)!=B)return!1;var a=Ya(s);if(a===null)return!0;var u=Pt.call(a,"constructor")&&a.constructor;return typeof u=="function"&&u instanceof u&&Ga.call(u)==Z0}var wu=Df?jn(Df):Qv;function tM(s){return _p(s)&&s>=-9007199254740991&&s<=K}var yp=Of?jn(Of):ex;function yc(s){return typeof s=="string"||!it(s)&&$t(s)&&In(s)==de}function Kn(s){return typeof s=="symbol"||$t(s)&&In(s)==Be}var Ns=Uf?jn(Uf):tx;function nM(s){return s===t}function iM(s){return $t(s)&&bn(s)==De}function rM(s){return $t(s)&&In(s)==Ve}var sM=uc(tu),oM=uc(function(s,a){return s<=a});function Sp(s){if(!s)return[];if(Hn(s))return yc(s)?_i(s):kn(s);if(Fo&&s[Fo])return B0(s[Fo]());var a=bn(s),u=a==bt?Gl:a==ue?za:Fs;return u(s)}function ar(s){if(!s)return s===0?s:0;if(s=ui(s),s===pe||s===-1/0){var a=s<0?-1:1;return a*he}return s===s?s:0}function st(s){var a=ar(s),u=a%1;return a===a?u?a-u:a:0}function Mp(s){return s?Jr(st(s),0,Me):0}function ui(s){if(typeof s=="number")return s;if(Kn(s))return me;if(jt(s)){var a=typeof s.valueOf=="function"?s.valueOf():s;s=jt(a)?a+"":a}if(typeof s!="string")return s===0?s:+s;s=Hf(s);var u=Q.test(s);return u||$.test(s)?S0(s.slice(2),u?2:8):Y.test(s)?me:+s}function Ep(s){return Fi(s,Gn(s))}function aM(s){return s?Jr(st(s),-9007199254740991,K):s===0?s:0}function Rt(s){return s==null?"":qn(s)}var cM=Ds(function(s,a){if(qo(a)||Hn(a)){Fi(a,pn(a),s);return}for(var u in a)Pt.call(a,u)&&Go(s,u,a[u])}),bp=Ds(function(s,a){Fi(a,Gn(a),s)}),Sc=Ds(function(s,a,u,g){Fi(a,Gn(a),s,g)}),lM=Ds(function(s,a,u,g){Fi(a,pn(a),s,g)}),uM=rr(ql);function hM(s,a){var u=Is(s);return a==null?u:nd(u,a)}var fM=pt(function(s,a){s=Ot(s);var u=-1,g=a.length,T=g>2?a[2]:t;for(T&&Dn(a[0],a[1],T)&&(g=1);++u<g;)for(var P=a[u],z=Gn(P),H=-1,X=z.length;++H<X;){var ce=z[H],le=s[ce];(le===t||xi(le,Cs[ce])&&!Pt.call(s,ce))&&(s[ce]=P[ce])}return s}),dM=pt(function(s){return s.push(t,Hd),Yn(Tp,t,s)});function pM(s,a){return Ff(s,We(a,3),Ni)}function mM(s,a){return Ff(s,We(a,3),Zl)}function gM(s,a){return s==null?s:Kl(s,We(a,3),Gn)}function _M(s,a){return s==null?s:ad(s,We(a,3),Gn)}function vM(s,a){return s&&Ni(s,We(a,3))}function xM(s,a){return s&&Zl(s,We(a,3))}function yM(s){return s==null?[]:nc(s,pn(s))}function SM(s){return s==null?[]:nc(s,Gn(s))}function Ru(s,a,u){var g=s==null?t:Qr(s,a);return g===t?u:g}function MM(s,a){return s!=null&&Wd(s,a,Xv)}function Cu(s,a){return s!=null&&Wd(s,a,Yv)}var EM=Nd(function(s,a,u){a!=null&&typeof a.toString!="function"&&(a=Va.call(a)),s[a]=u},Lu(Vn)),bM=Nd(function(s,a,u){a!=null&&typeof a.toString!="function"&&(a=Va.call(a)),Pt.call(s,a)?s[a].push(u):s[a]=[u]},We),TM=pt(Wo);function pn(s){return Hn(s)?ed(s):eu(s)}function Gn(s){return Hn(s)?ed(s,!0):nx(s)}function AM(s,a){var u={};return a=We(a,3),Ni(s,function(g,T,P){nr(u,a(g,T,P),g)}),u}function wM(s,a){var u={};return a=We(a,3),Ni(s,function(g,T,P){nr(u,T,a(g,T,P))}),u}var RM=Ds(function(s,a,u){ic(s,a,u)}),Tp=Ds(function(s,a,u,g){ic(s,a,u,g)}),CM=rr(function(s,a){var u={};if(s==null)return u;var g=!1;a=Wt(a,function(P){return P=Cr(P,s),g||(g=P.length>1),P}),Fi(s,pu(s),u),g&&(u=ai(u,p|m|x,Ex));for(var T=a.length;T--;)ou(u,a[T]);return u});function PM(s,a){return Ap(s,vc(We(a)))}var LM=rr(function(s,a){return s==null?{}:rx(s,a)});function Ap(s,a){if(s==null)return{};var u=Wt(pu(s),function(g){return[g]});return a=We(a),_d(s,u,function(g,T){return a(g,T[0])})}function IM(s,a,u){a=Cr(a,s);var g=-1,T=a.length;for(T||(T=1,s=t);++g<T;){var P=s==null?t:s[Bi(a[g])];P===t&&(g=T,P=u),s=or(P)?P.call(s):P}return s}function DM(s,a,u){return s==null?s:Yo(s,a,u)}function OM(s,a,u,g){return g=typeof g=="function"?g:t,s==null?s:Yo(s,a,u,g)}var wp=zd(pn),Rp=zd(Gn);function UM(s,a,u){var g=it(s),T=g||Lr(s)||Ns(s);if(a=We(a,4),u==null){var P=s&&s.constructor;T?u=g?new P:[]:jt(s)?u=or(P)?Is(Ya(s)):{}:u={}}return(T?ri:Ni)(s,function(z,H,X){return a(u,z,H,X)}),u}function NM(s,a){return s==null?!0:ou(s,a)}function FM(s,a,u){return s==null?s:Md(s,a,lu(u))}function BM(s,a,u,g){return g=typeof g=="function"?g:t,s==null?s:Md(s,a,lu(u),g)}function Fs(s){return s==null?[]:Hl(s,pn(s))}function zM(s){return s==null?[]:Hl(s,Gn(s))}function kM(s,a,u){return u===t&&(u=a,a=t),u!==t&&(u=ui(u),u=u===u?u:0),a!==t&&(a=ui(a),a=a===a?a:0),Jr(ui(s),a,u)}function HM(s,a,u){return a=ar(a),u===t?(u=a,a=0):u=ar(u),s=ui(s),jv(s,a,u)}function GM(s,a,u){if(u&&typeof u!="boolean"&&Dn(s,a,u)&&(a=u=t),u===t&&(typeof a=="boolean"?(u=a,a=t):typeof s=="boolean"&&(u=s,s=t)),s===t&&a===t?(s=0,a=1):(s=ar(s),a===t?(a=s,s=0):a=ar(a)),s>a){var g=s;s=a,a=g}if(u||s%1||a%1){var T=Jf();return En(s+T*(a-s+y0("1e-"+((T+"").length-1))),a)}return iu(s,a)}var VM=Os(function(s,a,u){return a=a.toLowerCase(),s+(u?Cp(a):a)});function Cp(s){return Pu(Rt(s).toLowerCase())}function Pp(s){return s=Rt(s),s&&s.replace(Fe,D0).replace(u0,"")}function WM(s,a,u){s=Rt(s),a=qn(a);var g=s.length;u=u===t?g:Jr(st(u),0,g);var T=u;return u-=a.length,u>=0&&s.slice(u,T)==a}function XM(s){return s=Rt(s),s&&dt.test(s)?s.replace(Re,O0):s}function YM(s){return s=Rt(s),s&&Di.test(s)?s.replace(Sn,"\\$&"):s}var jM=Os(function(s,a,u){return s+(u?"-":"")+a.toLowerCase()}),qM=Os(function(s,a,u){return s+(u?" ":"")+a.toLowerCase()}),KM=Dd("toLowerCase");function ZM(s,a,u){s=Rt(s),a=st(a);var g=a?ws(s):0;if(!a||g>=a)return s;var T=(a-g)/2;return lc(Za(T),u)+s+lc(Ka(T),u)}function $M(s,a,u){s=Rt(s),a=st(a);var g=a?ws(s):0;return a&&g<a?s+lc(a-g,u):s}function JM(s,a,u){s=Rt(s),a=st(a);var g=a?ws(s):0;return a&&g<a?lc(a-g,u)+s:s}function QM(s,a,u){return u||a==null?a=0:a&&(a=+a),ov(Rt(s).replace(Oi,""),a||0)}function eE(s,a,u){return(u?Dn(s,a,u):a===t)?a=1:a=st(a),ru(Rt(s),a)}function tE(){var s=arguments,a=Rt(s[0]);return s.length<3?a:a.replace(s[1],s[2])}var nE=Os(function(s,a,u){return s+(u?"_":"")+a.toLowerCase()});function iE(s,a,u){return u&&typeof u!="number"&&Dn(s,a,u)&&(a=u=t),u=u===t?Me:u>>>0,u?(s=Rt(s),s&&(typeof a=="string"||a!=null&&!wu(a))&&(a=qn(a),!a&&As(s))?Pr(_i(s),0,u):s.split(a,u)):[]}var rE=Os(function(s,a,u){return s+(u?" ":"")+Pu(a)});function sE(s,a,u){return s=Rt(s),u=u==null?0:Jr(st(u),0,s.length),a=qn(a),s.slice(u,u+a.length)==a}function oE(s,a,u){var g=R.templateSettings;u&&Dn(s,a,u)&&(a=t),s=Rt(s),a=Sc({},a,g,kd);var T=Sc({},a.imports,g.imports,kd),P=pn(T),z=Hl(T,P),H,X,ce=0,le=a.interpolate||ke,fe="__p += '",Ee=Vl((a.escape||ke).source+"|"+le.source+"|"+(le===At?wl:ke).source+"|"+(a.evaluate||ke).source+"|$","g"),Oe="//# sourceURL="+(Pt.call(a,"sourceURL")?(a.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++m0+"]")+`
|
|
3807
|
+
`;s.replace(Ee,function(je,vt,Et,Zn,On,$n){return Et||(Et=Zn),fe+=s.slice(ce,$n).replace(Ze,U0),vt&&(H=!0,fe+=`' +
|
|
3808
|
+
__e(`+vt+`) +
|
|
3809
|
+
'`),On&&(X=!0,fe+=`';
|
|
3810
|
+
`+On+`;
|
|
3811
|
+
__p += '`),Et&&(fe+=`' +
|
|
3812
|
+
((__t = (`+Et+`)) == null ? '' : __t) +
|
|
3813
|
+
'`),ce=$n+je.length,je}),fe+=`';
|
|
3814
|
+
`;var Ye=Pt.call(a,"variable")&&a.variable;if(!Ye)fe=`with (obj) {
|
|
3815
|
+
`+fe+`
|
|
3816
|
+
}
|
|
3817
|
+
`;else if(Tl.test(Ye))throw new tt(l);fe=(X?fe.replace(S,""):fe).replace(Z,"$1").replace(oe,"$1;"),fe="function("+(Ye||"obj")+`) {
|
|
3818
|
+
`+(Ye?"":`obj || (obj = {});
|
|
3819
|
+
`)+"var __t, __p = ''"+(H?", __e = _.escape":"")+(X?`, __j = Array.prototype.join;
|
|
3820
3820
|
function print() { __p += __j.call(arguments, '') }
|
|
3821
3821
|
`:`;
|
|
3822
|
-
`)+
|
|
3823
|
-
}`;var at=Sp(function(){return wt(P,Ue+"return "+ue).apply(t,F)});if(at.source=ue,gh(at))throw at;return at}function VM(r){return Rt(r).toLowerCase()}function WM(r){return Rt(r).toUpperCase()}function XM(r,a,h){if(r=Rt(r),r&&(h||a===t))return Pf(r);if(!r||!(a=Yn(a)))return r;var g=di(r),M=di(a),P=Lf(g,M),F=If(g,M)+1;return yr(g,P,F).join("")}function YM(r,a,h){if(r=Rt(r),r&&(h||a===t))return r.slice(0,Uf(r)+1);if(!r||!(a=Yn(a)))return r;var g=di(r),M=If(g,di(a))+1;return yr(g,0,M).join("")}function jM(r,a,h){if(r=Rt(r),r&&(h||a===t))return r.replace(Ri,"");if(!r||!(a=Yn(a)))return r;var g=di(r),M=Lf(g,di(a));return yr(g,M).join("")}function qM(r,a){var h=T,g=W;if(Yt(a)){var M="separator"in a?a.separator:M;h="length"in a?st(a.length):h,g="omission"in a?Yn(a.omission):g}r=Rt(r);var P=r.length;if(vs(r)){var F=di(r);P=F.length}if(h>=P)return r;var z=h-xs(g);if(z<1)return g;var V=F?yr(F,0,z).join(""):r.slice(0,z);if(M===t)return V+g;if(F&&(z+=V.length-z),_h(M)){if(r.slice(z).search(M)){var ae,ce=V;for(M.global||(M=Dl(M.source,Rt(I.exec(M))+"g")),M.lastIndex=0;ae=M.exec(ce);)var ue=ae.index;V=V.slice(0,ue===t?z:ue)}}else if(r.indexOf(Yn(M),z)!=z){var Se=V.lastIndexOf(M);Se>-1&&(V=V.slice(0,Se))}return V+g}function KM(r){return r=Rt(r),r&&mt.test(r)?r.replace(xe,b0):r}var ZM=As(function(r,a,h){return r+(h?" ":"")+a.toUpperCase()}),yh=Md("toUpperCase");function yp(r,a,h){return r=Rt(r),a=h?t:a,a===t?x0(r)?w0(r):h0(r):r.match(a)||[]}var Sp=ft(function(r,a){try{return Wn(r,t,a)}catch(h){return gh(h)?h:new et(h)}}),$M=qi(function(r,a){return ti(a,function(h){h=Ii(h),Yi(r,h,ph(r[h],r))}),r});function JM(r){var a=r==null?0:r.length,h=Ge();return r=a?Vt(r,function(g){if(typeof g[1]!="function")throw new ni(c);return[h(g[0]),g[1]]}):[],ft(function(g){for(var M=-1;++M<a;){var P=r[M];if(Wn(P[0],this,g))return Wn(P[1],this,g)}})}function QM(r){return bv(ri(r,p))}function Sh(r){return function(){return r}}function eE(r,a){return r==null||r!==r?a:r}var tE=bd(),nE=bd(!0);function kn(r){return r}function Mh(r){return ed(typeof r=="function"?r:ri(r,p))}function iE(r){return nd(ri(r,p))}function rE(r,a){return id(r,ri(a,p))}var sE=ft(function(r,a){return function(h){return Fo(h,r,a)}}),oE=ft(function(r,a){return function(h){return Fo(r,h,a)}});function Eh(r,a,h){var g=fn(a),M=Xa(a,g);h==null&&!(Yt(a)&&(M.length||!g.length))&&(h=a,a=r,r=this,M=Xa(a,fn(a)));var P=!(Yt(h)&&"chain"in h)||!!h.chain,F=Zi(r);return ti(M,function(z){var V=a[z];r[z]=V,F&&(r.prototype[z]=function(){var ae=this.__chain__;if(P||ae){var ce=r(this.__wrapped__),ue=ce.__actions__=Fn(this.__actions__);return ue.push({func:V,args:arguments,thisArg:r}),ce.__chain__=ae,ce}return V.apply(r,pr([this.value()],arguments))})}),r}function aE(){return _n._===this&&(_n._=D0),this}function bh(){}function cE(r){return r=st(r),ft(function(a){return rd(a,r)})}var lE=th(Vt),hE=th(Tf),uE=th(Al);function Mp(r){return ch(r)?wl(Ii(r)):Hv(r)}function fE(r){return function(a){return r==null?t:Xr(r,a)}}var dE=Ad(),pE=Ad(!0);function Th(){return[]}function Ah(){return!1}function mE(){return{}}function gE(){return""}function _E(){return!0}function vE(r,a){if(r=st(r),r<1||r>$)return[];var h=Ee,g=Mn(r,Ee);a=Ge(a),r-=Ee;for(var M=Pl(g,a);++h<r;)a(h);return M}function xE(r){return it(r)?Vt(r,Ii):jn(r)?[r]:Fn(Gd(Rt(r)))}function yE(r){var a=++L0;return Rt(r)+a}var SE=$a(function(r,a){return r+a},0),ME=nh("ceil"),EE=$a(function(r,a){return r/a},1),bE=nh("floor");function TE(r){return r&&r.length?Wa(r,kn,Hl):t}function AE(r,a){return r&&r.length?Wa(r,Ge(a,2),Hl):t}function wE(r){return Rf(r,kn)}function RE(r,a){return Rf(r,Ge(a,2))}function CE(r){return r&&r.length?Wa(r,kn,Xl):t}function PE(r,a){return r&&r.length?Wa(r,Ge(a,2),Xl):t}var LE=$a(function(r,a){return r*a},1),IE=nh("round"),DE=$a(function(r,a){return r-a},0);function UE(r){return r&&r.length?Cl(r,kn):0}function OE(r,a){return r&&r.length?Cl(r,Ge(a,2)):0}return w.after=iS,w.ary=Qd,w.assign=WS,w.assignIn=dp,w.assignInWith=hc,w.assignWith=XS,w.at=YS,w.before=ep,w.bind=ph,w.bindAll=$M,w.bindKey=tp,w.castArray=mS,w.chain=Zd,w.chunk=bx,w.compact=Tx,w.concat=Ax,w.cond=JM,w.conforms=QM,w.constant=Sh,w.countBy=Uy,w.create=jS,w.curry=np,w.curryRight=ip,w.debounce=rp,w.defaults=qS,w.defaultsDeep=KS,w.defer=rS,w.delay=sS,w.difference=wx,w.differenceBy=Rx,w.differenceWith=Cx,w.drop=Px,w.dropRight=Lx,w.dropRightWhile=Ix,w.dropWhile=Dx,w.fill=Ux,w.filter=Ny,w.flatMap=zy,w.flatMapDeep=ky,w.flatMapDepth=Hy,w.flatten=Yd,w.flattenDeep=Ox,w.flattenDepth=Nx,w.flip=oS,w.flow=tE,w.flowRight=nE,w.fromPairs=Fx,w.functions=nM,w.functionsIn=iM,w.groupBy=Gy,w.initial=zx,w.intersection=kx,w.intersectionBy=Hx,w.intersectionWith=Gx,w.invert=sM,w.invertBy=oM,w.invokeMap=Wy,w.iteratee=Mh,w.keyBy=Xy,w.keys=fn,w.keysIn=zn,w.map=rc,w.mapKeys=cM,w.mapValues=lM,w.matches=iE,w.matchesProperty=rE,w.memoize=oc,w.merge=hM,w.mergeWith=pp,w.method=sE,w.methodOf=oE,w.mixin=Eh,w.negate=ac,w.nthArg=cE,w.omit=uM,w.omitBy=fM,w.once=aS,w.orderBy=Yy,w.over=lE,w.overArgs=cS,w.overEvery=hE,w.overSome=uE,w.partial=mh,w.partialRight=sp,w.partition=jy,w.pick=dM,w.pickBy=mp,w.property=Mp,w.propertyOf=fE,w.pull=Yx,w.pullAll=qd,w.pullAllBy=jx,w.pullAllWith=qx,w.pullAt=Kx,w.range=dE,w.rangeRight=pE,w.rearg=lS,w.reject=Zy,w.remove=Zx,w.rest=hS,w.reverse=fh,w.sampleSize=Jy,w.set=mM,w.setWith=gM,w.shuffle=Qy,w.slice=$x,w.sortBy=nS,w.sortedUniq=ry,w.sortedUniqBy=sy,w.split=zM,w.spread=uS,w.tail=oy,w.take=ay,w.takeRight=cy,w.takeRightWhile=ly,w.takeWhile=hy,w.tap=Ty,w.throttle=fS,w.thru=ic,w.toArray=hp,w.toPairs=gp,w.toPairsIn=_p,w.toPath=xE,w.toPlainObject=fp,w.transform=_M,w.unary=dS,w.union=uy,w.unionBy=fy,w.unionWith=dy,w.uniq=py,w.uniqBy=my,w.uniqWith=gy,w.unset=vM,w.unzip=dh,w.unzipWith=Kd,w.update=xM,w.updateWith=yM,w.values=Cs,w.valuesIn=SM,w.without=_y,w.words=yp,w.wrap=pS,w.xor=vy,w.xorBy=xy,w.xorWith=yy,w.zip=Sy,w.zipObject=My,w.zipObjectDeep=Ey,w.zipWith=by,w.entries=gp,w.entriesIn=_p,w.extend=dp,w.extendWith=hc,Eh(w,w),w.add=SE,w.attempt=Sp,w.camelCase=TM,w.capitalize=vp,w.ceil=ME,w.clamp=MM,w.clone=gS,w.cloneDeep=vS,w.cloneDeepWith=xS,w.cloneWith=_S,w.conformsTo=yS,w.deburr=xp,w.defaultTo=eE,w.divide=EE,w.endsWith=AM,w.eq=mi,w.escape=wM,w.escapeRegExp=RM,w.every=Oy,w.find=Fy,w.findIndex=Wd,w.findKey=ZS,w.findLast=By,w.findLastIndex=Xd,w.findLastKey=$S,w.floor=bE,w.forEach=$d,w.forEachRight=Jd,w.forIn=JS,w.forInRight=QS,w.forOwn=eM,w.forOwnRight=tM,w.get=vh,w.gt=SS,w.gte=MS,w.has=rM,w.hasIn=xh,w.head=jd,w.identity=kn,w.includes=Vy,w.indexOf=Bx,w.inRange=EM,w.invoke=aM,w.isArguments=qr,w.isArray=it,w.isArrayBuffer=ES,w.isArrayLike=Bn,w.isArrayLikeObject=Qt,w.isBoolean=bS,w.isBuffer=Sr,w.isDate=TS,w.isElement=AS,w.isEmpty=wS,w.isEqual=RS,w.isEqualWith=CS,w.isError=gh,w.isFinite=PS,w.isFunction=Zi,w.isInteger=op,w.isLength=cc,w.isMap=ap,w.isMatch=LS,w.isMatchWith=IS,w.isNaN=DS,w.isNative=US,w.isNil=NS,w.isNull=OS,w.isNumber=cp,w.isObject=Yt,w.isObjectLike=Zt,w.isPlainObject=Vo,w.isRegExp=_h,w.isSafeInteger=FS,w.isSet=lp,w.isString=lc,w.isSymbol=jn,w.isTypedArray=Rs,w.isUndefined=BS,w.isWeakMap=zS,w.isWeakSet=kS,w.join=Vx,w.kebabCase=CM,w.last=oi,w.lastIndexOf=Wx,w.lowerCase=PM,w.lowerFirst=LM,w.lt=HS,w.lte=GS,w.max=TE,w.maxBy=AE,w.mean=wE,w.meanBy=RE,w.min=CE,w.minBy=PE,w.stubArray=Th,w.stubFalse=Ah,w.stubObject=mE,w.stubString=gE,w.stubTrue=_E,w.multiply=LE,w.nth=Xx,w.noConflict=aE,w.noop=bh,w.now=sc,w.pad=IM,w.padEnd=DM,w.padStart=UM,w.parseInt=OM,w.random=bM,w.reduce=qy,w.reduceRight=Ky,w.repeat=NM,w.replace=FM,w.result=pM,w.round=IE,w.runInContext=G,w.sample=$y,w.size=eS,w.snakeCase=BM,w.some=tS,w.sortedIndex=Jx,w.sortedIndexBy=Qx,w.sortedIndexOf=ey,w.sortedLastIndex=ty,w.sortedLastIndexBy=ny,w.sortedLastIndexOf=iy,w.startCase=kM,w.startsWith=HM,w.subtract=DE,w.sum=UE,w.sumBy=OE,w.template=GM,w.times=vE,w.toFinite=$i,w.toInteger=st,w.toLength=up,w.toLower=VM,w.toNumber=ai,w.toSafeInteger=VS,w.toString=Rt,w.toUpper=WM,w.trim=XM,w.trimEnd=YM,w.trimStart=jM,w.truncate=qM,w.unescape=KM,w.uniqueId=yE,w.upperCase=ZM,w.upperFirst=yh,w.each=$d,w.eachRight=Jd,w.first=jd,Eh(w,function(){var r={};return Pi(w,function(a,h){Pt.call(w.prototype,h)||(r[h]=a)}),r}(),{chain:!1}),w.VERSION=n,ti(["bind","bindKey","curry","curryRight","partial","partialRight"],function(r){w[r].placeholder=w}),ti(["drop","take"],function(r,a){vt.prototype[r]=function(h){h=h===t?1:on(st(h),0);var g=this.__filtered__&&!a?new vt(this):this.clone();return g.__filtered__?g.__takeCount__=Mn(h,g.__takeCount__):g.__views__.push({size:Mn(h,Ee),type:r+(g.__dir__<0?"Right":"")}),g},vt.prototype[r+"Right"]=function(h){return this.reverse()[r](h).reverse()}}),ti(["filter","map","takeWhile"],function(r,a){var h=a+1,g=h==K||h==he;vt.prototype[r]=function(M){var P=this.clone();return P.__iteratees__.push({iteratee:Ge(M,3),type:h}),P.__filtered__=P.__filtered__||g,P}}),ti(["head","last"],function(r,a){var h="take"+(a?"Right":"");vt.prototype[r]=function(){return this[h](1).value()[0]}}),ti(["initial","tail"],function(r,a){var h="drop"+(a?"":"Right");vt.prototype[r]=function(){return this.__filtered__?new vt(this):this[h](1)}}),vt.prototype.compact=function(){return this.filter(kn)},vt.prototype.find=function(r){return this.filter(r).head()},vt.prototype.findLast=function(r){return this.reverse().find(r)},vt.prototype.invokeMap=ft(function(r,a){return typeof r=="function"?new vt(this):this.map(function(h){return Fo(h,r,a)})}),vt.prototype.reject=function(r){return this.filter(ac(Ge(r)))},vt.prototype.slice=function(r,a){r=st(r);var h=this;return h.__filtered__&&(r>0||a<0)?new vt(h):(r<0?h=h.takeRight(-r):r&&(h=h.drop(r)),a!==t&&(a=st(a),h=a<0?h.dropRight(-a):h.take(a-r)),h)},vt.prototype.takeRightWhile=function(r){return this.reverse().takeWhile(r).reverse()},vt.prototype.toArray=function(){return this.take(Ee)},Pi(vt.prototype,function(r,a){var h=/^(?:filter|find|map|reject)|While$/.test(a),g=/^(?:head|last)$/.test(a),M=w[g?"take"+(a=="last"?"Right":""):a],P=g||/^find/.test(a);M&&(w.prototype[a]=function(){var F=this.__wrapped__,z=g?[1]:arguments,V=F instanceof vt,ae=z[0],ce=V||it(F),ue=function(gt){var Mt=M.apply(w,pr([gt],z));return g&&Se?Mt[0]:Mt};ce&&h&&typeof ae=="function"&&ae.length!=1&&(V=ce=!1);var Se=this.__chain__,Ue=!!this.__actions__.length,We=P&&!Se,at=V&&!Ue;if(!P&&ce){F=at?F:new vt(this);var Xe=r.apply(F,z);return Xe.__actions__.push({func:ic,args:[ue],thisArg:t}),new ii(Xe,Se)}return We&&at?r.apply(this,z):(Xe=this.thru(ue),We?g?Xe.value()[0]:Xe.value():Xe)})}),ti(["pop","push","shift","sort","splice","unshift"],function(r){var a=Ca[r],h=/^(?:push|sort|unshift)$/.test(r)?"tap":"thru",g=/^(?:pop|shift)$/.test(r);w.prototype[r]=function(){var M=arguments;if(g&&!this.__chain__){var P=this.value();return a.apply(it(P)?P:[],M)}return this[h](function(F){return a.apply(it(F)?F:[],M)})}}),Pi(vt.prototype,function(r,a){var h=w[a];if(h){var g=h.name+"";Pt.call(Es,g)||(Es[g]=[]),Es[g].push({name:a,func:h})}}),Es[Za(t,_).name]=[{name:"wrapper",func:t}],vt.prototype.clone=K0,vt.prototype.reverse=Z0,vt.prototype.value=$0,w.prototype.at=Ay,w.prototype.chain=wy,w.prototype.commit=Ry,w.prototype.next=Cy,w.prototype.plant=Ly,w.prototype.reverse=Iy,w.prototype.toJSON=w.prototype.valueOf=w.prototype.value=Dy,w.prototype.first=w.prototype.head,Po&&(w.prototype[Po]=Py),w},ys=R0();kr?((kr.exports=ys)._=ys,Ml._=ys):_n._=ys}).call(mP)}(ca,ca.exports)),ca.exports}var _P=gP();class fu{constructor(e,t){this._path=e,this._ctor=t,this._promise=null,this._instance=null}async get(){return this._instance?Promise.resolve(this._instance):this._promise?this._promise:(this._promise=(async()=>{const t=(await import(this._path))[this._ctor];if(!t)throw new Error(`DIVE: Module class ${this._ctor} not found in ${this._path}`);if(typeof t!="function")throw new Error(`DIVE: Module at ${this._path} does not export a valid constructor (${this._ctor} wanted)`);return this._instance=new t,this._instance})(),this._promise)}}const io=class io{constructor(e,t,n,i){this._mediaGenerator=new fu("../mediacreator/MediaCreator.ts","DIVEMediaCreator"),this._io=new fu("../io/IO.ts","DIVEIO"),this._ar=new fu("../ar/AR.ts","DIVEAR"),this.registered=new Map,this.listeners=new Map,this._id=iP(),this.renderer=e,this.scene=t,this.controller=n,this.toolbox=i,io.__instances.push(this)}static get(e){const t=this.__instances.find(n=>n.id===e);return t||this.__instances.find(n=>Array.from(n.registered.values()).find(i=>i.id===e))}get id(){return this._id}DestroyInstance(){const e=io.__instances.findIndex(t=>t.id===this.id);return e===-1?!1:(io.__instances.splice(e,1),!0)}PerformAction(e,t){let n=!1;switch(e){case"START_RENDER":{this.renderer.StartRenderer(this.scene,this.controller.object),n=!0;break}case"GET_ALL_SCENE_DATA":{n=this.getAllSceneData(t);break}case"GET_ALL_OBJECTS":{n=this.getAllObjects(t);break}case"GET_OBJECTS":{n=this.getObjects(t);break}case"ADD_OBJECT":{n=this.addObject(t);break}case"UPDATE_OBJECT":{n=this.updateObject(t);break}case"DELETE_OBJECT":{n=this.deleteObject(t);break}case"SELECT_OBJECT":{n=this.selectObject(t);break}case"DESELECT_OBJECT":{n=this.deselectObject(t);break}case"SET_BACKGROUND":{n=this.setBackground(t);break}case"DROP_IT":{n=this.dropIt(t);break}case"PLACE_ON_FLOOR":{n=this.placeOnFloor(t);break}case"SET_CAMERA_TRANSFORM":{n=this.setCameraTransform(t);break}case"GET_CAMERA_TRANSFORM":{n=this.getCameraTransform(t);break}case"MOVE_CAMERA":{n=this.moveCamera(t);break}case"RESET_CAMERA":{n=this.resetCamera(t);break}case"COMPUTE_ENCOMPASSING_VIEW":{n=this.computeEncompassingView(t);break}case"SET_CAMERA_LAYER":{n=this.setCameraLayer(t);break}case"ZOOM_CAMERA":{n=this.zoomCamera(t);break}case"SET_GIZMO_MODE":{n=this.setGizmoMode(t);break}case"SET_GIZMO_VISIBILITY":{n=this.setGizmoVisibility(t);break}case"SET_GIZMO_SCALE_LINKED":{n=this.setGizmoScaleLinked(t);break}case"USE_TOOL":{n=this.useTool(t);break}case"MODEL_LOADED":{n=this.modelLoaded(t);break}case"UPDATE_SCENE":{n=this.updateScene(t);break}case"GENERATE_MEDIA":{n=this.generateMedia(t);break}case"SET_PARENT":{n=this.setParent(t);break}case"EXPORT_SCENE":{n=this.exportScene(t);break}case"LAUNCH_AR":{n=new Promise((i,o)=>{this._ar.get().then(c=>{i(c.Launch(t))}).catch(o)});break}default:console.warn(`DIVECommunication.PerformAction: has been executed with unknown Action type ${e}`)}return this.dispatch(e,t),n}Subscribe(e,t){return this.listeners.get(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t),()=>{const n=this.listeners.get(e);if(!n)return!1;const i=n.findIndex(o=>o===t);return i===-1?!1:(n.splice(i,1),!0)}}dispatch(e,t){const n=this.listeners.get(e);n&&n.forEach(i=>i(t))}getAllSceneData(e){const t={name:this.scene.name,mediaItem:null,backgroundColor:"#"+this.scene.background.getHexString(),floorEnabled:this.scene.Floor.visible,floorColor:"#"+this.scene.Floor.material.color.getHexString(),userCamera:{position:this.controller.object.position.clone(),target:this.controller.target.clone()},spotmarks:[],lights:Array.from(this.registered.values()).filter(n=>n.entityType==="light"),objects:Array.from(this.registered.values()).filter(n=>n.entityType==="model"),cameras:Array.from(this.registered.values()).filter(n=>n.entityType==="pov"),primitives:Array.from(this.registered.values()).filter(n=>n.entityType==="primitive"),groups:Array.from(this.registered.values()).filter(n=>n.entityType==="group")};return Object.assign(e,t),t}getAllObjects(e){return Object.assign(e,this.registered),this.registered}getObjects(e){if(e.ids.length===0)return[];const t=[];return this.registered.forEach(n=>{e.ids.includes(n.id)&&t.push(n)}),t}addObject(e){return this.registered.get(e.id)?!1:(e.parentId===void 0&&(e.parentId=null),this.registered.set(e.id,e),this.scene.AddSceneObject(e),!0)}updateObject(e){const t=this.registered.get(e.id);if(!t)return!1;this.registered.set(e.id,_P.merge(t,e));const n=this.registered.get(e.id);return this.scene.UpdateSceneObject({...e,id:n.id,entityType:n.entityType}),Object.assign(e,n),!0}deleteObject(e){const t=this.registered.get(e.id);return t?(t.parentId&&this.setParent({object:{id:t.id},parent:null}),t.entityType==="group"&&this.registered.forEach(n=>{n.parentId===t.id&&this.updateObject({id:n.id,parentId:null})}),Object.assign(e,t),this.registered.delete(e.id),Array.from(this.registered.values()).forEach(n=>{n.parentId&&n.parentId===e.id&&(n.parentId=null)}),this.scene.DeleteSceneObject(t),!0):!1}selectObject(e){const t=this.registered.get(e.id);if(!t)return!1;const n=this.scene.GetSceneObject(t);if(!n||!("isSelectable"in n))return!1;const i=this.toolbox.GetActiveTool();return i&&Tg(i)&&i.AttachGizmo(n),Object.assign(e,t),!0}deselectObject(e){const t=this.registered.get(e.id);if(!t)return!1;const n=this.scene.GetSceneObject(t);if(!n||!("isSelectable"in n))return!1;const i=this.toolbox.GetActiveTool();return i&&Tg(i)&&i.DetachGizmo(),Object.assign(e,t),!0}setBackground(e){return this.scene.SetBackground(e.color),!0}dropIt(e){const t=this.registered.get(e.id);return t?(this.scene.GetSceneObject(t).DropIt(),!0):!1}placeOnFloor(e){const t=this.registered.get(e.id);return t?(this.scene.PlaceOnFloor(t),!0):!1}setCameraTransform(e){return this.controller.object.position.copy(e.position),this.controller.target.copy(e.target),this.controller.update(),!0}getCameraTransform(e){const t={position:this.controller.object.position.clone(),target:this.controller.target.clone()};return Object.assign(e,t),t}moveCamera(e){let t={x:0,y:0,z:0},n={x:0,y:0,z:0};return"id"in e?(t=this.registered.get(e.id).position,n=this.registered.get(e.id).target):(t=e.position,n=e.target),this.controller.MoveTo(t,n,e.duration,e.locked),!0}setCameraLayer(e){return this.controller.object.SetCameraLayer(e.layer),!0}resetCamera(e){return this.controller.RevertLast(e.duration),!0}computeEncompassingView(e){const t=this.scene.ComputeSceneBB(),n=this.controller.ComputeEncompassingView(t);return Object.assign(e,n),n}zoomCamera(e){return e.direction==="IN"&&this.controller.ZoomIn(e.by),e.direction==="OUT"&&this.controller.ZoomOut(e.by),!0}setGizmoMode(e){return this.toolbox.SetGizmoMode(e.mode),!0}setGizmoVisibility(e){return this.toolbox.SetGizmoVisibility(e),e}setGizmoScaleLinked(e){return this.toolbox.SetGizmoScaleLinked(e),e}useTool(e){return this.toolbox.UseTool(e.tool),!0}modelLoaded(e){return this.registered.get(e.id).loaded=!0,!0}updateScene(e){return e.name!==void 0&&(this.scene.name=e.name),e.backgroundColor!==void 0&&this.scene.SetBackground(e.backgroundColor),e.gridEnabled!==void 0&&this.scene.Grid.SetVisibility(e.gridEnabled),e.floorEnabled!==void 0&&this.scene.Floor.SetVisibility(e.floorEnabled),e.floorColor!==void 0&&this.scene.Floor.SetColor(e.floorColor),e.name=this.scene.name,e.backgroundColor="#"+this.scene.background.getHexString(),e.gridEnabled=this.scene.Grid.visible,e.floorEnabled=this.scene.Floor.visible,e.floorColor="#"+this.scene.Floor.material.color.getHexString(),!0}generateMedia(e){let t={x:0,y:0,z:0},n={x:0,y:0,z:0};return"id"in e?(t=this.registered.get(e.id).position,n=this.registered.get(e.id).target):(t=e.position,n=e.target),this._mediaGenerator.get().then(i=>i.GenerateMedia(t,n,e.width,e.height))}setParent(e){const t=this.registered.get(e.object.id);if(!t)return!1;const n=this.scene.GetSceneObject(t);if(!n)return!1;if(e.parent===null)return this.scene.Root.attach(n),this.updateObject({id:t.id,parentId:null}),!0;if(e.object.id===e.parent.id)return!1;const i=this.registered.get(e.parent.id);if(!i)return this.scene.Root.attach(n),this.updateObject({id:t.id,parentId:null}),!0;const o=this.scene.GetSceneObject(i);return o?(o.attach(n),this.updateObject({id:t.id,parentId:i.id}),!0):(this.scene.Root.attach(n),this.updateObject({id:t.id,parentId:null}),!0)}exportScene(e){return new Promise((t,n)=>{this._io.get().then(i=>{t(i.Export(e.type))}).catch(n)})}};io.__instances=[];let Gn=io;class vP extends _t{constructor(){super(),this.isDIVELight=!0,this.isDIVEPointLight=!0,this.isMovable=!0,this.isSelectable=!0,this.gizmo=null,this.name="DIVEPointLight",this.light=new A_(16777215,1),this.light.layers.mask=Jn,this.light.castShadow=!0,this.light.shadow.mapSize.width=512,this.light.shadow.mapSize.height=512,this.add(this.light);const e=.1,t=new ya(e,e*320,e*320),n=new Ni({color:this.light.color,transparent:!0,opacity:.8,side:Fi});this.mesh=new ye(t,n),this.mesh.layers.mask=rf,this.add(this.mesh)}SetColor(e){this.light.color=e,this.mesh.material.color=e}SetIntensity(e){this.light.intensity=e,this.mesh.material.opacity=e>.8?.8:e*.8}SetEnabled(e){this.light.visible=e}onMove(){var e;(e=Gn.get(this.userData.id))==null||e.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.position})}onSelect(){var e;(e=Gn.get(this.userData.id))==null||e.PerformAction("SELECT_OBJECT",{id:this.userData.id})}onDeselect(){var e;(e=Gn.get(this.userData.id))==null||e.PerformAction("DESELECT_OBJECT",{id:this.userData.id})}}class xP extends _t{constructor(){super(),this.isDIVELight=!0,this.isDIVESceneLight=!0,this.name="DIVESceneLight",this._hemiLight=new OC(16777215,16777215,2),this._hemiLight.layers.mask=Jn,this._hemiLight.position.set(0,50,0),this.add(this._hemiLight),this._dirLight=new ef(16777215,3),this._dirLight.layers.mask=Jn,this._dirLight.position.set(1,1.75,1),this._dirLight.position.multiplyScalar(30),this._dirLight.castShadow=!0,this._dirLight.shadow.mapSize.width=2048,this._dirLight.shadow.mapSize.height=2048;const e=5;this._dirLight.shadow.camera.left=-5,this._dirLight.shadow.camera.right=e,this._dirLight.shadow.camera.top=e,this._dirLight.shadow.camera.bottom=-5,this._dirLight.shadow.camera.far=3500,this.add(this._dirLight)}SetColor(e){this._hemiLight.color=e,this._dirLight.color=e}SetIntensity(e){this._hemiLight.intensity=e*2,this._dirLight.intensity=e*3}SetEnabled(e){this._hemiLight.visible=e,this._dirLight.visible=e}}const sf=s=>s.parent?sf(s.parent):s;class of extends _t{constructor(){super(),this.isDIVENode=!0,this.isSelectable=!0,this.isMovable=!0,this.gizmo=null,this.layers.mask=Jn,this._positionWorldBuffer=new U,this._boundingBox=new Ai}SetPosition(e){if(!this.parent){this.position.set(e.x,e.y,e.z);return}const t=new U(e.x,e.y,e.z);this.position.copy(this.parent.worldToLocal(t)),"isDIVEGroup"in this.parent&&this.parent.UpdateLineTo(this)}SetRotation(e){this.rotation.set(e.x,e.y,e.z)}SetScale(e){this.scale.set(e.x,e.y,e.z)}SetVisibility(e){this.visible=e}SetToWorldOrigin(){var e;this.position.set(0,0,0),(e=Gn.get(this.userData.id))==null||e.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})}onMove(){var e;(e=Gn.get(this.userData.id))==null||e.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})}onSelect(){var e;(e=Gn.get(this.userData.id))==null||e.PerformAction("SELECT_OBJECT",{id:this.userData.id})}onDeselect(){var e;(e=Gn.get(this.userData.id))==null||e.PerformAction("DESELECT_OBJECT",{id:this.userData.id})}}class yP extends of{constructor(){super(...arguments),this.isDIVEModel=!0,this._mesh=null,this._material=null}SetModel(e){this.clear(),this._boundingBox.makeEmpty(),e.scene.traverse(t=>{t.castShadow=!0,t.receiveShadow=!0,t.layers.mask=this.layers.mask,this._boundingBox.expandByObject(t),!this._mesh&&"isMesh"in t&&(this._mesh=t,this._material?this._mesh.material=this._material:this._material=t.material)}),this.add(e.scene)}SetMaterial(e){this._material||(this._material=new So),e.vertexColors!==void 0&&(this._material.vertexColors=e.vertexColors),e.color!==void 0&&this._material.color.set(e.color),e.map!==void 0&&(this._material.map=e.map),e.normalMap!==void 0&&(this._material.normalMap=e.normalMap),e.roughness!==void 0&&(this._material.roughness=e.roughness),e.roughnessMap!==void 0&&(this._material.roughnessMap=e.roughnessMap,this._material.roughnessMap&&(this._material.roughness=1)),e.metalness!==void 0&&(this._material.metalness=e.metalness),e.metalnessMap!==void 0&&(this._material.metalnessMap=e.metalnessMap,this._material.metalnessMap&&(this._material.metalness=1)),this._mesh&&(this._mesh.material=this._material)}PlaceOnFloor(){var i,o,c,l,u;const e=this.getWorldPosition(this._positionWorldBuffer),t=e.clone();(o=(i=this._mesh)==null?void 0:i.geometry)==null||o.computeBoundingBox();const n=(l=(c=this._mesh)==null?void 0:c.geometry)==null?void 0:l.boundingBox;!n||!this._mesh||(e.y=e.y-this._mesh.localToWorld(n.min.clone()).y,e.y!==t.y&&((u=Gn.get(this.userData.id))==null||u.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:e,rotation:this.rotation,scale:this.scale})))}DropIt(){if(!this.parent){console.warn("DIVEModel: DropIt() called on a model that is not in the scene.",this);return}const e=this._boundingBox.min.y*this.scale.y,t=this.localToWorld(this._boundingBox.getCenter(new U).multiply(this.scale));t.y=e+this.position.y;const n=new dl(t,new U(0,-1,0));n.layers.mask=Jn;const i=n.intersectObjects(sf(this).Root.children,!0);if(i.length>0){const o=i[0].object;o.geometry.computeBoundingBox();const c=o.geometry.boundingBox,l=o.localToWorld(c.max.clone()),u=this.position.clone(),f=this.position.clone().setY(l.y).sub(new U(0,e,0));if(this.position.copy(f),this.position.y===u.y)return;this.onMove()}}}const du=new WeakMap;class SP extends ps{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,i){const o=new sl(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,c=>{this.parse(c,t,i)},n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,mn).catch(n)}decodeDracoFile(e,t,n,i,o=gn,c=()=>{}){const l={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:o};return this.decodeGeometry(e,l).then(t).catch(c)}decodeGeometry(e,t){const n=JSON.stringify(t);if(du.has(e)){const u=du.get(e);if(u.key===n)return u.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const o=this.workerNextTaskID++,c=e.byteLength,l=this._getWorker(o,c).then(u=>(i=u,new Promise((f,d)=>{i._callbacks[o]={resolve:f,reject:d},i.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))).then(u=>this._createGeometry(u.geometry));return l.catch(()=>!0).then(()=>{i&&o&&this._releaseTask(i,o)}),du.set(e,{key:n,promise:l}),l}_createGeometry(e){const t=new $t;e.index&&t.setIndex(new cn(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const i=e.attributes[n],o=i.name,c=i.array,l=i.itemSize,u=new cn(c,l);o==="color"&&(this._assignVertexColorSpace(u,i.vertexColorSpace),u.normalized=!(c instanceof Float32Array)),t.setAttribute(o,u)}return t}_assignVertexColorSpace(e,t){if(t!==mn)return;const n=new Ne;for(let i=0,o=e.count;i<o;i++)n.fromBufferAttribute(e,i).convertSRGBToLinear(),e.setXYZ(i,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new sl(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((i,o)=>{n.load(e,i,void 0,o)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(n=>{const i=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const o=MP.toString(),c=["/* draco decoder */",i,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
|
|
3824
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([c]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(o){const c=o.data;switch(c.type){case"decode":i._callbacks[c.id].resolve(c);break;case"error":i._callbacks[c.id].reject(c);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+c.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,o){return i._taskLoad>o._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function MP(){let s,e;onmessage=function(c){const l=c.data;switch(l.type){case"init":s=l.decoderConfig,e=new Promise(function(d){s.onModuleLoaded=function(p){d({draco:p})},DracoDecoderModule(s)});break;case"decode":const u=l.buffer,f=l.taskConfig;e.then(d=>{const p=d.draco,m=new p.Decoder;try{const v=t(p,m,new Int8Array(u),f),S=v.attributes.map(b=>b.array.buffer);v.index&&S.push(v.index.array.buffer),self.postMessage({type:"decode",id:l.id,geometry:v},S)}catch(v){console.error(v),self.postMessage({type:"error",id:l.id,error:v.message})}finally{p.destroy(m)}});break}};function t(c,l,u,f){const d=f.attributeIDs,p=f.attributeTypes;let m,v;const S=l.GetEncodedGeometryType(u);if(S===c.TRIANGULAR_MESH)m=new c.Mesh,v=l.DecodeArrayToMesh(u,u.byteLength,m);else if(S===c.POINT_CLOUD)m=new c.PointCloud,v=l.DecodeArrayToPointCloud(u,u.byteLength,m);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!v.ok()||m.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+v.error_msg());const b={index:null,attributes:[]};for(const x in d){const _=self[p[x]];let R,E;if(f.useUniqueIDs)E=d[x],R=l.GetAttributeByUniqueId(m,E);else{if(E=l.GetAttributeId(m,c[d[x]]),E===-1)continue;R=l.GetAttribute(m,E)}const L=i(c,l,m,x,_,R);x==="color"&&(L.vertexColorSpace=f.vertexColorSpace),b.attributes.push(L)}return S===c.TRIANGULAR_MESH&&(b.index=n(c,l,m)),c.destroy(m),b}function n(c,l,u){const d=u.num_faces()*3,p=d*4,m=c._malloc(p);l.GetTrianglesUInt32Array(u,p,m);const v=new Uint32Array(c.HEAPF32.buffer,m,d).slice();return c._free(m),{array:v,itemSize:1}}function i(c,l,u,f,d,p){const m=p.num_components(),S=u.num_points()*m,b=S*d.BYTES_PER_ELEMENT,x=o(c,d),_=c._malloc(b);l.GetAttributeDataArrayForAllPoints(u,p,x,b,_);const R=new d(c.HEAPF32.buffer,_,S).slice();return c._free(_),{name:f,array:R,itemSize:m}}function o(c,l){switch(l){case Float32Array:return c.DT_FLOAT32;case Int8Array:return c.DT_INT8;case Int16Array:return c.DT_INT16;case Int32Array:return c.DT_INT32;case Uint8Array:return c.DT_UINT8;case Uint16Array:return c.DT_UINT16;case Uint32Array:return c.DT_UINT32}}}function wg(s,e){if(e===Cb)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),s;if(e===Eu||e===$g){let t=s.getIndex();if(t===null){const c=[],l=s.getAttribute("position");if(l!==void 0){for(let u=0;u<l.count;u++)c.push(u);s.setIndex(c),t=s.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),s}const n=t.count-2,i=[];if(e===Eu)for(let c=1;c<=n;c++)i.push(t.getX(0)),i.push(t.getX(c)),i.push(t.getX(c+1));else for(let c=0;c<n;c++)c%2===0?(i.push(t.getX(c)),i.push(t.getX(c+1)),i.push(t.getX(c+2))):(i.push(t.getX(c+2)),i.push(t.getX(c+1)),i.push(t.getX(c)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=s.clone();return o.setIndex(i),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),s}class EP extends ps{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new RP(t)}),this.register(function(t){return new FP(t)}),this.register(function(t){return new BP(t)}),this.register(function(t){return new zP(t)}),this.register(function(t){return new PP(t)}),this.register(function(t){return new LP(t)}),this.register(function(t){return new IP(t)}),this.register(function(t){return new DP(t)}),this.register(function(t){return new wP(t)}),this.register(function(t){return new UP(t)}),this.register(function(t){return new CP(t)}),this.register(function(t){return new NP(t)}),this.register(function(t){return new OP(t)}),this.register(function(t){return new TP(t)}),this.register(function(t){return new kP(t)}),this.register(function(t){return new HP(t)})}load(e,t,n,i){const o=this;let c;if(this.resourcePath!=="")c=this.resourcePath;else if(this.path!==""){const f=da.extractUrlBase(e);c=da.resolveURL(f,this.path)}else c=da.extractUrlBase(e);this.manager.itemStart(e);const l=function(f){i?i(f):console.error(f),o.manager.itemError(e),o.manager.itemEnd(e)},u=new sl(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(this.withCredentials),u.load(e,function(f){try{o.parse(f,c,function(d){t(d),o.manager.itemEnd(e)},l)}catch(d){l(d)}},n,l)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let o;const c={},l={},u=new TextDecoder;if(typeof e=="string")o=JSON.parse(e);else if(e instanceof ArrayBuffer)if(u.decode(new Uint8Array(e,0,4))===L_){try{c[xt.KHR_BINARY_GLTF]=new GP(e)}catch(p){i&&i(p);return}o=JSON.parse(c[xt.KHR_BINARY_GLTF].content)}else o=JSON.parse(u.decode(e));else o=e;if(o.asset===void 0||o.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const f=new tL(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});f.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const p=this.pluginCallbacks[d](f);p.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),l[p.name]=p,c[p.name]=!0}if(o.extensionsUsed)for(let d=0;d<o.extensionsUsed.length;++d){const p=o.extensionsUsed[d],m=o.extensionsRequired||[];switch(p){case xt.KHR_MATERIALS_UNLIT:c[p]=new AP;break;case xt.KHR_DRACO_MESH_COMPRESSION:c[p]=new VP(o,this.dracoLoader);break;case xt.KHR_TEXTURE_TRANSFORM:c[p]=new WP;break;case xt.KHR_MESH_QUANTIZATION:c[p]=new XP;break;default:m.indexOf(p)>=0&&l[p]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}f.setExtensions(c),f.setPlugins(l),f.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,o){n.parse(e,t,i,o)})}}function bP(){let s={};return{get:function(e){return s[e]},add:function(e,t){s[e]=t},remove:function(e){delete s[e]},removeAll:function(){s={}}}}const xt={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class TP{constructor(e){this.parser=e,this.name=xt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const o=t[n];o.extensions&&o.extensions[this.name]&&o.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,o.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const o=t.json,u=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let f;const d=new Ne(16777215);u.color!==void 0&&d.setRGB(u.color[0],u.color[1],u.color[2],gn);const p=u.range!==void 0?u.range:0;switch(u.type){case"directional":f=new ef(d),f.target.position.set(0,0,-1),f.add(f.target);break;case"point":f=new A_(d),f.distance=p;break;case"spot":f=new FC(d),f.distance=p,u.spot=u.spot||{},u.spot.innerConeAngle=u.spot.innerConeAngle!==void 0?u.spot.innerConeAngle:0,u.spot.outerConeAngle=u.spot.outerConeAngle!==void 0?u.spot.outerConeAngle:Math.PI/4,f.angle=u.spot.outerConeAngle,f.penumbra=1-u.spot.innerConeAngle/u.spot.outerConeAngle,f.target.position.set(0,0,-1),f.add(f.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+u.type)}return f.position.set(0,0,0),f.decay=2,Lr(f,u),u.intensity!==void 0&&(f.intensity=u.intensity),f.name=t.createUniqueName(u.name||"light_"+e),i=Promise.resolve(f),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,o=n.json.nodes[e],l=(o.extensions&&o.extensions[this.name]||{}).light;return l===void 0?null:this._loadLight(l).then(function(u){return n._getNodeRef(t.cache,l,u)})}}class AP{constructor(){this.name=xt.KHR_MATERIALS_UNLIT}getMaterialType(){return Ni}extendParams(e,t,n){const i=[];e.color=new Ne(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const c=o.baseColorFactor;e.color.setRGB(c[0],c[1],c[2],gn),e.opacity=c[3]}o.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",o.baseColorTexture,mn))}return Promise.all(i)}}class wP{constructor(e){this.parser=e,this.name=xt.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=i.extensions[this.name].emissiveStrength;return o!==void 0&&(t.emissiveIntensity=o),Promise.resolve()}}class RP{constructor(e){this.parser=e,this.name=xt.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:hr}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],c=i.extensions[this.name];if(c.clearcoatFactor!==void 0&&(t.clearcoat=c.clearcoatFactor),c.clearcoatTexture!==void 0&&o.push(n.assignTexture(t,"clearcoatMap",c.clearcoatTexture)),c.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=c.clearcoatRoughnessFactor),c.clearcoatRoughnessTexture!==void 0&&o.push(n.assignTexture(t,"clearcoatRoughnessMap",c.clearcoatRoughnessTexture)),c.clearcoatNormalTexture!==void 0&&(o.push(n.assignTexture(t,"clearcoatNormalMap",c.clearcoatNormalTexture)),c.clearcoatNormalTexture.scale!==void 0)){const l=c.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Ie(l,l)}return Promise.all(o)}}class CP{constructor(e){this.parser=e,this.name=xt.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:hr}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],c=i.extensions[this.name];return c.iridescenceFactor!==void 0&&(t.iridescence=c.iridescenceFactor),c.iridescenceTexture!==void 0&&o.push(n.assignTexture(t,"iridescenceMap",c.iridescenceTexture)),c.iridescenceIor!==void 0&&(t.iridescenceIOR=c.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),c.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=c.iridescenceThicknessMinimum),c.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=c.iridescenceThicknessMaximum),c.iridescenceThicknessTexture!==void 0&&o.push(n.assignTexture(t,"iridescenceThicknessMap",c.iridescenceThicknessTexture)),Promise.all(o)}}class PP{constructor(e){this.parser=e,this.name=xt.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:hr}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new Ne(0,0,0),t.sheenRoughness=0,t.sheen=1;const c=i.extensions[this.name];if(c.sheenColorFactor!==void 0){const l=c.sheenColorFactor;t.sheenColor.setRGB(l[0],l[1],l[2],gn)}return c.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=c.sheenRoughnessFactor),c.sheenColorTexture!==void 0&&o.push(n.assignTexture(t,"sheenColorMap",c.sheenColorTexture,mn)),c.sheenRoughnessTexture!==void 0&&o.push(n.assignTexture(t,"sheenRoughnessMap",c.sheenRoughnessTexture)),Promise.all(o)}}class LP{constructor(e){this.parser=e,this.name=xt.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:hr}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],c=i.extensions[this.name];return c.transmissionFactor!==void 0&&(t.transmission=c.transmissionFactor),c.transmissionTexture!==void 0&&o.push(n.assignTexture(t,"transmissionMap",c.transmissionTexture)),Promise.all(o)}}class IP{constructor(e){this.parser=e,this.name=xt.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:hr}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],c=i.extensions[this.name];t.thickness=c.thicknessFactor!==void 0?c.thicknessFactor:0,c.thicknessTexture!==void 0&&o.push(n.assignTexture(t,"thicknessMap",c.thicknessTexture)),t.attenuationDistance=c.attenuationDistance||1/0;const l=c.attenuationColor||[1,1,1];return t.attenuationColor=new Ne().setRGB(l[0],l[1],l[2],gn),Promise.all(o)}}class DP{constructor(e){this.parser=e,this.name=xt.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:hr}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=i.extensions[this.name];return t.ior=o.ior!==void 0?o.ior:1.5,Promise.resolve()}}class UP{constructor(e){this.parser=e,this.name=xt.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:hr}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],c=i.extensions[this.name];t.specularIntensity=c.specularFactor!==void 0?c.specularFactor:1,c.specularTexture!==void 0&&o.push(n.assignTexture(t,"specularIntensityMap",c.specularTexture));const l=c.specularColorFactor||[1,1,1];return t.specularColor=new Ne().setRGB(l[0],l[1],l[2],gn),c.specularColorTexture!==void 0&&o.push(n.assignTexture(t,"specularColorMap",c.specularColorTexture,mn)),Promise.all(o)}}class OP{constructor(e){this.parser=e,this.name=xt.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:hr}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],c=i.extensions[this.name];return t.bumpScale=c.bumpFactor!==void 0?c.bumpFactor:1,c.bumpTexture!==void 0&&o.push(n.assignTexture(t,"bumpMap",c.bumpTexture)),Promise.all(o)}}class NP{constructor(e){this.parser=e,this.name=xt.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:hr}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],c=i.extensions[this.name];return c.anisotropyStrength!==void 0&&(t.anisotropy=c.anisotropyStrength),c.anisotropyRotation!==void 0&&(t.anisotropyRotation=c.anisotropyRotation),c.anisotropyTexture!==void 0&&o.push(n.assignTexture(t,"anisotropyMap",c.anisotropyTexture)),Promise.all(o)}}class FP{constructor(e){this.parser=e,this.name=xt.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const o=i.extensions[this.name],c=t.options.ktx2Loader;if(!c){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,c)}}class BP{constructor(e){this.parser=e,this.name=xt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,o=i.textures[e];if(!o.extensions||!o.extensions[t])return null;const c=o.extensions[t],l=i.images[c.source];let u=n.textureLoader;if(l.uri){const f=n.options.manager.getHandler(l.uri);f!==null&&(u=f)}return this.detectSupport().then(function(f){if(f)return n.loadTextureImage(e,c.source,u);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class zP{constructor(e){this.parser=e,this.name=xt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,o=i.textures[e];if(!o.extensions||!o.extensions[t])return null;const c=o.extensions[t],l=i.images[c.source];let u=n.textureLoader;if(l.uri){const f=n.options.manager.getHandler(l.uri);f!==null&&(u=f)}return this.detectSupport().then(function(f){if(f)return n.loadTextureImage(e,c.source,u);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class kP{constructor(e){this.name=xt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],o=this.parser.getDependency("buffer",i.buffer),c=this.parser.options.meshoptDecoder;if(!c||!c.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(l){const u=i.byteOffset||0,f=i.byteLength||0,d=i.count,p=i.byteStride,m=new Uint8Array(l,u,f);return c.decodeGltfBufferAsync?c.decodeGltfBufferAsync(d,p,m,i.mode,i.filter).then(function(v){return v.buffer}):c.ready.then(function(){const v=new ArrayBuffer(d*p);return c.decodeGltfBuffer(new Uint8Array(v),d,p,m,i.mode,i.filter),v})})}else return null}}class HP{constructor(e){this.name=xt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const f of i.primitives)if(f.mode!==li.TRIANGLES&&f.mode!==li.TRIANGLE_STRIP&&f.mode!==li.TRIANGLE_FAN&&f.mode!==void 0)return null;const c=n.extensions[this.name].attributes,l=[],u={};for(const f in c)l.push(this.parser.getDependency("accessor",c[f]).then(d=>(u[f]=d,u[f])));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then(f=>{const d=f.pop(),p=d.isGroup?d.children:[d],m=f[0].count,v=[];for(const S of p){const b=new $e,x=new U,_=new rn,R=new U(1,1,1),E=new gC(S.geometry,S.material,m);for(let L=0;L<m;L++)u.TRANSLATION&&x.fromBufferAttribute(u.TRANSLATION,L),u.ROTATION&&_.fromBufferAttribute(u.ROTATION,L),u.SCALE&&R.fromBufferAttribute(u.SCALE,L),E.setMatrixAt(L,b.compose(x,_,R));for(const L in u)if(L==="_COLOR_0"){const B=u[L];E.instanceColor=new Au(B.array,B.itemSize,B.normalized)}else L!=="TRANSLATION"&&L!=="ROTATION"&&L!=="SCALE"&&S.geometry.setAttribute(L,u[L]);_t.prototype.copy.call(E,S),this.parser.assignFinalMaterial(E),v.push(E)}return d.isGroup?(d.clear(),d.add(...v),d):v[0]}))}}const L_="glTF",ia=12,Rg={JSON:1313821514,BIN:5130562};class GP{constructor(e){this.name=xt.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,ia),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==L_)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-ia,o=new DataView(e,ia);let c=0;for(;c<i;){const l=o.getUint32(c,!0);c+=4;const u=o.getUint32(c,!0);if(c+=4,u===Rg.JSON){const f=new Uint8Array(e,ia+c,l);this.content=n.decode(f)}else if(u===Rg.BIN){const f=ia+c;this.body=e.slice(f,f+l)}c+=l}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class VP{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=xt.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,o=e.extensions[this.name].bufferView,c=e.extensions[this.name].attributes,l={},u={},f={};for(const d in c){const p=Iu[d]||d.toLowerCase();l[p]=c[d]}for(const d in e.attributes){const p=Iu[d]||d.toLowerCase();if(c[d]!==void 0){const m=n.accessors[e.attributes[d]],v=ao[m.componentType];f[p]=v.name,u[p]=m.normalized===!0}}return t.getDependency("bufferView",o).then(function(d){return new Promise(function(p,m){i.decodeDracoFile(d,function(v){for(const S in v.attributes){const b=v.attributes[S],x=u[S];x!==void 0&&(b.normalized=x)}p(v)},l,f,gn,m)})})}}class WP{constructor(){this.name=xt.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class XP{constructor(){this.name=xt.KHR_MESH_QUANTIZATION}}class I_ extends Sa{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,o=e*i*3+i;for(let c=0;c!==i;c++)t[c]=n[o+c];return t}interpolate_(e,t,n,i){const o=this.resultBuffer,c=this.sampleValues,l=this.valueSize,u=l*2,f=l*3,d=i-t,p=(n-t)/d,m=p*p,v=m*p,S=e*f,b=S-f,x=-2*v+3*m,_=v-m,R=1-x,E=_-m+p;for(let L=0;L!==l;L++){const B=c[b+L+l],N=c[b+L+u]*d,D=c[S+L+l],k=c[S+L]*d;o[L]=R*B+E*N+x*D+_*k}return o}}const YP=new rn;class jP extends I_{interpolate_(e,t,n,i){const o=super.interpolate_(e,t,n,i);return YP.fromArray(o).normalize().toArray(o),o}}const li={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},ao={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Cg={9728:Nn,9729:Hn,9984:Hg,9985:jc,9986:ra,9987:or},Pg={33071:Dr,33648:Qc,10497:ho},pu={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Iu={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Cr={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},qP={CUBICSPLINE:void 0,LINEAR:fo,STEP:ga},mu={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function KP(s){return s.DefaultMaterial===void 0&&(s.DefaultMaterial=new So({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Fi})),s.DefaultMaterial}function ns(s,e,t){for(const n in t.extensions)s[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function Lr(s,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(s.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function ZP(s,e,t){let n=!1,i=!1,o=!1;for(let f=0,d=e.length;f<d;f++){const p=e[f];if(p.POSITION!==void 0&&(n=!0),p.NORMAL!==void 0&&(i=!0),p.COLOR_0!==void 0&&(o=!0),n&&i&&o)break}if(!n&&!i&&!o)return Promise.resolve(s);const c=[],l=[],u=[];for(let f=0,d=e.length;f<d;f++){const p=e[f];if(n){const m=p.POSITION!==void 0?t.getDependency("accessor",p.POSITION):s.attributes.position;c.push(m)}if(i){const m=p.NORMAL!==void 0?t.getDependency("accessor",p.NORMAL):s.attributes.normal;l.push(m)}if(o){const m=p.COLOR_0!==void 0?t.getDependency("accessor",p.COLOR_0):s.attributes.color;u.push(m)}}return Promise.all([Promise.all(c),Promise.all(l),Promise.all(u)]).then(function(f){const d=f[0],p=f[1],m=f[2];return n&&(s.morphAttributes.position=d),i&&(s.morphAttributes.normal=p),o&&(s.morphAttributes.color=m),s.morphTargetsRelative=!0,s})}function $P(s,e){if(s.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)s.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(s.morphTargetInfluences.length===t.length){s.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)s.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function JP(s){let e;const t=s.extensions&&s.extensions[xt.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+gu(t.attributes):e=s.indices+":"+gu(s.attributes)+":"+s.mode,s.targets!==void 0)for(let n=0,i=s.targets.length;n<i;n++)e+=":"+gu(s.targets[n]);return e}function gu(s){let e="";const t=Object.keys(s).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+s[t[n]]+";";return e}function Du(s){switch(s){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function QP(s){return s.search(/\.jpe?g($|\?)/i)>0||s.search(/^data\:image\/jpeg/)===0?"image/jpeg":s.search(/\.webp($|\?)/i)>0||s.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const eL=new $e;class tL{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new bP,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=!1,o=-1;typeof navigator<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,o=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||i&&o<98?this.textureLoader=new UC(this.options.manager):this.textureLoader=new VC(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new sl(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(c){return c._markDefs&&c._markDefs()}),Promise.all(this._invokeAll(function(c){return c.beforeRoot&&c.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(c){const l={scene:c[0][i.scene||0],scenes:c[0],animations:c[1],cameras:c[2],asset:i.asset,parser:n,userData:{}};return ns(o,l,i),Lr(l,i),Promise.all(n._invokeAll(function(u){return u.afterRoot&&u.afterRoot(l)})).then(function(){for(const u of l.scenes)u.updateMatrixWorld();e(l)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,o=t.length;i<o;i++){const c=t[i].joints;for(let l=0,u=c.length;l<u;l++)e[c[l]].isBone=!0}for(let i=0,o=e.length;i<o;i++){const c=e[i];c.mesh!==void 0&&(this._addNodeRef(this.meshCache,c.mesh),c.skin!==void 0&&(n[c.mesh].isSkinnedMesh=!0)),c.camera!==void 0&&this._addNodeRef(this.cameraCache,c.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),o=(c,l)=>{const u=this.associations.get(c);u!=null&&this.associations.set(l,u);for(const[f,d]of c.children.entries())o(d,l.children[f])};return o(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const o=e(t[i]);o&&n.push(o)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(o){return o.loadNode&&o.loadNode(t)});break;case"mesh":i=this._invokeOne(function(o){return o.loadMesh&&o.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(o){return o.loadBufferView&&o.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(o){return o.loadMaterial&&o.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(o){return o.loadTexture&&o.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(o){return o.loadAnimation&&o.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(o){return o!=this&&o.getDependency&&o.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(o,c){return n.getDependency(e,c)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[xt.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(o,c){n.load(da.resolveURL(t.uri,i.path),o,void 0,function(){c(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const i=t.byteLength||0,o=t.byteOffset||0;return n.slice(o,o+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const c=pu[i.type],l=ao[i.componentType],u=i.normalized===!0,f=new l(i.count*c);return Promise.resolve(new cn(f,c,u))}const o=[];return i.bufferView!==void 0?o.push(this.getDependency("bufferView",i.bufferView)):o.push(null),i.sparse!==void 0&&(o.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(o).then(function(c){const l=c[0],u=pu[i.type],f=ao[i.componentType],d=f.BYTES_PER_ELEMENT,p=d*u,m=i.byteOffset||0,v=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,S=i.normalized===!0;let b,x;if(v&&v!==p){const _=Math.floor(m/v),R="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+_+":"+i.count;let E=t.cache.get(R);E||(b=new f(l,_*v,i.count*v/d),E=new v_(b,v/d),t.cache.add(R,E)),x=new va(E,u,m%v/d,S)}else l===null?b=new f(i.count*u):b=new f(l,m,i.count*u),x=new cn(b,u,S);if(i.sparse!==void 0){const _=pu.SCALAR,R=ao[i.sparse.indices.componentType],E=i.sparse.indices.byteOffset||0,L=i.sparse.values.byteOffset||0,B=new R(c[1],E,i.sparse.count*_),N=new f(c[2],L,i.sparse.count*u);l!==null&&(x=new cn(x.array.slice(),x.itemSize,x.normalized));for(let D=0,k=B.length;D<k;D++){const C=B[D];if(x.setX(C,N[D*u]),u>=2&&x.setY(C,N[D*u+1]),u>=3&&x.setZ(C,N[D*u+2]),u>=4&&x.setW(C,N[D*u+3]),u>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return x})}loadTexture(e){const t=this.json,n=this.options,o=t.textures[e].source,c=t.images[o];let l=this.textureLoader;if(c.uri){const u=n.manager.getHandler(c.uri);u!==null&&(l=u)}return this.loadTextureImage(e,o,l)}loadTextureImage(e,t,n){const i=this,o=this.json,c=o.textures[e],l=o.images[t],u=(l.uri||l.bufferView)+":"+c.sampler;if(this.textureCache[u])return this.textureCache[u];const f=this.loadImageSource(t,n).then(function(d){d.flipY=!1,d.name=c.name||l.name||"",d.name===""&&typeof l.uri=="string"&&l.uri.startsWith("data:image/")===!1&&(d.name=l.uri);const m=(o.samplers||{})[c.sampler]||{};return d.magFilter=Cg[m.magFilter]||Hn,d.minFilter=Cg[m.minFilter]||or,d.wrapS=Pg[m.wrapS]||ho,d.wrapT=Pg[m.wrapT]||ho,i.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[u]=f,f}loadImageSource(e,t){const n=this,i=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(p=>p.clone());const c=i.images[e],l=self.URL||self.webkitURL;let u=c.uri||"",f=!1;if(c.bufferView!==void 0)u=n.getDependency("bufferView",c.bufferView).then(function(p){f=!0;const m=new Blob([p],{type:c.mimeType});return u=l.createObjectURL(m),u});else if(c.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(u).then(function(p){return new Promise(function(m,v){let S=m;t.isImageBitmapLoader===!0&&(S=function(b){const x=new an(b);x.needsUpdate=!0,m(x)}),t.load(da.resolveURL(p,o.path),S,void 0,v)})}).then(function(p){return f===!0&&l.revokeObjectURL(u),p.userData.mimeType=c.mimeType||QP(c.uri),p}).catch(function(p){throw console.error("THREE.GLTFLoader: Couldn't load texture",u),p});return this.sourceCache[e]=d,d}assignTexture(e,t,n,i){const o=this;return this.getDependency("texture",n.index).then(function(c){if(!c)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(c=c.clone(),c.channel=n.texCoord),o.extensions[xt.KHR_TEXTURE_TRANSFORM]){const l=n.extensions!==void 0?n.extensions[xt.KHR_TEXTURE_TRANSFORM]:void 0;if(l){const u=o.associations.get(c);c=o.extensions[xt.KHR_TEXTURE_TRANSFORM].extendTexture(c,l),o.associations.set(c,u)}}return i!==void 0&&(c.colorSpace=i),e[t]=c,c})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,c=t.attributes.normal===void 0;if(e.isPoints){const l="PointsMaterial:"+n.uuid;let u=this.cache.get(l);u||(u=new E_,ui.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,u.sizeAttenuation=!1,this.cache.add(l,u)),n=u}else if(e.isLine){const l="LineBasicMaterial:"+n.uuid;let u=this.cache.get(l);u||(u=new yo,ui.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,this.cache.add(l,u)),n=u}if(i||o||c){let l="ClonedMaterial:"+n.uuid+":";i&&(l+="derivative-tangents:"),o&&(l+="vertex-colors:"),c&&(l+="flat-shading:");let u=this.cache.get(l);u||(u=n.clone(),o&&(u.vertexColors=!0),c&&(u.flatShading=!0),i&&(u.normalScale&&(u.normalScale.y*=-1),u.clearcoatNormalScale&&(u.clearcoatNormalScale.y*=-1)),this.cache.add(l,u),this.associations.set(u,this.associations.get(n))),n=u}e.material=n}getMaterialType(){return So}loadMaterial(e){const t=this,n=this.json,i=this.extensions,o=n.materials[e];let c;const l={},u=o.extensions||{},f=[];if(u[xt.KHR_MATERIALS_UNLIT]){const p=i[xt.KHR_MATERIALS_UNLIT];c=p.getMaterialType(),f.push(p.extendParams(l,o,t))}else{const p=o.pbrMetallicRoughness||{};if(l.color=new Ne(1,1,1),l.opacity=1,Array.isArray(p.baseColorFactor)){const m=p.baseColorFactor;l.color.setRGB(m[0],m[1],m[2],gn),l.opacity=m[3]}p.baseColorTexture!==void 0&&f.push(t.assignTexture(l,"map",p.baseColorTexture,mn)),l.metalness=p.metallicFactor!==void 0?p.metallicFactor:1,l.roughness=p.roughnessFactor!==void 0?p.roughnessFactor:1,p.metallicRoughnessTexture!==void 0&&(f.push(t.assignTexture(l,"metalnessMap",p.metallicRoughnessTexture)),f.push(t.assignTexture(l,"roughnessMap",p.metallicRoughnessTexture))),c=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(e)}),f.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(e,l)})))}o.doubleSided===!0&&(l.side=yi);const d=o.alphaMode||mu.OPAQUE;if(d===mu.BLEND?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,d===mu.MASK&&(l.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&c!==Ni&&(f.push(t.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new Ie(1,1),o.normalTexture.scale!==void 0)){const p=o.normalTexture.scale;l.normalScale.set(p,p)}if(o.occlusionTexture!==void 0&&c!==Ni&&(f.push(t.assignTexture(l,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(l.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&c!==Ni){const p=o.emissiveFactor;l.emissive=new Ne().setRGB(p[0],p[1],p[2],gn)}return o.emissiveTexture!==void 0&&c!==Ni&&f.push(t.assignTexture(l,"emissiveMap",o.emissiveTexture,mn)),Promise.all(f).then(function(){const p=new c(l);return o.name&&(p.name=o.name),Lr(p,o),t.associations.set(p,{materials:e}),o.extensions&&ns(i,p,o),p})}createUniqueName(e){const t=It.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function o(l){return n[xt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(l,t).then(function(u){return Lg(u,l,t)})}const c=[];for(let l=0,u=e.length;l<u;l++){const f=e[l],d=JP(f),p=i[d];if(p)c.push(p.promise);else{let m;f.extensions&&f.extensions[xt.KHR_DRACO_MESH_COMPRESSION]?m=o(f):m=Lg(new $t,f,t),i[d]={primitive:f,promise:m},c.push(m)}}return Promise.all(c)}loadMesh(e){const t=this,n=this.json,i=this.extensions,o=n.meshes[e],c=o.primitives,l=[];for(let u=0,f=c.length;u<f;u++){const d=c[u].material===void 0?KP(this.cache):this.getDependency("material",c[u].material);l.push(d)}return l.push(t.loadGeometries(c)),Promise.all(l).then(function(u){const f=u.slice(0,u.length-1),d=u[u.length-1],p=[];for(let v=0,S=d.length;v<S;v++){const b=d[v],x=c[v];let _;const R=f[v];if(x.mode===li.TRIANGLES||x.mode===li.TRIANGLE_STRIP||x.mode===li.TRIANGLE_FAN||x.mode===void 0)_=o.isSkinnedMesh===!0?new dC(b,R):new ye(b,R),_.isSkinnedMesh===!0&&_.normalizeSkinWeights(),x.mode===li.TRIANGLE_STRIP?_.geometry=wg(_.geometry,$g):x.mode===li.TRIANGLE_FAN&&(_.geometry=wg(_.geometry,Eu));else if(x.mode===li.LINES)_=new Zu(b,R);else if(x.mode===li.LINE_STRIP)_=new hi(b,R);else if(x.mode===li.LINE_LOOP)_=new _C(b,R);else if(x.mode===li.POINTS)_=new vC(b,R);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+x.mode);Object.keys(_.geometry.morphAttributes).length>0&&$P(_,o),_.name=t.createUniqueName(o.name||"mesh_"+e),Lr(_,o),x.extensions&&ns(i,_,x),t.assignFinalMaterial(_),p.push(_)}for(let v=0,S=p.length;v<S;v++)t.associations.set(p[v],{meshes:e,primitives:v});if(p.length===1)return o.extensions&&ns(i,p[0],o),p[0];const m=new Ur;o.extensions&&ns(i,m,o),t.associations.set(m,{meshes:e});for(let v=0,S=p.length;v<S;v++)m.add(p[v]);return m})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new On(Bi.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new ul(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Lr(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,o=t.joints.length;i<o;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){const o=i.pop(),c=i,l=[],u=[];for(let f=0,d=c.length;f<d;f++){const p=c[f];if(p){l.push(p);const m=new $e;o!==null&&m.fromArray(o.array,f*16),u.push(m)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[f])}return new Ku(l,u)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],o=i.name?i.name:"animation_"+e,c=[],l=[],u=[],f=[],d=[];for(let p=0,m=i.channels.length;p<m;p++){const v=i.channels[p],S=i.samplers[v.sampler],b=v.target,x=b.node,_=i.parameters!==void 0?i.parameters[S.input]:S.input,R=i.parameters!==void 0?i.parameters[S.output]:S.output;b.node!==void 0&&(c.push(this.getDependency("node",x)),l.push(this.getDependency("accessor",_)),u.push(this.getDependency("accessor",R)),f.push(S),d.push(b))}return Promise.all([Promise.all(c),Promise.all(l),Promise.all(u),Promise.all(f),Promise.all(d)]).then(function(p){const m=p[0],v=p[1],S=p[2],b=p[3],x=p[4],_=[];for(let R=0,E=m.length;R<E;R++){const L=m[R],B=v[R],N=S[R],D=b[R],k=x[R];if(L===void 0)continue;L.updateMatrix&&L.updateMatrix();const C=n._createAnimationTracks(L,B,N,D,k);if(C)for(let T=0;T<C.length;T++)_.push(C[T])}return new wC(o,void 0,_)})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(o){const c=n._getNodeRef(n.meshCache,i.mesh,o);return i.weights!==void 0&&c.traverse(function(l){if(l.isMesh)for(let u=0,f=i.weights.length;u<f;u++)l.morphTargetInfluences[u]=i.weights[u]}),c})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],o=n._loadNodeShallow(e),c=[],l=i.children||[];for(let f=0,d=l.length;f<d;f++)c.push(n.getDependency("node",l[f]));const u=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([o,Promise.all(c),u]).then(function(f){const d=f[0],p=f[1],m=f[2];m!==null&&d.traverse(function(v){v.isSkinnedMesh&&v.bind(m,eL)});for(let v=0,S=p.length;v<S;v++)d.add(p[v]);return d})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const o=t.nodes[e],c=o.name?i.createUniqueName(o.name):"",l=[],u=i._invokeOne(function(f){return f.createNodeMesh&&f.createNodeMesh(e)});return u&&l.push(u),o.camera!==void 0&&l.push(i.getDependency("camera",o.camera).then(function(f){return i._getNodeRef(i.cameraCache,o.camera,f)})),i._invokeAll(function(f){return f.createNodeAttachment&&f.createNodeAttachment(e)}).forEach(function(f){l.push(f)}),this.nodeCache[e]=Promise.all(l).then(function(f){let d;if(o.isBone===!0?d=new S_:f.length>1?d=new Ur:f.length===1?d=f[0]:d=new _t,d!==f[0])for(let p=0,m=f.length;p<m;p++)d.add(f[p]);if(o.name&&(d.userData.name=o.name,d.name=c),Lr(d,o),o.extensions&&ns(n,d,o),o.matrix!==void 0){const p=new $e;p.fromArray(o.matrix),d.applyMatrix4(p)}else o.translation!==void 0&&d.position.fromArray(o.translation),o.rotation!==void 0&&d.quaternion.fromArray(o.rotation),o.scale!==void 0&&d.scale.fromArray(o.scale);return i.associations.has(d)||i.associations.set(d,{}),i.associations.get(d).nodes=e,d}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,o=new Ur;n.name&&(o.name=i.createUniqueName(n.name)),Lr(o,n),n.extensions&&ns(t,o,n);const c=n.nodes||[],l=[];for(let u=0,f=c.length;u<f;u++)l.push(i.getDependency("node",c[u]));return Promise.all(l).then(function(u){for(let d=0,p=u.length;d<p;d++)o.add(u[d]);const f=d=>{const p=new Map;for(const[m,v]of i.associations)(m instanceof ui||m instanceof an)&&p.set(m,v);return d.traverse(m=>{const v=i.associations.get(m);v!=null&&p.set(m,v)}),p};return i.associations=f(o),o})}_createAnimationTracks(e,t,n,i,o){const c=[],l=e.name?e.name:e.uuid,u=[];Cr[o.path]===Cr.weights?e.traverse(function(m){m.morphTargetInfluences&&u.push(m.name?m.name:m.uuid)}):u.push(l);let f;switch(Cr[o.path]){case Cr.weights:f=go;break;case Cr.rotation:f=us;break;case Cr.position:case Cr.scale:f=_o;break;default:switch(n.itemSize){case 1:f=go;break;case 2:case 3:default:f=_o;break}break}const d=i.interpolation!==void 0?qP[i.interpolation]:fo,p=this._getArrayFromAccessor(n);for(let m=0,v=u.length;m<v;m++){const S=new f(u[m]+"."+Cr[o.path],t.array,p,d);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(S),c.push(S)}return c}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=Du(t.constructor),i=new Float32Array(t.length);for(let o=0,c=t.length;o<c;o++)i[o]=t[o]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const i=this instanceof us?jP:I_;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function nL(s,e,t){const n=e.attributes,i=new Ai;if(n.POSITION!==void 0){const l=t.json.accessors[n.POSITION],u=l.min,f=l.max;if(u!==void 0&&f!==void 0){if(i.set(new U(u[0],u[1],u[2]),new U(f[0],f[1],f[2])),l.normalized){const d=Du(ao[l.componentType]);i.min.multiplyScalar(d),i.max.multiplyScalar(d)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const o=e.targets;if(o!==void 0){const l=new U,u=new U;for(let f=0,d=o.length;f<d;f++){const p=o[f];if(p.POSITION!==void 0){const m=t.json.accessors[p.POSITION],v=m.min,S=m.max;if(v!==void 0&&S!==void 0){if(u.setX(Math.max(Math.abs(v[0]),Math.abs(S[0]))),u.setY(Math.max(Math.abs(v[1]),Math.abs(S[1]))),u.setZ(Math.max(Math.abs(v[2]),Math.abs(S[2]))),m.normalized){const b=Du(ao[m.componentType]);u.multiplyScalar(b)}l.max(u)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(l)}s.boundingBox=i;const c=new Hi;i.getCenter(c.center),c.radius=i.min.distanceTo(i.max)/2,s.boundingSphere=c}function Lg(s,e,t){const n=e.attributes,i=[];function o(c,l){return t.getDependency("accessor",c).then(function(u){s.setAttribute(l,u)})}for(const c in n){const l=Iu[c]||c.toLowerCase();l in s.attributes||i.push(o(n[c],l))}if(e.indices!==void 0&&!s.index){const c=t.getDependency("accessor",e.indices).then(function(l){s.setIndex(l)});i.push(c)}return Ct.workingColorSpace!==gn&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ct.workingColorSpace}" not supported.`),Lr(s,e),nL(s,e,t),Promise.all(i).then(function(){return e.targets!==void 0?ZP(s,e.targets,t):s})}class iL{constructor(){this.progress=new Map,this.gltfloader=new EP,this.dracoloader=new SP,this.dracoloader.setDecoderPath("https://www.gstatic.com/draco/v1/decoders/"),this.gltfloader.setDRACOLoader(this.dracoloader)}async LoadGLTF(e){const t=n=>{this.progress.set(e,n.loaded/n.total)};return this.progress.set(e,0),new Promise((n,i)=>{this.gltfloader.loadAsync(e,t).then(n).catch(i)})}PollProgress(){let e=0;return this.progress.forEach(t=>{e+=t}),this.progress.size===0?1:e/this.progress.size}}class rL extends of{constructor(){super(),this.isDIVEPrimitive=!0,this._mesh=new ye,this._mesh.layers.mask=Jn,this._mesh.castShadow=!0,this._mesh.receiveShadow=!0,this._mesh.material=new So,this.add(this._mesh)}SetGeometry(e){const t=this.assembleGeometry(e);t&&(this._mesh.geometry=t,this._boundingBox.setFromObject(this._mesh))}SetMaterial(e){const t=this._mesh.material;e.vertexColors!==void 0&&(t.vertexColors=e.vertexColors),e.color!==void 0&&(t.color=new Ne(e.color)),e.map!==void 0&&(t.map=e.map),e.normalMap!==void 0&&(t.normalMap=e.normalMap),e.roughness!==void 0&&(t.roughness=e.roughness),e.roughnessMap!==void 0&&(t.roughnessMap=e.roughnessMap,t.roughnessMap&&(t.roughness=1)),e.metalness!==void 0&&(t.metalness=e.metalness),e.metalnessMap!==void 0&&(t.metalnessMap=e.metalnessMap,t.metalnessMap&&(t.metalness=0)),this._mesh&&(this._mesh.material=t)}PlaceOnFloor(){var i,o,c,l,u;const e=this.getWorldPosition(this._positionWorldBuffer),t=e.clone();(o=(i=this._mesh)==null?void 0:i.geometry)==null||o.computeBoundingBox();const n=(l=(c=this._mesh)==null?void 0:c.geometry)==null?void 0:l.boundingBox;!n||!this._mesh||(e.y=e.y-this._mesh.localToWorld(n.min.clone()).y,e.y!==t.y&&((u=Gn.get(this.userData.id))==null||u.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:e,rotation:this.rotation,scale:this.scale})))}DropIt(){if(!this.parent){console.warn("DIVEPrimitive: DropIt() called on a model that is not in the scene.",this);return}const e=this._boundingBox.min.y*this.scale.y,t=this.localToWorld(this._boundingBox.getCenter(new U).multiply(this.scale));t.y=e+this.position.y;const n=new dl(t,new U(0,-1,0));n.layers.mask=Jn;const i=n.intersectObjects(sf(this).Root.children,!0);if(i.length>0){const o=i[0].object;o.geometry.computeBoundingBox();const c=o.geometry.boundingBox,l=o.localToWorld(c.max.clone()),u=this.position.clone(),f=this.position.clone().setY(l.y).sub(new U(0,e,0));if(this.position.copy(f),this.position.y===u.y)return;this.onMove()}}assembleGeometry(e){switch(this._mesh.material.flatShading=!1,e.name.toLowerCase()){case"cylinder":return this.createCylinderGeometry(e);case"sphere":return this.createSphereGeometry(e);case"pyramid":return this._mesh.material.flatShading=!0,this.createPyramidGeometry(e);case"cube":case"box":return this.createBoxGeometry(e);case"cone":return this.createConeGeometry(e);case"wall":return this.createWallGeometry(e);case"plane":return this.createPlaneGeometry(e);default:return console.warn("DIVEPrimitive.assembleGeometry: Invalid geometry type:",e.name.toLowerCase()),null}}createCylinderGeometry(e){const t=new pn(e.width/2,e.width/2,e.height,64);return t.translate(0,e.height/2,0),t}createSphereGeometry(e){return new ya(e.width/2,256,256)}createPyramidGeometry(e){const t=new Float32Array([-e.width/2,0,-e.depth/2,e.width/2,0,-e.depth/2,e.width/2,0,e.depth/2,-e.width/2,0,e.depth/2,0,e.height,0]),n=new Uint16Array([0,1,2,0,2,3,0,4,1,1,4,2,2,4,3,3,4,0]),i=new $t;return i.setAttribute("position",new cn(t,3)),i.setIndex(new cn(n,1)),i.computeVertexNormals(),i.computeBoundingBox(),i.computeBoundingSphere(),i}createBoxGeometry(e){const t=new jt(e.width,e.height,e.depth);return t.translate(0,e.height/2,0),t}createConeGeometry(e){const t=new $u(e.width/2,e.height,256);return t.translate(0,e.height/2,0),t}createWallGeometry(e){const t=new jt(e.width,e.height,e.depth||.05,16);return t.translate(0,e.height/2,0),t}createPlaneGeometry(e){const t=new jt(e.width,e.height,e.depth);return t.translate(0,e.height/2,0),t}}class sL extends of{constructor(){super(),this.isDIVEGroup=!0,this.name="DIVEGroup",this._members=[],this._lines=[]}get members(){return this._members}SetPosition(e){super.SetPosition(e),this._members.forEach(t=>{"isDIVENode"in t&&t.onMove()})}SetLinesVisibility(e,t){if(!t){this._lines.forEach(i=>{i.visible=e});return}const n=this._members.indexOf(t);n!==-1&&(this._lines[n].visible=e)}attach(e){if(this._members.includes(e))return this;const t=this.createLine();return this.add(t),this._lines.push(t),super.attach(e),this._members.push(e),this.updateLineTo(t,e),this.SetLinesVisibility(!0,e),this}remove(e){const t=this._members.indexOf(e);if(t===-1)return this;const n=this._lines[t];return super.remove(n),this._lines.splice(t,1),super.remove(e),this._members.splice(t,1),this}UpdateLineTo(e){const t=this._members.indexOf(e);t!==-1&&this.updateLineTo(this._lines[t],e)}createLine(){const e=new $t,t=new yC({color:6710886,dashSize:.05,gapSize:.025}),n=new hi(e,t);return n.visible=!1,n}updateLineTo(e,t){e.geometry.setFromPoints([new U(0,0,0),t.position.clone()]),e.computeLineDistances()}}class af extends _t{constructor(){super(),this.isDIVERoot=!0,this.name="Root",this.loadingManager=new iL}ComputeSceneBB(){const e=new Ai;return this.traverse(t=>{"isObject3D"in t&&e.expandByObject(t)}),e}GetSceneObject(e){let t;return this.traverse(n=>{t||n.userData.id===e.id&&(t=n)}),t}AddSceneObject(e){switch(e.entityType){case"pov":break;case"light":{this.updateLight(e);break}case"model":{this.updateModel(e);break}case"primitive":{this.updatePrimitive(e);break}case"group":{this.updateGroup(e);break}default:console.warn(`DIVERoot.AddSceneObject: Unknown entity type: ${e.entityType}`)}}UpdateSceneObject(e){switch(e.entityType){case"pov":break;case"light":{this.updateLight(e);break}case"model":{this.updateModel(e);break}case"primitive":{this.updatePrimitive(e);break}case"group":{this.updateGroup(e);break}default:console.warn(`DIVERoot.UpdateSceneObject: Unknown entity type: ${e.entityType}`)}}DeleteSceneObject(e){switch(e.entityType){case"pov":break;case"light":{this.deleteLight(e);break}case"model":{this.deleteModel(e);break}case"primitive":{this.deletePrimitive(e);break}case"group":{this.deleteGroup(e);break}default:console.warn(`DIVERoot.DeleteSceneObject: Unknown entity type: ${e.entityType}`)}}PlaceOnFloor(e){switch(e.entityType){case"pov":case"light":break;case"model":case"primitive":{this.placeOnFloor(e);break}default:console.warn(`DIVERoot.PlaceOnFloor: Unknown entity type: ${e.entityType}`)}}updateLight(e){let t=this.GetSceneObject(e);if(!t){switch(e.type){case"scene":{t=new xP;break}case"ambient":{t=new nP;break}case"point":{t=new vP;break}default:{console.warn(`DIVERoot.updateLight: Unknown light type: ${e.type}`);return}}t.userData.id=e.id,this.add(t)}e.name!==void 0&&e.name!==null&&(t.name=e.name),e.position!==void 0&&e.position!==null&&t.position.set(e.position.x,e.position.y,e.position.z),e.intensity!==void 0&&e.intensity!==null&&t.SetIntensity(e.intensity),e.enabled!==void 0&&e.enabled!==null&&t.SetEnabled(e.enabled),e.color!==void 0&&e.color!==null&&t.SetColor(new Ne(e.color)),e.visible!==void 0&&e.visible!==null&&(t.visible=e.visible),e.parentId!==void 0&&this.setParent({...e,parentId:e.parentId})}updateModel(e){let t=this.GetSceneObject(e);t||(t=new yP,t.userData.id=e.id,t.userData.uri=e.uri,this.add(t)),e.uri!==void 0&&this.loadingManager.LoadGLTF(e.uri).then(n=>{var i;t.SetModel(n),(i=Gn.get(e.id))==null||i.PerformAction("MODEL_LOADED",{id:e.id})}),e.name!==void 0&&(t.name=e.name),e.position!==void 0&&t.SetPosition(e.position),e.rotation!==void 0&&t.SetRotation(e.rotation),e.scale!==void 0&&t.SetScale(e.scale),e.visible!==void 0&&t.SetVisibility(e.visible),e.material!==void 0&&t.SetMaterial(e.material),e.parentId!==void 0&&this.setParent({...e,parentId:e.parentId})}updatePrimitive(e){let t=this.GetSceneObject(e);t||(t=new rL,t.userData.id=e.id,this.add(t)),e.name!==void 0&&(t.name=e.name),e.geometry!==void 0&&t.SetGeometry(e.geometry),e.position!==void 0&&t.SetPosition(e.position),e.rotation!==void 0&&t.SetRotation(e.rotation),e.scale!==void 0&&t.SetScale(e.scale),e.visible!==void 0&&t.SetVisibility(e.visible),e.material!==void 0&&t.SetMaterial(e.material),e.parentId!==void 0&&this.setParent({...e,parentId:e.parentId})}updateGroup(e){let t=this.GetSceneObject(e);t||(t=new sL,t.userData.id=e.id,this.add(t)),e.name!==void 0&&(t.name=e.name),e.position!==void 0&&t.SetPosition(e.position),e.rotation!==void 0&&t.SetRotation(e.rotation),e.scale!==void 0&&t.SetScale(e.scale),e.visible!==void 0&&t.SetVisibility(e.visible),e.bbVisible!==void 0&&t.SetLinesVisibility(e.bbVisible),e.parentId!==void 0&&this.setParent({...e,parentId:e.parentId})}deleteLight(e){const t=this.GetSceneObject(e);if(!t){console.warn(`DIVERoot.deleteLight: Light with id ${e.id} not found`);return}this.detachTransformControls(t),t.parent.remove(t)}deleteModel(e){const t=this.GetSceneObject(e);if(!t){console.warn(`DIVERoot.deleteModel: Model with id ${e.id} not found`);return}this.detachTransformControls(t),t.parent.remove(t)}deletePrimitive(e){const t=this.GetSceneObject(e);if(!t){console.warn(`DIVERoot.deletePrimitive: Primitive with id ${e.id} not found`);return}this.detachTransformControls(t),t.parent.remove(t)}deleteGroup(e){const t=this.GetSceneObject(e);if(!t){console.warn(`DIVERoot.deleteGroup: Group with id ${e.id} not found`);return}this.detachTransformControls(t);for(let n=t.members.length-1;n>=0;n--)this.attach(t.members[n]);t.parent.remove(t)}placeOnFloor(e){const t=this.GetSceneObject(e);t&&t.PlaceOnFloor()}setParent(e){const t=this.GetSceneObject(e);if(t)if(e.parentId!==null){const n=this.GetSceneObject({id:e.parentId});if(!n)return;n.attach(t)}else this.attach(t)}detachTransformControls(e){this.findScene(e).children.find(t=>{"isTransformControls"in t&&t.detach()})}findScene(e){return e.parent!==null?this.findScene(e.parent):e}}const oL="#888888",aL="#dddddd";class cL extends _t{constructor(){super(),this.name="Grid";const e=new QC(100,100,oL,aL);e.material.depthTest=!1,e.layers.mask=w_,this.add(e)}SetVisibility(e){this.visible=e}}class lL extends ye{constructor(){super(new ds(1e4,1e4),new So({color:new Ne(150/255,150/255,150/255)})),this.isFloor=!0,this.name="Floor",this.layers.mask=Jn,this.receiveShadow=!0,this.rotateX(-Math.PI/2)}SetVisibility(e){this.visible=e}SetColor(e){this.material.color=new Ne(e)}}class hL{constructor(e,t,n,i,o){this.xrLight=e,this.renderer=t,this.lightProbe=n,this.xrWebGLBinding=null,this.estimationStartCallback=o,this.frameCallback=this.onXRFrame.bind(this);const c=t.xr.getSession();if(i&&"XRWebGLBinding"in window){const l=new h_(16);e.environment=l.texture;const u=t.getContext();switch(c.preferredReflectionFormat){case"srgba8":u.getExtension("EXT_sRGB");break;case"rgba16f":u.getExtension("OES_texture_half_float");break}this.xrWebGLBinding=new XRWebGLBinding(c,u),this.lightProbe.addEventListener("reflectionchange",()=>{this.updateReflection()})}c.requestAnimationFrame(this.frameCallback)}updateReflection(){const e=this.renderer.properties.get(this.xrLight.environment);if(e){const t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);const i=t.getLightEstimate(this.lightProbe);if(i){this.xrLight.lightProbe.sh.fromArray(i.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const o=Math.max(1,Math.max(i.primaryLightIntensity.x,Math.max(i.primaryLightIntensity.y,i.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(i.primaryLightIntensity.x/o,i.primaryLightIntensity.y/o,i.primaryLightIntensity.z/o),this.xrLight.directionalLight.intensity=o,this.xrLight.directionalLight.position.copy(i.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class uL extends Ur{constructor(e,t=!0){super(),this.lightProbe=new GC,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new ef,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let n=null,i=!1;e.xr.addEventListener("sessionstart",()=>{const o=e.xr.getSession();"requestLightProbe"in o&&o.requestLightProbe({reflectionFormat:o.preferredReflectionFormat}).then(c=>{n=new hL(this,e,c,t,()=>{i=!0,this.dispatchEvent({type:"estimationstart"})})})}),e.xr.addEventListener("sessionend",()=>{n&&(n.dispose(),n=null),i&&this.dispatchEvent({type:"estimationend"})}),this.dispose=()=>{n&&(n.dispose(),n=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}class fL extends _t{constructor(e){super(),this.name="XRLightRoot",this._scene=e,this._xrLight=null,this._lightRoot=new af,this._lightRoot.UpdateSceneObject({id:"XRSceneLight",entityType:"light",name:"XRSceneLight",type:"scene",color:16777215,intensity:1,enabled:!0,visible:!0}),this.add(this._lightRoot)}InitLightEstimation(e){this._xrLight||(this._xrLight=new uL(e,!0),this._xrLight.layers.mask=Jn,this.add(this._xrLight)),this._xrLight.addEventListener("estimationstart",()=>{this.onEstimationStart()}),this._xrLight.addEventListener("estimationend",()=>{this.onEstimationEnd()})}DisposeLightEstimation(){this._xrLight&&(this._xrLight.removeEventListener("estimationstart",()=>{this.onEstimationStart()}),this._xrLight.removeEventListener("estimationend",()=>{this.onEstimationEnd()}))}onEstimationStart(){this._lightRoot.visible=!1,this._xrLight&&this._xrLight.environment&&(this._scene.environment=this._xrLight.environment)}onEstimationEnd(){this._lightRoot.visible=!0,this._scene.environment=null,this._xrLight}}class dL extends _t{get XRModelRoot(){return this._xrModelRoot}get XRLightRoot(){return this._xrLightRoot}get XRHandNode(){return this._xrHandNode}constructor(e){super(),this.name="XRRoot",this._xrModelRoot=new af,this._xrModelRoot.name="XRModelRoot",this.add(this._xrModelRoot),this._xrShadowPlane=new ye(new ds(100,100),new xC({opacity:1,transparent:!0})),this._xrModelRoot.add(this._xrShadowPlane),this._xrLightRoot=new fL(e),this._xrLightRoot.name="XRLightRoot",this.add(this._xrLightRoot),this._xrHandNode=new _t,this._xrHandNode.name="XRHandNode",this.add(this._xrHandNode)}InitLightEstimation(e){this._xrLightRoot.InitLightEstimation(e)}DisposeLightEstimation(){this._xrLightRoot.DisposeLightEstimation()}}class pL extends hC{get Root(){return this._root}get XRRoot(){return this._xrRoot}get Floor(){return this._floor}get Grid(){return this._grid}constructor(){super(),this.background=new Ne(16777215),this._root=new af,this.add(this._root),this._floor=new lL,this.add(this._floor),this._grid=new cL,this.add(this._grid),this._xrRoot=new dL(this),this._xrRoot.visible=!1,this.add(this._xrRoot)}InitXR(e){this._root.visible=!1,this._xrRoot.visible=!0,this._xrRoot.InitLightEstimation(e)}DisposeXR(){this._root.visible=!0,this._xrRoot.visible=!1,this._xrRoot.DisposeLightEstimation()}SetBackground(e){this.background=new Ne(e)}ComputeSceneBB(){return this.Root.ComputeSceneBB()}GetSceneObject(e){return this.Root.GetSceneObject(e)}AddSceneObject(e){this.Root.AddSceneObject(e)}UpdateSceneObject(e){this.Root.UpdateSceneObject(e)}DeleteSceneObject(e){this.Root.DeleteSceneObject(e)}PlaceOnFloor(e){this.Root.PlaceOnFloor(e)}}const la={fov:70,near:.1,far:1e3},ls=class ls extends On{constructor(e=la){super(e.fov||la.fov,1,e.near||la.near,e.far||la.far),this.onSetCameraLayer=()=>{},this.layers.mask=ls.EDITOR_VIEW_LAYER_MASK}OnResize(e,t){this.aspect=e/t,this.updateProjectionMatrix()}SetCameraLayer(e){this.layers.mask=e==="LIVE"?ls.LIVE_VIEW_LAYER_MASK:ls.EDITOR_VIEW_LAYER_MASK,this.onSetCameraLayer(this.layers.mask)}};ls.EDITOR_VIEW_LAYER_MASK=tP|rf|w_|Jn,ls.LIVE_VIEW_LAYER_MASK=Jn;let Uu=ls;const Ig={type:"change"},_u={type:"start"},Dg={type:"end"},Xc=new vo,Ug=new Pr,mL=Math.cos(70*Bi.DEG2RAD);class gL extends fs{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new U,this.cursor=new U,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Ps.ROTATE,MIDDLE:Ps.DOLLY,RIGHT:Ps.PAN},this.touches={ONE:Ls.ROTATE,TWO:Ls.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(y){y.addEventListener("keydown",be),this._domElementKeyEvents=y},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",be),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(Ig),n.update(),o=i.NONE},this.update=function(){const y=new U,q=new rn().setFromUnitVectors(e.up,new U(0,1,0)),se=q.clone().invert(),xe=new U,we=new rn,mt=new U,ut=2*Math.PI;return function(tn=null){const At=n.object.position;y.copy(At).sub(n.target),y.applyQuaternion(q),l.setFromVector3(y),n.autoRotate&&o===i.NONE&&j(T(tn)),n.enableDamping?(l.theta+=u.theta*n.dampingFactor,l.phi+=u.phi*n.dampingFactor):(l.theta+=u.theta,l.phi+=u.phi);let qt=n.minAzimuthAngle,Kt=n.maxAzimuthAngle;isFinite(qt)&&isFinite(Kt)&&(qt<-Math.PI?qt+=ut:qt>Math.PI&&(qt-=ut),Kt<-Math.PI?Kt+=ut:Kt>Math.PI&&(Kt-=ut),qt<=Kt?l.theta=Math.max(qt,Math.min(Kt,l.theta)):l.theta=l.theta>(qt+Kt)/2?Math.max(qt,l.theta):Math.min(Kt,l.theta)),l.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,l.phi)),l.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(d,n.dampingFactor):n.target.add(d),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor);let Rn=!1;if(n.zoomToCursor&&N||n.object.isOrthographicCamera)l.radius=pe(l.radius);else{const yn=l.radius;l.radius=pe(l.radius*f),Rn=yn!=l.radius}if(y.setFromSpherical(l),y.applyQuaternion(se),At.copy(n.target).add(y),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,d.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),d.set(0,0,0)),n.zoomToCursor&&N){let yn=null;if(n.object.isPerspectiveCamera){const wi=y.length();yn=pe(wi*f);const Ri=wi-yn;n.object.position.addScaledVector(L,Ri),n.object.updateMatrixWorld(),Rn=!!Ri}else if(n.object.isOrthographicCamera){const wi=new U(B.x,B.y,0);wi.unproject(n.object);const Ri=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/f)),n.object.updateProjectionMatrix(),Rn=Ri!==n.object.zoom;const Vi=new U(B.x,B.y,0);Vi.unproject(n.object),n.object.position.sub(Vi).add(wi),n.object.updateMatrixWorld(),yn=y.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;yn!==null&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(yn).add(n.object.position):(Xc.origin.copy(n.object.position),Xc.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Xc.direction))<mL?e.lookAt(n.target):(Ug.setFromNormalAndCoplanarPoint(n.object.up,n.target),Xc.intersectPlane(Ug,n.target))))}else if(n.object.isOrthographicCamera){const yn=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/f)),yn!==n.object.zoom&&(n.object.updateProjectionMatrix(),Rn=!0)}return f=1,N=!1,Rn||xe.distanceToSquared(n.object.position)>c||8*(1-we.dot(n.object.quaternion))>c||mt.distanceToSquared(n.target)>c?(n.dispatchEvent(Ig),xe.copy(n.object.position),we.copy(n.object.quaternion),mt.copy(n.target),!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",Le),n.domElement.removeEventListener("pointerdown",te),n.domElement.removeEventListener("pointercancel",le),n.domElement.removeEventListener("wheel",ge),n.domElement.removeEventListener("pointermove",oe),n.domElement.removeEventListener("pointerup",le),n.domElement.getRootNode().removeEventListener("keydown",He,{capture:!0}),n._domElementKeyEvents!==null&&(n._domElementKeyEvents.removeEventListener("keydown",be),n._domElementKeyEvents=null)};const n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let o=i.NONE;const c=1e-6,l=new gg,u=new gg;let f=1;const d=new U,p=new Ie,m=new Ie,v=new Ie,S=new Ie,b=new Ie,x=new Ie,_=new Ie,R=new Ie,E=new Ie,L=new U,B=new Ie;let N=!1;const D=[],k={};let C=!1;function T(y){return y!==null?2*Math.PI/60*n.autoRotateSpeed*y:2*Math.PI/60/60*n.autoRotateSpeed}function W(y){const q=Math.abs(y*.01);return Math.pow(.95,n.zoomSpeed*q)}function j(y){u.theta-=y}function H(y){u.phi-=y}const K=function(){const y=new U;return function(se,xe){y.setFromMatrixColumn(xe,0),y.multiplyScalar(-se),d.add(y)}}(),ne=function(){const y=new U;return function(se,xe){n.screenSpacePanning===!0?y.setFromMatrixColumn(xe,1):(y.setFromMatrixColumn(xe,0),y.crossVectors(n.object.up,y)),y.multiplyScalar(se),d.add(y)}}(),he=function(){const y=new U;return function(se,xe){const we=n.domElement;if(n.object.isPerspectiveCamera){const mt=n.object.position;y.copy(mt).sub(n.target);let ut=y.length();ut*=Math.tan(n.object.fov/2*Math.PI/180),K(2*se*ut/we.clientHeight,n.object.matrix),ne(2*xe*ut/we.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(K(se*(n.object.right-n.object.left)/n.object.zoom/we.clientWidth,n.object.matrix),ne(xe*(n.object.top-n.object.bottom)/n.object.zoom/we.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function me(y){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?f/=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function $(y){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?f*=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function fe(y,q){if(!n.zoomToCursor)return;N=!0;const se=n.domElement.getBoundingClientRect(),xe=y-se.left,we=q-se.top,mt=se.width,ut=se.height;B.x=xe/mt*2-1,B.y=-(we/ut)*2+1,L.set(B.x,B.y,1).unproject(n.object).sub(n.object.position).normalize()}function pe(y){return Math.max(n.minDistance,Math.min(n.maxDistance,y))}function Ee(y){p.set(y.clientX,y.clientY)}function Je(y){fe(y.clientX,y.clientX),_.set(y.clientX,y.clientY)}function bt(y){S.set(y.clientX,y.clientY)}function ie(y){m.set(y.clientX,y.clientY),v.subVectors(m,p).multiplyScalar(n.rotateSpeed);const q=n.domElement;j(2*Math.PI*v.x/q.clientHeight),H(2*Math.PI*v.y/q.clientHeight),p.copy(m),n.update()}function _e(y){R.set(y.clientX,y.clientY),E.subVectors(R,_),E.y>0?me(W(E.y)):E.y<0&&$(W(E.y)),_.copy(R),n.update()}function Ce(y){b.set(y.clientX,y.clientY),x.subVectors(b,S).multiplyScalar(n.panSpeed),he(x.x,x.y),S.copy(b),n.update()}function Ae(y){fe(y.clientX,y.clientY),y.deltaY<0?$(W(y.deltaY)):y.deltaY>0&&me(W(y.deltaY)),n.update()}function je(y){let q=!1;switch(y.code){case n.keys.UP:y.ctrlKey||y.metaKey||y.shiftKey?H(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):he(0,n.keyPanSpeed),q=!0;break;case n.keys.BOTTOM:y.ctrlKey||y.metaKey||y.shiftKey?H(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):he(0,-n.keyPanSpeed),q=!0;break;case n.keys.LEFT:y.ctrlKey||y.metaKey||y.shiftKey?j(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):he(n.keyPanSpeed,0),q=!0;break;case n.keys.RIGHT:y.ctrlKey||y.metaKey||y.shiftKey?j(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):he(-n.keyPanSpeed,0),q=!0;break}q&&(y.preventDefault(),n.update())}function qe(y){if(D.length===1)p.set(y.pageX,y.pageY);else{const q=St(y),se=.5*(y.pageX+q.x),xe=.5*(y.pageY+q.y);p.set(se,xe)}}function dt(y){if(D.length===1)S.set(y.pageX,y.pageY);else{const q=St(y),se=.5*(y.pageX+q.x),xe=.5*(y.pageY+q.y);S.set(se,xe)}}function Y(y){const q=St(y),se=y.pageX-q.x,xe=y.pageY-q.y,we=Math.sqrt(se*se+xe*xe);_.set(0,we)}function tt(y){n.enableZoom&&Y(y),n.enablePan&&dt(y)}function Ve(y){n.enableZoom&&Y(y),n.enableRotate&&qe(y)}function Et(y){if(D.length==1)m.set(y.pageX,y.pageY);else{const se=St(y),xe=.5*(y.pageX+se.x),we=.5*(y.pageY+se.y);m.set(xe,we)}v.subVectors(m,p).multiplyScalar(n.rotateSpeed);const q=n.domElement;j(2*Math.PI*v.x/q.clientHeight),H(2*Math.PI*v.y/q.clientHeight),p.copy(m)}function ke(y){if(D.length===1)b.set(y.pageX,y.pageY);else{const q=St(y),se=.5*(y.pageX+q.x),xe=.5*(y.pageY+q.y);b.set(se,xe)}x.subVectors(b,S).multiplyScalar(n.panSpeed),he(x.x,x.y),S.copy(b)}function Tt(y){const q=St(y),se=y.pageX-q.x,xe=y.pageY-q.y,we=Math.sqrt(se*se+xe*xe);R.set(0,we),E.set(0,Math.pow(R.y/_.y,n.zoomSpeed)),me(E.y),_.copy(R);const mt=(y.pageX+q.x)*.5,ut=(y.pageY+q.y)*.5;fe(mt,ut)}function O(y){n.enableZoom&&Tt(y),n.enablePan&&ke(y)}function A(y){n.enableZoom&&Tt(y),n.enableRotate&&Et(y)}function te(y){n.enabled!==!1&&(D.length===0&&(n.domElement.setPointerCapture(y.pointerId),n.domElement.addEventListener("pointermove",oe),n.domElement.addEventListener("pointerup",le)),!yt(y)&&(ot(y),y.pointerType==="touch"?Ye(y):de(y)))}function oe(y){n.enabled!==!1&&(y.pointerType==="touch"?Pe(y):Be(y))}function le(y){switch(ht(y),D.length){case 0:n.domElement.releasePointerCapture(y.pointerId),n.domElement.removeEventListener("pointermove",oe),n.domElement.removeEventListener("pointerup",le),n.dispatchEvent(Dg),o=i.NONE;break;case 1:const q=D[0],se=k[q];Ye({pointerId:q,pageX:se.x,pageY:se.y});break}}function de(y){let q;switch(y.button){case 0:q=n.mouseButtons.LEFT;break;case 1:q=n.mouseButtons.MIDDLE;break;case 2:q=n.mouseButtons.RIGHT;break;default:q=-1}switch(q){case Ps.DOLLY:if(n.enableZoom===!1)return;Je(y),o=i.DOLLY;break;case Ps.ROTATE:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enablePan===!1)return;bt(y),o=i.PAN}else{if(n.enableRotate===!1)return;Ee(y),o=i.ROTATE}break;case Ps.PAN:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enableRotate===!1)return;Ee(y),o=i.ROTATE}else{if(n.enablePan===!1)return;bt(y),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent(_u)}function Be(y){switch(o){case i.ROTATE:if(n.enableRotate===!1)return;ie(y);break;case i.DOLLY:if(n.enableZoom===!1)return;_e(y);break;case i.PAN:if(n.enablePan===!1)return;Ce(y);break}}function ge(y){n.enabled===!1||n.enableZoom===!1||o!==i.NONE||(y.preventDefault(),n.dispatchEvent(_u),Ae(De(y)),n.dispatchEvent(Dg))}function De(y){const q=y.deltaMode,se={clientX:y.clientX,clientY:y.clientY,deltaY:y.deltaY};switch(q){case 1:se.deltaY*=16;break;case 2:se.deltaY*=100;break}return y.ctrlKey&&!C&&(se.deltaY*=10),se}function He(y){y.key==="Control"&&(C=!0,n.domElement.getRootNode().addEventListener("keyup",ve,{passive:!0,capture:!0}))}function ve(y){y.key==="Control"&&(C=!1,n.domElement.getRootNode().removeEventListener("keyup",ve,{passive:!0,capture:!0}))}function be(y){n.enabled===!1||n.enablePan===!1||je(y)}function Ye(y){switch(pt(y),D.length){case 1:switch(n.touches.ONE){case Ls.ROTATE:if(n.enableRotate===!1)return;qe(y),o=i.TOUCH_ROTATE;break;case Ls.PAN:if(n.enablePan===!1)return;dt(y),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(n.touches.TWO){case Ls.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;tt(y),o=i.TOUCH_DOLLY_PAN;break;case Ls.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Ve(y),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent(_u)}function Pe(y){switch(pt(y),o){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;Et(y),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;ke(y),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;O(y),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;A(y),n.update();break;default:o=i.NONE}}function Le(y){n.enabled!==!1&&y.preventDefault()}function ot(y){D.push(y.pointerId)}function ht(y){delete k[y.pointerId];for(let q=0;q<D.length;q++)if(D[q]==y.pointerId){D.splice(q,1);return}}function yt(y){for(let q=0;q<D.length;q++)if(D[q]==y.pointerId)return!0;return!1}function pt(y){let q=k[y.pointerId];q===void 0&&(q=new Ie,k[y.pointerId]=q),q.set(y.pageX,y.pageY)}function St(y){const q=y.pointerId===D[0]?D[1]:D[0];return k[q]}n.domElement.addEventListener("contextmenu",Le),n.domElement.addEventListener("pointerdown",te),n.domElement.addEventListener("pointercancel",le),n.domElement.addEventListener("wheel",ge,{passive:!1}),n.domElement.getRootNode().addEventListener("keydown",He,{passive:!0,capture:!0}),this.update()}}var cr=Object.freeze({Linear:Object.freeze({None:function(s){return s},In:function(s){return s},Out:function(s){return s},InOut:function(s){return s}}),Quadratic:Object.freeze({In:function(s){return s*s},Out:function(s){return s*(2-s)},InOut:function(s){return(s*=2)<1?.5*s*s:-.5*(--s*(s-2)-1)}}),Cubic:Object.freeze({In:function(s){return s*s*s},Out:function(s){return--s*s*s+1},InOut:function(s){return(s*=2)<1?.5*s*s*s:.5*((s-=2)*s*s+2)}}),Quartic:Object.freeze({In:function(s){return s*s*s*s},Out:function(s){return 1- --s*s*s*s},InOut:function(s){return(s*=2)<1?.5*s*s*s*s:-.5*((s-=2)*s*s*s-2)}}),Quintic:Object.freeze({In:function(s){return s*s*s*s*s},Out:function(s){return--s*s*s*s*s+1},InOut:function(s){return(s*=2)<1?.5*s*s*s*s*s:.5*((s-=2)*s*s*s*s+2)}}),Sinusoidal:Object.freeze({In:function(s){return 1-Math.sin((1-s)*Math.PI/2)},Out:function(s){return Math.sin(s*Math.PI/2)},InOut:function(s){return .5*(1-Math.sin(Math.PI*(.5-s)))}}),Exponential:Object.freeze({In:function(s){return s===0?0:Math.pow(1024,s-1)},Out:function(s){return s===1?1:1-Math.pow(2,-10*s)},InOut:function(s){return s===0?0:s===1?1:(s*=2)<1?.5*Math.pow(1024,s-1):.5*(-Math.pow(2,-10*(s-1))+2)}}),Circular:Object.freeze({In:function(s){return 1-Math.sqrt(1-s*s)},Out:function(s){return Math.sqrt(1- --s*s)},InOut:function(s){return(s*=2)<1?-.5*(Math.sqrt(1-s*s)-1):.5*(Math.sqrt(1-(s-=2)*s)+1)}}),Elastic:Object.freeze({In:function(s){return s===0?0:s===1?1:-Math.pow(2,10*(s-1))*Math.sin((s-1.1)*5*Math.PI)},Out:function(s){return s===0?0:s===1?1:Math.pow(2,-10*s)*Math.sin((s-.1)*5*Math.PI)+1},InOut:function(s){return s===0?0:s===1?1:(s*=2,s<1?-.5*Math.pow(2,10*(s-1))*Math.sin((s-1.1)*5*Math.PI):.5*Math.pow(2,-10*(s-1))*Math.sin((s-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(s){var e=1.70158;return s===1?1:s*s*((e+1)*s-e)},Out:function(s){var e=1.70158;return s===0?0:--s*s*((e+1)*s+e)+1},InOut:function(s){var e=2.5949095;return(s*=2)<1?.5*(s*s*((e+1)*s-e)):.5*((s-=2)*s*((e+1)*s+e)+2)}}),Bounce:Object.freeze({In:function(s){return 1-cr.Bounce.Out(1-s)},Out:function(s){return s<1/2.75?7.5625*s*s:s<2/2.75?7.5625*(s-=1.5/2.75)*s+.75:s<2.5/2.75?7.5625*(s-=2.25/2.75)*s+.9375:7.5625*(s-=2.625/2.75)*s+.984375},InOut:function(s){return s<.5?cr.Bounce.In(s*2)*.5:cr.Bounce.Out(s*2-1)*.5+.5}}),generatePow:function(s){return s===void 0&&(s=4),s=s<Number.EPSILON?Number.EPSILON:s,s=s>1e4?1e4:s,{In:function(e){return Math.pow(e,s)},Out:function(e){return 1-Math.pow(1-e,s)},InOut:function(e){return e<.5?Math.pow(e*2,s)/2:(1-Math.pow(2-e*2,s))/2+.5}}}}),ha=function(){return performance.now()},_L=function(){function s(){this._tweens={},this._tweensAddedDuringUpdate={}}return s.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},s.prototype.removeAll=function(){this._tweens={}},s.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},s.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},s.prototype.update=function(e,t){e===void 0&&(e=ha()),t===void 0&&(t=!1);var n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var o=this._tweens[n[i]],c=!t;o&&o.update(e,c)===!1&&!t&&delete this._tweens[n[i]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},s}(),Ou={Linear:function(s,e){var t=s.length-1,n=t*e,i=Math.floor(n),o=Ou.Utils.Linear;return e<0?o(s[0],s[1],n):e>1?o(s[t],s[t-1],t-n):o(s[i],s[i+1>t?t:i+1],n-i)},Utils:{Linear:function(s,e,t){return(e-s)*t+s}}},D_=function(){function s(){}return s.nextId=function(){return s._nextId++},s._nextId=0,s}(),Nu=new _L,vL=function(){function s(e,t){t===void 0&&(t=Nu),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=cr.Linear.None,this._interpolationFunction=Ou.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=D_.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return s.prototype.getId=function(){return this._id},s.prototype.isPlaying=function(){return this._isPlaying},s.prototype.isPaused=function(){return this._isPaused},s.prototype.getDuration=function(){return this._duration},s.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},s.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},s.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},s.prototype.start=function(e,t){if(e===void 0&&(e=ha()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var o in this._valuesEnd)i[o]=this._valuesEnd[o];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},s.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},s.prototype._setupProperties=function(e,t,n,i,o){for(var c in n){var l=e[c],u=Array.isArray(l),f=u?"array":typeof l,d=!u&&Array.isArray(n[c]);if(!(f==="undefined"||f==="function")){if(d){var p=n[c];if(p.length===0)continue;for(var m=[l],v=0,S=p.length;v<S;v+=1){var b=this._handleRelativeValue(l,p[v]);if(isNaN(b)){d=!1,console.warn("Found invalid interpolation list. Skipping.");break}m.push(b)}d&&(n[c]=m)}if((f==="object"||u)&&l&&!d){t[c]=u?[]:{};var x=l;for(var _ in x)t[c][_]=x[_];i[c]=u?[]:{};var p=n[c];if(!this._isDynamic){var R={};for(var _ in p)R[_]=p[_];n[c]=p=R}this._setupProperties(x,t[c],p,i[c],o)}else(typeof t[c]>"u"||o)&&(t[c]=l),u||(t[c]*=1),d?i[c]=n[c].slice().reverse():i[c]=t[c]||0}}},s.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},s.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},s.prototype.pause=function(e){return e===void 0&&(e=ha()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},s.prototype.resume=function(e){return e===void 0&&(e=ha()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},s.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},s.prototype.group=function(e){return e===void 0&&(e=Nu),this._group=e,this},s.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},s.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},s.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},s.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},s.prototype.easing=function(e){return e===void 0&&(e=cr.Linear.None),this._easingFunction=e,this},s.prototype.interpolation=function(e){return e===void 0&&(e=Ou.Linear),this._interpolationFunction=e,this},s.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},s.prototype.onStart=function(e){return this._onStartCallback=e,this},s.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},s.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},s.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},s.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},s.prototype.onStop=function(e){return this._onStopCallback=e,this},s.prototype.update=function(e,t){var n;if(e===void 0&&(e=ha()),t===void 0&&(t=!0),this._isPaused)return!0;var i=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>i)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=e-this._startTime,c=this._duration+((n=this._repeatDelayTime)!==null&&n!==void 0?n:this._delayTime),l=this._duration+this._repeat*c,u=this._calculateElapsedPortion(o,c,l),f=this._easingFunction(u),d=this._calculateCompletionStatus(o,c);if(d==="repeat"&&this._processRepetition(o,c),this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),d==="about-to-repeat"&&this._processRepetition(o,c),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),d==="repeat"||d==="about-to-repeat")this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1;else if(d==="completed"){this._isPlaying=!1,this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var p=0,m=this._chainedTweens.length;p<m;p++)this._chainedTweens[p].start(this._startTime+this._duration,!1)}return d!=="completed"},s.prototype._calculateElapsedPortion=function(e,t,n){if(this._duration===0||e>n)return 1;var i=e%t,o=Math.min(i/this._duration,1);return o===0&&e!==0&&e%this._duration===0?1:o},s.prototype._calculateCompletionStatus=function(e,t){return this._duration!==0&&e<this._duration?"playing":this._repeat<=0?"completed":e===this._duration?"about-to-repeat":"repeat"},s.prototype._processRepetition=function(e,t){var n=Math.min(Math.trunc((e-this._duration)/t)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=n);for(var i in this._valuesStartRepeat){var o=this._valuesEnd[i];!this._yoyo&&typeof o=="string"&&(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(o)),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}this._yoyo&&(this._reversed=!this._reversed),this._startTime+=t*n},s.prototype._updateProperties=function(e,t,n,i){for(var o in n)if(t[o]!==void 0){var c=t[o]||0,l=n[o],u=Array.isArray(e[o]),f=Array.isArray(l),d=!u&&f;d?e[o]=this._interpolationFunction(l,i):typeof l=="object"&&l?this._updateProperties(e[o],c,l,i):(l=this._handleRelativeValue(c,l),typeof l=="number"&&(e[o]=c+(l-c)*i))}},s.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},s.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];typeof n=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(n):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},s}();D_.nextId;var zi=Nu;zi.getAll.bind(zi);zi.removeAll.bind(zi);zi.add.bind(zi);zi.remove.bind(zi);var xL=zi.update.bind(zi);const $c={enableDamping:!0,dampingFactor:.04},pa=class pa extends gL{constructor(e,t,n,i=$c){super(e,t.domElement),this.last=null,this.animating=!1,this.locked=!1,this.stopMoveTo=()=>{},this.stopRevertLast=()=>{},this._removePreRenderCallback=()=>{},this.preRenderCallback=()=>{this.locked||this.update()},this._animationSystem=n,this.domElement=t.domElement,this.object=e;const o=t.AddPreRenderCallback(()=>{this.preRenderCallback()});this._removePreRenderCallback=()=>{t.RemovePreRenderCallback(o)},this.enableDamping=i.enableDamping||$c.enableDamping,this.dampingFactor=i.dampingFactor||$c.dampingFactor,this.object.position.set(0,2,2),this.target.copy({x:0,y:.5,z:0}),this.update()}Dispose(){this._removePreRenderCallback(),this.dispose()}ComputeEncompassingView(e){const t=e.getCenter(new U),n=e.getSize(new U),i=Math.max(n.x,n.y,n.z)*1.25;return{position:this.object.position.clone().normalize().multiplyScalar(i),target:t}}ZoomIn(e){const t=e||pa.DEFAULT_ZOOM_FACTOR,{minDistance:n,maxDistance:i}=this;this.minDistance=this.maxDistance=Bi.clamp(this.getDistance()-t,n+t,i-t),this.update(),this.minDistance=n,this.maxDistance=i}ZoomOut(e){const t=e||pa.DEFAULT_ZOOM_FACTOR,{minDistance:n,maxDistance:i}=this;this.minDistance=this.maxDistance=Bi.clamp(this.getDistance()+t,n+t,i-t),this.update(),this.minDistance=n,this.maxDistance=i}MoveTo(e,t,n,i){if(this.animating)return;const o=e||this.object.position.clone(),c=t||this.target.clone();this.stopRevertLast(),this.locked||(this.last={pos:this.object.position.clone(),target:this.target.clone()}),this.animating=n>0,this.locked=i,this.enabled=!1;const l=this._animationSystem.Animate(this.object.position).to(o,n).easing(cr.Quadratic.Out).start(),u=this._animationSystem.Animate(this.target).to(c,n).easing(cr.Quadratic.Out).onUpdate(()=>{this.object.lookAt(this.target)}).onComplete(()=>{this.animating=!1,this.enabled=!i}).start();this.stopMoveTo=()=>{l.stop(),u.stop()}}RevertLast(e){if(this.animating||!this.locked)return;this.stopMoveTo(),this.animating=e>0,this.enabled=!1;const{pos:t,target:n}=this.last,i=this._animationSystem.Animate(this.object.position).to(t,e).easing(cr.Quadratic.Out).start(),o=this._animationSystem.Animate(this.target).to(n,e).easing(cr.Quadratic.Out).onUpdate(()=>{this.object.lookAt(this.target)}).onComplete(()=>{this.animating=!1,this.locked=!1,this.enabled=!0}).start();this.stopRevertLast=()=>{i.stop(),o.stop()}}};pa.DEFAULT_ZOOM_FACTOR=1;let Fu=pa;const cf=class cf{get selectTool(){return this._selectTool||(this._selectTool=new pP(this._scene,this._controller)),this._selectTool}constructor(e,t){this._scene=e,this._controller=t,this._selectTool=null,this._activeTool=null}Dispose(){this.removeEventListeners()}GetActiveTool(){return this._activeTool}UseTool(e){var t;switch((t=this._activeTool)==null||t.Deactivate(),e){case"select":{this.addEventListeners(),this.selectTool.Activate(),this._activeTool=this.selectTool;break}case"none":{this.removeEventListeners(),this._activeTool=null;break}default:console.warn(`DIVEToolBox.UseTool: Unknown tool: ${e}`)}}SetGizmoMode(e){this.selectTool.SetGizmoMode(e)}SetGizmoVisibility(e){this.selectTool.SetGizmoVisibility(e)}SetGizmoScaleLinked(e){this.selectTool.SetGizmoScaleLinked(e)}onPointerMove(e){var t;(t=this._activeTool)==null||t.onPointerMove(e)}onPointerDown(e){var t;(t=this._activeTool)==null||t.onPointerDown(e)}onPointerUp(e){var t;(t=this._activeTool)==null||t.onPointerUp(e)}onWheel(e){var t;(t=this._activeTool)==null||t.onWheel(e)}addEventListeners(){this._controller.domElement.addEventListener("pointermove",e=>this.onPointerMove(e)),this._controller.domElement.addEventListener("pointerdown",e=>this.onPointerDown(e)),this._controller.domElement.addEventListener("pointerup",e=>this.onPointerUp(e)),this._controller.domElement.addEventListener("wheel",e=>this.onWheel(e))}removeEventListeners(){this._controller.domElement.removeEventListener("pointermove",e=>this.onPointerMove(e)),this._controller.domElement.removeEventListener("pointerdown",e=>this.onPointerDown(e)),this._controller.domElement.removeEventListener("pointerup",e=>this.onPointerUp(e)),this._controller.domElement.removeEventListener("wheel",e=>this.onWheel(e))}};cf.DefaultTool="select";let Bu=cf;class yL{constructor(e){this._renderer=e,this._rendererCallbackId=this._renderer.AddPreRenderCallback(()=>{this.Update()})}Dispose(){this._renderer.RemovePreRenderCallback(this._rendererCallbackId)}Update(){xL()}Animate(e){return new vL(e)}}function SL(s,e,t){return e=al(e),PL(s,U_()?Reflect.construct(e,t||[],al(s).constructor):e.apply(s,t))}function U_(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(U_=function(){return!!s})()}function ML(s,e){var t=s==null?null:typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(t!=null){var n,i,o,c,l=[],u=!0,f=!1;try{if(o=(t=t.call(s)).next,e===0){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=o.call(t)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(d){f=!0,i=d}finally{try{if(!u&&t.return!=null&&(c=t.return(),Object(c)!==c))return}finally{if(f)throw i}}return l}}function EL(s,e){if(typeof s!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var n=t.call(s,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(s)}function bL(s){var e=EL(s,"string");return typeof e=="symbol"?e:String(e)}function TL(s,e){if(!(s instanceof e))throw new TypeError("Cannot call a class as a function")}function AL(s,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(s,bL(n.key),n)}}function wL(s,e,t){return e&&AL(s.prototype,e),Object.defineProperty(s,"prototype",{writable:!1}),s}function RL(s,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(e&&e.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),Object.defineProperty(s,"prototype",{writable:!1}),e&&zu(s,e)}function al(s){return al=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},al(s)}function zu(s,e){return zu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},zu(s,e)}function CL(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function PL(s,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return CL(s)}function Og(s,e){return IL(s)||ML(s,e)||O_(s,e)||OL()}function Yc(s){return LL(s)||DL(s)||O_(s)||UL()}function LL(s){if(Array.isArray(s))return ku(s)}function IL(s){if(Array.isArray(s))return s}function DL(s){if(typeof Symbol<"u"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function O_(s,e){if(s){if(typeof s=="string")return ku(s,e);var t=Object.prototype.toString.call(s).slice(8,-1);if(t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set")return Array.from(s);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ku(s,e)}}function ku(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=s[t];return n}function UL(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3822
|
+
`)+fe+`return __p
|
|
3823
|
+
}`;var lt=Ip(function(){return wt(P,Oe+"return "+fe).apply(t,z)});if(lt.source=fe,Au(lt))throw lt;return lt}function aE(s){return Rt(s).toLowerCase()}function cE(s){return Rt(s).toUpperCase()}function lE(s,a,u){if(s=Rt(s),s&&(u||a===t))return Hf(s);if(!s||!(a=qn(a)))return s;var g=_i(s),T=_i(a),P=Gf(g,T),z=Vf(g,T)+1;return Pr(g,P,z).join("")}function uE(s,a,u){if(s=Rt(s),s&&(u||a===t))return s.slice(0,Xf(s)+1);if(!s||!(a=qn(a)))return s;var g=_i(s),T=Vf(g,_i(a))+1;return Pr(g,0,T).join("")}function hE(s,a,u){if(s=Rt(s),s&&(u||a===t))return s.replace(Oi,"");if(!s||!(a=qn(a)))return s;var g=_i(s),T=Gf(g,_i(a));return Pr(g,T).join("")}function fE(s,a){var u=y,g=F;if(jt(a)){var T="separator"in a?a.separator:T;u="length"in a?st(a.length):u,g="omission"in a?qn(a.omission):g}s=Rt(s);var P=s.length;if(As(s)){var z=_i(s);P=z.length}if(u>=P)return s;var H=u-ws(g);if(H<1)return g;var X=z?Pr(z,0,H).join(""):s.slice(0,H);if(T===t)return X+g;if(z&&(H+=X.length-H),wu(T)){if(s.slice(H).search(T)){var ce,le=X;for(T.global||(T=Vl(T.source,Rt(D.exec(T))+"g")),T.lastIndex=0;ce=T.exec(le);)var fe=ce.index;X=X.slice(0,fe===t?H:fe)}}else if(s.indexOf(qn(T),H)!=H){var Ee=X.lastIndexOf(T);Ee>-1&&(X=X.slice(0,Ee))}return X+g}function dE(s){return s=Rt(s),s&&_t.test(s)?s.replace(xe,G0):s}var pE=Os(function(s,a,u){return s+(u?" ":"")+a.toUpperCase()}),Pu=Dd("toUpperCase");function Lp(s,a,u){return s=Rt(s),a=u?t:a,a===t?F0(s)?X0(s):R0(s):s.match(a)||[]}var Ip=pt(function(s,a){try{return Yn(s,t,a)}catch(u){return Au(u)?u:new tt(u)}}),mE=rr(function(s,a){return ri(a,function(u){u=Bi(u),nr(s,u,bu(s[u],s))}),s});function gE(s){var a=s==null?0:s.length,u=We();return s=a?Wt(s,function(g){if(typeof g[1]!="function")throw new si(c);return[u(g[0]),g[1]]}):[],pt(function(g){for(var T=-1;++T<a;){var P=s[T];if(Yn(P[0],this,g))return Yn(P[1],this,g)}})}function _E(s){return Gv(ai(s,p))}function Lu(s){return function(){return s}}function vE(s,a){return s==null||s!==s?a:s}var xE=Ud(),yE=Ud(!0);function Vn(s){return s}function Iu(s){return hd(typeof s=="function"?s:ai(s,p))}function SE(s){return dd(ai(s,p))}function ME(s,a){return pd(s,ai(a,p))}var EE=pt(function(s,a){return function(u){return Wo(u,s,a)}}),bE=pt(function(s,a){return function(u){return Wo(s,u,a)}});function Du(s,a,u){var g=pn(a),T=nc(a,g);u==null&&!(jt(a)&&(T.length||!g.length))&&(u=a,a=s,s=this,T=nc(a,pn(a)));var P=!(jt(u)&&"chain"in u)||!!u.chain,z=or(s);return ri(T,function(H){var X=a[H];s[H]=X,z&&(s.prototype[H]=function(){var ce=this.__chain__;if(P||ce){var le=s(this.__wrapped__),fe=le.__actions__=kn(this.__actions__);return fe.push({func:X,args:arguments,thisArg:s}),le.__chain__=ce,le}return X.apply(s,br([this.value()],arguments))})}),s}function TE(){return _n._===this&&(_n._=$0),this}function Ou(){}function AE(s){return s=st(s),pt(function(a){return md(a,s)})}var wE=hu(Wt),RE=hu(Nf),CE=hu(Nl);function Dp(s){return vu(s)?Fl(Bi(s)):sx(s)}function PE(s){return function(a){return s==null?t:Qr(s,a)}}var LE=Fd(),IE=Fd(!0);function Uu(){return[]}function Nu(){return!1}function DE(){return{}}function OE(){return""}function UE(){return!0}function NE(s,a){if(s=st(s),s<1||s>K)return[];var u=Me,g=En(s,Me);a=We(a),s-=Me;for(var T=kl(g,a);++u<s;)a(u);return T}function FE(s){return it(s)?Wt(s,Bi):Kn(s)?[s]:kn(Qd(Rt(s)))}function BE(s){var a=++K0;return Rt(s)+a}var zE=cc(function(s,a){return s+a},0),kE=fu("ceil"),HE=cc(function(s,a){return s/a},1),GE=fu("floor");function VE(s){return s&&s.length?tc(s,Vn,$l):t}function WE(s,a){return s&&s.length?tc(s,We(a,2),$l):t}function XE(s){return zf(s,Vn)}function YE(s,a){return zf(s,We(a,2))}function jE(s){return s&&s.length?tc(s,Vn,tu):t}function qE(s,a){return s&&s.length?tc(s,We(a,2),tu):t}var KE=cc(function(s,a){return s*a},1),ZE=fu("round"),$E=cc(function(s,a){return s-a},0);function JE(s){return s&&s.length?zl(s,Vn):0}function QE(s,a){return s&&s.length?zl(s,We(a,2)):0}return R.after=SS,R.ary=up,R.assign=cM,R.assignIn=bp,R.assignInWith=Sc,R.assignWith=lM,R.at=uM,R.before=hp,R.bind=bu,R.bindAll=mE,R.bindKey=fp,R.castArray=DS,R.chain=ap,R.chunk=Gx,R.compact=Vx,R.concat=Wx,R.cond=gE,R.conforms=_E,R.constant=Lu,R.countBy=Jy,R.create=hM,R.curry=dp,R.curryRight=pp,R.debounce=mp,R.defaults=fM,R.defaultsDeep=dM,R.defer=MS,R.delay=ES,R.difference=Xx,R.differenceBy=Yx,R.differenceWith=jx,R.drop=qx,R.dropRight=Kx,R.dropRightWhile=Zx,R.dropWhile=$x,R.fill=Jx,R.filter=eS,R.flatMap=iS,R.flatMapDeep=rS,R.flatMapDepth=sS,R.flatten=ip,R.flattenDeep=Qx,R.flattenDepth=ey,R.flip=bS,R.flow=xE,R.flowRight=yE,R.fromPairs=ty,R.functions=yM,R.functionsIn=SM,R.groupBy=oS,R.initial=iy,R.intersection=ry,R.intersectionBy=sy,R.intersectionWith=oy,R.invert=EM,R.invertBy=bM,R.invokeMap=cS,R.iteratee=Iu,R.keyBy=lS,R.keys=pn,R.keysIn=Gn,R.map=mc,R.mapKeys=AM,R.mapValues=wM,R.matches=SE,R.matchesProperty=ME,R.memoize=_c,R.merge=RM,R.mergeWith=Tp,R.method=EE,R.methodOf=bE,R.mixin=Du,R.negate=vc,R.nthArg=AE,R.omit=CM,R.omitBy=PM,R.once=TS,R.orderBy=uS,R.over=wE,R.overArgs=AS,R.overEvery=RE,R.overSome=CE,R.partial=Tu,R.partialRight=gp,R.partition=hS,R.pick=LM,R.pickBy=Ap,R.property=Dp,R.propertyOf=PE,R.pull=uy,R.pullAll=sp,R.pullAllBy=hy,R.pullAllWith=fy,R.pullAt=dy,R.range=LE,R.rangeRight=IE,R.rearg=wS,R.reject=pS,R.remove=py,R.rest=RS,R.reverse=Mu,R.sampleSize=gS,R.set=DM,R.setWith=OM,R.shuffle=_S,R.slice=my,R.sortBy=yS,R.sortedUniq=My,R.sortedUniqBy=Ey,R.split=iE,R.spread=CS,R.tail=by,R.take=Ty,R.takeRight=Ay,R.takeRightWhile=wy,R.takeWhile=Ry,R.tap=Vy,R.throttle=PS,R.thru=pc,R.toArray=Sp,R.toPairs=wp,R.toPairsIn=Rp,R.toPath=FE,R.toPlainObject=Ep,R.transform=UM,R.unary=LS,R.union=Cy,R.unionBy=Py,R.unionWith=Ly,R.uniq=Iy,R.uniqBy=Dy,R.uniqWith=Oy,R.unset=NM,R.unzip=Eu,R.unzipWith=op,R.update=FM,R.updateWith=BM,R.values=Fs,R.valuesIn=zM,R.without=Uy,R.words=Lp,R.wrap=IS,R.xor=Ny,R.xorBy=Fy,R.xorWith=By,R.zip=zy,R.zipObject=ky,R.zipObjectDeep=Hy,R.zipWith=Gy,R.entries=wp,R.entriesIn=Rp,R.extend=bp,R.extendWith=Sc,Du(R,R),R.add=zE,R.attempt=Ip,R.camelCase=VM,R.capitalize=Cp,R.ceil=kE,R.clamp=kM,R.clone=OS,R.cloneDeep=NS,R.cloneDeepWith=FS,R.cloneWith=US,R.conformsTo=BS,R.deburr=Pp,R.defaultTo=vE,R.divide=HE,R.endsWith=WM,R.eq=xi,R.escape=XM,R.escapeRegExp=YM,R.every=Qy,R.find=tS,R.findIndex=tp,R.findKey=pM,R.findLast=nS,R.findLastIndex=np,R.findLastKey=mM,R.floor=GE,R.forEach=cp,R.forEachRight=lp,R.forIn=gM,R.forInRight=_M,R.forOwn=vM,R.forOwnRight=xM,R.get=Ru,R.gt=zS,R.gte=kS,R.has=MM,R.hasIn=Cu,R.head=rp,R.identity=Vn,R.includes=aS,R.indexOf=ny,R.inRange=HM,R.invoke=TM,R.isArguments=ns,R.isArray=it,R.isArrayBuffer=HS,R.isArrayLike=Hn,R.isArrayLikeObject=en,R.isBoolean=GS,R.isBuffer=Lr,R.isDate=VS,R.isElement=WS,R.isEmpty=XS,R.isEqual=YS,R.isEqualWith=jS,R.isError=Au,R.isFinite=qS,R.isFunction=or,R.isInteger=_p,R.isLength=xc,R.isMap=vp,R.isMatch=KS,R.isMatchWith=ZS,R.isNaN=$S,R.isNative=JS,R.isNil=eM,R.isNull=QS,R.isNumber=xp,R.isObject=jt,R.isObjectLike=$t,R.isPlainObject=Zo,R.isRegExp=wu,R.isSafeInteger=tM,R.isSet=yp,R.isString=yc,R.isSymbol=Kn,R.isTypedArray=Ns,R.isUndefined=nM,R.isWeakMap=iM,R.isWeakSet=rM,R.join=ay,R.kebabCase=jM,R.last=li,R.lastIndexOf=cy,R.lowerCase=qM,R.lowerFirst=KM,R.lt=sM,R.lte=oM,R.max=VE,R.maxBy=WE,R.mean=XE,R.meanBy=YE,R.min=jE,R.minBy=qE,R.stubArray=Uu,R.stubFalse=Nu,R.stubObject=DE,R.stubString=OE,R.stubTrue=UE,R.multiply=KE,R.nth=ly,R.noConflict=TE,R.noop=Ou,R.now=gc,R.pad=ZM,R.padEnd=$M,R.padStart=JM,R.parseInt=QM,R.random=GM,R.reduce=fS,R.reduceRight=dS,R.repeat=eE,R.replace=tE,R.result=IM,R.round=ZE,R.runInContext=W,R.sample=mS,R.size=vS,R.snakeCase=nE,R.some=xS,R.sortedIndex=gy,R.sortedIndexBy=_y,R.sortedIndexOf=vy,R.sortedLastIndex=xy,R.sortedLastIndexBy=yy,R.sortedLastIndexOf=Sy,R.startCase=rE,R.startsWith=sE,R.subtract=$E,R.sum=JE,R.sumBy=QE,R.template=oE,R.times=NE,R.toFinite=ar,R.toInteger=st,R.toLength=Mp,R.toLower=aE,R.toNumber=ui,R.toSafeInteger=aM,R.toString=Rt,R.toUpper=cE,R.trim=lE,R.trimEnd=uE,R.trimStart=hE,R.truncate=fE,R.unescape=dE,R.uniqueId=BE,R.upperCase=pE,R.upperFirst=Pu,R.each=cp,R.eachRight=lp,R.first=rp,Du(R,function(){var s={};return Ni(R,function(a,u){Pt.call(R.prototype,u)||(s[u]=a)}),s}(),{chain:!1}),R.VERSION=n,ri(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){R[s].placeholder=R}),ri(["drop","take"],function(s,a){xt.prototype[s]=function(u){u=u===t?1:cn(st(u),0);var g=this.__filtered__&&!a?new xt(this):this.clone();return g.__filtered__?g.__takeCount__=En(u,g.__takeCount__):g.__views__.push({size:En(u,Me),type:s+(g.__dir__<0?"Right":"")}),g},xt.prototype[s+"Right"]=function(u){return this.reverse()[s](u).reverse()}}),ri(["filter","map","takeWhile"],function(s,a){var u=a+1,g=u==q||u==se;xt.prototype[s]=function(T){var P=this.clone();return P.__iteratees__.push({iteratee:We(T,3),type:u}),P.__filtered__=P.__filtered__||g,P}}),ri(["head","last"],function(s,a){var u="take"+(a?"Right":"");xt.prototype[s]=function(){return this[u](1).value()[0]}}),ri(["initial","tail"],function(s,a){var u="drop"+(a?"":"Right");xt.prototype[s]=function(){return this.__filtered__?new xt(this):this[u](1)}}),xt.prototype.compact=function(){return this.filter(Vn)},xt.prototype.find=function(s){return this.filter(s).head()},xt.prototype.findLast=function(s){return this.reverse().find(s)},xt.prototype.invokeMap=pt(function(s,a){return typeof s=="function"?new xt(this):this.map(function(u){return Wo(u,s,a)})}),xt.prototype.reject=function(s){return this.filter(vc(We(s)))},xt.prototype.slice=function(s,a){s=st(s);var u=this;return u.__filtered__&&(s>0||a<0)?new xt(u):(s<0?u=u.takeRight(-s):s&&(u=u.drop(s)),a!==t&&(a=st(a),u=a<0?u.dropRight(-a):u.take(a-s)),u)},xt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},xt.prototype.toArray=function(){return this.take(Me)},Ni(xt.prototype,function(s,a){var u=/^(?:filter|find|map|reject)|While$/.test(a),g=/^(?:head|last)$/.test(a),T=R[g?"take"+(a=="last"?"Right":""):a],P=g||/^find/.test(a);T&&(R.prototype[a]=function(){var z=this.__wrapped__,H=g?[1]:arguments,X=z instanceof xt,ce=H[0],le=X||it(z),fe=function(vt){var Et=T.apply(R,br([vt],H));return g&&Ee?Et[0]:Et};le&&u&&typeof ce=="function"&&ce.length!=1&&(X=le=!1);var Ee=this.__chain__,Oe=!!this.__actions__.length,Ye=P&&!Ee,lt=X&&!Oe;if(!P&&le){z=lt?z:new xt(this);var je=s.apply(z,H);return je.__actions__.push({func:pc,args:[fe],thisArg:t}),new oi(je,Ee)}return Ye&<?s.apply(this,H):(je=this.thru(fe),Ye?g?je.value()[0]:je.value():je)})}),ri(["pop","push","shift","sort","splice","unshift"],function(s){var a=ka[s],u=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",g=/^(?:pop|shift)$/.test(s);R.prototype[s]=function(){var T=arguments;if(g&&!this.__chain__){var P=this.value();return a.apply(it(P)?P:[],T)}return this[u](function(z){return a.apply(it(z)?z:[],T)})}}),Ni(xt.prototype,function(s,a){var u=R[a];if(u){var g=u.name+"";Pt.call(Ls,g)||(Ls[g]=[]),Ls[g].push({name:a,func:u})}}),Ls[ac(t,_).name]=[{name:"wrapper",func:t}],xt.prototype.clone=dv,xt.prototype.reverse=pv,xt.prototype.value=mv,R.prototype.at=Wy,R.prototype.chain=Xy,R.prototype.commit=Yy,R.prototype.next=jy,R.prototype.plant=Ky,R.prototype.reverse=Zy,R.prototype.toJSON=R.prototype.valueOf=R.prototype.value=$y,R.prototype.first=R.prototype.head,Fo&&(R.prototype[Fo]=qy),R},Rs=Y0();qr?((qr.exports=Rs)._=Rs,Il._=Rs):_n._=Rs}).call(IP)}(ma,ma.exports)),ma.exports}var OP=DP();class Mh{constructor(e,t){this._path=e,this._ctor=t}_promise=null;_instance=null;async get(){return this._instance?Promise.resolve(this._instance):this._promise?this._promise:(this._promise=(async()=>{const t=(await import(this._path))[this._ctor];if(!t)throw new Error(`DIVE: Module class ${this._ctor} not found in ${this._path}`);if(typeof t!="function")throw new Error(`DIVE: Module at ${this._path} does not export a valid constructor (${this._ctor} wanted)`);return this._instance=new t,this._instance})(),this._promise)}}class Cn{static __instances=[];static get(e){const t=this.__instances.find(n=>n.id===e);return t||this.__instances.find(n=>Array.from(n.registered.values()).find(r=>r.id===e))}_id;get id(){return this._id}renderer;scene;controller;toolbox;_mediaGenerator=new Mh("../mediacreator/MediaCreator.ts","DIVEMediaCreator");_io=new Mh("../io/IO.ts","DIVEIO");_ar=new Mh("../ar/AR.ts","DIVEAR");registered=new Map;listeners=new Map;constructor(e,t,n,r){this._id=yP(),this.renderer=e,this.scene=t,this.controller=n,this.toolbox=r,Cn.__instances.push(this)}DestroyInstance(){const e=Cn.__instances.findIndex(t=>t.id===this.id);return e===-1?!1:(Cn.__instances.splice(e,1),!0)}PerformAction(e,t){let n=!1;switch(e){case"START_RENDER":{this.renderer.StartRenderer(this.scene,this.controller.object),n=!0;break}case"GET_ALL_SCENE_DATA":{n=this.getAllSceneData(t);break}case"GET_ALL_OBJECTS":{n=this.getAllObjects(t);break}case"GET_OBJECTS":{n=this.getObjects(t);break}case"ADD_OBJECT":{n=this.addObject(t);break}case"UPDATE_OBJECT":{n=this.updateObject(t);break}case"DELETE_OBJECT":{n=this.deleteObject(t);break}case"SELECT_OBJECT":{n=this.selectObject(t);break}case"DESELECT_OBJECT":{n=this.deselectObject(t);break}case"SET_BACKGROUND":{n=this.setBackground(t);break}case"DROP_IT":{n=this.dropIt(t);break}case"PLACE_ON_FLOOR":{n=this.placeOnFloor(t);break}case"SET_CAMERA_TRANSFORM":{n=this.setCameraTransform(t);break}case"GET_CAMERA_TRANSFORM":{n=this.getCameraTransform(t);break}case"MOVE_CAMERA":{n=this.moveCamera(t);break}case"RESET_CAMERA":{n=this.resetCamera(t);break}case"COMPUTE_ENCOMPASSING_VIEW":{n=this.computeEncompassingView(t);break}case"SET_CAMERA_LAYER":{n=this.setCameraLayer(t);break}case"ZOOM_CAMERA":{n=this.zoomCamera(t);break}case"SET_GIZMO_MODE":{n=this.setGizmoMode(t);break}case"SET_GIZMO_VISIBILITY":{n=this.setGizmoVisibility(t);break}case"SET_GIZMO_SCALE_LINKED":{n=this.setGizmoScaleLinked(t);break}case"USE_TOOL":{n=this.useTool(t);break}case"MODEL_LOADED":{n=this.modelLoaded(t);break}case"UPDATE_SCENE":{n=this.updateScene(t);break}case"GENERATE_MEDIA":{n=this.generateMedia(t);break}case"SET_PARENT":{n=this.setParent(t);break}case"EXPORT_SCENE":{n=this.exportScene(t);break}case"LAUNCH_AR":{const{uri:r,options:o}=t;n=new Promise((c,l)=>{this._ar.get().then(h=>{c(h.launch(r,o))}).catch(l)});break}default:console.warn(`DIVECommunication.PerformAction: has been executed with unknown Action type ${e}`)}return this.dispatch(e,t),n}Subscribe(e,t){return this.listeners.get(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t),()=>{const n=this.listeners.get(e);if(!n)return!1;const r=n.findIndex(o=>o===t);return r===-1?!1:(n.splice(r,1),!0)}}dispatch(e,t){const n=this.listeners.get(e);n&&n.forEach(r=>r(t))}getAllSceneData(e){const t={name:this.scene.name,mediaItem:null,backgroundColor:"#"+this.scene.background.getHexString(),floorEnabled:this.scene.Floor.visible,floorColor:"#"+this.scene.Floor.material.color.getHexString(),userCamera:{position:this.controller.object.position.clone(),target:this.controller.target.clone()},spotmarks:[],lights:Array.from(this.registered.values()).filter(n=>n.entityType==="light"),objects:Array.from(this.registered.values()).filter(n=>n.entityType==="model"),cameras:Array.from(this.registered.values()).filter(n=>n.entityType==="pov"),primitives:Array.from(this.registered.values()).filter(n=>n.entityType==="primitive"),groups:Array.from(this.registered.values()).filter(n=>n.entityType==="group")};return Object.assign(e,t),t}getAllObjects(e){return Object.assign(e,this.registered),this.registered}getObjects(e){if(e.ids.length===0)return[];const t=[];return this.registered.forEach(n=>{e.ids.includes(n.id)&&t.push(n)}),t}addObject(e){return this.registered.get(e.id)?!1:(e.parentId===void 0&&(e.parentId=null),this.registered.set(e.id,e),this.scene.AddSceneObject(e),!0)}updateObject(e){const t=this.registered.get(e.id);if(!t)return!1;this.registered.set(e.id,OP.merge(t,e));const n=this.registered.get(e.id);return this.scene.UpdateSceneObject({...e,id:n.id,entityType:n.entityType}),Object.assign(e,n),!0}deleteObject(e){const t=this.registered.get(e.id);return t?(t.parentId&&this.setParent({object:{id:t.id},parent:null}),t.entityType==="group"&&this.registered.forEach(n=>{n.parentId===t.id&&this.updateObject({id:n.id,parentId:null})}),Object.assign(e,t),this.registered.delete(e.id),Array.from(this.registered.values()).forEach(n=>{n.parentId&&n.parentId===e.id&&(n.parentId=null)}),this.scene.DeleteSceneObject(t),!0):!1}selectObject(e){const t=this.registered.get(e.id);if(!t)return!1;const n=this.scene.GetSceneObject(t);if(!n||!("isSelectable"in n))return!1;const r=this.toolbox.GetActiveTool();return r&&Ng(r)&&r.AttachGizmo(n),Object.assign(e,t),!0}deselectObject(e){const t=this.registered.get(e.id);if(!t)return!1;const n=this.scene.GetSceneObject(t);if(!n||!("isSelectable"in n))return!1;const r=this.toolbox.GetActiveTool();return r&&Ng(r)&&r.DetachGizmo(),Object.assign(e,t),!0}setBackground(e){return this.scene.SetBackground(e.color),!0}dropIt(e){const t=this.registered.get(e.id);return t?(this.scene.GetSceneObject(t).DropIt(),!0):!1}placeOnFloor(e){const t=this.registered.get(e.id);return t?(this.scene.PlaceOnFloor(t),!0):!1}setCameraTransform(e){return this.controller.object.position.copy(e.position),this.controller.target.copy(e.target),this.controller.update(),!0}getCameraTransform(e){const t={position:this.controller.object.position.clone(),target:this.controller.target.clone()};return Object.assign(e,t),t}moveCamera(e){let t={x:0,y:0,z:0},n={x:0,y:0,z:0};return"id"in e?(t=this.registered.get(e.id).position,n=this.registered.get(e.id).target):(t=e.position,n=e.target),this.controller.MoveTo(t,n,e.duration,e.locked),!0}setCameraLayer(e){return this.controller.object.SetCameraLayer(e.layer),!0}resetCamera(e){return this.controller.RevertLast(e.duration),!0}computeEncompassingView(e){const t=this.scene.ComputeSceneBB(),n=this.controller.ComputeEncompassingView(t);return Object.assign(e,n),n}zoomCamera(e){return e.direction==="IN"&&this.controller.ZoomIn(e.by),e.direction==="OUT"&&this.controller.ZoomOut(e.by),!0}setGizmoMode(e){return this.toolbox.SetGizmoMode(e.mode),!0}setGizmoVisibility(e){return this.toolbox.SetGizmoVisibility(e),e}setGizmoScaleLinked(e){return this.toolbox.SetGizmoScaleLinked(e),e}useTool(e){return this.toolbox.UseTool(e.tool),!0}modelLoaded(e){return this.registered.get(e.id).loaded=!0,!0}updateScene(e){return e.name!==void 0&&(this.scene.name=e.name),e.backgroundColor!==void 0&&this.scene.SetBackground(e.backgroundColor),e.gridEnabled!==void 0&&this.scene.Grid.SetVisibility(e.gridEnabled),e.floorEnabled!==void 0&&this.scene.Floor.SetVisibility(e.floorEnabled),e.floorColor!==void 0&&this.scene.Floor.SetColor(e.floorColor),e.name=this.scene.name,e.backgroundColor="#"+this.scene.background.getHexString(),e.gridEnabled=this.scene.Grid.visible,e.floorEnabled=this.scene.Floor.visible,e.floorColor="#"+this.scene.Floor.material.color.getHexString(),!0}generateMedia(e){let t={x:0,y:0,z:0},n={x:0,y:0,z:0};return"id"in e?(t=this.registered.get(e.id).position,n=this.registered.get(e.id).target):(t=e.position,n=e.target),this._mediaGenerator.get().then(r=>r.GenerateMedia(t,n,e.width,e.height))}setParent(e){const t=this.registered.get(e.object.id);if(!t)return!1;const n=this.scene.GetSceneObject(t);if(!n)return!1;if(e.parent===null)return this.scene.Root.attach(n),this.updateObject({id:t.id,parentId:null}),!0;if(e.object.id===e.parent.id)return!1;const r=this.registered.get(e.parent.id);if(!r)return this.scene.Root.attach(n),this.updateObject({id:t.id,parentId:null}),!0;const o=this.scene.GetSceneObject(r);return o?(o.attach(n),this.updateObject({id:t.id,parentId:r.id}),!0):(this.scene.Root.attach(n),this.updateObject({id:t.id,parentId:null}),!0)}exportScene(e){return new Promise((t,n)=>{this._io.get().then(r=>{t(r.Export(e.type))}).catch(n)})}}class UP extends mt{isDIVELight=!0;isDIVEPointLight=!0;isMovable=!0;isSelectable=!0;gizmo=null;light;mesh;constructor(){super(),this.name="DIVEPointLight",this.light=new B_(16777215,1),this.light.layers.mask=ti,this.light.castShadow=!0,this.light.shadow.mapSize.width=512,this.light.shadow.mapSize.height=512,this.add(this.light);const e=.1,t=new Pa(e,e*320,e*320),n=new Wi({color:this.light.color,transparent:!0,opacity:.8,side:Yi});this.mesh=new ye(t,n),this.mesh.layers.mask=mf,this.add(this.mesh)}SetColor(e){this.light.color=e,this.mesh.material.color=e}SetIntensity(e){this.light.intensity=e,this.mesh.material.opacity=e>.8?.8:e*.8}SetEnabled(e){this.light.visible=e}onMove(){Cn.get(this.userData.id)?.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.position})}onSelect(){Cn.get(this.userData.id)?.PerformAction("SELECT_OBJECT",{id:this.userData.id})}onDeselect(){Cn.get(this.userData.id)?.PerformAction("DESELECT_OBJECT",{id:this.userData.id})}}class NP extends mt{isDIVELight=!0;isDIVESceneLight=!0;_hemiLight;_dirLight;constructor(){super(),this.name="DIVESceneLight",this._hemiLight=new JC(16777215,16777215,2),this._hemiLight.layers.mask=ti,this._hemiLight.position.set(0,50,0),this.add(this._hemiLight),this._dirLight=new ff(16777215,3),this._dirLight.layers.mask=ti,this._dirLight.position.set(1,1.75,1),this._dirLight.position.multiplyScalar(30),this._dirLight.castShadow=!0,this._dirLight.shadow.mapSize.width=2048,this._dirLight.shadow.mapSize.height=2048;const e=5;this._dirLight.shadow.camera.left=-5,this._dirLight.shadow.camera.right=e,this._dirLight.shadow.camera.top=e,this._dirLight.shadow.camera.bottom=-5,this._dirLight.shadow.camera.far=3500,this.add(this._dirLight)}SetColor(e){this._hemiLight.color=e,this._dirLight.color=e}SetIntensity(e){this._hemiLight.intensity=e*2,this._dirLight.intensity=e*3}SetEnabled(e){this._hemiLight.visible=e,this._dirLight.visible=e}}const gf=i=>i.parent?gf(i.parent):i;class FP{isMovable=!0}class BP{isSelectable=!0}function zP(i,e){return e.forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(n=>{Object.defineProperty(i.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))})}),i}class _f extends zP(mt,[BP,FP]){isDIVENode=!0;gizmo=null;_positionWorldBuffer;_boundingBox;constructor(){super(),this.layers.mask=ti,this._positionWorldBuffer=new N,this._boundingBox=new Ii}SetPosition(e){if(!this.parent){this.position.set(e.x,e.y,e.z);return}const t=new N(e.x,e.y,e.z);this.position.copy(this.parent.worldToLocal(t)),"isDIVEGroup"in this.parent&&this.parent.UpdateLineTo(this)}SetRotation(e){this.rotation.set(e.x,e.y,e.z)}SetScale(e){this.scale.set(e.x,e.y,e.z)}SetVisibility(e){this.visible=e}SetToWorldOrigin(){this.position.set(0,0,0),Cn.get(this.userData.id)?.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})}onMove(){Cn.get(this.userData.id)?.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})}onSelect(){Cn.get(this.userData.id)?.PerformAction("SELECT_OBJECT",{id:this.userData.id})}onDeselect(){Cn.get(this.userData.id)?.PerformAction("DESELECT_OBJECT",{id:this.userData.id})}}class kP extends _f{isDIVEModel=!0;_mesh=null;_material=null;SetModel(e){this.clear(),this._boundingBox.makeEmpty(),e.traverse(t=>{t.castShadow=!0,t.receiveShadow=!0,t.layers.mask=this.layers.mask,this._boundingBox.expandByObject(t),!this._mesh&&"isMesh"in t&&(this._mesh=t,this._material?this._mesh.material=this._material:this._material=t.material)}),this.add(e)}SetMaterial(e){this._material||(this._material=new Ro),e.vertexColors!==void 0&&(this._material.vertexColors=e.vertexColors),e.color!==void 0&&this._material.color.set(e.color),e.map!==void 0&&(this._material.map=e.map),e.normalMap!==void 0&&(this._material.normalMap=e.normalMap),e.roughness!==void 0&&(this._material.roughness=e.roughness),e.roughnessMap!==void 0&&(this._material.roughnessMap=e.roughnessMap,this._material.roughnessMap&&(this._material.roughness=1)),e.metalness!==void 0&&(this._material.metalness=e.metalness),e.metalnessMap!==void 0&&(this._material.metalnessMap=e.metalnessMap,this._material.metalnessMap&&(this._material.metalness=1)),this._mesh&&(this._mesh.material=this._material)}PlaceOnFloor(){const e=this.getWorldPosition(this._positionWorldBuffer),t=e.clone();this._mesh?.geometry?.computeBoundingBox();const n=this._mesh?.geometry?.boundingBox;!n||!this._mesh||(e.y=e.y-this._mesh.localToWorld(n.min.clone()).y,e.y!==t.y&&Cn.get(this.userData.id)?.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:e,rotation:this.rotation,scale:this.scale}))}DropIt(){if(!this.parent){console.warn("DIVEModel: DropIt() called on a model that is not in the scene.",this);return}const e=this._boundingBox.min.y*this.scale.y,t=this.localToWorld(this._boundingBox.getCenter(new N).multiply(this.scale));t.y=e+this.position.y;const n=new El(t,new N(0,-1,0));n.layers.mask=ti;const r=n.intersectObjects(gf(this).Root.children,!0);if(r.length>0){const o=r[0].object;o.geometry.computeBoundingBox();const c=o.geometry.boundingBox,l=o.localToWorld(c.max.clone()),h=this.position.clone(),f=this.position.clone().setY(l.y).sub(new N(0,e,0));if(this.position.copy(f),this.position.y===h.y)return;this.onMove()}}}class HP extends _f{isDIVEPrimitive=!0;_mesh;constructor(){super(),this._mesh=new ye,this._mesh.layers.mask=ti,this._mesh.castShadow=!0,this._mesh.receiveShadow=!0,this._mesh.material=new Ro,this.add(this._mesh)}SetGeometry(e){const t=this.assembleGeometry(e);t&&(this._mesh.geometry=t,this._boundingBox.setFromObject(this._mesh))}SetMaterial(e){const t=this._mesh.material;e.vertexColors!==void 0&&(t.vertexColors=e.vertexColors),e.color!==void 0&&(t.color=new Ne(e.color)),e.map!==void 0&&(t.map=e.map),e.normalMap!==void 0&&(t.normalMap=e.normalMap),e.roughness!==void 0&&(t.roughness=e.roughness),e.roughnessMap!==void 0&&(t.roughnessMap=e.roughnessMap,t.roughnessMap&&(t.roughness=1)),e.metalness!==void 0&&(t.metalness=e.metalness),e.metalnessMap!==void 0&&(t.metalnessMap=e.metalnessMap,t.metalnessMap&&(t.metalness=0)),this._mesh&&(this._mesh.material=t)}PlaceOnFloor(){const e=this.getWorldPosition(this._positionWorldBuffer),t=e.clone();this._mesh?.geometry?.computeBoundingBox();const n=this._mesh?.geometry?.boundingBox;!n||!this._mesh||(e.y=e.y-this._mesh.localToWorld(n.min.clone()).y,e.y!==t.y&&Cn.get(this.userData.id)?.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:e,rotation:this.rotation,scale:this.scale}))}DropIt(){if(!this.parent){console.warn("DIVEPrimitive: DropIt() called on a model that is not in the scene.",this);return}const e=this._boundingBox.min.y*this.scale.y,t=this.localToWorld(this._boundingBox.getCenter(new N).multiply(this.scale));t.y=e+this.position.y;const n=new El(t,new N(0,-1,0));n.layers.mask=ti;const r=n.intersectObjects(gf(this).Root.children,!0);if(r.length>0){const o=r[0].object;o.geometry.computeBoundingBox();const c=o.geometry.boundingBox,l=o.localToWorld(c.max.clone()),h=this.position.clone(),f=this.position.clone().setY(l.y).sub(new N(0,e,0));if(this.position.copy(f),this.position.y===h.y)return;this.onMove()}}assembleGeometry(e){switch(this._mesh.material.flatShading=!1,e.name.toLowerCase()){case"cylinder":return this.createCylinderGeometry(e);case"sphere":return this.createSphereGeometry(e);case"pyramid":return this._mesh.material.flatShading=!0,this.createPyramidGeometry(e);case"cube":case"box":return this.createBoxGeometry(e);case"cone":return this.createConeGeometry(e);case"wall":return this.createWallGeometry(e);case"plane":return this.createPlaneGeometry(e);default:return console.warn("DIVEPrimitive.assembleGeometry: Invalid geometry type:",e.name.toLowerCase()),null}}createCylinderGeometry(e){const t=new gn(e.width/2,e.width/2,e.height,64);return t.translate(0,e.height/2,0),t}createSphereGeometry(e){return new Pa(e.width/2,256,256)}createPyramidGeometry(e){const t=new Float32Array([-e.width/2,0,-e.depth/2,e.width/2,0,-e.depth/2,e.width/2,0,e.depth/2,-e.width/2,0,e.depth/2,0,e.height,0]),n=new Uint16Array([0,1,2,0,2,3,0,4,1,1,4,2,2,4,3,3,4,0]),r=new Jt;return r.setAttribute("position",new nn(t,3)),r.setIndex(new nn(n,1)),r.computeVertexNormals(),r.computeBoundingBox(),r.computeBoundingSphere(),r}createBoxGeometry(e){const t=new qt(e.width,e.height,e.depth);return t.translate(0,e.height/2,0),t}createConeGeometry(e){const t=new lf(e.width/2,e.height,256);return t.translate(0,e.height/2,0),t}createWallGeometry(e){const t=new qt(e.width,e.height,e.depth||.05,16);return t.translate(0,e.height/2,0),t}createPlaneGeometry(e){const t=new qt(e.width,e.height,e.depth);return t.translate(0,e.height/2,0),t}}class GP extends _f{isDIVEGroup=!0;_members;get members(){return this._members}_lines;constructor(){super(),this.name="DIVEGroup",this._members=[],this._lines=[]}SetPosition(e){super.SetPosition(e),this._members.forEach(t=>{"isDIVENode"in t&&t.onMove()})}SetLinesVisibility(e,t){if(!t){this._lines.forEach(r=>{r.visible=e});return}const n=this._members.indexOf(t);n!==-1&&(this._lines[n].visible=e)}attach(e){if(this._members.includes(e))return this;const t=this.createLine();return this.add(t),this._lines.push(t),super.attach(e),this._members.push(e),this.updateLineTo(t,e),this.SetLinesVisibility(!0,e),this}remove(e){const t=this._members.indexOf(e);if(t===-1)return this;const n=this._lines[t];return super.remove(n),this._lines.splice(t,1),super.remove(e),this._members.splice(t,1),this}UpdateLineTo(e){const t=this._members.indexOf(e);t!==-1&&this.updateLineTo(this._lines[t],e)}createLine(){const e=new Jt,t=new BC({color:6710886,dashSize:.05,gapSize:.025}),n=new di(e,t);return n.visible=!1,n}updateLineTo(e,t){e.geometry.setFromPoints([new N(0,0,0),t.position.clone()]),e.computeLineDistances()}}function Bg(i,e){if(e===jb)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===Uh||e===c_){let t=i.getIndex();if(t===null){const c=[],l=i.getAttribute("position");if(l!==void 0){for(let h=0;h<l.count;h++)c.push(h);i.setIndex(c),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}const n=t.count-2,r=[];if(e===Uh)for(let c=1;c<=n;c++)r.push(t.getX(0)),r.push(t.getX(c)),r.push(t.getX(c+1));else for(let c=0;c<n;c++)c%2===0?(r.push(t.getX(c)),r.push(t.getX(c+1)),r.push(t.getX(c+2))):(r.push(t.getX(c+2)),r.push(t.getX(c+1)),r.push(t.getX(c)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=i.clone();return o.setIndex(r),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}class VP extends Ms{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new qP(t)}),this.register(function(t){return new iL(t)}),this.register(function(t){return new rL(t)}),this.register(function(t){return new sL(t)}),this.register(function(t){return new ZP(t)}),this.register(function(t){return new $P(t)}),this.register(function(t){return new JP(t)}),this.register(function(t){return new QP(t)}),this.register(function(t){return new jP(t)}),this.register(function(t){return new eL(t)}),this.register(function(t){return new KP(t)}),this.register(function(t){return new nL(t)}),this.register(function(t){return new tL(t)}),this.register(function(t){return new XP(t)}),this.register(function(t){return new oL(t)}),this.register(function(t){return new aL(t)})}load(e,t,n,r){const o=this;let c;if(this.resourcePath!=="")c=this.resourcePath;else if(this.path!==""){const f=Sa.extractUrlBase(e);c=Sa.resolveURL(f,this.path)}else c=Sa.extractUrlBase(e);this.manager.itemStart(e);const l=function(f){r?r(f):console.error(f),o.manager.itemError(e),o.manager.itemEnd(e)},h=new ml(this.manager);h.setPath(this.path),h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(e,function(f){try{o.parse(f,c,function(d){t(d),o.manager.itemEnd(e)},l)}catch(d){l(d)}},n,l)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,r){let o;const c={},l={},h=new TextDecoder;if(typeof e=="string")o=JSON.parse(e);else if(e instanceof ArrayBuffer)if(h.decode(new Uint8Array(e,0,4))===V_){try{c[yt.KHR_BINARY_GLTF]=new cL(e)}catch(p){r&&r(p);return}o=JSON.parse(c[yt.KHR_BINARY_GLTF].content)}else o=JSON.parse(h.decode(e));else o=e;if(o.asset===void 0||o.asset.version[0]<2){r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const f=new SL(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});f.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const p=this.pluginCallbacks[d](f);p.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),l[p.name]=p,c[p.name]=!0}if(o.extensionsUsed)for(let d=0;d<o.extensionsUsed.length;++d){const p=o.extensionsUsed[d],m=o.extensionsRequired||[];switch(p){case yt.KHR_MATERIALS_UNLIT:c[p]=new YP;break;case yt.KHR_DRACO_MESH_COMPRESSION:c[p]=new lL(o,this.dracoLoader);break;case yt.KHR_TEXTURE_TRANSFORM:c[p]=new uL;break;case yt.KHR_MESH_QUANTIZATION:c[p]=new hL;break;default:m.indexOf(p)>=0&&l[p]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}f.setExtensions(c),f.setPlugins(l),f.parse(n,r)}parseAsync(e,t){const n=this;return new Promise(function(r,o){n.parse(e,t,r,o)})}}function WP(){let i={};return{get:function(e){return i[e]},add:function(e,t){i[e]=t},remove:function(e){delete i[e]},removeAll:function(){i={}}}}const yt={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class XP{constructor(e){this.parser=e,this.name=yt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n<r;n++){const o=t[n];o.extensions&&o.extensions[this.name]&&o.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,o.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let r=t.cache.get(n);if(r)return r;const o=t.json,h=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let f;const d=new Ne(16777215);h.color!==void 0&&d.setRGB(h.color[0],h.color[1],h.color[2],yn);const p=h.range!==void 0?h.range:0;switch(h.type){case"directional":f=new ff(d),f.target.position.set(0,0,-1),f.add(f.target);break;case"point":f=new B_(d),f.distance=p;break;case"spot":f=new eP(d),f.distance=p,h.spot=h.spot||{},h.spot.innerConeAngle=h.spot.innerConeAngle!==void 0?h.spot.innerConeAngle:0,h.spot.outerConeAngle=h.spot.outerConeAngle!==void 0?h.spot.outerConeAngle:Math.PI/4,f.angle=h.spot.outerConeAngle,f.penumbra=1-h.spot.innerConeAngle/h.spot.outerConeAngle,f.target.position.set(0,0,-1),f.add(f.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+h.type)}return f.position.set(0,0,0),f.decay=2,Gr(f,h),h.intensity!==void 0&&(f.intensity=h.intensity),f.name=t.createUniqueName(h.name||"light_"+e),r=Promise.resolve(f),t.cache.add(n,r),r}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,o=n.json.nodes[e],l=(o.extensions&&o.extensions[this.name]||{}).light;return l===void 0?null:this._loadLight(l).then(function(h){return n._getNodeRef(t.cache,l,h)})}}class YP{constructor(){this.name=yt.KHR_MATERIALS_UNLIT}getMaterialType(){return Wi}extendParams(e,t,n){const r=[];e.color=new Ne(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const c=o.baseColorFactor;e.color.setRGB(c[0],c[1],c[2],yn),e.opacity=c[3]}o.baseColorTexture!==void 0&&r.push(n.assignTexture(e,"map",o.baseColorTexture,ln))}return Promise.all(r)}}class jP{constructor(e){this.parser=e,this.name=yt.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=r.extensions[this.name].emissiveStrength;return o!==void 0&&(t.emissiveIntensity=o),Promise.resolve()}}class qP{constructor(e){this.parser=e,this.name=yt.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:$i}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],c=r.extensions[this.name];if(c.clearcoatFactor!==void 0&&(t.clearcoat=c.clearcoatFactor),c.clearcoatTexture!==void 0&&o.push(n.assignTexture(t,"clearcoatMap",c.clearcoatTexture)),c.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=c.clearcoatRoughnessFactor),c.clearcoatRoughnessTexture!==void 0&&o.push(n.assignTexture(t,"clearcoatRoughnessMap",c.clearcoatRoughnessTexture)),c.clearcoatNormalTexture!==void 0&&(o.push(n.assignTexture(t,"clearcoatNormalMap",c.clearcoatNormalTexture)),c.clearcoatNormalTexture.scale!==void 0)){const l=c.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Pe(l,l)}return Promise.all(o)}}class KP{constructor(e){this.parser=e,this.name=yt.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:$i}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],c=r.extensions[this.name];return c.iridescenceFactor!==void 0&&(t.iridescence=c.iridescenceFactor),c.iridescenceTexture!==void 0&&o.push(n.assignTexture(t,"iridescenceMap",c.iridescenceTexture)),c.iridescenceIor!==void 0&&(t.iridescenceIOR=c.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),c.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=c.iridescenceThicknessMinimum),c.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=c.iridescenceThicknessMaximum),c.iridescenceThicknessTexture!==void 0&&o.push(n.assignTexture(t,"iridescenceThicknessMap",c.iridescenceThicknessTexture)),Promise.all(o)}}class ZP{constructor(e){this.parser=e,this.name=yt.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:$i}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new Ne(0,0,0),t.sheenRoughness=0,t.sheen=1;const c=r.extensions[this.name];if(c.sheenColorFactor!==void 0){const l=c.sheenColorFactor;t.sheenColor.setRGB(l[0],l[1],l[2],yn)}return c.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=c.sheenRoughnessFactor),c.sheenColorTexture!==void 0&&o.push(n.assignTexture(t,"sheenColorMap",c.sheenColorTexture,ln)),c.sheenRoughnessTexture!==void 0&&o.push(n.assignTexture(t,"sheenRoughnessMap",c.sheenRoughnessTexture)),Promise.all(o)}}class $P{constructor(e){this.parser=e,this.name=yt.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:$i}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],c=r.extensions[this.name];return c.transmissionFactor!==void 0&&(t.transmission=c.transmissionFactor),c.transmissionTexture!==void 0&&o.push(n.assignTexture(t,"transmissionMap",c.transmissionTexture)),Promise.all(o)}}class JP{constructor(e){this.parser=e,this.name=yt.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:$i}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],c=r.extensions[this.name];t.thickness=c.thicknessFactor!==void 0?c.thicknessFactor:0,c.thicknessTexture!==void 0&&o.push(n.assignTexture(t,"thicknessMap",c.thicknessTexture)),t.attenuationDistance=c.attenuationDistance||1/0;const l=c.attenuationColor||[1,1,1];return t.attenuationColor=new Ne().setRGB(l[0],l[1],l[2],yn),Promise.all(o)}}class QP{constructor(e){this.parser=e,this.name=yt.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:$i}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=r.extensions[this.name];return t.ior=o.ior!==void 0?o.ior:1.5,Promise.resolve()}}class eL{constructor(e){this.parser=e,this.name=yt.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:$i}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],c=r.extensions[this.name];t.specularIntensity=c.specularFactor!==void 0?c.specularFactor:1,c.specularTexture!==void 0&&o.push(n.assignTexture(t,"specularIntensityMap",c.specularTexture));const l=c.specularColorFactor||[1,1,1];return t.specularColor=new Ne().setRGB(l[0],l[1],l[2],yn),c.specularColorTexture!==void 0&&o.push(n.assignTexture(t,"specularColorMap",c.specularColorTexture,ln)),Promise.all(o)}}class tL{constructor(e){this.parser=e,this.name=yt.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:$i}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],c=r.extensions[this.name];return t.bumpScale=c.bumpFactor!==void 0?c.bumpFactor:1,c.bumpTexture!==void 0&&o.push(n.assignTexture(t,"bumpMap",c.bumpTexture)),Promise.all(o)}}class nL{constructor(e){this.parser=e,this.name=yt.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:$i}extendMaterialParams(e,t){const n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],c=r.extensions[this.name];return c.anisotropyStrength!==void 0&&(t.anisotropy=c.anisotropyStrength),c.anisotropyRotation!==void 0&&(t.anisotropyRotation=c.anisotropyRotation),c.anisotropyTexture!==void 0&&o.push(n.assignTexture(t,"anisotropyMap",c.anisotropyTexture)),Promise.all(o)}}class iL{constructor(e){this.parser=e,this.name=yt.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const o=r.extensions[this.name],c=t.options.ktx2Loader;if(!c){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,c)}}class rL{constructor(e){this.parser=e,this.name=yt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,r=n.json,o=r.textures[e];if(!o.extensions||!o.extensions[t])return null;const c=o.extensions[t],l=r.images[c.source];let h=n.textureLoader;if(l.uri){const f=n.options.manager.getHandler(l.uri);f!==null&&(h=f)}return this.detectSupport().then(function(f){if(f)return n.loadTextureImage(e,c.source,h);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class sL{constructor(e){this.parser=e,this.name=yt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,r=n.json,o=r.textures[e];if(!o.extensions||!o.extensions[t])return null;const c=o.extensions[t],l=r.images[c.source];let h=n.textureLoader;if(l.uri){const f=n.options.manager.getHandler(l.uri);f!==null&&(h=f)}return this.detectSupport().then(function(f){if(f)return n.loadTextureImage(e,c.source,h);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class oL{constructor(e){this.name=yt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const r=n.extensions[this.name],o=this.parser.getDependency("buffer",r.buffer),c=this.parser.options.meshoptDecoder;if(!c||!c.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(l){const h=r.byteOffset||0,f=r.byteLength||0,d=r.count,p=r.byteStride,m=new Uint8Array(l,h,f);return c.decodeGltfBufferAsync?c.decodeGltfBufferAsync(d,p,m,r.mode,r.filter).then(function(x){return x.buffer}):c.ready.then(function(){const x=new ArrayBuffer(d*p);return c.decodeGltfBuffer(new Uint8Array(x),d,p,m,r.mode,r.filter),x})})}else return null}}class aL{constructor(e){this.name=yt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const r=t.meshes[n.mesh];for(const f of r.primitives)if(f.mode!==fi.TRIANGLES&&f.mode!==fi.TRIANGLE_STRIP&&f.mode!==fi.TRIANGLE_FAN&&f.mode!==void 0)return null;const c=n.extensions[this.name].attributes,l=[],h={};for(const f in c)l.push(this.parser.getDependency("accessor",c[f]).then(d=>(h[f]=d,h[f])));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then(f=>{const d=f.pop(),p=d.isGroup?d.children:[d],m=f[0].count,x=[];for(const M of p){const A=new Qe,v=new N,_=new on,C=new N(1,1,1),b=new OC(M.geometry,M.material,m);for(let L=0;L<m;L++)h.TRANSLATION&&v.fromBufferAttribute(h.TRANSLATION,L),h.ROTATION&&_.fromBufferAttribute(h.ROTATION,L),h.SCALE&&C.fromBufferAttribute(h.SCALE,L),b.setMatrixAt(L,A.compose(v,_,C));for(const L in h)if(L==="_COLOR_0"){const k=h[L];b.instanceColor=new Bh(k.array,k.itemSize,k.normalized)}else L!=="TRANSLATION"&&L!=="ROTATION"&&L!=="SCALE"&&M.geometry.setAttribute(L,h[L]);mt.prototype.copy.call(b,M),this.parser.assignFinalMaterial(b),x.push(b)}return d.isGroup?(d.clear(),d.add(...x),d):x[0]}))}}const V_="glTF",ua=12,zg={JSON:1313821514,BIN:5130562};class cL{constructor(e){this.name=yt.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,ua),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==V_)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-ua,o=new DataView(e,ua);let c=0;for(;c<r;){const l=o.getUint32(c,!0);c+=4;const h=o.getUint32(c,!0);if(c+=4,h===zg.JSON){const f=new Uint8Array(e,ua+c,l);this.content=n.decode(f)}else if(h===zg.BIN){const f=ua+c;this.body=e.slice(f,f+l)}c+=l}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class lL{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=yt.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,r=this.dracoLoader,o=e.extensions[this.name].bufferView,c=e.extensions[this.name].attributes,l={},h={},f={};for(const d in c){const p=Wh[d]||d.toLowerCase();l[p]=c[d]}for(const d in e.attributes){const p=Wh[d]||d.toLowerCase();if(c[d]!==void 0){const m=n.accessors[e.attributes[d]],x=go[m.componentType];f[p]=x.name,h[p]=m.normalized===!0}}return t.getDependency("bufferView",o).then(function(d){return new Promise(function(p,m){r.decodeDracoFile(d,function(x){for(const M in x.attributes){const A=x.attributes[M],v=h[M];v!==void 0&&(A.normalized=v)}p(x)},l,f,yn,m)})})}}class uL{constructor(){this.name=yt.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class hL{constructor(){this.name=yt.KHR_MESH_QUANTIZATION}}class W_ extends La{constructor(e,t,n,r){super(e,t,n,r)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,o=e*r*3+r;for(let c=0;c!==r;c++)t[c]=n[o+c];return t}interpolate_(e,t,n,r){const o=this.resultBuffer,c=this.sampleValues,l=this.valueSize,h=l*2,f=l*3,d=r-t,p=(n-t)/d,m=p*p,x=m*p,M=e*f,A=M-f,v=-2*x+3*m,_=x-m,C=1-v,b=_-m+p;for(let L=0;L!==l;L++){const k=c[A+L+l],U=c[A+L+h]*d,O=c[M+L+l],I=c[M+L]*d;o[L]=C*k+b*U+v*O+_*I}return o}}const fL=new on;class dL extends W_{interpolate_(e,t,n,r){const o=super.interpolate_(e,t,n,r);return fL.fromArray(o).normalize().toArray(o),o}}const fi={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},go={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},kg={9728:zn,9729:Wn,9984:Jg,9985:rl,9986:ha,9987:_r},Hg={33071:gr,33648:ba,10497:_s},Eh={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Wh={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},zr={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},pL={CUBICSPLINE:void 0,LINEAR:yo,STEP:Aa},bh={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function mL(i){return i.DefaultMaterial===void 0&&(i.DefaultMaterial=new Ro({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Yi})),i.DefaultMaterial}function us(i,e,t){for(const n in t.extensions)i[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function Gr(i,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(i.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function gL(i,e,t){let n=!1,r=!1,o=!1;for(let f=0,d=e.length;f<d;f++){const p=e[f];if(p.POSITION!==void 0&&(n=!0),p.NORMAL!==void 0&&(r=!0),p.COLOR_0!==void 0&&(o=!0),n&&r&&o)break}if(!n&&!r&&!o)return Promise.resolve(i);const c=[],l=[],h=[];for(let f=0,d=e.length;f<d;f++){const p=e[f];if(n){const m=p.POSITION!==void 0?t.getDependency("accessor",p.POSITION):i.attributes.position;c.push(m)}if(r){const m=p.NORMAL!==void 0?t.getDependency("accessor",p.NORMAL):i.attributes.normal;l.push(m)}if(o){const m=p.COLOR_0!==void 0?t.getDependency("accessor",p.COLOR_0):i.attributes.color;h.push(m)}}return Promise.all([Promise.all(c),Promise.all(l),Promise.all(h)]).then(function(f){const d=f[0],p=f[1],m=f[2];return n&&(i.morphAttributes.position=d),r&&(i.morphAttributes.normal=p),o&&(i.morphAttributes.color=m),i.morphTargetsRelative=!0,i})}function _L(i,e){if(i.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)i.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(i.morphTargetInfluences.length===t.length){i.morphTargetDictionary={};for(let n=0,r=t.length;n<r;n++)i.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function vL(i){let e;const t=i.extensions&&i.extensions[yt.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Th(t.attributes):e=i.indices+":"+Th(i.attributes)+":"+i.mode,i.targets!==void 0)for(let n=0,r=i.targets.length;n<r;n++)e+=":"+Th(i.targets[n]);return e}function Th(i){let e="";const t=Object.keys(i).sort();for(let n=0,r=t.length;n<r;n++)e+=t[n]+":"+i[t[n]]+";";return e}function Xh(i){switch(i){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function xL(i){return i.search(/\.jpe?g($|\?)/i)>0||i.search(/^data\:image\/jpeg/)===0?"image/jpeg":i.search(/\.webp($|\?)/i)>0||i.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const yL=new Qe;class SL{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new WP,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=!1,o=-1;typeof navigator<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,r=navigator.userAgent.indexOf("Firefox")>-1,o=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||r&&o<98?this.textureLoader=new F_(this.options.manager):this.textureLoader=new oP(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ml(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,r=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(c){return c._markDefs&&c._markDefs()}),Promise.all(this._invokeAll(function(c){return c.beforeRoot&&c.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(c){const l={scene:c[0][r.scene||0],scenes:c[0],animations:c[1],cameras:c[2],asset:r.asset,parser:n,userData:{}};return us(o,l,r),Gr(l,r),Promise.all(n._invokeAll(function(h){return h.afterRoot&&h.afterRoot(l)})).then(function(){for(const h of l.scenes)h.updateMatrixWorld();e(l)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let r=0,o=t.length;r<o;r++){const c=t[r].joints;for(let l=0,h=c.length;l<h;l++)e[c[l]].isBone=!0}for(let r=0,o=e.length;r<o;r++){const c=e[r];c.mesh!==void 0&&(this._addNodeRef(this.meshCache,c.mesh),c.skin!==void 0&&(n[c.mesh].isSkinnedMesh=!0)),c.camera!==void 0&&this._addNodeRef(this.cameraCache,c.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const r=n.clone(),o=(c,l)=>{const h=this.associations.get(c);h!=null&&this.associations.set(l,h);for(const[f,d]of c.children.entries())o(d,l.children[f])};return o(n,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const r=e(t[n]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let r=0;r<t.length;r++){const o=e(t[r]);o&&n.push(o)}return n}getDependency(e,t){const n=e+":"+t;let r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(o){return o.loadNode&&o.loadNode(t)});break;case"mesh":r=this._invokeOne(function(o){return o.loadMesh&&o.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(o){return o.loadBufferView&&o.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(o){return o.loadMaterial&&o.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(o){return o.loadTexture&&o.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(o){return o.loadAnimation&&o.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(o){return o!=this&&o.getDependency&&o.getDependency(e,t)}),!r)throw new Error("Unknown type: "+e);break}this.cache.add(n,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,r=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(r.map(function(o,c){return n.getDependency(e,c)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[yt.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(o,c){n.load(Sa.resolveURL(t.uri,r.path),o,void 0,function(){c(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const r=t.byteLength||0,o=t.byteOffset||0;return n.slice(o,o+r)})}loadAccessor(e){const t=this,n=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){const c=Eh[r.type],l=go[r.componentType],h=r.normalized===!0,f=new l(r.count*c);return Promise.resolve(new nn(f,c,h))}const o=[];return r.bufferView!==void 0?o.push(this.getDependency("bufferView",r.bufferView)):o.push(null),r.sparse!==void 0&&(o.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(o).then(function(c){const l=c[0],h=Eh[r.type],f=go[r.componentType],d=f.BYTES_PER_ELEMENT,p=d*h,m=r.byteOffset||0,x=r.bufferView!==void 0?n.bufferViews[r.bufferView].byteStride:void 0,M=r.normalized===!0;let A,v;if(x&&x!==p){const _=Math.floor(m/x),C="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+_+":"+r.count;let b=t.cache.get(C);b||(A=new f(l,_*x,r.count*x/d),b=new C_(A,x/d),t.cache.add(C,b)),v=new Ra(b,h,m%x/d,M)}else l===null?A=new f(r.count*h):A=new f(l,m,r.count*h),v=new nn(A,h,M);if(r.sparse!==void 0){const _=Eh.SCALAR,C=go[r.sparse.indices.componentType],b=r.sparse.indices.byteOffset||0,L=r.sparse.values.byteOffset||0,k=new C(c[1],b,r.sparse.count*_),U=new f(c[2],L,r.sparse.count*h);l!==null&&(v=new nn(v.array.slice(),v.itemSize,v.normalized));for(let O=0,I=k.length;O<I;O++){const E=k[O];if(v.setX(E,U[O*h]),h>=2&&v.setY(E,U[O*h+1]),h>=3&&v.setZ(E,U[O*h+2]),h>=4&&v.setW(E,U[O*h+3]),h>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return v})}loadTexture(e){const t=this.json,n=this.options,o=t.textures[e].source,c=t.images[o];let l=this.textureLoader;if(c.uri){const h=n.manager.getHandler(c.uri);h!==null&&(l=h)}return this.loadTextureImage(e,o,l)}loadTextureImage(e,t,n){const r=this,o=this.json,c=o.textures[e],l=o.images[t],h=(l.uri||l.bufferView)+":"+c.sampler;if(this.textureCache[h])return this.textureCache[h];const f=this.loadImageSource(t,n).then(function(d){d.flipY=!1,d.name=c.name||l.name||"",d.name===""&&typeof l.uri=="string"&&l.uri.startsWith("data:image/")===!1&&(d.name=l.uri);const m=(o.samplers||{})[c.sampler]||{};return d.magFilter=kg[m.magFilter]||Wn,d.minFilter=kg[m.minFilter]||_r,d.wrapS=Hg[m.wrapS]||_s,d.wrapT=Hg[m.wrapT]||_s,r.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[h]=f,f}loadImageSource(e,t){const n=this,r=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(p=>p.clone());const c=r.images[e],l=self.URL||self.webkitURL;let h=c.uri||"",f=!1;if(c.bufferView!==void 0)h=n.getDependency("bufferView",c.bufferView).then(function(p){f=!0;const m=new Blob([p],{type:c.mimeType});return h=l.createObjectURL(m),h});else if(c.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(h).then(function(p){return new Promise(function(m,x){let M=m;t.isImageBitmapLoader===!0&&(M=function(A){const v=new un(A);v.needsUpdate=!0,m(v)}),t.load(Sa.resolveURL(p,o.path),M,void 0,x)})}).then(function(p){return f===!0&&l.revokeObjectURL(h),p.userData.mimeType=c.mimeType||xL(c.uri),p}).catch(function(p){throw console.error("THREE.GLTFLoader: Couldn't load texture",h),p});return this.sourceCache[e]=d,d}assignTexture(e,t,n,r){const o=this;return this.getDependency("texture",n.index).then(function(c){if(!c)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(c=c.clone(),c.channel=n.texCoord),o.extensions[yt.KHR_TEXTURE_TRANSFORM]){const l=n.extensions!==void 0?n.extensions[yt.KHR_TEXTURE_TRANSFORM]:void 0;if(l){const h=o.associations.get(c);c=o.extensions[yt.KHR_TEXTURE_TRANSFORM].extendTexture(c,l),o.associations.set(c,h)}}return r!==void 0&&(c.colorSpace=r),e[t]=c,c})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const r=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,c=t.attributes.normal===void 0;if(e.isPoints){const l="PointsMaterial:"+n.uuid;let h=this.cache.get(l);h||(h=new O_,mi.prototype.copy.call(h,n),h.color.copy(n.color),h.map=n.map,h.sizeAttenuation=!1,this.cache.add(l,h)),n=h}else if(e.isLine){const l="LineBasicMaterial:"+n.uuid;let h=this.cache.get(l);h||(h=new wo,mi.prototype.copy.call(h,n),h.color.copy(n.color),h.map=n.map,this.cache.add(l,h)),n=h}if(r||o||c){let l="ClonedMaterial:"+n.uuid+":";r&&(l+="derivative-tangents:"),o&&(l+="vertex-colors:"),c&&(l+="flat-shading:");let h=this.cache.get(l);h||(h=n.clone(),o&&(h.vertexColors=!0),c&&(h.flatShading=!0),r&&(h.normalScale&&(h.normalScale.y*=-1),h.clearcoatNormalScale&&(h.clearcoatNormalScale.y*=-1)),this.cache.add(l,h),this.associations.set(h,this.associations.get(n))),n=h}e.material=n}getMaterialType(){return Ro}loadMaterial(e){const t=this,n=this.json,r=this.extensions,o=n.materials[e];let c;const l={},h=o.extensions||{},f=[];if(h[yt.KHR_MATERIALS_UNLIT]){const p=r[yt.KHR_MATERIALS_UNLIT];c=p.getMaterialType(),f.push(p.extendParams(l,o,t))}else{const p=o.pbrMetallicRoughness||{};if(l.color=new Ne(1,1,1),l.opacity=1,Array.isArray(p.baseColorFactor)){const m=p.baseColorFactor;l.color.setRGB(m[0],m[1],m[2],yn),l.opacity=m[3]}p.baseColorTexture!==void 0&&f.push(t.assignTexture(l,"map",p.baseColorTexture,ln)),l.metalness=p.metallicFactor!==void 0?p.metallicFactor:1,l.roughness=p.roughnessFactor!==void 0?p.roughnessFactor:1,p.metallicRoughnessTexture!==void 0&&(f.push(t.assignTexture(l,"metalnessMap",p.metallicRoughnessTexture)),f.push(t.assignTexture(l,"roughnessMap",p.metallicRoughnessTexture))),c=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(e)}),f.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(e,l)})))}o.doubleSided===!0&&(l.side=Ai);const d=o.alphaMode||bh.OPAQUE;if(d===bh.BLEND?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,d===bh.MASK&&(l.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&c!==Wi&&(f.push(t.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new Pe(1,1),o.normalTexture.scale!==void 0)){const p=o.normalTexture.scale;l.normalScale.set(p,p)}if(o.occlusionTexture!==void 0&&c!==Wi&&(f.push(t.assignTexture(l,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(l.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&c!==Wi){const p=o.emissiveFactor;l.emissive=new Ne().setRGB(p[0],p[1],p[2],yn)}return o.emissiveTexture!==void 0&&c!==Wi&&f.push(t.assignTexture(l,"emissiveMap",o.emissiveTexture,ln)),Promise.all(f).then(function(){const p=new c(l);return o.name&&(p.name=o.name),Gr(p,o),t.associations.set(p,{materials:e}),o.extensions&&us(r,p,o),p})}createUniqueName(e){const t=It.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,r=this.primitiveCache;function o(l){return n[yt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(l,t).then(function(h){return Gg(h,l,t)})}const c=[];for(let l=0,h=e.length;l<h;l++){const f=e[l],d=vL(f),p=r[d];if(p)c.push(p.promise);else{let m;f.extensions&&f.extensions[yt.KHR_DRACO_MESH_COMPRESSION]?m=o(f):m=Gg(new Jt,f,t),r[d]={primitive:f,promise:m},c.push(m)}}return Promise.all(c)}loadMesh(e){const t=this,n=this.json,r=this.extensions,o=n.meshes[e],c=o.primitives,l=[];for(let h=0,f=c.length;h<f;h++){const d=c[h].material===void 0?mL(this.cache):this.getDependency("material",c[h].material);l.push(d)}return l.push(t.loadGeometries(c)),Promise.all(l).then(function(h){const f=h.slice(0,h.length-1),d=h[h.length-1],p=[];for(let x=0,M=d.length;x<M;x++){const A=d[x],v=c[x];let _;const C=f[x];if(v.mode===fi.TRIANGLES||v.mode===fi.TRIANGLE_STRIP||v.mode===fi.TRIANGLE_FAN||v.mode===void 0)_=o.isSkinnedMesh===!0?new LC(A,C):new ye(A,C),_.isSkinnedMesh===!0&&_.normalizeSkinWeights(),v.mode===fi.TRIANGLE_STRIP?_.geometry=Bg(_.geometry,c_):v.mode===fi.TRIANGLE_FAN&&(_.geometry=Bg(_.geometry,Uh));else if(v.mode===fi.LINES)_=new cf(A,C);else if(v.mode===fi.LINE_STRIP)_=new di(A,C);else if(v.mode===fi.LINE_LOOP)_=new UC(A,C);else if(v.mode===fi.POINTS)_=new NC(A,C);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+v.mode);Object.keys(_.geometry.morphAttributes).length>0&&_L(_,o),_.name=t.createUniqueName(o.name||"mesh_"+e),Gr(_,o),v.extensions&&us(r,_,v),t.assignFinalMaterial(_),p.push(_)}for(let x=0,M=p.length;x<M;x++)t.associations.set(p[x],{meshes:e,primitives:x});if(p.length===1)return o.extensions&&us(r,p[0],o),p[0];const m=new Xi;o.extensions&&us(r,m,o),t.associations.set(m,{meshes:e});for(let x=0,M=p.length;x<M;x++)m.add(p[x]);return m})}loadCamera(e){let t;const n=this.json.cameras[e],r=n[n.type];if(!r){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new Bn(ji.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):n.type==="orthographic"&&(t=new Sl(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Gr(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let r=0,o=t.joints.length;r<o;r++)n.push(this._loadNodeShallow(t.joints[r]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(r){const o=r.pop(),c=r,l=[],h=[];for(let f=0,d=c.length;f<d;f++){const p=c[f];if(p){l.push(p);const m=new Qe;o!==null&&m.fromArray(o.array,f*16),h.push(m)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[f])}return new af(l,h)})}loadAnimation(e){const t=this.json,n=this,r=t.animations[e],o=r.name?r.name:"animation_"+e,c=[],l=[],h=[],f=[],d=[];for(let p=0,m=r.channels.length;p<m;p++){const x=r.channels[p],M=r.samplers[x.sampler],A=x.target,v=A.node,_=r.parameters!==void 0?r.parameters[M.input]:M.input,C=r.parameters!==void 0?r.parameters[M.output]:M.output;A.node!==void 0&&(c.push(this.getDependency("node",v)),l.push(this.getDependency("accessor",_)),h.push(this.getDependency("accessor",C)),f.push(M),d.push(A))}return Promise.all([Promise.all(c),Promise.all(l),Promise.all(h),Promise.all(f),Promise.all(d)]).then(function(p){const m=p[0],x=p[1],M=p[2],A=p[3],v=p[4],_=[];for(let C=0,b=m.length;C<b;C++){const L=m[C],k=x[C],U=M[C],O=A[C],I=v[C];if(L===void 0)continue;L.updateMatrix&&L.updateMatrix();const E=n._createAnimationTracks(L,k,U,O,I);if(E)for(let y=0;y<E.length;y++)_.push(E[y])}return new XC(o,void 0,_)})}createNodeMesh(e){const t=this.json,n=this,r=t.nodes[e];return r.mesh===void 0?null:n.getDependency("mesh",r.mesh).then(function(o){const c=n._getNodeRef(n.meshCache,r.mesh,o);return r.weights!==void 0&&c.traverse(function(l){if(l.isMesh)for(let h=0,f=r.weights.length;h<f;h++)l.morphTargetInfluences[h]=r.weights[h]}),c})}loadNode(e){const t=this.json,n=this,r=t.nodes[e],o=n._loadNodeShallow(e),c=[],l=r.children||[];for(let f=0,d=l.length;f<d;f++)c.push(n.getDependency("node",l[f]));const h=r.skin===void 0?Promise.resolve(null):n.getDependency("skin",r.skin);return Promise.all([o,Promise.all(c),h]).then(function(f){const d=f[0],p=f[1],m=f[2];m!==null&&d.traverse(function(x){x.isSkinnedMesh&&x.bind(m,yL)});for(let x=0,M=p.length;x<M;x++)d.add(p[x]);return d})}_loadNodeShallow(e){const t=this.json,n=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const o=t.nodes[e],c=o.name?r.createUniqueName(o.name):"",l=[],h=r._invokeOne(function(f){return f.createNodeMesh&&f.createNodeMesh(e)});return h&&l.push(h),o.camera!==void 0&&l.push(r.getDependency("camera",o.camera).then(function(f){return r._getNodeRef(r.cameraCache,o.camera,f)})),r._invokeAll(function(f){return f.createNodeAttachment&&f.createNodeAttachment(e)}).forEach(function(f){l.push(f)}),this.nodeCache[e]=Promise.all(l).then(function(f){let d;if(o.isBone===!0?d=new I_:f.length>1?d=new Xi:f.length===1?d=f[0]:d=new mt,d!==f[0])for(let p=0,m=f.length;p<m;p++)d.add(f[p]);if(o.name&&(d.userData.name=o.name,d.name=c),Gr(d,o),o.extensions&&us(n,d,o),o.matrix!==void 0){const p=new Qe;p.fromArray(o.matrix),d.applyMatrix4(p)}else o.translation!==void 0&&d.position.fromArray(o.translation),o.rotation!==void 0&&d.quaternion.fromArray(o.rotation),o.scale!==void 0&&d.scale.fromArray(o.scale);return r.associations.has(d)||r.associations.set(d,{}),r.associations.get(d).nodes=e,d}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],r=this,o=new Xi;n.name&&(o.name=r.createUniqueName(n.name)),Gr(o,n),n.extensions&&us(t,o,n);const c=n.nodes||[],l=[];for(let h=0,f=c.length;h<f;h++)l.push(r.getDependency("node",c[h]));return Promise.all(l).then(function(h){for(let d=0,p=h.length;d<p;d++)o.add(h[d]);const f=d=>{const p=new Map;for(const[m,x]of r.associations)(m instanceof mi||m instanceof un)&&p.set(m,x);return d.traverse(m=>{const x=r.associations.get(m);x!=null&&p.set(m,x)}),p};return r.associations=f(o),o})}_createAnimationTracks(e,t,n,r,o){const c=[],l=e.name?e.name:e.uuid,h=[];zr[o.path]===zr.weights?e.traverse(function(m){m.morphTargetInfluences&&h.push(m.name?m.name:m.uuid)}):h.push(l);let f;switch(zr[o.path]){case zr.weights:f=Eo;break;case zr.rotation:f=xs;break;case zr.position:case zr.scale:f=bo;break;default:switch(n.itemSize){case 1:f=Eo;break;case 2:case 3:default:f=bo;break}break}const d=r.interpolation!==void 0?pL[r.interpolation]:yo,p=this._getArrayFromAccessor(n);for(let m=0,x=h.length;m<x;m++){const M=new f(h[m]+"."+zr[o.path],t.array,p,d);r.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(M),c.push(M)}return c}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=Xh(t.constructor),r=new Float32Array(t.length);for(let o=0,c=t.length;o<c;o++)r[o]=t[o]*n;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const r=this instanceof xs?dL:W_;return new r(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function ML(i,e,t){const n=e.attributes,r=new Ii;if(n.POSITION!==void 0){const l=t.json.accessors[n.POSITION],h=l.min,f=l.max;if(h!==void 0&&f!==void 0){if(r.set(new N(h[0],h[1],h[2]),new N(f[0],f[1],f[2])),l.normalized){const d=Xh(go[l.componentType]);r.min.multiplyScalar(d),r.max.multiplyScalar(d)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const o=e.targets;if(o!==void 0){const l=new N,h=new N;for(let f=0,d=o.length;f<d;f++){const p=o[f];if(p.POSITION!==void 0){const m=t.json.accessors[p.POSITION],x=m.min,M=m.max;if(x!==void 0&&M!==void 0){if(h.setX(Math.max(Math.abs(x[0]),Math.abs(M[0]))),h.setY(Math.max(Math.abs(x[1]),Math.abs(M[1]))),h.setZ(Math.max(Math.abs(x[2]),Math.abs(M[2]))),m.normalized){const A=Xh(go[m.componentType]);h.multiplyScalar(A)}l.max(h)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(l)}i.boundingBox=r;const c=new Zi;r.getCenter(c.center),c.radius=r.min.distanceTo(r.max)/2,i.boundingSphere=c}function Gg(i,e,t){const n=e.attributes,r=[];function o(c,l){return t.getDependency("accessor",c).then(function(h){i.setAttribute(l,h)})}for(const c in n){const l=Wh[c]||c.toLowerCase();l in i.attributes||r.push(o(n[c],l))}if(e.indices!==void 0&&!i.index){const c=t.getDependency("accessor",e.indices).then(function(l){i.setIndex(l)});r.push(c)}return Ct.workingColorSpace!==yn&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ct.workingColorSpace}" not supported.`),Gr(i,e),ML(i,e,t),Promise.all(r).then(function(){return e.targets!==void 0?gL(i,e.targets,t):i})}/*!
|
|
3824
|
+
fflate - fast JavaScript compression/decompression
|
|
3825
|
+
<https://101arrowz.github.io/fflate>
|
|
3826
|
+
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
|
|
3827
|
+
version 0.8.2
|
|
3828
|
+
*/var ei=Uint8Array,ho=Uint16Array,EL=Int32Array,X_=new ei([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Y_=new ei([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),bL=new ei([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),j_=function(i,e){for(var t=new ho(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];for(var r=new EL(t[30]),n=1;n<30;++n)for(var o=t[n];o<t[n+1];++o)r[o]=o-t[n]<<5|n;return{b:t,r}},q_=j_(X_,2),K_=q_.b,TL=q_.r;K_[28]=258,TL[258]=28;var AL=j_(Y_,0),wL=AL.b,Yh=new ho(32768);for(var Vt=0;Vt<32768;++Vt){var kr=(Vt&43690)>>1|(Vt&21845)<<1;kr=(kr&52428)>>2|(kr&13107)<<2,kr=(kr&61680)>>4|(kr&3855)<<4,Yh[Vt]=((kr&65280)>>8|(kr&255)<<8)>>1}var Ma=function(i,e,t){for(var n=i.length,r=0,o=new ho(e);r<n;++r)i[r]&&++o[i[r]-1];var c=new ho(e);for(r=1;r<e;++r)c[r]=c[r-1]+o[r-1]<<1;var l;if(t){l=new ho(1<<e);var h=15-e;for(r=0;r<n;++r)if(i[r])for(var f=r<<4|i[r],d=e-i[r],p=c[i[r]-1]++<<d,m=p|(1<<d)-1;p<=m;++p)l[Yh[p]>>h]=f}else for(l=new ho(n),r=0;r<n;++r)i[r]&&(l[r]=Yh[c[i[r]-1]++]>>15-i[r]);return l},Ia=new ei(288);for(var Vt=0;Vt<144;++Vt)Ia[Vt]=8;for(var Vt=144;Vt<256;++Vt)Ia[Vt]=9;for(var Vt=256;Vt<280;++Vt)Ia[Vt]=7;for(var Vt=280;Vt<288;++Vt)Ia[Vt]=8;var Z_=new ei(32);for(var Vt=0;Vt<32;++Vt)Z_[Vt]=5;var RL=Ma(Ia,9,1),CL=Ma(Z_,5,1),Ah=function(i){for(var e=i[0],t=1;t<i.length;++t)i[t]>e&&(e=i[t]);return e},bi=function(i,e,t){var n=e/8|0;return(i[n]|i[n+1]<<8)>>(e&7)&t},wh=function(i,e){var t=e/8|0;return(i[t]|i[t+1]<<8|i[t+2]<<16)>>(e&7)},PL=function(i){return(i+7)/8|0},vf=function(i,e,t){return(e==null||e<0)&&(e=0),(t==null||t>i.length)&&(t=i.length),new ei(i.subarray(e,t))},LL=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],pi=function(i,e,t){var n=new Error(e||LL[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,pi),!t)throw n;return n},IL=function(i,e,t,n){var r=i.length,o=n?n.length:0;if(!r||e.f&&!e.l)return t||new ei(0);var c=!t,l=c||e.i!=2,h=e.i;c&&(t=new ei(r*3));var f=function(j){var $e=t.length;if(j>$e){var ze=new ei(Math.max($e*2,j));ze.set(t),t=ze}},d=e.f||0,p=e.p||0,m=e.b||0,x=e.l,M=e.d,A=e.m,v=e.n,_=r*8;do{if(!x){d=bi(i,p,1);var C=bi(i,p+1,3);if(p+=3,C)if(C==1)x=RL,M=CL,A=9,v=5;else if(C==2){var U=bi(i,p,31)+257,O=bi(i,p+10,15)+4,I=U+bi(i,p+5,31)+1;p+=14;for(var E=new ei(I),y=new ei(19),F=0;F<O;++F)y[bL[F]]=bi(i,p+F*3,7);p+=O*3;for(var V=Ah(y),G=(1<<V)-1,q=Ma(y,V,1),F=0;F<I;){var ne=q[bi(i,p,G)];p+=ne&15;var b=ne>>4;if(b<16)E[F++]=b;else{var se=0,pe=0;for(b==16?(pe=3+bi(i,p,3),p+=2,se=E[F-1]):b==17?(pe=3+bi(i,p,7),p+=3):b==18&&(pe=11+bi(i,p,127),p+=7);pe--;)E[F++]=se}}var K=E.subarray(0,U),he=E.subarray(U);A=Ah(K),v=Ah(he),x=Ma(K,A,1),M=Ma(he,v,1)}else pi(1);else{var b=PL(p)+4,L=i[b-4]|i[b-3]<<8,k=b+L;if(k>r){h&&pi(0);break}l&&f(m+L),t.set(i.subarray(b,k),m),e.b=m+=L,e.p=p=k*8,e.f=d;continue}if(p>_){h&&pi(0);break}}l&&f(m+131072);for(var me=(1<<A)-1,Me=(1<<v)-1,Ke=p;;Ke=p){var se=x[wh(i,p)&me],ot=se>>4;if(p+=se&15,p>_){h&&pi(0);break}if(se||pi(2),ot<256)t[m++]=ot;else if(ot==256){Ke=p,x=null;break}else{var ie=ot-254;if(ot>264){var F=ot-257,ge=X_[F];ie=bi(i,p,(1<<ge)-1)+K_[F],p+=ge}var we=M[wh(i,p)&Me],Se=we>>4;we||pi(3),p+=we&15;var he=wL[Se];if(Se>3){var ge=Y_[Se];he+=wh(i,p)&(1<<ge)-1,p+=ge}if(p>_){h&&pi(0);break}l&&f(m+131072);var Ge=m+ie;if(m<he){var Xe=o-he,at=Math.min(he,Ge);for(Xe+m<0&&pi(3);m<at;++m)t[m]=n[Xe+m]}for(;m<Ge;++m)t[m]=t[m-he]}}e.l=x,e.p=Ke,e.b=m,e.f=d,x&&(d=1,e.m=A,e.d=M,e.n=v)}while(!d);return m!=t.length&&c?vf(t,0,m):t.subarray(0,m)},DL=new ei(0),Gi=function(i,e){return i[e]|i[e+1]<<8},Ti=function(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16|i[e+3]<<24)>>>0},Rh=function(i,e){return Ti(i,e)+Ti(i,e+4)*4294967296};function OL(i,e){return IL(i,{i:2},e&&e.out,e&&e.dictionary)}var jh=typeof TextDecoder<"u"&&new TextDecoder,UL=0;try{jh.decode(DL,{stream:!0}),UL=1}catch{}var NL=function(i){for(var e="",t=0;;){var n=i[t++],r=(n>127)+(n>223)+(n>239);if(t+r>i.length)return{s:e,r:vf(i,t-1)};r?r==3?(n=((n&15)<<18|(i[t++]&63)<<12|(i[t++]&63)<<6|i[t++]&63)-65536,e+=String.fromCharCode(55296|n>>10,56320|n&1023)):r&1?e+=String.fromCharCode((n&31)<<6|i[t++]&63):e+=String.fromCharCode((n&15)<<12|(i[t++]&63)<<6|i[t++]&63):e+=String.fromCharCode(n)}};function qh(i,e){if(e){for(var t="",n=0;n<i.length;n+=16384)t+=String.fromCharCode.apply(null,i.subarray(n,n+16384));return t}else{if(jh)return jh.decode(i);var r=NL(i),o=r.s,t=r.r;return t.length&&pi(8),o}}var FL=function(i,e){return e+30+Gi(i,e+26)+Gi(i,e+28)},BL=function(i,e,t){var n=Gi(i,e+28),r=qh(i.subarray(e+46,e+46+n),!(Gi(i,e+8)&2048)),o=e+46+n,c=Ti(i,e+20),l=t&&c==4294967295?zL(i,o):[c,Ti(i,e+24),Ti(i,e+42)],h=l[0],f=l[1],d=l[2];return[Gi(i,e+10),h,f,r,o+Gi(i,e+30)+Gi(i,e+32),d]},zL=function(i,e){for(;Gi(i,e)!=1;e+=4+Gi(i,e+2));return[Rh(i,e+12),Rh(i,e+4),Rh(i,e+20)]};function kL(i,e){for(var t={},n=i.length-22;Ti(i,n)!=101010256;--n)(!n||i.length-n>65558)&&pi(13);var r=Gi(i,n+8);if(!r)return{};var o=Ti(i,n+16),c=o==4294967295||r==65535;if(c){var l=Ti(i,n-12);c=Ti(i,l)==101075792,c&&(r=Ti(i,l+32),o=Ti(i,l+48))}for(var h=0;h<r;++h){var f=BL(i,o,c),d=f[0],p=f[1],m=f[2],x=f[3],M=f[4],A=f[5],v=FL(i,A);o=M,d?d==8?t[x]=OL(i.subarray(v,v+p),{out:new ei(m)}):pi(14,"unknown compression type "+d):t[x]=vf(i,v,v+p)}return t}class HL{parse(e){const t={},n=e.split(`
|
|
3829
|
+
`);let r=null,o=t;const c=[t];for(const l of n)if(l.includes("=")){const h=l.split("="),f=h[0].trim(),d=h[1].trim();if(d.endsWith("{")){const p={};c.push(p),o[f]=p,o=p}else o[f]=d}else if(l.endsWith("{")){const h=o[r]||{};c.push(h),o[r]=h,o=h}else if(l.endsWith("}")){if(c.pop(),c.length===0)continue;o=c[c.length-1]}else if(l.endsWith("(")){const h={};c.push(h),r=l.split("(")[0].trim()||r,o[r]=h,o=h}else l.endsWith(")")?(c.pop(),o=c[c.length-1]):r=l.trim();return t}}class GL extends Ms{constructor(e){super(e)}load(e,t,n,r){const o=this,c=new ml(o.manager);c.setPath(o.path),c.setResponseType("arraybuffer"),c.setRequestHeader(o.requestHeader),c.setWithCredentials(o.withCredentials),c.load(e,function(l){try{t(o.parse(l))}catch(h){r?r(h):console.error(h),o.manager.itemError(e)}},n,r)}parse(e){const t=new HL;function n(I){const E={};new ml().setResponseType("arraybuffer");for(const F in I){if(F.endsWith("png")){const V=new Blob([I[F]],{type:{type:"image/png"}});E[F]=URL.createObjectURL(V)}if(F.endsWith("usd")||F.endsWith("usda")){if(r(I[F])){console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");continue}const V=qh(I[F]);E[F]=t.parse(V)}}return E}function r(I){const E=I.slice(0,7),y=new Uint8Array([80,88,82,45,85,83,68,67]);return E.every((F,V)=>F===y[V])}function o(I){if(I.length<1)return;const E=Object.keys(I)[0];let y=!1;if(E.endsWith("usda"))return I[E];if(E.endsWith("usdc"))y=!0;else if(E.endsWith("usd"))if(r(I[E]))y=!0;else return I[E];y&&console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.")}const c=kL(new Uint8Array(e)),l=n(c),h=o(c);if(h===void 0)return console.warn("THREE.USDZLoader: No usda file found."),new Xi;const f=qh(h),d=t.parse(f);function p(I){if(I){if("prepend references"in I){const y=I["prepend references"].split("@"),F=y[1].replace(/^.\//,""),V=y[2].replace(/^<\//,"").replace(/>$/,"");return m(l[F],V)}return m(I)}}function m(I,E){if(I){if(E!==void 0){const y=`def Mesh "${E}"`;if(y in I)return I[y]}for(const y in I){const F=I[y];if(y.startsWith("def Mesh"))return"point3f[] points"in I&&(F["point3f[] points"]=I["point3f[] points"]),"texCoord2f[] primvars:st"in I&&(F["texCoord2f[] primvars:st"]=I["texCoord2f[] primvars:st"]),"int[] primvars:st:indices"in I&&(F["int[] primvars:st:indices"]=I["int[] primvars:st:indices"]),F;if(typeof F=="object"){const V=m(F);if(V)return V}}}}function x(I){if(!I)return;let E=new Jt;if("int[] faceVertexIndices"in I){const y=JSON.parse(I["int[] faceVertexIndices"]);E.setIndex(y)}if("point3f[] points"in I){const y=JSON.parse(I["point3f[] points"].replace(/[()]*/g,"")),F=new nn(new Float32Array(y),3);E.setAttribute("position",F)}if("normal3f[] normals"in I){const y=JSON.parse(I["normal3f[] normals"].replace(/[()]*/g,"")),F=new nn(new Float32Array(y),3);E.setAttribute("normal",F)}else E.computeVertexNormals();if("float2[] primvars:st"in I&&(I["texCoord2f[] primvars:st"]=I["float2[] primvars:st"]),"texCoord2f[] primvars:st"in I){const y=JSON.parse(I["texCoord2f[] primvars:st"].replace(/[()]*/g,"")),F=new nn(new Float32Array(y),2);if("int[] primvars:st:indices"in I){E=E.toNonIndexed();const V=JSON.parse(I["int[] primvars:st:indices"]);E.setAttribute("uv",M(F,V))}else E.setAttribute("uv",F)}return E}function M(I,E){const y=I.array,F=I.itemSize,V=new y.constructor(E.length*F);let G=0,q=0;for(let ne=0,se=E.length;ne<se;ne++){G=E[ne]*F;for(let pe=0;pe<F;pe++)V[q++]=y[G++]}return new nn(V,F)}function A(I){if(I){if("rel material:binding"in I){const F=I["rel material:binding"].replace(/^<\//,"").replace(/>$/,"").split("/");return v(d,` "${F[1]}"`)}return v(I)}}function v(I,E=""){for(const y in I){const F=I[y];if(y.startsWith("def Material"+E))return F;if(typeof F=="object"){const V=v(F,E);if(V)return V}}}function _(I,E){E["float inputs:rotation"]&&(I.rotation=parseFloat(E["float inputs:rotation"])),E["float2 inputs:scale"]&&(I.repeat=new Pe().fromArray(JSON.parse("["+E["float2 inputs:scale"].replace(/[()]*/g,"")+"]"))),E["float2 inputs:translation"]&&(I.offset=new Pe().fromArray(JSON.parse("["+E["float2 inputs:translation"].replace(/[()]*/g,"")+"]")))}function C(I){const E=new $i;if(I!==void 0){if('def Shader "PreviewSurface"'in I){const y=I['def Shader "PreviewSurface"'];if("color3f inputs:diffuseColor.connect"in y){const F=y["color3f inputs:diffuseColor.connect"],V=b(d,/(\w+).output/.exec(F)[1]);E.map=L(V),E.map.colorSpace=ln,'def Shader "Transform2d_diffuse"'in I&&_(E.map,I['def Shader "Transform2d_diffuse"'])}else if("color3f inputs:diffuseColor"in y){const F=y["color3f inputs:diffuseColor"].replace(/[()]*/g,"");E.color.fromArray(JSON.parse("["+F+"]"))}if("color3f inputs:emissiveColor.connect"in y){const F=y["color3f inputs:emissiveColor.connect"],V=b(d,/(\w+).output/.exec(F)[1]);E.emissiveMap=L(V),E.emissiveMap.colorSpace=ln,E.emissive.set(16777215),'def Shader "Transform2d_emissive"'in I&&_(E.emissiveMap,I['def Shader "Transform2d_emissive"'])}else if("color3f inputs:emissiveColor"in y){const F=y["color3f inputs:emissiveColor"].replace(/[()]*/g,"");E.emissive.fromArray(JSON.parse("["+F+"]"))}if("normal3f inputs:normal.connect"in y){const F=y["normal3f inputs:normal.connect"],V=b(d,/(\w+).output/.exec(F)[1]);E.normalMap=L(V),E.normalMap.colorSpace=Fn,'def Shader "Transform2d_normal"'in I&&_(E.normalMap,I['def Shader "Transform2d_normal"'])}if("float inputs:roughness.connect"in y){const F=y["float inputs:roughness.connect"],V=b(d,/(\w+).output/.exec(F)[1]);E.roughness=1,E.roughnessMap=L(V),E.roughnessMap.colorSpace=Fn,'def Shader "Transform2d_roughness"'in I&&_(E.roughnessMap,I['def Shader "Transform2d_roughness"'])}else"float inputs:roughness"in y&&(E.roughness=parseFloat(y["float inputs:roughness"]));if("float inputs:metallic.connect"in y){const F=y["float inputs:metallic.connect"],V=b(d,/(\w+).output/.exec(F)[1]);E.metalness=1,E.metalnessMap=L(V),E.metalnessMap.colorSpace=Fn,'def Shader "Transform2d_metallic"'in I&&_(E.metalnessMap,I['def Shader "Transform2d_metallic"'])}else"float inputs:metallic"in y&&(E.metalness=parseFloat(y["float inputs:metallic"]));if("float inputs:clearcoat.connect"in y){const F=y["float inputs:clearcoat.connect"],V=b(d,/(\w+).output/.exec(F)[1]);E.clearcoat=1,E.clearcoatMap=L(V),E.clearcoatMap.colorSpace=Fn,'def Shader "Transform2d_clearcoat"'in I&&_(E.clearcoatMap,I['def Shader "Transform2d_clearcoat"'])}else"float inputs:clearcoat"in y&&(E.clearcoat=parseFloat(y["float inputs:clearcoat"]));if("float inputs:clearcoatRoughness.connect"in y){const F=y["float inputs:clearcoatRoughness.connect"],V=b(d,/(\w+).output/.exec(F)[1]);E.clearcoatRoughness=1,E.clearcoatRoughnessMap=L(V),E.clearcoatRoughnessMap.colorSpace=Fn,'def Shader "Transform2d_clearcoatRoughness"'in I&&_(E.clearcoatRoughnessMap,I['def Shader "Transform2d_clearcoatRoughness"'])}else"float inputs:clearcoatRoughness"in y&&(E.clearcoatRoughness=parseFloat(y["float inputs:clearcoatRoughness"]));if("float inputs:ior"in y&&(E.ior=parseFloat(y["float inputs:ior"])),"float inputs:occlusion.connect"in y){const F=y["float inputs:occlusion.connect"],V=b(d,/(\w+).output/.exec(F)[1]);E.aoMap=L(V),E.aoMap.colorSpace=Fn,'def Shader "Transform2d_occlusion"'in I&&_(E.aoMap,I['def Shader "Transform2d_occlusion"'])}}if('def Shader "diffuseColor_texture"'in I){const y=I['def Shader "diffuseColor_texture"'];E.map=L(y),E.map.colorSpace=ln}if('def Shader "normal_texture"'in I){const y=I['def Shader "normal_texture"'];E.normalMap=L(y),E.normalMap.colorSpace=Fn}}return E}function b(I,E){for(const y in I){const F=I[y];if(y.startsWith(`def Shader "${E}"`))return F;if(typeof F=="object"){const V=b(F,E);if(V)return V}}}function L(I){if("asset inputs:file"in I){const E=I["asset inputs:file"].replace(/@*/g,""),F=new F_().load(l[E]),V={'"clamp"':gr,'"mirror"':ba,'"repeat"':_s};return"token inputs:wrapS"in I&&(F.wrapS=V[I["token inputs:wrapS"]]),"token inputs:wrapT"in I&&(F.wrapT=V[I["token inputs:wrapT"]]),F}return null}function k(I){const E=x(p(I)),y=C(A(I)),F=E?new ye(E,y):new mt;if("matrix4d xformOp:transform"in I){const V=JSON.parse("["+I["matrix4d xformOp:transform"].replace(/[()]*/g,"")+"]");F.matrix.fromArray(V),F.matrix.decompose(F.position,F.quaternion,F.scale)}return F}function U(I,E){for(const y in I)if(y.startsWith("def Scope"))U(I[y],E);else if(y.startsWith("def Xform")){const F=k(I[y]);/def Xform "(\w+)"/.test(y)&&(F.name=/def Xform "(\w+)"/.exec(y)[1]),E.add(F),U(I[y],F)}}const O=new Xi;return U(d,O),O}}const VL={glb:{key:"glb",extension:".glb",options:{}},gltf:{key:"gltf",extension:".gltf",options:{}},usdz:{key:"usdz",extension:".usdz",options:{}}},WL=Object.values(VL).map(i=>i.extension);class XL{_gltfLoader;_usdzLoader;constructor(){this._gltfLoader=new VP,this._usdzLoader=new GL}async load(e){const t=this._getFileTypeFromUri(e);return this._load(e,t)}_getFileTypeFromUri(e){const t=e.split(".").pop()?.toLowerCase();if(!t||!WL.includes(t))throw new Error(`Unsupported file type: ${t}`);return t}async _load(e,t){switch(t){case"glb":case"gltf":return this._loadGltf(e);case"usdz":return this._loadUsdz(e)}}async _loadGltf(e){return(await this._gltfLoader.loadAsync(e)).scene}async _loadUsdz(e){return this._usdzLoader.loadAsync(e)}}class xf extends mt{isDIVERoot=!0;loader;constructor(){super(),this.name="Root",this.loader=new XL}ComputeSceneBB(){const e=new Ii;return this.traverse(t=>{"isObject3D"in t&&e.expandByObject(t)}),e}GetSceneObject(e){let t;return this.traverse(n=>{t||n.userData.id===e.id&&(t=n)}),t}AddSceneObject(e){switch(e.entityType){case"pov":break;case"light":{this.updateLight(e);break}case"model":{this.updateModel(e);break}case"primitive":{this.updatePrimitive(e);break}case"group":{this.updateGroup(e);break}default:console.warn(`DIVERoot.AddSceneObject: Unknown entity type: ${e.entityType}`)}}UpdateSceneObject(e){switch(e.entityType){case"pov":break;case"light":{this.updateLight(e);break}case"model":{this.updateModel(e);break}case"primitive":{this.updatePrimitive(e);break}case"group":{this.updateGroup(e);break}default:console.warn(`DIVERoot.UpdateSceneObject: Unknown entity type: ${e.entityType}`)}}DeleteSceneObject(e){switch(e.entityType){case"pov":break;case"light":{this.deleteLight(e);break}case"model":{this.deleteModel(e);break}case"primitive":{this.deletePrimitive(e);break}case"group":{this.deleteGroup(e);break}default:console.warn(`DIVERoot.DeleteSceneObject: Unknown entity type: ${e.entityType}`)}}PlaceOnFloor(e){switch(e.entityType){case"pov":case"light":break;case"model":case"primitive":{this.placeOnFloor(e);break}default:console.warn(`DIVERoot.PlaceOnFloor: Unknown entity type: ${e.entityType}`)}}updateLight(e){let t=this.GetSceneObject(e);if(!t){switch(e.type){case"scene":{t=new NP;break}case"ambient":{t=new xP;break}case"point":{t=new UP;break}default:{console.warn(`DIVERoot.updateLight: Unknown light type: ${e.type}`);return}}t.userData.id=e.id,this.add(t)}e.name!==void 0&&e.name!==null&&(t.name=e.name),e.position!==void 0&&e.position!==null&&t.position.set(e.position.x,e.position.y,e.position.z),e.intensity!==void 0&&e.intensity!==null&&t.SetIntensity(e.intensity),e.enabled!==void 0&&e.enabled!==null&&t.SetEnabled(e.enabled),e.color!==void 0&&e.color!==null&&t.SetColor(new Ne(e.color)),e.visible!==void 0&&e.visible!==null&&(t.visible=e.visible),e.parentId!==void 0&&this.setParent({...e,parentId:e.parentId})}updateModel(e){let t=this.GetSceneObject(e);t||(t=new kP,t.userData.id=e.id,t.userData.uri=e.uri,this.add(t)),e.uri!==void 0&&this.loader.load(e.uri).then(n=>{t.SetModel(n),Cn.get(e.id)?.PerformAction("MODEL_LOADED",{id:e.id})}),e.name!==void 0&&(t.name=e.name),e.position!==void 0&&t.SetPosition(e.position),e.rotation!==void 0&&t.SetRotation(e.rotation),e.scale!==void 0&&t.SetScale(e.scale),e.visible!==void 0&&t.SetVisibility(e.visible),e.material!==void 0&&t.SetMaterial(e.material),e.parentId!==void 0&&this.setParent({...e,parentId:e.parentId})}updatePrimitive(e){let t=this.GetSceneObject(e);t||(t=new HP,t.userData.id=e.id,this.add(t)),e.name!==void 0&&(t.name=e.name),e.geometry!==void 0&&t.SetGeometry(e.geometry),e.position!==void 0&&t.SetPosition(e.position),e.rotation!==void 0&&t.SetRotation(e.rotation),e.scale!==void 0&&t.SetScale(e.scale),e.visible!==void 0&&t.SetVisibility(e.visible),e.material!==void 0&&t.SetMaterial(e.material),e.parentId!==void 0&&this.setParent({...e,parentId:e.parentId})}updateGroup(e){let t=this.GetSceneObject(e);t||(t=new GP,t.userData.id=e.id,this.add(t)),e.name!==void 0&&(t.name=e.name),e.position!==void 0&&t.SetPosition(e.position),e.rotation!==void 0&&t.SetRotation(e.rotation),e.scale!==void 0&&t.SetScale(e.scale),e.visible!==void 0&&t.SetVisibility(e.visible),e.bbVisible!==void 0&&t.SetLinesVisibility(e.bbVisible),e.parentId!==void 0&&this.setParent({...e,parentId:e.parentId})}deleteLight(e){const t=this.GetSceneObject(e);if(!t){console.warn(`DIVERoot.deleteLight: Light with id ${e.id} not found`);return}this.detachTransformControls(t),t.parent.remove(t)}deleteModel(e){const t=this.GetSceneObject(e);if(!t){console.warn(`DIVERoot.deleteModel: Model with id ${e.id} not found`);return}this.detachTransformControls(t),t.parent.remove(t)}deletePrimitive(e){const t=this.GetSceneObject(e);if(!t){console.warn(`DIVERoot.deletePrimitive: Primitive with id ${e.id} not found`);return}this.detachTransformControls(t),t.parent.remove(t)}deleteGroup(e){const t=this.GetSceneObject(e);if(!t){console.warn(`DIVERoot.deleteGroup: Group with id ${e.id} not found`);return}this.detachTransformControls(t);for(let n=t.members.length-1;n>=0;n--)this.attach(t.members[n]);t.parent.remove(t)}placeOnFloor(e){const t=this.GetSceneObject(e);t&&t.PlaceOnFloor()}setParent(e){const t=this.GetSceneObject(e);if(t)if(e.parentId!==null){const n=this.GetSceneObject({id:e.parentId});if(!n)return;n.attach(t)}else this.attach(t)}detachTransformControls(e){this.findScene(e).children.find(t=>{"isTransformControls"in t&&t.detach()})}findScene(e){return e.parent!==null?this.findScene(e.parent):e}}const YL="#888888",jL="#dddddd";class qL extends mt{constructor(){super(),this.name="Grid";const e=new gP(100,100,YL,jL);e.material.depthTest=!1,e.layers.mask=z_,this.add(e)}SetVisibility(e){this.visible=e}}class KL extends ye{isFloor=!0;constructor(){super(new Ss(1e4,1e4),new Ro({color:new Ne(150/255,150/255,150/255)})),this.name="Floor",this.layers.mask=ti,this.receiveShadow=!0,this.rotateX(-Math.PI/2)}SetVisibility(e){this.visible=e}SetColor(e){this.material.color=new Ne(e)}}class ZL{constructor(e,t,n,r,o){this.xrLight=e,this.renderer=t,this.lightProbe=n,this.xrWebGLBinding=null,this.estimationStartCallback=o,this.frameCallback=this.onXRFrame.bind(this);const c=t.xr.getSession();if(r&&"XRWebGLBinding"in window){const l=new S_(16);e.environment=l.texture;const h=t.getContext();switch(c.preferredReflectionFormat){case"srgba8":h.getExtension("EXT_sRGB");break;case"rgba16f":h.getExtension("OES_texture_half_float");break}this.xrWebGLBinding=new XRWebGLBinding(c,h),this.lightProbe.addEventListener("reflectionchange",()=>{this.updateReflection()})}c.requestAnimationFrame(this.frameCallback)}updateReflection(){const e=this.renderer.properties.get(this.xrLight.environment);if(e){const t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);const r=t.getLightEstimate(this.lightProbe);if(r){this.xrLight.lightProbe.sh.fromArray(r.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const o=Math.max(1,Math.max(r.primaryLightIntensity.x,Math.max(r.primaryLightIntensity.y,r.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(r.primaryLightIntensity.x/o,r.primaryLightIntensity.y/o,r.primaryLightIntensity.z/o),this.xrLight.directionalLight.intensity=o,this.xrLight.directionalLight.position.copy(r.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class $L extends Xi{constructor(e,t=!0){super(),this.lightProbe=new sP,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new ff,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let n=null,r=!1;e.xr.addEventListener("sessionstart",()=>{const o=e.xr.getSession();"requestLightProbe"in o&&o.requestLightProbe({reflectionFormat:o.preferredReflectionFormat}).then(c=>{n=new ZL(this,e,c,t,()=>{r=!0,this.dispatchEvent({type:"estimationstart"})})})}),e.xr.addEventListener("sessionend",()=>{n&&(n.dispose(),n=null),r&&this.dispatchEvent({type:"estimationend"})}),this.dispose=()=>{n&&(n.dispose(),n=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}class JL extends mt{_scene;_xrLight;_lightRoot;constructor(e){super(),this.name="XRLightRoot",this._scene=e,this._xrLight=null,this._lightRoot=new xf,this._lightRoot.UpdateSceneObject({id:"XRSceneLight",entityType:"light",name:"XRSceneLight",type:"scene",color:16777215,intensity:1,enabled:!0,visible:!0}),this.add(this._lightRoot)}InitLightEstimation(e){this._xrLight||(this._xrLight=new $L(e,!0),this._xrLight.layers.mask=ti,this.add(this._xrLight)),this._xrLight.addEventListener("estimationstart",()=>{this.onEstimationStart()}),this._xrLight.addEventListener("estimationend",()=>{this.onEstimationEnd()})}DisposeLightEstimation(){this._xrLight&&(this._xrLight.removeEventListener("estimationstart",()=>{this.onEstimationStart()}),this._xrLight.removeEventListener("estimationend",()=>{this.onEstimationEnd()}))}onEstimationStart(){this._lightRoot.visible=!1,this._xrLight&&this._xrLight.environment&&(this._scene.environment=this._xrLight.environment)}onEstimationEnd(){this._lightRoot.visible=!0,this._scene.environment=null,this._xrLight}}class QL extends mt{_xrLightRoot;_xrModelRoot;_xrHandNode;get XRModelRoot(){return this._xrModelRoot}get XRLightRoot(){return this._xrLightRoot}get XRHandNode(){return this._xrHandNode}_xrShadowPlane;constructor(e){super(),this.name="XRRoot",this._xrModelRoot=new xf,this._xrModelRoot.name="XRModelRoot",this.add(this._xrModelRoot),this._xrShadowPlane=new ye(new Ss(100,100),new FC({opacity:1,transparent:!0})),this._xrModelRoot.add(this._xrShadowPlane),this._xrLightRoot=new JL(e),this._xrLightRoot.name="XRLightRoot",this.add(this._xrLightRoot),this._xrHandNode=new mt,this._xrHandNode.name="XRHandNode",this.add(this._xrHandNode)}InitLightEstimation(e){this._xrLightRoot.InitLightEstimation(e)}DisposeLightEstimation(){this._xrLightRoot.DisposeLightEstimation()}}class eI extends RC{_root;_floor;_grid;get Root(){return this._root}_xrRoot;get XRRoot(){return this._xrRoot}get Floor(){return this._floor}get Grid(){return this._grid}constructor(){super(),this.background=new Ne(16777215),this._root=new xf,this.add(this._root),this._floor=new KL,this.add(this._floor),this._grid=new qL,this.add(this._grid),this._xrRoot=new QL(this),this._xrRoot.visible=!1,this.add(this._xrRoot)}InitXR(e){this._root.visible=!1,this._xrRoot.visible=!0,this._xrRoot.InitLightEstimation(e)}DisposeXR(){this._root.visible=!0,this._xrRoot.visible=!1,this._xrRoot.DisposeLightEstimation()}SetBackground(e){this.background=new Ne(e)}ComputeSceneBB(){return this.Root.ComputeSceneBB()}GetSceneObject(e){return this.Root.GetSceneObject(e)}AddSceneObject(e){this.Root.AddSceneObject(e)}UpdateSceneObject(e){this.Root.UpdateSceneObject(e)}DeleteSceneObject(e){this.Root.DeleteSceneObject(e)}PlaceOnFloor(e){this.Root.PlaceOnFloor(e)}}const ga={fov:70,near:.1,far:1e3};class Ea extends Bn{static EDITOR_VIEW_LAYER_MASK=vP|mf|z_|ti;static LIVE_VIEW_LAYER_MASK=ti;onSetCameraLayer=()=>{};constructor(e=ga){super(e.fov||ga.fov,1,e.near||ga.near,e.far||ga.far),this.layers.mask=Ea.EDITOR_VIEW_LAYER_MASK}OnResize(e,t){this.aspect=e/t,this.updateProjectionMatrix()}SetCameraLayer(e){this.layers.mask=e==="LIVE"?Ea.LIVE_VIEW_LAYER_MASK:Ea.EDITOR_VIEW_LAYER_MASK,this.onSetCameraLayer(this.layers.mask)}}const Vg={type:"change"},Ch={type:"start"},Wg={type:"end"},nl=new To,Xg=new Hr,tI=Math.cos(70*ji.DEG2RAD);class nI extends ys{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new N,this.cursor=new N,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Bs.ROTATE,MIDDLE:Bs.DOLLY,RIGHT:Bs.PAN},this.touches={ONE:zs.ROTATE,TWO:zs.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(S){S.addEventListener("keydown",Te),this._domElementKeyEvents=S},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",Te),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(Vg),n.update(),o=r.NONE},this.update=function(){const S=new N,Z=new on().setFromUnitVectors(e.up,new N(0,1,0)),oe=Z.clone().invert(),xe=new N,Re=new on,_t=new N,dt=2*Math.PI;return function(rn=null){const At=n.object.position;S.copy(At).sub(n.target),S.applyQuaternion(Z),l.setFromVector3(S),n.autoRotate&&o===r.NONE&&V(y(rn)),n.enableDamping?(l.theta+=h.theta*n.dampingFactor,l.phi+=h.phi*n.dampingFactor):(l.theta+=h.theta,l.phi+=h.phi);let Kt=n.minAzimuthAngle,Zt=n.maxAzimuthAngle;isFinite(Kt)&&isFinite(Zt)&&(Kt<-Math.PI?Kt+=dt:Kt>Math.PI&&(Kt-=dt),Zt<-Math.PI?Zt+=dt:Zt>Math.PI&&(Zt-=dt),Kt<=Zt?l.theta=Math.max(Kt,Math.min(Zt,l.theta)):l.theta=l.theta>(Kt+Zt)/2?Math.max(Kt,l.theta):Math.min(Zt,l.theta)),l.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,l.phi)),l.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(d,n.dampingFactor):n.target.add(d),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor);let Pn=!1;if(n.zoomToCursor&&U||n.object.isOrthographicCamera)l.radius=me(l.radius);else{const Sn=l.radius;l.radius=me(l.radius*f),Pn=Sn!=l.radius}if(S.setFromSpherical(l),S.applyQuaternion(oe),At.copy(n.target).add(S),n.object.lookAt(n.target),n.enableDamping===!0?(h.theta*=1-n.dampingFactor,h.phi*=1-n.dampingFactor,d.multiplyScalar(1-n.dampingFactor)):(h.set(0,0,0),d.set(0,0,0)),n.zoomToCursor&&U){let Sn=null;if(n.object.isPerspectiveCamera){const Di=S.length();Sn=me(Di*f);const Oi=Di-Sn;n.object.position.addScaledVector(L,Oi),n.object.updateMatrixWorld(),Pn=!!Oi}else if(n.object.isOrthographicCamera){const Di=new N(k.x,k.y,0);Di.unproject(n.object);const Oi=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/f)),n.object.updateProjectionMatrix(),Pn=Oi!==n.object.zoom;const Qi=new N(k.x,k.y,0);Qi.unproject(n.object),n.object.position.sub(Qi).add(Di),n.object.updateMatrixWorld(),Sn=S.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Sn!==null&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Sn).add(n.object.position):(nl.origin.copy(n.object.position),nl.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(nl.direction))<tI?e.lookAt(n.target):(Xg.setFromNormalAndCoplanarPoint(n.object.up,n.target),nl.intersectPlane(Xg,n.target))))}else if(n.object.isOrthographicCamera){const Sn=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/f)),Sn!==n.object.zoom&&(n.object.updateProjectionMatrix(),Pn=!0)}return f=1,U=!1,Pn||xe.distanceToSquared(n.object.position)>c||8*(1-Re.dot(n.object.quaternion))>c||_t.distanceToSquared(n.target)>c?(n.dispatchEvent(Vg),xe.copy(n.object.position),Re.copy(n.object.quaternion),_t.copy(n.target),!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",Ie),n.domElement.removeEventListener("pointerdown",te),n.domElement.removeEventListener("pointercancel",ue),n.domElement.removeEventListener("wheel",_e),n.domElement.removeEventListener("pointermove",ae),n.domElement.removeEventListener("pointerup",ue),n.domElement.getRootNode().removeEventListener("keydown",Ve,{capture:!0}),n._domElementKeyEvents!==null&&(n._domElementKeyEvents.removeEventListener("keydown",Te),n._domElementKeyEvents=null)};const n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let o=r.NONE;const c=1e-6,l=new wg,h=new wg;let f=1;const d=new N,p=new Pe,m=new Pe,x=new Pe,M=new Pe,A=new Pe,v=new Pe,_=new Pe,C=new Pe,b=new Pe,L=new N,k=new Pe;let U=!1;const O=[],I={};let E=!1;function y(S){return S!==null?2*Math.PI/60*n.autoRotateSpeed*S:2*Math.PI/60/60*n.autoRotateSpeed}function F(S){const Z=Math.abs(S*.01);return Math.pow(.95,n.zoomSpeed*Z)}function V(S){h.theta-=S}function G(S){h.phi-=S}const q=function(){const S=new N;return function(oe,xe){S.setFromMatrixColumn(xe,0),S.multiplyScalar(-oe),d.add(S)}}(),ne=function(){const S=new N;return function(oe,xe){n.screenSpacePanning===!0?S.setFromMatrixColumn(xe,1):(S.setFromMatrixColumn(xe,0),S.crossVectors(n.object.up,S)),S.multiplyScalar(oe),d.add(S)}}(),se=function(){const S=new N;return function(oe,xe){const Re=n.domElement;if(n.object.isPerspectiveCamera){const _t=n.object.position;S.copy(_t).sub(n.target);let dt=S.length();dt*=Math.tan(n.object.fov/2*Math.PI/180),q(2*oe*dt/Re.clientHeight,n.object.matrix),ne(2*xe*dt/Re.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(q(oe*(n.object.right-n.object.left)/n.object.zoom/Re.clientWidth,n.object.matrix),ne(xe*(n.object.top-n.object.bottom)/n.object.zoom/Re.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function pe(S){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?f/=S:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function K(S){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?f*=S:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function he(S,Z){if(!n.zoomToCursor)return;U=!0;const oe=n.domElement.getBoundingClientRect(),xe=S-oe.left,Re=Z-oe.top,_t=oe.width,dt=oe.height;k.x=xe/_t*2-1,k.y=-(Re/dt)*2+1,L.set(k.x,k.y,1).unproject(n.object).sub(n.object.position).normalize()}function me(S){return Math.max(n.minDistance,Math.min(n.maxDistance,S))}function Me(S){p.set(S.clientX,S.clientY)}function Ke(S){he(S.clientX,S.clientX),_.set(S.clientX,S.clientY)}function ot(S){M.set(S.clientX,S.clientY)}function ie(S){m.set(S.clientX,S.clientY),x.subVectors(m,p).multiplyScalar(n.rotateSpeed);const Z=n.domElement;V(2*Math.PI*x.x/Z.clientHeight),G(2*Math.PI*x.y/Z.clientHeight),p.copy(m),n.update()}function ge(S){C.set(S.clientX,S.clientY),b.subVectors(C,_),b.y>0?pe(F(b.y)):b.y<0&&K(F(b.y)),_.copy(C),n.update()}function we(S){A.set(S.clientX,S.clientY),v.subVectors(A,M).multiplyScalar(n.panSpeed),se(v.x,v.y),M.copy(A),n.update()}function Se(S){he(S.clientX,S.clientY),S.deltaY<0?K(F(S.deltaY)):S.deltaY>0&&pe(F(S.deltaY)),n.update()}function Ge(S){let Z=!1;switch(S.code){case n.keys.UP:S.ctrlKey||S.metaKey||S.shiftKey?G(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):se(0,n.keyPanSpeed),Z=!0;break;case n.keys.BOTTOM:S.ctrlKey||S.metaKey||S.shiftKey?G(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):se(0,-n.keyPanSpeed),Z=!0;break;case n.keys.LEFT:S.ctrlKey||S.metaKey||S.shiftKey?V(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):se(n.keyPanSpeed,0),Z=!0;break;case n.keys.RIGHT:S.ctrlKey||S.metaKey||S.shiftKey?V(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):se(-n.keyPanSpeed,0),Z=!0;break}Z&&(S.preventDefault(),n.update())}function Xe(S){if(O.length===1)p.set(S.pageX,S.pageY);else{const Z=Mt(S),oe=.5*(S.pageX+Z.x),xe=.5*(S.pageY+Z.y);p.set(oe,xe)}}function at(S){if(O.length===1)M.set(S.pageX,S.pageY);else{const Z=Mt(S),oe=.5*(S.pageX+Z.x),xe=.5*(S.pageY+Z.y);M.set(oe,xe)}}function j(S){const Z=Mt(S),oe=S.pageX-Z.x,xe=S.pageY-Z.y,Re=Math.sqrt(oe*oe+xe*xe);_.set(0,Re)}function $e(S){n.enableZoom&&j(S),n.enablePan&&at(S)}function ze(S){n.enableZoom&&j(S),n.enableRotate&&Xe(S)}function bt(S){if(O.length==1)m.set(S.pageX,S.pageY);else{const oe=Mt(S),xe=.5*(S.pageX+oe.x),Re=.5*(S.pageY+oe.y);m.set(xe,Re)}x.subVectors(m,p).multiplyScalar(n.rotateSpeed);const Z=n.domElement;V(2*Math.PI*x.x/Z.clientHeight),G(2*Math.PI*x.y/Z.clientHeight),p.copy(m)}function He(S){if(O.length===1)A.set(S.pageX,S.pageY);else{const Z=Mt(S),oe=.5*(S.pageX+Z.x),xe=.5*(S.pageY+Z.y);A.set(oe,xe)}v.subVectors(A,M).multiplyScalar(n.panSpeed),se(v.x,v.y),M.copy(A)}function Tt(S){const Z=Mt(S),oe=S.pageX-Z.x,xe=S.pageY-Z.y,Re=Math.sqrt(oe*oe+xe*xe);C.set(0,Re),b.set(0,Math.pow(C.y/_.y,n.zoomSpeed)),pe(b.y),_.copy(C);const _t=(S.pageX+Z.x)*.5,dt=(S.pageY+Z.y)*.5;he(_t,dt)}function B(S){n.enableZoom&&Tt(S),n.enablePan&&He(S)}function w(S){n.enableZoom&&Tt(S),n.enableRotate&&bt(S)}function te(S){n.enabled!==!1&&(O.length===0&&(n.domElement.setPointerCapture(S.pointerId),n.domElement.addEventListener("pointermove",ae),n.domElement.addEventListener("pointerup",ue)),!St(S)&&(ct(S),S.pointerType==="touch"?qe(S):de(S)))}function ae(S){n.enabled!==!1&&(S.pointerType==="touch"?Le(S):Be(S))}function ue(S){switch(ft(S),O.length){case 0:n.domElement.releasePointerCapture(S.pointerId),n.domElement.removeEventListener("pointermove",ae),n.domElement.removeEventListener("pointerup",ue),n.dispatchEvent(Wg),o=r.NONE;break;case 1:const Z=O[0],oe=I[Z];qe({pointerId:Z,pageX:oe.x,pageY:oe.y});break}}function de(S){let Z;switch(S.button){case 0:Z=n.mouseButtons.LEFT;break;case 1:Z=n.mouseButtons.MIDDLE;break;case 2:Z=n.mouseButtons.RIGHT;break;default:Z=-1}switch(Z){case Bs.DOLLY:if(n.enableZoom===!1)return;Ke(S),o=r.DOLLY;break;case Bs.ROTATE:if(S.ctrlKey||S.metaKey||S.shiftKey){if(n.enablePan===!1)return;ot(S),o=r.PAN}else{if(n.enableRotate===!1)return;Me(S),o=r.ROTATE}break;case Bs.PAN:if(S.ctrlKey||S.metaKey||S.shiftKey){if(n.enableRotate===!1)return;Me(S),o=r.ROTATE}else{if(n.enablePan===!1)return;ot(S),o=r.PAN}break;default:o=r.NONE}o!==r.NONE&&n.dispatchEvent(Ch)}function Be(S){switch(o){case r.ROTATE:if(n.enableRotate===!1)return;ie(S);break;case r.DOLLY:if(n.enableZoom===!1)return;ge(S);break;case r.PAN:if(n.enablePan===!1)return;we(S);break}}function _e(S){n.enabled===!1||n.enableZoom===!1||o!==r.NONE||(S.preventDefault(),n.dispatchEvent(Ch),Se(De(S)),n.dispatchEvent(Wg))}function De(S){const Z=S.deltaMode,oe={clientX:S.clientX,clientY:S.clientY,deltaY:S.deltaY};switch(Z){case 1:oe.deltaY*=16;break;case 2:oe.deltaY*=100;break}return S.ctrlKey&&!E&&(oe.deltaY*=10),oe}function Ve(S){S.key==="Control"&&(E=!0,n.domElement.getRootNode().addEventListener("keyup",ve,{passive:!0,capture:!0}))}function ve(S){S.key==="Control"&&(E=!1,n.domElement.getRootNode().removeEventListener("keyup",ve,{passive:!0,capture:!0}))}function Te(S){n.enabled===!1||n.enablePan===!1||Ge(S)}function qe(S){switch(gt(S),O.length){case 1:switch(n.touches.ONE){case zs.ROTATE:if(n.enableRotate===!1)return;Xe(S),o=r.TOUCH_ROTATE;break;case zs.PAN:if(n.enablePan===!1)return;at(S),o=r.TOUCH_PAN;break;default:o=r.NONE}break;case 2:switch(n.touches.TWO){case zs.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;$e(S),o=r.TOUCH_DOLLY_PAN;break;case zs.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ze(S),o=r.TOUCH_DOLLY_ROTATE;break;default:o=r.NONE}break;default:o=r.NONE}o!==r.NONE&&n.dispatchEvent(Ch)}function Le(S){switch(gt(S),o){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;bt(S),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;He(S),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;B(S),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;w(S),n.update();break;default:o=r.NONE}}function Ie(S){n.enabled!==!1&&S.preventDefault()}function ct(S){O.push(S.pointerId)}function ft(S){delete I[S.pointerId];for(let Z=0;Z<O.length;Z++)if(O[Z]==S.pointerId){O.splice(Z,1);return}}function St(S){for(let Z=0;Z<O.length;Z++)if(O[Z]==S.pointerId)return!0;return!1}function gt(S){let Z=I[S.pointerId];Z===void 0&&(Z=new Pe,I[S.pointerId]=Z),Z.set(S.pageX,S.pageY)}function Mt(S){const Z=S.pointerId===O[0]?O[1]:O[0];return I[Z]}n.domElement.addEventListener("contextmenu",Ie),n.domElement.addEventListener("pointerdown",te),n.domElement.addEventListener("pointercancel",ue),n.domElement.addEventListener("wheel",_e,{passive:!1}),n.domElement.getRootNode().addEventListener("keydown",Ve,{passive:!0,capture:!0}),this.update()}}var xr=Object.freeze({Linear:Object.freeze({None:function(i){return i},In:function(i){return i},Out:function(i){return i},InOut:function(i){return i}}),Quadratic:Object.freeze({In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}}),Cubic:Object.freeze({In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}}),Quartic:Object.freeze({In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}}),Quintic:Object.freeze({In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}}),Sinusoidal:Object.freeze({In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}}),Exponential:Object.freeze({In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}}),Circular:Object.freeze({In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}}),Elastic:Object.freeze({In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(i){var e=1.70158;return i===1?1:i*i*((e+1)*i-e)},Out:function(i){var e=1.70158;return i===0?0:--i*i*((e+1)*i+e)+1},InOut:function(i){var e=2.5949095;return(i*=2)<1?.5*(i*i*((e+1)*i-e)):.5*((i-=2)*i*((e+1)*i+e)+2)}}),Bounce:Object.freeze({In:function(i){return 1-xr.Bounce.Out(1-i)},Out:function(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},InOut:function(i){return i<.5?xr.Bounce.In(i*2)*.5:xr.Bounce.Out(i*2-1)*.5+.5}}),generatePow:function(i){return i===void 0&&(i=4),i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(e){return Math.pow(e,i)},Out:function(e){return 1-Math.pow(1-e,i)},InOut:function(e){return e<.5?Math.pow(e*2,i)/2:(1-Math.pow(2-e*2,i))/2+.5}}}}),_a=function(){return performance.now()},iI=function(){function i(){this._tweens={},this._tweensAddedDuringUpdate={}}return i.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},i.prototype.removeAll=function(){this._tweens={}},i.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},i.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},i.prototype.update=function(e,t){e===void 0&&(e=_a()),t===void 0&&(t=!1);var n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var o=this._tweens[n[r]],c=!t;o&&o.update(e,c)===!1&&!t&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},i}(),Kh={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),o=Kh.Utils.Linear;return e<0?o(i[0],i[1],n):e>1?o(i[t],i[t-1],t-n):o(i[r],i[r+1>t?t:r+1],n-r)},Utils:{Linear:function(i,e,t){return(e-i)*t+i}}},$_=function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i}(),Zh=new iI,rI=function(){function i(e,t){t===void 0&&(t=Zh),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=xr.Linear.None,this._interpolationFunction=Kh.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=$_.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return i.prototype.getId=function(){return this._id},i.prototype.isPlaying=function(){return this._isPlaying},i.prototype.isPaused=function(){return this._isPaused},i.prototype.getDuration=function(){return this._duration},i.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},i.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},i.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},i.prototype.start=function(e,t){if(e===void 0&&(e=_a()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var o in this._valuesEnd)r[o]=this._valuesEnd[o];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},i.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},i.prototype._setupProperties=function(e,t,n,r,o){for(var c in n){var l=e[c],h=Array.isArray(l),f=h?"array":typeof l,d=!h&&Array.isArray(n[c]);if(!(f==="undefined"||f==="function")){if(d){var p=n[c];if(p.length===0)continue;for(var m=[l],x=0,M=p.length;x<M;x+=1){var A=this._handleRelativeValue(l,p[x]);if(isNaN(A)){d=!1,console.warn("Found invalid interpolation list. Skipping.");break}m.push(A)}d&&(n[c]=m)}if((f==="object"||h)&&l&&!d){t[c]=h?[]:{};var v=l;for(var _ in v)t[c][_]=v[_];r[c]=h?[]:{};var p=n[c];if(!this._isDynamic){var C={};for(var _ in p)C[_]=p[_];n[c]=p=C}this._setupProperties(v,t[c],p,r[c],o)}else(typeof t[c]>"u"||o)&&(t[c]=l),h||(t[c]*=1),d?r[c]=n[c].slice().reverse():r[c]=t[c]||0}}},i.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},i.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},i.prototype.pause=function(e){return e===void 0&&(e=_a()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},i.prototype.resume=function(e){return e===void 0&&(e=_a()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},i.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},i.prototype.group=function(e){return e===void 0&&(e=Zh),this._group=e,this},i.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},i.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},i.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},i.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},i.prototype.easing=function(e){return e===void 0&&(e=xr.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=Kh.Linear),this._interpolationFunction=e,this},i.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},i.prototype.onStart=function(e){return this._onStartCallback=e,this},i.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},i.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},i.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},i.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},i.prototype.onStop=function(e){return this._onStopCallback=e,this},i.prototype.update=function(e,t){var n;if(e===void 0&&(e=_a()),t===void 0&&(t=!0),this._isPaused)return!0;var r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>r)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=e-this._startTime,c=this._duration+((n=this._repeatDelayTime)!==null&&n!==void 0?n:this._delayTime),l=this._duration+this._repeat*c,h=this._calculateElapsedPortion(o,c,l),f=this._easingFunction(h),d=this._calculateCompletionStatus(o,c);if(d==="repeat"&&this._processRepetition(o,c),this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),d==="about-to-repeat"&&this._processRepetition(o,c),this._onUpdateCallback&&this._onUpdateCallback(this._object,h),d==="repeat"||d==="about-to-repeat")this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1;else if(d==="completed"){this._isPlaying=!1,this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var p=0,m=this._chainedTweens.length;p<m;p++)this._chainedTweens[p].start(this._startTime+this._duration,!1)}return d!=="completed"},i.prototype._calculateElapsedPortion=function(e,t,n){if(this._duration===0||e>n)return 1;var r=e%t,o=Math.min(r/this._duration,1);return o===0&&e!==0&&e%this._duration===0?1:o},i.prototype._calculateCompletionStatus=function(e,t){return this._duration!==0&&e<this._duration?"playing":this._repeat<=0?"completed":e===this._duration?"about-to-repeat":"repeat"},i.prototype._processRepetition=function(e,t){var n=Math.min(Math.trunc((e-this._duration)/t)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=n);for(var r in this._valuesStartRepeat){var o=this._valuesEnd[r];!this._yoyo&&typeof o=="string"&&(this._valuesStartRepeat[r]=this._valuesStartRepeat[r]+parseFloat(o)),this._yoyo&&this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}this._yoyo&&(this._reversed=!this._reversed),this._startTime+=t*n},i.prototype._updateProperties=function(e,t,n,r){for(var o in n)if(t[o]!==void 0){var c=t[o]||0,l=n[o],h=Array.isArray(e[o]),f=Array.isArray(l),d=!h&&f;d?e[o]=this._interpolationFunction(l,r):typeof l=="object"&&l?this._updateProperties(e[o],c,l,r):(l=this._handleRelativeValue(c,l),typeof l=="number"&&(e[o]=c+(l-c)*r))}},i.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},i.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];typeof n=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(n):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},i}();$_.nextId;var qi=Zh;qi.getAll.bind(qi);qi.removeAll.bind(qi);qi.add.bind(qi);qi.remove.bind(qi);var sI=qi.update.bind(qi);const cl={enableDamping:!0,dampingFactor:.04};class _l extends nI{static DEFAULT_ZOOM_FACTOR=1;_animationSystem;last=null;animating=!1;locked=!1;stopMoveTo=()=>{};stopRevertLast=()=>{};object;domElement;_removePreRenderCallback=()=>{};constructor(e,t,n,r=cl){super(e,t.domElement),this._animationSystem=n,this.domElement=t.domElement,this.object=e;const o=t.AddPreRenderCallback(()=>{this.preRenderCallback()});this._removePreRenderCallback=()=>{t.RemovePreRenderCallback(o)},this.enableDamping=r.enableDamping||cl.enableDamping,this.dampingFactor=r.dampingFactor||cl.dampingFactor,this.object.position.set(0,2,2),this.target.copy({x:0,y:.5,z:0}),this.update()}Dispose(){this._removePreRenderCallback(),this.dispose()}ComputeEncompassingView(e){const t=e.getCenter(new N),n=e.getSize(new N),r=Math.max(n.x,n.y,n.z)*1.25;return{position:this.object.position.clone().normalize().multiplyScalar(r),target:t}}ZoomIn(e){const t=e||_l.DEFAULT_ZOOM_FACTOR,{minDistance:n,maxDistance:r}=this;this.minDistance=this.maxDistance=ji.clamp(this.getDistance()-t,n+t,r-t),this.update(),this.minDistance=n,this.maxDistance=r}ZoomOut(e){const t=e||_l.DEFAULT_ZOOM_FACTOR,{minDistance:n,maxDistance:r}=this;this.minDistance=this.maxDistance=ji.clamp(this.getDistance()+t,n+t,r-t),this.update(),this.minDistance=n,this.maxDistance=r}MoveTo(e,t,n,r){if(this.animating)return;const o=e||this.object.position.clone(),c=t||this.target.clone();this.stopRevertLast(),this.locked||(this.last={pos:this.object.position.clone(),target:this.target.clone()}),this.animating=n>0,this.locked=r,this.enabled=!1;const l=this._animationSystem.Animate(this.object.position).to(o,n).easing(xr.Quadratic.Out).start(),h=this._animationSystem.Animate(this.target).to(c,n).easing(xr.Quadratic.Out).onUpdate(()=>{this.object.lookAt(this.target)}).onComplete(()=>{this.animating=!1,this.enabled=!r}).start();this.stopMoveTo=()=>{l.stop(),h.stop()}}RevertLast(e){if(this.animating||!this.locked)return;this.stopMoveTo(),this.animating=e>0,this.enabled=!1;const{pos:t,target:n}=this.last,r=this._animationSystem.Animate(this.object.position).to(t,e).easing(xr.Quadratic.Out).start(),o=this._animationSystem.Animate(this.target).to(n,e).easing(xr.Quadratic.Out).onUpdate(()=>{this.object.lookAt(this.target)}).onComplete(()=>{this.animating=!1,this.locked=!1,this.enabled=!0}).start();this.stopRevertLast=()=>{r.stop(),o.stop()}}preRenderCallback=()=>{this.locked||this.update()}}class oI{static DefaultTool="select";_scene;_controller;_activeTool;_selectTool;get selectTool(){return this._selectTool||(this._selectTool=new LP(this._scene,this._controller)),this._selectTool}constructor(e,t){this._scene=e,this._controller=t,this._selectTool=null,this._activeTool=null}Dispose(){this.removeEventListeners()}GetActiveTool(){return this._activeTool}UseTool(e){switch(this._activeTool?.Deactivate(),e){case"select":{this.addEventListeners(),this.selectTool.Activate(),this._activeTool=this.selectTool;break}case"none":{this.removeEventListeners(),this._activeTool=null;break}default:console.warn(`DIVEToolBox.UseTool: Unknown tool: ${e}`)}}SetGizmoMode(e){this.selectTool.SetGizmoMode(e)}SetGizmoVisibility(e){this.selectTool.SetGizmoVisibility(e)}SetGizmoScaleLinked(e){this.selectTool.SetGizmoScaleLinked(e)}onPointerMove(e){this._activeTool?.onPointerMove(e)}onPointerDown(e){this._activeTool?.onPointerDown(e)}onPointerUp(e){this._activeTool?.onPointerUp(e)}onWheel(e){this._activeTool?.onWheel(e)}addEventListeners(){this._controller.domElement.addEventListener("pointermove",e=>this.onPointerMove(e)),this._controller.domElement.addEventListener("pointerdown",e=>this.onPointerDown(e)),this._controller.domElement.addEventListener("pointerup",e=>this.onPointerUp(e)),this._controller.domElement.addEventListener("wheel",e=>this.onWheel(e))}removeEventListeners(){this._controller.domElement.removeEventListener("pointermove",e=>this.onPointerMove(e)),this._controller.domElement.removeEventListener("pointerdown",e=>this.onPointerDown(e)),this._controller.domElement.removeEventListener("pointerup",e=>this.onPointerUp(e)),this._controller.domElement.removeEventListener("wheel",e=>this.onWheel(e))}}class aI{_renderer;_rendererCallbackId;constructor(e){this._renderer=e,this._rendererCallbackId=this._renderer.AddPreRenderCallback(()=>{this.Update()})}Dispose(){this._renderer.RemovePreRenderCallback(this._rendererCallbackId)}Update(){sI()}Animate(e){return new rI(e)}}function cI(i,e,t){return e=vl(e),_I(i,J_()?Reflect.construct(e,t||[],vl(i).constructor):e.apply(i,t))}function J_(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(J_=function(){return!!i})()}function lI(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,o,c,l=[],h=!0,f=!1;try{if(o=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;h=!1}else for(;!(h=(n=o.call(t)).done)&&(l.push(n.value),l.length!==e);h=!0);}catch(d){f=!0,r=d}finally{try{if(!h&&t.return!=null&&(c=t.return(),Object(c)!==c))return}finally{if(f)throw r}}return l}}function uI(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function hI(i){var e=uI(i,"string");return typeof e=="symbol"?e:String(e)}function fI(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function dI(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,hI(n.key),n)}}function pI(i,e,t){return e&&dI(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function mI(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&$h(i,e)}function vl(i){return vl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vl(i)}function $h(i,e){return $h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},$h(i,e)}function gI(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function _I(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gI(i)}function Yg(i,e){return xI(i)||lI(i,e)||Q_(i,e)||MI()}function il(i){return vI(i)||yI(i)||Q_(i)||SI()}function vI(i){if(Array.isArray(i))return Jh(i)}function xI(i){if(Array.isArray(i))return i}function yI(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Q_(i,e){if(i){if(typeof i=="string")return Jh(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Jh(i,e)}}function Jh(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=i[t];return n}function SI(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
3830
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function MI(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3831
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var co=typeof window<"u"&&window.THREE?window.THREE:{LinearFilter:Wn,Sprite:CC,SpriteMaterial:P_,SRGBColorSpace:ln,Texture:un},Ph=function(i){mI(e,i);function e(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:10,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"rgba(255, 255, 255, 1)";return fI(this,e),t=cI(this,e,[new co.SpriteMaterial]),t._text="".concat(n),t._textHeight=r,t._color=o,t._backgroundColor=!1,t._padding=0,t._borderWidth=0,t._borderRadius=0,t._borderColor="white",t._strokeWidth=0,t._strokeColor="white",t._fontFace="system-ui",t._fontSize=90,t._fontWeight="normal",t._canvas=document.createElement("canvas"),t._genCanvas(),t}return pI(e,[{key:"text",get:function(){return this._text},set:function(n){this._text=n,this._genCanvas()}},{key:"textHeight",get:function(){return this._textHeight},set:function(n){this._textHeight=n,this._genCanvas()}},{key:"color",get:function(){return this._color},set:function(n){this._color=n,this._genCanvas()}},{key:"backgroundColor",get:function(){return this._backgroundColor},set:function(n){this._backgroundColor=n,this._genCanvas()}},{key:"padding",get:function(){return this._padding},set:function(n){this._padding=n,this._genCanvas()}},{key:"borderWidth",get:function(){return this._borderWidth},set:function(n){this._borderWidth=n,this._genCanvas()}},{key:"borderRadius",get:function(){return this._borderRadius},set:function(n){this._borderRadius=n,this._genCanvas()}},{key:"borderColor",get:function(){return this._borderColor},set:function(n){this._borderColor=n,this._genCanvas()}},{key:"fontFace",get:function(){return this._fontFace},set:function(n){this._fontFace=n,this._genCanvas()}},{key:"fontSize",get:function(){return this._fontSize},set:function(n){this._fontSize=n,this._genCanvas()}},{key:"fontWeight",get:function(){return this._fontWeight},set:function(n){this._fontWeight=n,this._genCanvas()}},{key:"strokeWidth",get:function(){return this._strokeWidth},set:function(n){this._strokeWidth=n,this._genCanvas()}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(n){this._strokeColor=n,this._genCanvas()}},{key:"_genCanvas",value:function(){var n=this,r=this._canvas,o=r.getContext("2d"),c=Array.isArray(this.borderWidth)?this.borderWidth:[this.borderWidth,this.borderWidth],l=c.map(function(O){return O*n.fontSize*.1}),h=Array.isArray(this.borderRadius)?this.borderRadius:[this.borderRadius,this.borderRadius,this.borderRadius,this.borderRadius],f=h.map(function(O){return O*n.fontSize*.1}),d=Array.isArray(this.padding)?this.padding:[this.padding,this.padding],p=d.map(function(O){return O*n.fontSize*.1}),m=this.text.split(`
|
|
3832
|
+
`),x="".concat(this.fontWeight," ").concat(this.fontSize,"px ").concat(this.fontFace);o.font=x;var M=Math.max.apply(Math,il(m.map(function(O){return o.measureText(O).width}))),A=this.fontSize*m.length;if(r.width=M+l[0]*2+p[0]*2,r.height=A+l[1]*2+p[1]*2,this.borderWidth){if(o.strokeStyle=this.borderColor,l[0]){var v=l[0]/2;o.lineWidth=l[0],o.beginPath(),o.moveTo(v,f[0]),o.lineTo(v,r.height-f[3]),o.moveTo(r.width-v,f[1]),o.lineTo(r.width-v,r.height-f[2]),o.stroke()}if(l[1]){var _=l[1]/2;o.lineWidth=l[1],o.beginPath(),o.moveTo(Math.max(l[0],f[0]),_),o.lineTo(r.width-Math.max(l[0],f[1]),_),o.moveTo(Math.max(l[0],f[3]),r.height-_),o.lineTo(r.width-Math.max(l[0],f[2]),r.height-_),o.stroke()}if(this.borderRadius){var C=Math.max.apply(Math,il(l)),b=C/2;o.lineWidth=C,o.beginPath(),[!!f[0]&&[f[0],b,b,f[0]],!!f[1]&&[r.width-f[1],r.width-b,b,f[1]],!!f[2]&&[r.width-f[2],r.width-b,r.height-b,r.height-f[2]],!!f[3]&&[f[3],b,r.height-b,r.height-f[3]]].filter(function(O){return O}).forEach(function(O){var I=Yg(O,4),E=I[0],y=I[1],F=I[2],V=I[3];o.moveTo(E,F),o.quadraticCurveTo(y,F,y,V)}),o.stroke()}}this.backgroundColor&&(o.fillStyle=this.backgroundColor,this.borderRadius?(o.beginPath(),o.moveTo(l[0],f[0]),[[l[0],f[0],r.width-f[1],l[1],l[1],l[1]],[r.width-l[0],r.width-l[0],r.width-l[0],l[1],f[1],r.height-f[2]],[r.width-l[0],r.width-f[2],f[3],r.height-l[1],r.height-l[1],r.height-l[1]],[l[0],l[0],l[0],r.height-l[1],r.height-f[3],f[0]]].forEach(function(O){var I=Yg(O,6),E=I[0],y=I[1],F=I[2],V=I[3],G=I[4],q=I[5];o.quadraticCurveTo(E,V,y,G),o.lineTo(F,q)}),o.closePath(),o.fill()):o.fillRect(l[0],l[1],r.width-l[0]*2,r.height-l[1]*2)),o.translate.apply(o,il(l)),o.translate.apply(o,il(p)),o.font=x,o.fillStyle=this.color,o.textBaseline="bottom";var L=this.strokeWidth>0;L&&(o.lineWidth=this.strokeWidth*this.fontSize/10,o.strokeStyle=this.strokeColor),m.forEach(function(O,I){var E=(M-o.measureText(O).width)/2,y=(I+1)*n.fontSize;L&&o.strokeText(O,E,y),o.fillText(O,E,y)}),this.material.map&&this.material.map.dispose();var k=this.material.map=new co.Texture(r);k.minFilter=co.LinearFilter,k.colorSpace=co.SRGBColorSpace,k.needsUpdate=!0;var U=this.textHeight*m.length+c[1]*2+d[1]*2;this.scale.set(U*r.width/r.height,U,0)}},{key:"clone",value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:"copy",value:function(n){return co.Sprite.prototype.copy.call(this,n),this.color=n.color,this.backgroundColor=n.backgroundColor,this.padding=n.padding,this.borderWidth=n.borderWidth,this.borderColor=n.borderColor,this.fontFace=n.fontFace,this.fontSize=n.fontSize,this.fontWeight=n.fontWeight,this.strokeWidth=n.strokeWidth,this.strokeColor=n.strokeColor,this}}]),e}(co.Sprite);class jg extends Sl{axesHelper;_renderer;_scene;_renderCallbackId;constructor(e,t,n){super(-1,1,1,-1,.1,100),this.layers.mask=aa,this.axesHelper=new _P(.5),this.axesHelper.layers.mask=aa,this.axesHelper.material.depthTest=!1,this.axesHelper.position.set(0,0,-1),this.axesHelper.setColors(new Ne(Hh),new Ne(Gh),new Ne(Vh));const r=new Ph("X",.2,k_),o=new Ph("Y",.2,H_),c=new Ph("Z",.2,G_);r.layers.mask=aa,o.layers.mask=aa,c.layers.mask=aa,r.position.set(.7,0,0),o.position.set(0,.7,0),c.position.set(0,0,.7),this.axesHelper.add(r),this.axesHelper.add(o),this.axesHelper.add(c),this.add(this.axesHelper),this._renderer=e,this._scene=t,this._scene.add(this);const l=new Dt;this._renderCallbackId=e.AddPostRenderCallback(()=>{const h=t.background;t.background=null,e.getViewport(l),e.setViewport(0,0,150,150),e.autoClear=!1,this.SetFromCameraMatrix(n.object.matrix),e.render(t,this),e.setViewport(l),e.autoClear=!0,t.background=h})}Dispose(){this._renderer.RemovePostRenderCallback(this._renderCallbackId),this._scene.remove(this)}SetFromCameraMatrix(e){this.axesHelper.rotation.setFromRotationMatrix(new Qe().extractRotation(e).invert())}}const Qh=(i,e)=>{if(Object.keys(i).length===0&&Object.keys(e).length===0)return{};if(typeof i!="object"||typeof e!="object")return e;let t={};return Object.keys(e).forEach(n=>{if(!Object.keys(i).includes(n)){t={...t,[n]:e[n]};return}if(Array.isArray(e[n])){if(!Array.isArray(i[n])){t={...t,[n]:e[n]};return}const r=i[n],o=e[n];if(r.length===0&&o.length===0){t={...t};return}if(r.length!==o.length){t={...t,[n]:e[n]};return}const c=[];if(o.forEach((l,h)=>{const f=Qh(r[h],o[h]);Object.keys(f).length&&c.push(o[h])}),Object.keys(c).length){t={...t,[n]:c};return}return}if(typeof e[n]=="object"){if(typeof i[n]!="object"){t={...t,[n]:e[n]};return}const r=Qh(i[n],e[n]);if(Object.keys(r).length){t={...t,[n]:r};return}}i[n]!==e[n]&&(t={...t,[n]:e[n]})}),t};var ki=(i=>(i.IOS="iOS",i.ANDROID="Android",i.WINDOWS="Windows",i.MACOS="MacOS",i.LINUX="Linux",i.UNKNOWN="Unknown",i))(ki||{}),va=(i=>(i.NO_WEBXR_API="NO_WEBXR_API",i.NO_HTTPS="NO_HTTPS",i.IMMERSIVE_AR_NOT_SUPPORTED_BY_DEVICE="IMMERSIVE_AR_NOT_SUPPORTED_BY_DEVICE",i.AR_PERMISSION_DENIED="AR_PERMISSION_DENIED",i.UNKNOWN_ERROR="UNKNOWN_ERROR",i))(va||{});class EI{static _supportsWebXR=!1;static _webXRUnsupportedReason=null;static GetSystem(){if(typeof window>"u"||!window.navigator)return ki.UNKNOWN;const e=window.navigator.userAgent.toLowerCase();return e.includes("iphone")||e.includes("ipad")?ki.IOS:e.includes("android")?ki.ANDROID:e.includes("windows")?ki.WINDOWS:e.includes("macintosh")?ki.MACOS:e.includes("linux")?ki.LINUX:ki.UNKNOWN}static async GetSupportsWebXR(){if(this._supportsWebXR!==!1)return this._supportsWebXR;if(!window.isSecureContext)return this._supportsWebXR=!1,this._webXRUnsupportedReason=va.NO_HTTPS,this._supportsWebXR;if(!navigator.xr)return this._supportsWebXR=!1,this._webXRUnsupportedReason=va.NO_WEBXR_API,this._supportsWebXR;try{const e=await navigator.xr.isSessionSupported("immersive-ar");this._supportsWebXR=e,this._supportsWebXR||(this._webXRUnsupportedReason=va.IMMERSIVE_AR_NOT_SUPPORTED_BY_DEVICE)}catch{this._supportsWebXR=!1,this._webXRUnsupportedReason=va.AR_PERMISSION_DENIED}return this._supportsWebXR}static GetWebXRUnsupportedReason(){return this._supportsWebXR?(console.log("WebXR is supported."),null):this._webXRUnsupportedReason}static GetSupportsARQuickLook(){return document.createElement("a").relList.supports("ar")}static GetSupportsSceneViewer(){if(typeof window>"u"||!window.navigator)return!1;const e=window.navigator.userAgent.toLowerCase();if(!e.includes("android")||!e.includes("chrome"))return!1;const t=e.match(/chrome\/(\d+)/);return!(!t||parseInt(t[1])<89)}static get isMobile(){return this.GetSystem()===ki.ANDROID||this.GetSystem()===ki.IOS}static get isDesktop(){return!this.isMobile}static async GetIsARCapable(){return this.GetSupportsARQuickLook()?!0:await this.GetSupportsWebXR()}}const bI="1.19.1-beta.0",TI={version:bI};function Ki(i,e){const t=(i+"e").split("e");return+(t[0]+"e"+(+t[1]+(e||0)))}function AI(i,e=0){const t=Ki(i,+e);return Ki(Math.ceil(t),-e)}function wI(i,e=0){const t=Ki(i,+e);return Ki(Math.floor(t),-e)}function e0(i,e=0){if(i<0)return-e0(-i,e);const t=Ki(i,+e);return Ki(Math.round(t),-e)}function RI(i,e,t){return Math.atan2(i.clone().cross(e).dot(t),e.clone().dot(i))}function CI(i,e=0){const t=Ki(i,+e);return Ki(Math.round(t),-e).toFixed(e)}function PI(i,e=0){const t=Ki(i,+e);return Ki(Math.trunc(t),-e)}function LI(i){return(ji.radToDeg(i)+360)%360}function II(i){return ji.degToRad(i)}const DI={ceilExp:AI,floorExp:wI,roundExp:e0,toFixedExp:CI,truncateExp:PI,signedAngleTo:RI,radToDeg:LI,degToRad:II},t0={autoResize:!0,autoStart:!0,displayAxes:!1,renderer:fs,perspectiveCamera:ga,orbitControls:cl};class bl{static QuickView(e,t){const n=new bl(t);n.Communication.PerformAction("SET_CAMERA_TRANSFORM",{position:{x:0,y:2,z:2},target:{x:0,y:.5,z:0}});const r=ji.generateUUID();n.Communication.PerformAction("ADD_OBJECT",{entityType:"light",type:"scene",name:"light",id:r,enabled:!0,visible:!0,intensity:1,color:16777215});const o=ji.generateUUID();return n.Communication.Subscribe("MODEL_LOADED",c=>{if(c.id!==o)return;const l=n.Communication.PerformAction("COMPUTE_ENCOMPASSING_VIEW",{});n.Communication.PerformAction("SET_CAMERA_TRANSFORM",{position:l.position,target:l.target})}),n.Communication.PerformAction("ADD_OBJECT",{entityType:"model",name:"object",id:o,position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},uri:e,visible:!0,loaded:!1}),n.Communication.PerformAction("UPDATE_SCENE",{backgroundColor:16777215,gridEnabled:!1,floorColor:16777215}),n}_settings;_resizeObserverId;_width;_height;renderer;scene;perspectiveCamera;orbitControls;toolbox;communication;animationSystem;axisCamera;get Communication(){return this.communication}get Canvas(){return this.renderer.domElement}get Info(){return EI}set Settings(e){const t=Qh(this._settings,e);t.renderer&&(this.renderer=new Rg(this._settings.renderer)),t.perspectiveCamera&&(t.perspectiveCamera.fov!==void 0&&(this.perspectiveCamera.fov=t.perspectiveCamera.fov),t.perspectiveCamera.near!==void 0&&(this.perspectiveCamera.near=t.perspectiveCamera.near),t.perspectiveCamera.far!==void 0&&(this.perspectiveCamera.far=t.perspectiveCamera.far),this.perspectiveCamera.OnResize(this.renderer.domElement.width,this.renderer.domElement.height)),t.orbitControls&&(t.orbitControls.enableDamping!==void 0&&(this.orbitControls.enableDamping=t.orbitControls.enableDamping),t.orbitControls.dampingFactor!==void 0&&(this.orbitControls.dampingFactor=t.orbitControls.dampingFactor)),t.autoResize!==this._settings.autoResize&&(t.autoResize?this.addResizeObserver():this.removeResizeObserver()),t.displayAxes?this.axisCamera=new jg(this.renderer,this.scene,this.orbitControls):(this.axisCamera?.Dispose(),this.axisCamera=null),Object.assign(this._settings,e)}constructor(e){this._settings={...t0,...e!==void 0?e:{}},this._resizeObserverId="",this._width=0,this._height=0,this.renderer=new Rg(this._settings.renderer),this.scene=new eI,this.perspectiveCamera=new Ea(this._settings.perspectiveCamera),this.animationSystem=new aI(this.renderer),this.orbitControls=new _l(this.perspectiveCamera,this.renderer,this.animationSystem,this._settings.orbitControls),this.toolbox=new oI(this.scene,this.orbitControls),this.communication=new Cn(this.renderer,this.scene,this.orbitControls,this.toolbox),this._settings.displayAxes?this.axisCamera=new jg(this.renderer,this.scene,this.orbitControls):this.axisCamera=null,this._settings.autoResize&&this.addResizeObserver(),window.DIVE={PrintScene:()=>{console.log(this.scene)}},console.log(`DIVE ${TI.version} initialized successfully!`),console.log(`
|
|
3828
3833
|
@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
|
|
3829
3834
|
@@@@+-:::::::---------------------==------------------------------=#@@@@
|
|
3830
3835
|
@@%=::::.......::---------------------------------------------------------+@@
|
|
@@ -3853,5 +3858,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
3853
3858
|
@@@@+:::::::#@@ @@*-------*@@@@
|
|
3854
3859
|
@@@@@@@ @@@@@@
|
|
3855
3860
|
|
|
3856
|
-
`),this._settings.autoStart&&this.renderer.StartRenderer(this.scene,this.perspectiveCamera)}Dispose(){
|
|
3861
|
+
`),this._settings.autoStart&&this.renderer.StartRenderer(this.scene,this.perspectiveCamera)}Dispose(){this.removeResizeObserver(),this.renderer.Dispose(),this.orbitControls.Dispose(),this.axisCamera?.Dispose(),this.animationSystem.Dispose(),this.toolbox.Dispose(),this.communication.DestroyInstance()}OnResize(e,t){this.renderer.OnResize(e,t),this.perspectiveCamera.OnResize(e,t)}addResizeObserver(){this._resizeObserverId=this.renderer.AddPreRenderCallback(()=>{const e=this.renderer.domElement.parentElement;if(!e)return;const{clientWidth:t,clientHeight:n}=e;t===this._width&&n===this._height||(this.OnResize(t,n),this._width=t,this._height=n)})}removeResizeObserver(){this.renderer.RemovePreRenderCallback(this._resizeObserverId)}}exports.DIVE=bl;exports.DIVECommunication=Cn;exports.DIVEDefaultSettings=t0;exports.DIVEMath=DI;exports.default=bl;
|
|
3857
3862
|
//# sourceMappingURL=dive.cjs.map
|