From 8db3bde4c1f9712e680aa1ca9fb8a1094d8fbb96 Mon Sep 17 00:00:00 2001 From: David Ghitulescu Date: Fri, 11 Aug 2023 12:00:02 +0300 Subject: [PATCH] Updates --- assets/{index-1147a9eb.js => index-334a41ef.js} | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename assets/{index-1147a9eb.js => index-334a41ef.js} (97%) diff --git a/assets/index-1147a9eb.js b/assets/index-334a41ef.js similarity index 97% rename from assets/index-1147a9eb.js rename to assets/index-334a41ef.js index 794a082..c061d3f 100644 --- a/assets/index-1147a9eb.js +++ b/assets/index-334a41ef.js @@ -3595,7 +3595,7 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function ER(t,e,n){let i=new Wh;const r=new Pe,s=new Pe,o=new rt,a=new yR({depthPacking:iT}),l=new xR,u={},c=n.maxTextureSize,h={[vr]:ln,[ln]:vr,[li]:li},d=new Qr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Pe},radius:{value:4}},vertexShader:SR,fragmentShader:MR}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const y=new On;y.setAttribute("position",new Ln(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Yn(y,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Iy;let f=this.type;this.render=function(E,A,b){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||E.length===0)return;const D=t.getRenderTarget(),S=t.getActiveCubeFace(),T=t.getActiveMipmapLevel(),q=t.state;q.setBlending(cr),q.buffers.color.setClear(1,1,1,1),q.buffers.depth.setTest(!0),q.setScissorTest(!1);const Q=f!==Ei&&this.type===Ei,k=f===Ei&&this.type!==Ei;for(let H=0,W=E.length;Hc||r.y>c)&&(r.x>c&&(s.x=Math.floor(c/L.x),r.x=s.x*L.x,$.mapSize.x=s.x),r.y>c&&(s.y=Math.floor(c/L.y),r.y=s.y*L.y,$.mapSize.y=s.y)),$.map===null||Q===!0||k===!0){const z=this.type!==Ei?{minFilter:qt,magFilter:qt}:{};$.map!==null&&$.map.dispose(),$.map=new Kr(r.x,r.y,z),$.map.texture.name=K.name+".shadowMap",$.camera.updateProjectionMatrix()}t.setRenderTarget($.map),t.clear();const V=$.getViewportCount();for(let z=0;z0||A.map&&A.alphaTest>0){const q=S.uuid,Q=A.uuid;let k=u[q];k===void 0&&(k={},u[q]=k);let H=k[Q];H===void 0&&(H=S.clone(),k[Q]=H),S=H}if(S.visible=A.visible,S.wireframe=A.wireframe,D===Ei?S.side=A.shadowSide!==null?A.shadowSide:A.side:S.side=A.shadowSide!==null?A.shadowSide:h[A.side],S.alphaMap=A.alphaMap,S.alphaTest=A.alphaTest,S.map=A.map,S.clipShadows=A.clipShadows,S.clippingPlanes=A.clippingPlanes,S.clipIntersection=A.clipIntersection,S.displacementMap=A.displacementMap,S.displacementScale=A.displacementScale,S.displacementBias=A.displacementBias,S.wireframeLinewidth=A.wireframeLinewidth,S.linewidth=A.linewidth,b.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const q=t.properties.get(S);q.light=b}return S}function x(E,A,b,D,S){if(E.visible===!1)return;if(E.layers.test(A.layers)&&(E.isMesh||E.isLine||E.isPoints)&&(E.castShadow||E.receiveShadow&&S===Ei)&&(!E.frustumCulled||i.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,E.matrixWorld);const Q=e.update(E),k=E.material;if(Array.isArray(k)){const H=Q.groups;for(let W=0,K=H.length;W=1):L.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),K=$>=2);let V=null,z={};const O=t.getParameter(t.SCISSOR_BOX),F=t.getParameter(t.VIEWPORT),se=new rt().fromArray(O),ie=new rt().fromArray(F);function ce(R,oe,B,ne){const ue=new Uint8Array(4),Xe=t.createTexture();t.bindTexture(R,Xe),t.texParameteri(R,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(R,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let ot=0;ot"u"?!1:/OculusBrowser/g.test(navigator.userAgent),y=new WeakMap;let _;const m=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(C,M){return f?new OffscreenCanvas(C,M):Du("canvas")}function g(C,M,j,J){let ee=1;if((C.width>J||C.height>J)&&(ee=J/Math.max(C.width,C.height)),ee<1||M===!0)if(typeof HTMLImageElement<"u"&&C instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&C instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&C instanceof ImageBitmap){const ae=M?Lu:Math.floor,ve=ae(ee*C.width),le=ae(ee*C.height);_===void 0&&(_=v(ve,le));const Y=j?v(ve,le):_;return Y.width=ve,Y.height=le,Y.getContext("2d").drawImage(C,0,0,ve,le),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+C.width+"x"+C.height+") to ("+ve+"x"+le+")."),Y}else return"data"in C&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+C.width+"x"+C.height+")."),C;return C}function x(C){return Dd(C.width)&&Dd(C.height)}function E(C){return a?!1:C.wrapS!==Xn||C.wrapT!==Xn||C.minFilter!==qt&&C.minFilter!==An}function A(C,M){return C.generateMipmaps&&M&&C.minFilter!==qt&&C.minFilter!==An}function b(C){t.generateMipmap(C)}function D(C,M,j,J,ee=!1){if(a===!1)return M;if(C!==null){if(t[C]!==void 0)return t[C];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+C+"'")}let ae=M;return M===t.RED&&(j===t.FLOAT&&(ae=t.R32F),j===t.HALF_FLOAT&&(ae=t.R16F),j===t.UNSIGNED_BYTE&&(ae=t.R8)),M===t.RG&&(j===t.FLOAT&&(ae=t.RG32F),j===t.HALF_FLOAT&&(ae=t.RG16F),j===t.UNSIGNED_BYTE&&(ae=t.RG8)),M===t.RGBA&&(j===t.FLOAT&&(ae=t.RGBA32F),j===t.HALF_FLOAT&&(ae=t.RGBA16F),j===t.UNSIGNED_BYTE&&(ae=J===Oe&&ee===!1?t.SRGB8_ALPHA8:t.RGBA8),j===t.UNSIGNED_SHORT_4_4_4_4&&(ae=t.RGBA4),j===t.UNSIGNED_SHORT_5_5_5_1&&(ae=t.RGB5_A1)),(ae===t.R16F||ae===t.R32F||ae===t.RG16F||ae===t.RG32F||ae===t.RGBA16F||ae===t.RGBA32F)&&e.get("EXT_color_buffer_float"),ae}function S(C,M,j){return A(C,j)===!0||C.isFramebufferTexture&&C.minFilter!==qt&&C.minFilter!==An?Math.log2(Math.max(M.width,M.height))+1:C.mipmaps!==void 0&&C.mipmaps.length>0?C.mipmaps.length:C.isCompressedTexture&&Array.isArray(C.image)?M.mipmaps.length:1}function T(C){return C===qt||C===Xm||C===Wc?t.NEAREST:t.LINEAR}function q(C){const M=C.target;M.removeEventListener("dispose",q),k(M),M.isVideoTexture&&y.delete(M)}function Q(C){const M=C.target;M.removeEventListener("dispose",Q),W(M)}function k(C){const M=i.get(C);if(M.__webglInit===void 0)return;const j=C.source,J=m.get(j);if(J){const ee=J[M.__cacheKey];ee.usedTimes--,ee.usedTimes===0&&H(C),Object.keys(J).length===0&&m.delete(j)}i.remove(C)}function H(C){const M=i.get(C);t.deleteTexture(M.__webglTexture);const j=C.source,J=m.get(j);delete J[M.__cacheKey],o.memory.textures--}function W(C){const M=C.texture,j=i.get(C),J=i.get(M);if(J.__webglTexture!==void 0&&(t.deleteTexture(J.__webglTexture),o.memory.textures--),C.depthTexture&&C.depthTexture.dispose(),C.isWebGLCubeRenderTarget)for(let ee=0;ee<6;ee++)t.deleteFramebuffer(j.__webglFramebuffer[ee]),j.__webglDepthbuffer&&t.deleteRenderbuffer(j.__webglDepthbuffer[ee]);else{if(t.deleteFramebuffer(j.__webglFramebuffer),j.__webglDepthbuffer&&t.deleteRenderbuffer(j.__webglDepthbuffer),j.__webglMultisampledFramebuffer&&t.deleteFramebuffer(j.__webglMultisampledFramebuffer),j.__webglColorRenderbuffer)for(let ee=0;ee=l&&console.warn("THREE.WebGLTextures: Trying to use "+C+" texture units while this GPU supports only "+l),K+=1,C}function V(C){const M=[];return M.push(C.wrapS),M.push(C.wrapT),M.push(C.wrapR||0),M.push(C.magFilter),M.push(C.minFilter),M.push(C.anisotropy),M.push(C.internalFormat),M.push(C.format),M.push(C.type),M.push(C.generateMipmaps),M.push(C.premultiplyAlpha),M.push(C.flipY),M.push(C.unpackAlignment),M.push(C.colorSpace),M.join()}function z(C,M){const j=i.get(C);if(C.isVideoTexture&&Dt(C),C.isRenderTargetTexture===!1&&C.version>0&&j.__version!==C.version){const J=C.image;if(J===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(J.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ke(j,C,M);return}}n.bindTexture(t.TEXTURE_2D,j.__webglTexture,t.TEXTURE0+M)}function O(C,M){const j=i.get(C);if(C.version>0&&j.__version!==C.version){Ke(j,C,M);return}n.bindTexture(t.TEXTURE_2D_ARRAY,j.__webglTexture,t.TEXTURE0+M)}function F(C,M){const j=i.get(C);if(C.version>0&&j.__version!==C.version){Ke(j,C,M);return}n.bindTexture(t.TEXTURE_3D,j.__webglTexture,t.TEXTURE0+M)}function se(C,M){const j=i.get(C);if(C.version>0&&j.__version!==C.version){en(j,C,M);return}n.bindTexture(t.TEXTURE_CUBE_MAP,j.__webglTexture,t.TEXTURE0+M)}const ie={[Rd]:t.REPEAT,[Xn]:t.CLAMP_TO_EDGE,[Pd]:t.MIRRORED_REPEAT},ce={[qt]:t.NEAREST,[Xm]:t.NEAREST_MIPMAP_NEAREST,[Wc]:t.NEAREST_MIPMAP_LINEAR,[An]:t.LINEAR,[Xw]:t.LINEAR_MIPMAP_NEAREST,[wa]:t.LINEAR_MIPMAP_LINEAR},ge={[oT]:t.NEVER,[hT]:t.ALWAYS,[aT]:t.LESS,[uT]:t.LEQUAL,[lT]:t.EQUAL,[dT]:t.GEQUAL,[cT]:t.GREATER,[fT]:t.NOTEQUAL};function we(C,M,j){if(j?(t.texParameteri(C,t.TEXTURE_WRAP_S,ie[M.wrapS]),t.texParameteri(C,t.TEXTURE_WRAP_T,ie[M.wrapT]),(C===t.TEXTURE_3D||C===t.TEXTURE_2D_ARRAY)&&t.texParameteri(C,t.TEXTURE_WRAP_R,ie[M.wrapR]),t.texParameteri(C,t.TEXTURE_MAG_FILTER,ce[M.magFilter]),t.texParameteri(C,t.TEXTURE_MIN_FILTER,ce[M.minFilter])):(t.texParameteri(C,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(C,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),(C===t.TEXTURE_3D||C===t.TEXTURE_2D_ARRAY)&&t.texParameteri(C,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),(M.wrapS!==Xn||M.wrapT!==Xn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(C,t.TEXTURE_MAG_FILTER,T(M.magFilter)),t.texParameteri(C,t.TEXTURE_MIN_FILTER,T(M.minFilter)),M.minFilter!==qt&&M.minFilter!==An&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),M.compareFunction&&(t.texParameteri(C,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(C,t.TEXTURE_COMPARE_FUNC,ge[M.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const J=e.get("EXT_texture_filter_anisotropic");if(M.magFilter===qt||M.minFilter!==Wc&&M.minFilter!==wa||M.type===Ji&&e.has("OES_texture_float_linear")===!1||a===!1&&M.type===Ta&&e.has("OES_texture_half_float_linear")===!1)return;(M.anisotropy>1||i.get(M).__currentAnisotropy)&&(t.texParameterf(C,J.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,r.getMaxAnisotropy())),i.get(M).__currentAnisotropy=M.anisotropy)}}function Me(C,M){let j=!1;C.__webglInit===void 0&&(C.__webglInit=!0,M.addEventListener("dispose",q));const J=M.source;let ee=m.get(J);ee===void 0&&(ee={},m.set(J,ee));const ae=V(M);if(ae!==C.__cacheKey){ee[ae]===void 0&&(ee[ae]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,j=!0),ee[ae].usedTimes++;const ve=ee[C.__cacheKey];ve!==void 0&&(ee[C.__cacheKey].usedTimes--,ve.usedTimes===0&&H(M)),C.__cacheKey=ae,C.__webglTexture=ee[ae].texture}return j}function Ke(C,M,j){let J=t.TEXTURE_2D;(M.isDataArrayTexture||M.isCompressedArrayTexture)&&(J=t.TEXTURE_2D_ARRAY),M.isData3DTexture&&(J=t.TEXTURE_3D);const ee=Me(C,M),ae=M.source;n.bindTexture(J,C.__webglTexture,t.TEXTURE0+j);const ve=i.get(ae);if(ae.version!==ve.__version||ee===!0){n.activeTexture(t.TEXTURE0+j),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,M.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,M.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE);const le=E(M)&&x(M.image)===!1;let Y=g(M.image,le,!1,c);Y=kt(M,Y);const _e=x(Y)||a,ye=s.convert(M.format,M.colorSpace);let Se=s.convert(M.type),pe=D(M.internalFormat,ye,Se,M.colorSpace);we(J,M,_e);let me;const ke=M.mipmaps,Je=a&&M.isVideoTexture!==!0,R=ve.__version===void 0||ee===!0,oe=S(M,Y,_e);if(M.isDepthTexture)pe=t.DEPTH_COMPONENT,a?M.type===Ji?pe=t.DEPTH_COMPONENT32F:M.type===Qi?pe=t.DEPTH_COMPONENT24:M.type===zr?pe=t.DEPTH24_STENCIL8:pe=t.DEPTH_COMPONENT16:M.type===Ji&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),M.format===Br&&pe===t.DEPTH_COMPONENT&&M.type!==Hh&&M.type!==Qi&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),M.type=Qi,Se=s.convert(M.type)),M.format===co&&pe===t.DEPTH_COMPONENT&&(pe=t.DEPTH_STENCIL,M.type!==zr&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),M.type=zr,Se=s.convert(M.type))),R&&(Je?n.texStorage2D(t.TEXTURE_2D,1,pe,Y.width,Y.height):n.texImage2D(t.TEXTURE_2D,0,pe,Y.width,Y.height,0,ye,Se,null));else if(M.isDataTexture)if(ke.length>0&&_e){Je&&R&&n.texStorage2D(t.TEXTURE_2D,oe,pe,ke[0].width,ke[0].height);for(let B=0,ne=ke.length;B>=1,ne>>=1}}else if(ke.length>0&&_e){Je&&R&&n.texStorage2D(t.TEXTURE_2D,oe,pe,ke[0].width,ke[0].height);for(let B=0,ne=ke.length;B0&&R++,n.texStorage2D(t.TEXTURE_CUBE_MAP,R,me,Y[0].width,Y[0].height));for(let B=0;B<6;B++)if(le){ke?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+B,0,0,0,Y[B].width,Y[B].height,Se,pe,Y[B].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+B,0,me,Y[B].width,Y[B].height,0,Se,pe,Y[B].data);for(let ne=0;ne=t.TEXTURE_CUBE_MAP_POSITIVE_X&&ee<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,J,ee,i.get(j).__webglTexture,0),n.bindFramebuffer(t.FRAMEBUFFER,null)}function N(C,M,j){if(t.bindRenderbuffer(t.RENDERBUFFER,C),M.depthBuffer&&!M.stencilBuffer){let J=t.DEPTH_COMPONENT16;if(j||Qe(M)){const ee=M.depthTexture;ee&&ee.isDepthTexture&&(ee.type===Ji?J=t.DEPTH_COMPONENT32F:ee.type===Qi&&(J=t.DEPTH_COMPONENT24));const ae=Ne(M);Qe(M)?d.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ae,J,M.width,M.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,ae,J,M.width,M.height)}else t.renderbufferStorage(t.RENDERBUFFER,J,M.width,M.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,C)}else if(M.depthBuffer&&M.stencilBuffer){const J=Ne(M);j&&Qe(M)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,J,t.DEPTH24_STENCIL8,M.width,M.height):Qe(M)?d.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,J,t.DEPTH24_STENCIL8,M.width,M.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,M.width,M.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,C)}else{const J=M.isWebGLMultipleRenderTargets===!0?M.texture:[M.texture];for(let ee=0;ee0&&Qe(C)===!1){const le=ae?M:[M];j.__webglMultisampledFramebuffer=t.createFramebuffer(),j.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,j.__webglMultisampledFramebuffer);for(let Y=0;Y0&&Qe(C)===!1){const M=C.isWebGLMultipleRenderTargets?C.texture:[C.texture],j=C.width,J=C.height;let ee=t.COLOR_BUFFER_BIT;const ae=[],ve=C.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,le=i.get(C),Y=C.isWebGLMultipleRenderTargets===!0;if(Y)for(let _e=0;_e0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function Dt(C){const M=o.render.frame;y.get(C)!==M&&(y.set(C,M),C.update())}function kt(C,M){const j=C.colorSpace,J=C.format,ee=C.type;return C.isCompressedTexture===!0||C.format===Ld||j!==mi&&j!==Hr&&(j===Oe?a===!1?e.has("EXT_sRGB")===!0&&J===$n?(C.format=Ld,C.minFilter=An,C.generateMipmaps=!1):M=Ky.sRGBToLinear(M):(J!==$n||ee!==fr)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",j)),M}this.allocateTextureUnit=L,this.resetTextureUnits=$,this.setTexture2D=z,this.setTexture2DArray=O,this.setTexture3D=F,this.setTextureCube=se,this.rebindTextures=Le,this.setupRenderTarget=be,this.updateRenderTargetMipmap=st,this.updateMultisampleRenderTarget=He,this.setupDepthRenderbuffer=Ee,this.setupFrameBufferTexture=Be,this.useMultisampledRTT=Qe}function AR(t,e,n){const i=n.isWebGL2;function r(s,o=Hr){let a;if(s===fr)return t.UNSIGNED_BYTE;if(s===Vy)return t.UNSIGNED_SHORT_4_4_4_4;if(s===Hy)return t.UNSIGNED_SHORT_5_5_5_1;if(s===$w)return t.BYTE;if(s===Yw)return t.SHORT;if(s===Hh)return t.UNSIGNED_SHORT;if(s===By)return t.INT;if(s===Qi)return t.UNSIGNED_INT;if(s===Ji)return t.FLOAT;if(s===Ta)return i?t.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===qw)return t.ALPHA;if(s===$n)return t.RGBA;if(s===Kw)return t.LUMINANCE;if(s===Zw)return t.LUMINANCE_ALPHA;if(s===Br)return t.DEPTH_COMPONENT;if(s===co)return t.DEPTH_STENCIL;if(s===Ld)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===Qw)return t.RED;if(s===Gy)return t.RED_INTEGER;if(s===Jw)return t.RG;if(s===Wy)return t.RG_INTEGER;if(s===jy)return t.RGBA_INTEGER;if(s===jc||s===Xc||s===$c||s===Yc)if(o===Oe)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===jc)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Xc)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===$c)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Yc)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===jc)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Xc)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===$c)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Yc)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===$m||s===Ym||s===qm||s===Km)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===$m)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Ym)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===qm)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Km)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===eT)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Zm||s===Qm)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===Zm)return o===Oe?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Qm)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Jm||s===eg||s===tg||s===ng||s===ig||s===rg||s===sg||s===og||s===ag||s===lg||s===ug||s===cg||s===fg||s===dg)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Jm)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===eg)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===tg)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===ng)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===ig)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===rg)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===sg)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===og)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===ag)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===lg)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===ug)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===cg)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===fg)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===dg)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===qc)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===qc)return o===Oe?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===tT||s===hg||s===pg||s===mg)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===qc)return a.COMPRESSED_RED_RGTC1_EXT;if(s===hg)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===pg)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===mg)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===zr?i?t.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):t[s]!==void 0?t[s]:null}return{convert:r}}class bR extends pn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Dl extends Nt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const CR={type:"move"};class _f{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Dl,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 Dl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new P,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new P),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Dl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new P,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new P),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 n=this._hand;if(n)for(const i of e.hand.values())this._getHandJoint(n,i)}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,n,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,u=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(u&&e.hand){o=!0;for(const _ of e.hand.values()){const m=n.getJointPose(_,i),f=this._getHandJoint(u,_);m!==null&&(f.matrix.fromArray(m.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=m.radius),f.visible=m!==null}const c=u.joints["index-finger-tip"],h=u.joints["thumb-tip"],d=c.position.distanceTo(h.position),p=.02,y=.005;u.inputState.pinching&&d>p+y?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&d<=p-y&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=n.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(CR)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),u!==null&&(u.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new Dl;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}class RR extends yn{constructor(e,n,i,r,s,o,a,l,u,c){if(c=c!==void 0?c:Br,c!==Br&&c!==co)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&c===Br&&(i=Qi),i===void 0&&c===co&&(i=zr),super(null,r,s,o,a,l,c,i,u),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=a!==void 0?a:qt,this.minFilter=l!==void 0?l:qt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}class PR extends yo{constructor(e,n){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,u=null,c=null,h=null,d=null,p=null,y=null;const _=n.getContextAttributes();let m=null,f=null;const v=[],g=[],x=new pn;x.layers.enable(1),x.viewport=new rt;const E=new pn;E.layers.enable(2),E.viewport=new rt;const A=[x,E],b=new bR;b.layers.enable(1),b.layers.enable(2);let D=null,S=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(O){let F=v[O];return F===void 0&&(F=new _f,v[O]=F),F.getTargetRaySpace()},this.getControllerGrip=function(O){let F=v[O];return F===void 0&&(F=new _f,v[O]=F),F.getGripSpace()},this.getHand=function(O){let F=v[O];return F===void 0&&(F=new _f,v[O]=F),F.getHandSpace()};function T(O){const F=g.indexOf(O.inputSource);if(F===-1)return;const se=v[F];se!==void 0&&(se.update(O.inputSource,O.frame,u||o),se.dispatchEvent({type:O.type,data:O.inputSource}))}function q(){r.removeEventListener("select",T),r.removeEventListener("selectstart",T),r.removeEventListener("selectend",T),r.removeEventListener("squeeze",T),r.removeEventListener("squeezestart",T),r.removeEventListener("squeezeend",T),r.removeEventListener("end",q),r.removeEventListener("inputsourceschange",Q);for(let O=0;O=0&&(g[ie]=null,v[ie].disconnect(se))}for(let F=0;F=g.length){g.push(se),ie=ge;break}else if(g[ge]===null){g[ge]=se,ie=ge;break}if(ie===-1)break}const ce=v[ie];ce&&ce.connect(se)}}const k=new P,H=new P;function W(O,F,se){k.setFromMatrixPosition(F.matrixWorld),H.setFromMatrixPosition(se.matrixWorld);const ie=k.distanceTo(H),ce=F.projectionMatrix.elements,ge=se.projectionMatrix.elements,we=ce[14]/(ce[10]-1),Me=ce[14]/(ce[10]+1),Ke=(ce[9]+1)/ce[5],en=(ce[9]-1)/ce[5],Be=(ce[8]-1)/ce[0],N=(ge[8]+1)/ge[0],Ft=we*Be,Ee=we*N,Le=ie/(-Be+N),be=Le*-Be;F.matrixWorld.decompose(O.position,O.quaternion,O.scale),O.translateX(be),O.translateZ(Le),O.matrixWorld.compose(O.position,O.quaternion,O.scale),O.matrixWorldInverse.copy(O.matrixWorld).invert();const st=we+Le,He=Me+Le,Ne=Ft-be,Qe=Ee+(ie-be),Dt=Ke*Me/He*st,kt=en*Me/He*st;O.projectionMatrix.makePerspective(Ne,Qe,Dt,kt,st,He),O.projectionMatrixInverse.copy(O.projectionMatrix).invert()}function K(O,F){F===null?O.matrixWorld.copy(O.matrix):O.matrixWorld.multiplyMatrices(F.matrixWorld,O.matrix),O.matrixWorldInverse.copy(O.matrixWorld).invert()}this.updateCamera=function(O){if(r===null)return;b.near=E.near=x.near=O.near,b.far=E.far=x.far=O.far,(D!==b.near||S!==b.far)&&(r.updateRenderState({depthNear:b.near,depthFar:b.far}),D=b.near,S=b.far);const F=O.parent,se=b.cameras;K(b,F);for(let ie=0;ie0&&(m.alphaTest.value=f.alphaTest);const v=e.get(f).envMap;if(v&&(m.envMap.value=v,m.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap){m.lightMap.value=f.lightMap;const g=t.useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=f.lightMapIntensity*g,n(f.lightMap,m.lightMapTransform)}f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,n(f.aoMap,m.aoMapTransform))}function o(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,n(f.map,m.mapTransform))}function a(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function l(m,f,v,g){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*v,m.scale.value=g*.5,f.map&&(m.map.value=f.map,n(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,n(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function u(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,n(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,n(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function c(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function h(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function d(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,n(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,n(f.roughnessMap,m.roughnessMapTransform)),e.get(f).envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function p(m,f,v){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,n(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,n(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,n(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,n(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,n(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===ln&&m.clearcoatNormalScale.value.negate())),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,n(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,n(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=v.texture,m.transmissionSamplerSize.value.set(v.width,v.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,n(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,n(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,n(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,n(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,n(f.specularIntensityMap,m.specularIntensityMapTransform))}function y(m,f){f.matcap&&(m.matcap.value=f.matcap)}function _(m,f){const v=e.get(f).light;m.referencePosition.value.setFromMatrixPosition(v.matrixWorld),m.nearDistance.value=v.shadow.camera.near,m.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function DR(t,e,n,i){let r={},s={},o=[];const a=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(v,g){const x=g.program;i.uniformBlockBinding(v,x)}function u(v,g){let x=r[v.id];x===void 0&&(y(v),x=c(v),r[v.id]=x,v.addEventListener("dispose",m));const E=g.program;i.updateUBOMapping(v,E);const A=e.render.frame;s[v.id]!==A&&(d(v),s[v.id]=A)}function c(v){const g=h();v.__bindingPointIndex=g;const x=t.createBuffer(),E=v.__size,A=v.usage;return t.bindBuffer(t.UNIFORM_BUFFER,x),t.bufferData(t.UNIFORM_BUFFER,E,A),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,g,x),x}function h(){for(let v=0;v0){A=x%E;const Q=E-A;A!==0&&Q-T.boundary<0&&(x+=E-A,S.__offset=x)}x+=T.storage}return A=x%E,A>0&&(x+=E-A),v.__size=x,v.__cache={},this}function _(v){const g={boundary:0,storage:0};return typeof v=="number"?(g.boundary=4,g.storage=4):v.isVector2?(g.boundary=8,g.storage=8):v.isVector3||v.isColor?(g.boundary=16,g.storage=12):v.isVector4?(g.boundary=16,g.storage=16):v.isMatrix3?(g.boundary=48,g.storage=48):v.isMatrix4?(g.boundary=64,g.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),g}function m(v){const g=v.target;g.removeEventListener("dispose",m);const x=o.indexOf(g.__bindingPointIndex);o.splice(x,1),t.deleteBuffer(r[g.id]),delete r[g.id],delete s[g.id]}function f(){for(const v in r)t.deleteBuffer(r[v]);o=[],r={},s={}}return{bind:l,update:u,dispose:f}}function UR(){const t=Du("canvas");return t.style.display="block",t}class px{constructor(e={}){const{canvas:n=UR(),context:i=null,depth:r=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:u=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let d;i!==null?d=i.getContextAttributes().alpha:d=o;const p=new Uint32Array(4),y=new Int32Array(4);let _=null,m=null;const f=[],v=[];this.domElement=n,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=Oe,this.useLegacyLights=!0,this.toneMapping=Ui,this.toneMappingExposure=1;const g=this;let x=!1,E=0,A=0,b=null,D=-1,S=null;const T=new rt,q=new rt;let Q=null;const k=new qe(0);let H=0,W=n.width,K=n.height,$=1,L=null,V=null;const z=new rt(0,0,W,K),O=new rt(0,0,W,K);let F=!1;const se=new Wh;let ie=!1,ce=!1,ge=null;const we=new mt,Me=new Pe,Ke=new P,en={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Be(){return b===null?$:1}let N=i;function Ft(w,I){for(let G=0;G0?m=v[v.length-1]:m=null,f.pop(),f.length>0?_=f[f.length-1]:_=null};function Kh(w,I,G,U){if(w.visible===!1)return;if(w.layers.test(I.layers)){if(w.isGroup)G=w.renderOrder;else if(w.isLOD)w.autoUpdate===!0&&w.update(I);else if(w.isLight)m.pushLight(w),w.castShadow&&m.pushShadow(w);else if(w.isSprite){if(!w.frustumCulled||se.intersectsSprite(w)){U&&Ke.setFromMatrixPosition(w.matrixWorld).applyMatrix4(we);const xe=M.update(w),Te=w.material;Te.visible&&_.push(w,xe,Te,G,Ke.z,null)}}else if((w.isMesh||w.isLine||w.isPoints)&&(!w.frustumCulled||se.intersectsObject(w))){const xe=M.update(w),Te=w.material;if(U&&(w.boundingSphere!==void 0?(w.boundingSphere===null&&w.computeBoundingSphere(),Ke.copy(w.boundingSphere.center)):(xe.boundingSphere===null&&xe.computeBoundingSphere(),Ke.copy(xe.boundingSphere.center)),Ke.applyMatrix4(w.matrixWorld).applyMatrix4(we)),Array.isArray(Te)){const Ae=xe.groups;for(let ze=0,Re=Ae.length;ze0&&_x(X,de,I,G),U&&be.viewport(T.copy(U)),X.length>0&&Wa(X,I,G),de.length>0&&Wa(de,I,G),xe.length>0&&Wa(xe,I,G),be.buffers.depth.setTest(!0),be.buffers.depth.setMask(!0),be.buffers.color.setMask(!0),be.setPolygonOffset(!1)}function _x(w,I,G,U){const X=Le.isWebGL2;ge===null&&(ge=new Kr(1,1,{generateMipmaps:!0,type:Ee.has("EXT_color_buffer_half_float")?Ta:fr,minFilter:wa,samples:X?4:0})),g.getDrawingBufferSize(Me),X?ge.setSize(Me.x,Me.y):ge.setSize(Lu(Me.x),Lu(Me.y));const de=g.getRenderTarget();g.setRenderTarget(ge),g.getClearColor(k),H=g.getClearAlpha(),H<1&&g.setClearColor(16777215,.5),g.clear();const xe=g.toneMapping;g.toneMapping=Ui,Wa(w,G,U),Ne.updateMultisampleRenderTarget(ge),Ne.updateRenderTargetMipmap(ge);let Te=!1;for(let Ae=0,ze=I.length;Ae0),De=!!G.morphAttributes.position,ft=!!G.morphAttributes.normal,ht=!!G.morphAttributes.color,Nn=U.toneMapped?g.toneMapping:Ui,gi=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,gt=gi!==void 0?gi.length:0,Ge=He.get(U),uc=m.state.lights;if(ie===!0&&(ce===!0||w!==S)){const cn=w===S&&U.id===D;ve.setState(U,w,cn)}let At=!1;U.version===Ge.__version?(Ge.needsLights&&Ge.lightsStateVersion!==uc.state.version||Ge.outputColorSpace!==Te||X.isInstancedMesh&&Ge.instancing===!1||!X.isInstancedMesh&&Ge.instancing===!0||X.isSkinnedMesh&&Ge.skinning===!1||!X.isSkinnedMesh&&Ge.skinning===!0||Ge.envMap!==Ae||U.fog===!0&&Ge.fog!==de||Ge.numClippingPlanes!==void 0&&(Ge.numClippingPlanes!==ve.numPlanes||Ge.numIntersection!==ve.numIntersection)||Ge.vertexAlphas!==ze||Ge.vertexTangents!==Re||Ge.morphTargets!==De||Ge.morphNormals!==ft||Ge.morphColors!==ht||Ge.toneMapping!==Nn||Le.isWebGL2===!0&&Ge.morphTargetsCount!==gt)&&(At=!0):(At=!0,Ge.__version=U.version);let Mr=Ge.currentProgram;At===!0&&(Mr=ja(U,I,X));let ep=!1,Eo=!1,cc=!1;const Xt=Mr.getUniforms(),Er=Ge.uniforms;if(be.useProgram(Mr.program)&&(ep=!0,Eo=!0,cc=!0),U.id!==D&&(D=U.id,Eo=!0),ep||S!==w){if(Xt.setValue(N,"projectionMatrix",w.projectionMatrix),Le.logarithmicDepthBuffer&&Xt.setValue(N,"logDepthBufFC",2/(Math.log(w.far+1)/Math.LN2)),S!==w&&(S=w,Eo=!0,cc=!0),U.isShaderMaterial||U.isMeshPhongMaterial||U.isMeshToonMaterial||U.isMeshStandardMaterial||U.envMap){const cn=Xt.map.cameraPosition;cn!==void 0&&cn.setValue(N,Ke.setFromMatrixPosition(w.matrixWorld))}(U.isMeshPhongMaterial||U.isMeshToonMaterial||U.isMeshLambertMaterial||U.isMeshBasicMaterial||U.isMeshStandardMaterial||U.isShaderMaterial)&&Xt.setValue(N,"isOrthographic",w.isOrthographicCamera===!0),(U.isMeshPhongMaterial||U.isMeshToonMaterial||U.isMeshLambertMaterial||U.isMeshBasicMaterial||U.isMeshStandardMaterial||U.isShaderMaterial||U.isShadowMaterial||X.isSkinnedMesh)&&Xt.setValue(N,"viewMatrix",w.matrixWorldInverse)}if(X.isSkinnedMesh){Xt.setOptional(N,X,"bindMatrix"),Xt.setOptional(N,X,"bindMatrixInverse");const cn=X.skeleton;cn&&(Le.floatVertexTextures?(cn.boneTexture===null&&cn.computeBoneTexture(),Xt.setValue(N,"boneTexture",cn.boneTexture,Ne),Xt.setValue(N,"boneTextureSize",cn.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const fc=G.morphAttributes;if((fc.position!==void 0||fc.normal!==void 0||fc.color!==void 0&&Le.isWebGL2===!0)&&_e.update(X,G,Mr),(Eo||Ge.receiveShadow!==X.receiveShadow)&&(Ge.receiveShadow=X.receiveShadow,Xt.setValue(N,"receiveShadow",X.receiveShadow)),U.isMeshGouraudMaterial&&U.envMap!==null&&(Er.envMap.value=Ae,Er.flipEnvMap.value=Ae.isCubeTexture&&Ae.isRenderTargetTexture===!1?-1:1),Eo&&(Xt.setValue(N,"toneMappingExposure",g.toneMappingExposure),Ge.needsLights&&xx(Er,cc),de&&U.fog===!0&&J.refreshFogUniforms(Er,de),J.refreshMaterialUniforms(Er,U,$,K,ge),Zl.upload(N,Ge.uniformsList,Er,Ne)),U.isShaderMaterial&&U.uniformsNeedUpdate===!0&&(Zl.upload(N,Ge.uniformsList,Er,Ne),U.uniformsNeedUpdate=!1),U.isSpriteMaterial&&Xt.setValue(N,"center",X.center),Xt.setValue(N,"modelViewMatrix",X.modelViewMatrix),Xt.setValue(N,"normalMatrix",X.normalMatrix),Xt.setValue(N,"modelMatrix",X.matrixWorld),U.isShaderMaterial||U.isRawShaderMaterial){const cn=U.uniformsGroups;for(let dc=0,Mx=cn.length;dc0&&Ne.useMultisampledRTT(w)===!1?X=He.get(w).__webglMultisampledFramebuffer:X=Re,T.copy(w.viewport),q.copy(w.scissor),Q=w.scissorTest}else T.copy(z).multiplyScalar($).floor(),q.copy(O).multiplyScalar($).floor(),Q=F;if(be.bindFramebuffer(N.FRAMEBUFFER,X)&&Le.drawBuffers&&U&&be.drawBuffers(w,X),be.viewport(T),be.scissor(q),be.setScissorTest(Q),de){const Ae=He.get(w.texture);N.framebufferTexture2D(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0,N.TEXTURE_CUBE_MAP_POSITIVE_X+I,Ae.__webglTexture,G)}else if(xe){const Ae=He.get(w.texture),ze=I||0;N.framebufferTextureLayer(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0,Ae.__webglTexture,G||0,ze)}D=-1},this.readRenderTargetPixels=function(w,I,G,U,X,de,xe){if(!(w&&w.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Te=He.get(w).__webglFramebuffer;if(w.isWebGLCubeRenderTarget&&xe!==void 0&&(Te=Te[xe]),Te){be.bindFramebuffer(N.FRAMEBUFFER,Te);try{const Ae=w.texture,ze=Ae.format,Re=Ae.type;if(ze!==$n&&pe.convert(ze)!==N.getParameter(N.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const De=Re===Ta&&(Ee.has("EXT_color_buffer_half_float")||Le.isWebGL2&&Ee.has("EXT_color_buffer_float"));if(Re!==fr&&pe.convert(Re)!==N.getParameter(N.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Re===Ji&&(Le.isWebGL2||Ee.has("OES_texture_float")||Ee.has("WEBGL_color_buffer_float")))&&!De){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}I>=0&&I<=w.width-U&&G>=0&&G<=w.height-X&&N.readPixels(I,G,U,X,pe.convert(ze),pe.convert(Re),de)}finally{const Ae=b!==null?He.get(b).__webglFramebuffer:null;be.bindFramebuffer(N.FRAMEBUFFER,Ae)}}},this.copyFramebufferToTexture=function(w,I,G=0){const U=Math.pow(2,-G),X=Math.floor(I.image.width*U),de=Math.floor(I.image.height*U);Ne.setTexture2D(I,0),N.copyTexSubImage2D(N.TEXTURE_2D,G,0,0,w.x,w.y,X,de),be.unbindTexture()},this.copyTextureToTexture=function(w,I,G,U=0){const X=I.image.width,de=I.image.height,xe=pe.convert(G.format),Te=pe.convert(G.type);Ne.setTexture2D(G,0),N.pixelStorei(N.UNPACK_FLIP_Y_WEBGL,G.flipY),N.pixelStorei(N.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),N.pixelStorei(N.UNPACK_ALIGNMENT,G.unpackAlignment),I.isDataTexture?N.texSubImage2D(N.TEXTURE_2D,U,w.x,w.y,X,de,xe,Te,I.image.data):I.isCompressedTexture?N.compressedTexSubImage2D(N.TEXTURE_2D,U,w.x,w.y,I.mipmaps[0].width,I.mipmaps[0].height,xe,I.mipmaps[0].data):N.texSubImage2D(N.TEXTURE_2D,U,w.x,w.y,xe,Te,I.image),U===0&&G.generateMipmaps&&N.generateMipmap(N.TEXTURE_2D),be.unbindTexture()},this.copyTextureToTexture3D=function(w,I,G,U,X=0){if(g.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const de=w.max.x-w.min.x+1,xe=w.max.y-w.min.y+1,Te=w.max.z-w.min.z+1,Ae=pe.convert(U.format),ze=pe.convert(U.type);let Re;if(U.isData3DTexture)Ne.setTexture3D(U,0),Re=N.TEXTURE_3D;else if(U.isDataArrayTexture)Ne.setTexture2DArray(U,0),Re=N.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}N.pixelStorei(N.UNPACK_FLIP_Y_WEBGL,U.flipY),N.pixelStorei(N.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),N.pixelStorei(N.UNPACK_ALIGNMENT,U.unpackAlignment);const De=N.getParameter(N.UNPACK_ROW_LENGTH),ft=N.getParameter(N.UNPACK_IMAGE_HEIGHT),ht=N.getParameter(N.UNPACK_SKIP_PIXELS),Nn=N.getParameter(N.UNPACK_SKIP_ROWS),gi=N.getParameter(N.UNPACK_SKIP_IMAGES),gt=G.isCompressedTexture?G.mipmaps[0]:G.image;N.pixelStorei(N.UNPACK_ROW_LENGTH,gt.width),N.pixelStorei(N.UNPACK_IMAGE_HEIGHT,gt.height),N.pixelStorei(N.UNPACK_SKIP_PIXELS,w.min.x),N.pixelStorei(N.UNPACK_SKIP_ROWS,w.min.y),N.pixelStorei(N.UNPACK_SKIP_IMAGES,w.min.z),G.isDataTexture||G.isData3DTexture?N.texSubImage3D(Re,X,I.x,I.y,I.z,de,xe,Te,Ae,ze,gt.data):G.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),N.compressedTexSubImage3D(Re,X,I.x,I.y,I.z,de,xe,Te,Ae,gt.data)):N.texSubImage3D(Re,X,I.x,I.y,I.z,de,xe,Te,Ae,ze,gt),N.pixelStorei(N.UNPACK_ROW_LENGTH,De),N.pixelStorei(N.UNPACK_IMAGE_HEIGHT,ft),N.pixelStorei(N.UNPACK_SKIP_PIXELS,ht),N.pixelStorei(N.UNPACK_SKIP_ROWS,Nn),N.pixelStorei(N.UNPACK_SKIP_IMAGES,gi),X===0&&U.generateMipmaps&&N.generateMipmap(Re),be.unbindTexture()},this.initTexture=function(w){w.isCubeTexture?Ne.setTextureCube(w,0):w.isData3DTexture?Ne.setTexture3D(w,0):w.isDataArrayTexture||w.isCompressedArrayTexture?Ne.setTexture2DArray(w,0):Ne.setTexture2D(w,0),be.unbindTexture()},this.resetState=function(){E=0,A=0,b=null,be.reset(),me.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Pi}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Oe?Vr:Xy}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Vr?Oe:mi}}class OR extends px{}OR.prototype.isWebGL1Renderer=!0;class NR extends Nt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),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,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n}}class mx extends So{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new qe(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 nv=new P,iv=new P,rv=new mt,yf=new Jy,Ul=new Ha;class IR extends Nt{constructor(e=new On,n=new mx){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[0];for(let r=1,s=n.count;rl)continue;d.applyMatrix4(this.matrixWorld);const D=e.ray.origin.distanceTo(d);De.far||n.push({distance:D,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this})}}else{const f=Math.max(0,o.start),v=Math.min(m.count,o.start+o.count);for(let g=f,x=v-1;gl)continue;d.applyMatrix4(this.matrixWorld);const A=e.ray.origin.distanceTo(d);Ae.far||n.push({distance:A,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s0)&&p.push(g,x,A),(f!==i-1||l{u.key in this.keyStates&&(this.keyStates[u.key]=!0)}),window.addEventListener("keyup",u=>{u.key in this.keyStates&&(this.keyStates[u.key]=!1)}),this.scene=new NR,this.scene.background=new qe(1052688);const r=new GR(5);this.scene.add(r),this.scene.add(new HR(3487056,1));const s=new zR(16772863,100,100);s.position.set(5,5,5),this.scene.add(s);const o=new VR(16777215,.5);this.scene.add(o);const a=new $h(1,10,10),l=new Yh({color:1157649});this.theMesh=new Yn(a,l),this.scene.add(this.theMesh),this._module=is(e,n,this,{actions:{render:{symbolName:null},invalidate:{symbolName:null},randomCameraAngle:{},updateCamAngle:{history:{}},prevCamAngle:{name:"Prev Cam",symbolName:null},nextCamAngle:{name:"Next Cam",symbolName:null},focusObject:{name:"Focus Last Object",symbolName:null},normalizeObject:{symbolName:null},zoomIn:{},zoomOut:{}},props:{isOrbitMode:{name:"Orbit",symbolName:"orbit",onToggle:Pt(()=>{this.isOrbitMode||(this._module.isPanMode.obs=!1),this._module.isOrbitMode.obs=!this.isOrbitMode})},isPanMode:{name:"Pan",symbolName:"pan",onToggle:Pt(()=>{this.isPanMode||(this._module.isOrbitMode.obs=!1),this._module.isPanMode.obs=!this.isPanMode})},focusDistance:{symbolName:null,valueMin:0,valueMax:100,valueStep:.1,onUpdate:(u,c)=>{this.updateCamera(),this.invalidate()}}}}),this._module.updateCamAngle.action.trackWith({isDummyCall:!0})(this.cameraAngle.x,this.cameraAngle.y),this._queueRender()}updateCamera(){const[e,n]=[Math.cos(this.cameraAngle.x),Math.sin(this.cameraAngle.x)],[i,r]=[Math.cos(this.cameraAngle.y),Math.sin(this.cameraAngle.y)],s=new P(e*i,r,n*i).multiplyScalar(this.focusDistance);this.camera.position.copy(this.focusPoint).add(s),this.camera.lookAt(this.focusPoint)}prevCamAngle(){this._module.updateCamAngle.action.history.tryPrev().call()}nextCamAngle(){this._module.updateCamAngle.action.history.tryNext().call()}updateCamAngle(e,n){this.cameraAngle.set(e,n),this.updateCamera(),this.invalidate()}zoomIn(){this._module.focusDistance.obs=this.focusDistance*.9,this.updateCamera(),this.invalidate()}zoomOut(){this._module.focusDistance.obs=this.focusDistance*1.11112,this.updateCamera(),this.invalidate()}randomCameraAngle(){this._module.updateCamAngle.action(Math.random()*Ly,Math.random()*KE-Td)}focusObject(){const e=new Zr().setFromObject(this.scene.children.at(-1));e.getCenter(this.focusPoint);const n=new Ha;e.getBoundingSphere(n),this._module.focusDistance.obs=n.radius,this.updateCamera(),this.invalidate()}normalizeObject(){const e=new Zr().setFromObject(this.scene.children.at(-1)),n=new P;e.getSize(n);const i=Math.max(n.x,n.y,n.z);this.scene.children.at(-1).scale.set(10/i,10/i,10/i),this.invalidate()}_queueRender(){requestAnimationFrame(()=>this._module.render.action())}invalidate(){this.renderIsQueued||(this._queueRender(),this.renderIsQueued=!0)}render(){this.renderer.render(this.scene,this.camera),this.root.count.obs=this.root.count.value+1,this.renderIsQueued=!1}}function jR(t,e){if(e.length<3)throw new Error("polyloop must have length >= 3");const n=p=>{const y=p.l.dot(p.r),_=Math.max(p.lLength,p.rLength)/Math.min(p.lLength,p.rLength);return-.95<=y&&y<=.99&&_<=100},i=(p,y)=>{const _=p.dot(y.l),m=p.dot(y.r);return _>=0&&m>=0&&_+m<=1},r=p=>{const y=p.l,_=p.r;y.copy(p.prev.value).sub(p.value),_.copy(p.next.value).sub(p.value),p.lLength=y.length(),p.rLength=_.length(),y.divideScalar(p.lLength),_.divideScalar(p.rLength)},s=p=>[t[e[p]+0],t[e[p]+1],t[e[p]+2]];let o=null,a=null;{const p=new P,y=new P,_=new P;{_.set(...s(1)),y.set(...s(0)).sub(_),p.set(...s(2)).sub(_),p.normalize();const f=new P().crossVectors(p,y).negate();y.crossVectors(p,f).normalize()}const m={};a=m;for(const f in e)_.set(...s(f)),a.next={value:new Pe(_.dot(p),_.dot(y)),index:e[f],prev:a,next:null,l:new Pe,lLength:null,r:new Pe,rLength:null},a=a.next;o=m.next,a.next=o,o.prev=a,a=o;do r(a),a=a.next;while(a!==o)}const l=p=>{p.prev.next=p.next,p.next.prev=p.prev},u=p=>{const y=p.value,_=p.prev.value,m=p.next.value;if((y.x-m.x)*(_.y-y.y)-(_.x-y.x)*(y.y-m.y)>=0)return!1;let v=p;do{if(v!==p&&v!==p.prev&&v!==p.next&&i(v.value,p))return!1;v=v.next}while(v!==p);return!0},c=[];let h=0;const d=e.length*e.length;for(a=o;a.next.next!==a.prev;){let p=!0;const y=a;do{if(h++,h>d)throw new Error("this smells like an infinite loop edge case");if(n(a)&&u(a)){c.push(a.prev.index,a.index,a.next.index),l(a),r(a.prev),r(a.next),p=!1;break}a=a.next}while(a!==y);if(a=a.prev,p)return console.log("no isBitesized triangles found"),c}return c.push(a.prev.index,a.index,a.next.index),console.log("N:",e.length," steps:",h," ratio: ",h/e.length),c}class XR{constructor(e){this.root=e,this.fileContent=null,this.points=null,this.faces=null,this.count=0,this._module=is(e,parent,this,{actions:{loadFromURL:{symbolName:null}}}),ic(this,{fileContent:!0,processContent:!0}),ly(()=>this.fileContent,()=>this.processContent())}loadFromURL(e){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="text",n.onload=Pt(()=>{this.fileContent=n.responseText}),n.send()}processContent(){console.log("processing file:",this.fileContent);const e=(this.fileContent.match(/#.*?POINT/g)||[]).length;console.log("pointCount: ",e);const n=(this.fileContent.match(/#.*?FACE/g)||[]).length;console.log("faceCount: ",n);const i=(this.fileContent.match(/#.*?POLYLOOP/g)||[]).length;console.log("polyloopCount: ",i),this.points=new Float32Array(e*3);const r={};let s=0;for(const u of this.fileContent.matchAll(/^#(\d+)=\s?IFCCARTESIANPOINT\(\((.*?),(.*?),(.*?)\)\);$/gm))r[u[1]]=s,this.points[s]=parseFloat(u[2]),this.points[s+1]=parseFloat(u[3]),this.points[s+2]=parseFloat(u[4]),s+=3;this.faces=[];for(const u of this.fileContent.matchAll(/^#(\d+)=\s?IFCPOLYLOOP\(\((.*?)\)\);$/gm)){const c=[];for(const h of u[2].matchAll(/#(\d+)/g)){const d=r[h[1]];c.push(d),console.log("POLY",u[1],"POINT:",h[1],"vertexIndex",d,this.points[d],this.points[d+1],this.points[d+2])}this.faces.push(...jR(this.points,c))}console.log("loaded",this.faces.length,"indexes");const o=new On;console.log(this.faces),o.setIndex(this.faces),o.setAttribute("position",new Ln(this.points,3)),o.computeVertexNormals();const a=new Yh({color:13391121,side:li}),l=new Yn(o,a);this.root.render.scene.add(l),this.root.render.focusObject()}}class $R{constructor(e,n){this.root=e,this.fileContent=null,this.points=null,this.faces=null,this.count=0,this._module=is(e,n,this,{actions:{loadFromURL:{symbolName:null}}}),ic(this,{fileContent:!0,processContent:!0}),ly(()=>this.fileContent,Pt(()=>this.processContent()))}loadFromURL(e){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="text",n.onload=Pt(()=>{this.fileContent=n.responseText}),n.send()}processContent(){console.log("processing file:",this.fileContent);const e=(this.fileContent.match(/v/g)||[]).length;console.log("v: ",e);const n=(this.fileContent.match(/f/g)||[]).length;console.log("f: ",n),this.points=new Float32Array(e*3);let i=0;for(const u of this.fileContent.matchAll(/^v (.*?) (.*?) (.*?)$/gm))this.points[i]=parseFloat(u[1]),this.points[i+1]=parseFloat(u[2]),this.points[i+2]=parseFloat(u[3]),i+=3;this.faces=[];const r=new P,s=new P;for(const u of this.fileContent.matchAll(/^f (.*?) (.*?) (.*?)$/gm)){let c=u.slice(1,4).map(h=>parseInt(h));r.add(s.set(c)),c=c.map(h=>h-1),this.faces.push(...c)}r.divideScalar(e),console.log("loaded",this.faces.length,"indexes");const o=new On;console.log(this.points),console.log(this.faces),o.setIndex(this.faces),o.setAttribute("position",new Ln(this.points,3)),o.computeVertexNormals();const a=new Yh({color:13391121}),l=new Yn(o,a);this.root.render._target.scene.add(l),this.root.render.focusObject.action()}}class YR{constructor(e,n){this.flow="row",this.contentWidthVu=6,this.contentHeightVu=2.2,this._module=is(e,n,this,{$inherited:[{from:n}],props:{flow:{symbolName:null},contentWidthVu:{symbolName:null},contentHeightVu:{symbolName:null}},comps:{contentWidth:{symbolName:null},contentLeftAt:{symbolName:null},contentTopAt:{symbolName:null}}})}contentWidth(){return this.contentWidthVu*this._module.vUnit.obs}contentLeftAt(e){return this._module.paddingLeft.obs()+e*this.contentWidthVu*this._module.vUnit.obs}contentTopAt(e){return this._module.paddingTop.obs()+e*this.contentHeightVu*this._module.vUnit.obs}}class qR{constructor(e,n){this._module=is(e,n,this,{children:{standardSlider:YR},$inherited:[{from:n}]})}}class KR{constructor(e,n){this.isThemeLight=!1,this.isThemeDark=!0,this.isThemeSystem=!1,this.isConfigUI=!1,this.mainLumDark=28.3,this.mainLumLight=84.8,this.unit="rem",this.rem=16,this.vUnit=1,this.iUnit=2.2,this.gap=.2,this._module=is(e,n,this,{actions:{},props:{isThemeLight:{name:"Light",symbolName:"themeLight",onToggle:Pt(()=>{this.isThemeLight||(this._module.isThemeDark.obs=!1,this._module.isThemeSystem.obs=!1,this._module.isThemeLight.obs=!this.isThemeLight)})},isThemeDark:{name:"Dark",symbolName:"themeDark",onToggle:Pt(()=>{this.isThemeDark||(this._module.isThemeLight.obs=!1,this._module.isThemeSystem.obs=!1,this._module.isThemeDark.obs=!this.isThemeDark)})},isThemeSystem:{name:"System",symbolName:"themeSystem",onToggle:Pt(()=>{this.isThemeSystem||(this._module.isThemeLight.obs=!1,this._module.isThemeDark.obs=!1,this._module.isThemeSystem.obs=!this.isThemeSystem)})},isConfigUI:{name:"Configure UI",symbolName:"configUI",onToggle:Pt(()=>{this._module.isConfigUI.obs=!this.isConfigUI})},vUnit:{name:"Visual Unit",symbolName:null,valueMin:.3,valueMax:3,valueStep:.005,onUpdate:i=>{document.documentElement.style.setProperty("--vUnit",i+"rem")}},iUnit:{name:"Interaction Unit",symbolName:null,valueMin:1,valueMax:10,valueStep:.01,onUpdate:i=>{document.documentElement.style.setProperty("--iUnit",i+"rem")}},rem:{name:"root font size px",symbolName:null},gap:{name:"gap between panels",symbolName:null}},comps:{paddingLeft:{symbolName:null,obs:()=>Math.max(0,(this._module.iUnit.obs-this._module.vUnit.obs)*.5),value:()=>Math.max(0,(this.iUnit-this.vUnit)*.5)},paddingRight:{symbolName:null,obs:()=>Math.max(0,(this._module.iUnit.obs-this._module.vUnit.obs)*.5),value:()=>Math.max(0,(this.iUnit-this.vUnit)*.5)},paddingTop:{symbolName:null,obs:()=>Math.max(0,(this._module.iUnit.obs-this._module.vUnit.obs)*.5),value:()=>Math.max(0,(this.iUnit-this.vUnit)*.5)},paddingBottom:{symbolName:null,obs:()=>Math.max(0,(this._module.iUnit.obs-this._module.vUnit.obs)*.5),value:()=>Math.max(0,(this.iUnit-this.vUnit)*.5)},elemWidth:{symbolName:null,obs:()=>Math.max(this._module.iUnit.obs,this._module.vUnit.obs),value:()=>Math.max(this.iUnit,this.vUnit)},elemHeight:{symbolName:null,obs:()=>Math.max(this._module.iUnit.obs,this._module.vUnit.obs),value:()=>Math.max(this.iUnit,this.vUnit)}},children:{presenters:qR}}),this._module.vUnit.obs=this.vUnit,this._module.iUnit.obs=this.iUnit}}class ZR{constructor(){this.count=0,this._module=is(null,null,this,{actions:{loadLucySample:{symbolName:null},loadInstituteSample:{symbolName:null},loadHausSample:{symbolName:null},loadChurchSample:{symbolName:null}},props:{count:{symbolName:null}},children:{ui:KR,render:WR,ifcParser:XR,objParser:$R}})}loadLucySample(){this._module.objParser.loadFromURL.action("./samples/lucy.obj")}loadInstituteSample(){this._module.ifcParser.loadFromURL.action("./samples/AC20-Institute-Var-2.ifc")}loadHausSample(){this._module.ifcParser.loadFromURL.action("./samples/AC20-FZK-Haus.ifc")}loadChurchSample(){this._module.objParser.loadFromURL.action("./samples/20221025SantAntiniDelAbad_Llombay1M_CC0.obj")}saveState(e){window.localStorage.setItem("state",JSON.stringify(e))}loadState(){return JSON.parse(window.localStorage.getItem("state"))}}const $e=new ZR()._module,Vn=Ba(({presenter:t=$e.ui,style:e,flexBasis:n,children:i,flow:r,isMutex:s=!1,anchor:o})=>{const a=Fe.useRef(null),l=Fe.useRef([]),[u,c]=Fe.useState(0),[h,d]=Fe.useReducer(()=>({}),{}),p=t.elemWidth.obs()*1.1,y=(_,m)=>{l.current[_]=m,d()};return Fe.useEffect(()=>{c(r=="row"?a.current.clientWidth:a.current.clientHeight)}),Fe.useEffect(()=>{l.current=i instanceof Array&&i.every(_=>_.type==Vn)?i.map(_=>_.props.flexBasis??1):[1]},[]),he.jsx("div",{ref:a,style:{...e,flexBasis:`${n}rem`,justifyContent:Rt.condShort([o=="start","flex-start"],[o=="center","center"],[o=="end","flex-end"],[!0,"flex-start"])},className:"elem panel "+r+(s?" mutex":""),children:i instanceof Array&&i.every(_=>_.type==Vn)?Rt.pipe(i,_=>_.map((m,f)=>Fe.cloneElement(m,{key:2*f+0,flexBasis:l.current[f]*p})),_=>[...Rt.weave(_,(m,f)=>Rt.isnun(m,f),(m,f,v)=>he.jsx(dw,{presenter:t,containerLength:u,getPrev:()=>l.current[v],getNext:()=>l.current[v+1],updatePrev:g=>y(v,g),updateNext:g=>y(v+1,g),flow:r},2*v+1))]):i})});const vx=({symbolId:t})=>he.jsx("svg",{className:"symbol",children:he.jsx("use",{href:t})});const ri=({action:t})=>he.jsxs("button",{className:"elem",onClick:t.onDone,children:[t.symbolId&&he.jsx(vx,{symbolId:t.symbolId}),t.symbolId&&he.jsx("span",{className:"spacer"}),he.jsx("span",{children:t.name})]});const Mf=Ba(({property:t,presenter:e})=>{const n=Fe.useRef(null),i=Fe.useRef(null),r=Fe.useRef(!1),s=Fe.useRef(0),o=Fe.useRef({x:0,y:0}).current,a=Fe.useRef({}).current,[l,u]=Fe.useState(!1),c=t.valueMax-t.valueMin,h=(t.obs-t.valueMin)/c,d=p=>{const y=Rt.condShort([e.flow.value=="row",(p.clientX-a.left)/a.width],[e.flow.value=="col",(p.clientY-a.top)/a.height]);gm(()=>{t.obs=Rt.pipe(y,_=>QE(_,t.valueMin,t.valueMax),_=>zm(_,t.valueMin,t.valueStep),_=>km(_,t.valueMin,t.valueMax))})};return zh({elementRef:i,onDown:p=>{if(u(!0),s.current=t.value,document.body.style.cursor=e.flow.value=="row"?"ew-resize":"ns-resize",r.current=p.target.className.includes("slider_knob"),r.current)o.x=p.screenX,o.y=p.screenY;else{const _=n.current.getBoundingClientRect();for(var y of["width","height","left","top"])a[y]=_[y];d(p)}},onMove:p=>{if(r.current){const y=Rt.condShort([e.flow.value=="row",p.screenX-o.x],[e.flow.value=="col",p.screenY-o.y]);gm(()=>{t.obs=Rt.pipe(s.current+y/(.1*e.iUnit.value*e.rem.value)*t.valueStep,_=>zm(_,t.valueMin,t.valueStep),_=>km(_,t.valueMin,t.valueMax))})}else d(p)},onUp:p=>{u(!1),document.body.style.cursor=""}}),he.jsxs("div",{className:"slider "+e.flow.value,tabIndex:0,ref:i,style:{width:e.elemWidth.obs()+e.contentWidth.obs()+"rem"},children:[he.jsx("div",{className:"slider_knob",style:{left:e.contentLeftAt.obs(h)-e.paddingLeft.obs()+"rem",backgroundColor:l?"var(--elem-highlight-active-color)":"var(--elem-highlight-inactive-color)"},children:he.jsx("div",{className:"slider_pointer"})}),he.jsx("div",{className:"slider_trackBar",ref:n,style:{width:e.contentWidth.obs()+"rem"}})]})});const Ms=Ba(({property:t})=>he.jsxs("button",{className:"elem flag "+(t.obs?"flag-active":"flag-inactive"),onClick:t.onToggle,children:[t.symbolId&&he.jsx(vx,{symbolId:t.symbolId}),t.symbolId&&he.jsx("span",{className:"spacer"}),he.jsx("span",{children:t.name})]})),QR=({})=>{const t=Fe.useRef(null),e=$e.render._target;return Fe.useEffect(()=>{const n=t.current;return n.appendChild(e.renderer.domElement),()=>n.removeChild(e.renderer.domElement)},[]),zh({elementRef:t,onDown:n=>{if(e.isOrbitMode)e.isOrbiting=!0,e.orbitStartMousePos.set(n.screenX,n.screenY),e.orbitStartCamAngle.copy(e.cameraAngle),e._module.updateCamAngle.action.trackWith({isDummyCall:!0})(e.cameraAngle.x,e.cameraAngle.y);else if(e.isPanMode){e.isPanning=!0,e.panStartMousePos.set(n.screenX,n.screenY),e.panStartPos.copy(e.focusPoint),e.panSpeed.set(.003*e.focusDistance,.003*e.focusDistance);const i=new P().copy(e.focusPoint).sub(e.camera.position);e.panUnitX.crossVectors(new P(0,1,0),i).normalize(),e.panUnitY.crossVectors(i,e.panUnitX).normalize()}},onMove:n=>{if(e.isOrbiting){const i=new Pe(n.screenX,n.screenY).sub(e.orbitStartMousePos);i.multiply(e.orbitSpeed),e.cameraAngle.copy(e.orbitStartCamAngle).add(i),e._module.updateCamAngle.action.trackWith({isOverwrite:!0})(ZE(e.cameraAngle.x,0,Ly),CT.clamp(e.cameraAngle.y,-Td,Td))}else if(e.isPanning){const i=new Pe(n.screenX,n.screenY).sub(e.panStartMousePos);i.multiply(e.panSpeed);const r=new P().copy(e.panUnitX).multiplyScalar(i.x),s=new P().copy(e.panUnitY).multiplyScalar(i.y);e.focusPoint.copy(e.panStartPos).add(r).add(s),e.updateCamera(),e.invalidate()}},onUp:n=>{e.isOrbiting=!1,e.isPanning=!1}}),he.jsx("div",{ref:t})},JR=({})=>he.jsx("div",{});Ba(({property:t})=>he.jsx("div",{className:"inputText elem",children:he.jsx("input",{label:"Name",value:t.obs,onChange:action(e=>t.obs=e.target.value)})}));const cv={configUI:{__html:` +}`;function ER(t,e,n){let i=new Wh;const r=new Pe,s=new Pe,o=new rt,a=new yR({depthPacking:iT}),l=new xR,u={},c=n.maxTextureSize,h={[vr]:ln,[ln]:vr,[li]:li},d=new Qr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Pe},radius:{value:4}},vertexShader:SR,fragmentShader:MR}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const y=new On;y.setAttribute("position",new Ln(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Yn(y,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Iy;let f=this.type;this.render=function(E,A,b){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||E.length===0)return;const D=t.getRenderTarget(),S=t.getActiveCubeFace(),T=t.getActiveMipmapLevel(),q=t.state;q.setBlending(cr),q.buffers.color.setClear(1,1,1,1),q.buffers.depth.setTest(!0),q.setScissorTest(!1);const Q=f!==Ei&&this.type===Ei,k=f===Ei&&this.type!==Ei;for(let H=0,W=E.length;Hc||r.y>c)&&(r.x>c&&(s.x=Math.floor(c/L.x),r.x=s.x*L.x,$.mapSize.x=s.x),r.y>c&&(s.y=Math.floor(c/L.y),r.y=s.y*L.y,$.mapSize.y=s.y)),$.map===null||Q===!0||k===!0){const z=this.type!==Ei?{minFilter:qt,magFilter:qt}:{};$.map!==null&&$.map.dispose(),$.map=new Kr(r.x,r.y,z),$.map.texture.name=K.name+".shadowMap",$.camera.updateProjectionMatrix()}t.setRenderTarget($.map),t.clear();const V=$.getViewportCount();for(let z=0;z0||A.map&&A.alphaTest>0){const q=S.uuid,Q=A.uuid;let k=u[q];k===void 0&&(k={},u[q]=k);let H=k[Q];H===void 0&&(H=S.clone(),k[Q]=H),S=H}if(S.visible=A.visible,S.wireframe=A.wireframe,D===Ei?S.side=A.shadowSide!==null?A.shadowSide:A.side:S.side=A.shadowSide!==null?A.shadowSide:h[A.side],S.alphaMap=A.alphaMap,S.alphaTest=A.alphaTest,S.map=A.map,S.clipShadows=A.clipShadows,S.clippingPlanes=A.clippingPlanes,S.clipIntersection=A.clipIntersection,S.displacementMap=A.displacementMap,S.displacementScale=A.displacementScale,S.displacementBias=A.displacementBias,S.wireframeLinewidth=A.wireframeLinewidth,S.linewidth=A.linewidth,b.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const q=t.properties.get(S);q.light=b}return S}function x(E,A,b,D,S){if(E.visible===!1)return;if(E.layers.test(A.layers)&&(E.isMesh||E.isLine||E.isPoints)&&(E.castShadow||E.receiveShadow&&S===Ei)&&(!E.frustumCulled||i.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,E.matrixWorld);const Q=e.update(E),k=E.material;if(Array.isArray(k)){const H=Q.groups;for(let W=0,K=H.length;W=1):L.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),K=$>=2);let V=null,z={};const O=t.getParameter(t.SCISSOR_BOX),F=t.getParameter(t.VIEWPORT),se=new rt().fromArray(O),ie=new rt().fromArray(F);function ce(R,oe,B,ne){const ue=new Uint8Array(4),Xe=t.createTexture();t.bindTexture(R,Xe),t.texParameteri(R,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(R,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let ot=0;ot"u"?!1:/OculusBrowser/g.test(navigator.userAgent),y=new WeakMap;let _;const m=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(C,M){return f?new OffscreenCanvas(C,M):Du("canvas")}function g(C,M,j,J){let ee=1;if((C.width>J||C.height>J)&&(ee=J/Math.max(C.width,C.height)),ee<1||M===!0)if(typeof HTMLImageElement<"u"&&C instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&C instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&C instanceof ImageBitmap){const ae=M?Lu:Math.floor,ve=ae(ee*C.width),le=ae(ee*C.height);_===void 0&&(_=v(ve,le));const Y=j?v(ve,le):_;return Y.width=ve,Y.height=le,Y.getContext("2d").drawImage(C,0,0,ve,le),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+C.width+"x"+C.height+") to ("+ve+"x"+le+")."),Y}else return"data"in C&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+C.width+"x"+C.height+")."),C;return C}function x(C){return Dd(C.width)&&Dd(C.height)}function E(C){return a?!1:C.wrapS!==Xn||C.wrapT!==Xn||C.minFilter!==qt&&C.minFilter!==An}function A(C,M){return C.generateMipmaps&&M&&C.minFilter!==qt&&C.minFilter!==An}function b(C){t.generateMipmap(C)}function D(C,M,j,J,ee=!1){if(a===!1)return M;if(C!==null){if(t[C]!==void 0)return t[C];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+C+"'")}let ae=M;return M===t.RED&&(j===t.FLOAT&&(ae=t.R32F),j===t.HALF_FLOAT&&(ae=t.R16F),j===t.UNSIGNED_BYTE&&(ae=t.R8)),M===t.RG&&(j===t.FLOAT&&(ae=t.RG32F),j===t.HALF_FLOAT&&(ae=t.RG16F),j===t.UNSIGNED_BYTE&&(ae=t.RG8)),M===t.RGBA&&(j===t.FLOAT&&(ae=t.RGBA32F),j===t.HALF_FLOAT&&(ae=t.RGBA16F),j===t.UNSIGNED_BYTE&&(ae=J===Oe&&ee===!1?t.SRGB8_ALPHA8:t.RGBA8),j===t.UNSIGNED_SHORT_4_4_4_4&&(ae=t.RGBA4),j===t.UNSIGNED_SHORT_5_5_5_1&&(ae=t.RGB5_A1)),(ae===t.R16F||ae===t.R32F||ae===t.RG16F||ae===t.RG32F||ae===t.RGBA16F||ae===t.RGBA32F)&&e.get("EXT_color_buffer_float"),ae}function S(C,M,j){return A(C,j)===!0||C.isFramebufferTexture&&C.minFilter!==qt&&C.minFilter!==An?Math.log2(Math.max(M.width,M.height))+1:C.mipmaps!==void 0&&C.mipmaps.length>0?C.mipmaps.length:C.isCompressedTexture&&Array.isArray(C.image)?M.mipmaps.length:1}function T(C){return C===qt||C===Xm||C===Wc?t.NEAREST:t.LINEAR}function q(C){const M=C.target;M.removeEventListener("dispose",q),k(M),M.isVideoTexture&&y.delete(M)}function Q(C){const M=C.target;M.removeEventListener("dispose",Q),W(M)}function k(C){const M=i.get(C);if(M.__webglInit===void 0)return;const j=C.source,J=m.get(j);if(J){const ee=J[M.__cacheKey];ee.usedTimes--,ee.usedTimes===0&&H(C),Object.keys(J).length===0&&m.delete(j)}i.remove(C)}function H(C){const M=i.get(C);t.deleteTexture(M.__webglTexture);const j=C.source,J=m.get(j);delete J[M.__cacheKey],o.memory.textures--}function W(C){const M=C.texture,j=i.get(C),J=i.get(M);if(J.__webglTexture!==void 0&&(t.deleteTexture(J.__webglTexture),o.memory.textures--),C.depthTexture&&C.depthTexture.dispose(),C.isWebGLCubeRenderTarget)for(let ee=0;ee<6;ee++)t.deleteFramebuffer(j.__webglFramebuffer[ee]),j.__webglDepthbuffer&&t.deleteRenderbuffer(j.__webglDepthbuffer[ee]);else{if(t.deleteFramebuffer(j.__webglFramebuffer),j.__webglDepthbuffer&&t.deleteRenderbuffer(j.__webglDepthbuffer),j.__webglMultisampledFramebuffer&&t.deleteFramebuffer(j.__webglMultisampledFramebuffer),j.__webglColorRenderbuffer)for(let ee=0;ee=l&&console.warn("THREE.WebGLTextures: Trying to use "+C+" texture units while this GPU supports only "+l),K+=1,C}function V(C){const M=[];return M.push(C.wrapS),M.push(C.wrapT),M.push(C.wrapR||0),M.push(C.magFilter),M.push(C.minFilter),M.push(C.anisotropy),M.push(C.internalFormat),M.push(C.format),M.push(C.type),M.push(C.generateMipmaps),M.push(C.premultiplyAlpha),M.push(C.flipY),M.push(C.unpackAlignment),M.push(C.colorSpace),M.join()}function z(C,M){const j=i.get(C);if(C.isVideoTexture&&Dt(C),C.isRenderTargetTexture===!1&&C.version>0&&j.__version!==C.version){const J=C.image;if(J===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(J.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ke(j,C,M);return}}n.bindTexture(t.TEXTURE_2D,j.__webglTexture,t.TEXTURE0+M)}function O(C,M){const j=i.get(C);if(C.version>0&&j.__version!==C.version){Ke(j,C,M);return}n.bindTexture(t.TEXTURE_2D_ARRAY,j.__webglTexture,t.TEXTURE0+M)}function F(C,M){const j=i.get(C);if(C.version>0&&j.__version!==C.version){Ke(j,C,M);return}n.bindTexture(t.TEXTURE_3D,j.__webglTexture,t.TEXTURE0+M)}function se(C,M){const j=i.get(C);if(C.version>0&&j.__version!==C.version){en(j,C,M);return}n.bindTexture(t.TEXTURE_CUBE_MAP,j.__webglTexture,t.TEXTURE0+M)}const ie={[Rd]:t.REPEAT,[Xn]:t.CLAMP_TO_EDGE,[Pd]:t.MIRRORED_REPEAT},ce={[qt]:t.NEAREST,[Xm]:t.NEAREST_MIPMAP_NEAREST,[Wc]:t.NEAREST_MIPMAP_LINEAR,[An]:t.LINEAR,[Xw]:t.LINEAR_MIPMAP_NEAREST,[wa]:t.LINEAR_MIPMAP_LINEAR},ge={[oT]:t.NEVER,[hT]:t.ALWAYS,[aT]:t.LESS,[uT]:t.LEQUAL,[lT]:t.EQUAL,[dT]:t.GEQUAL,[cT]:t.GREATER,[fT]:t.NOTEQUAL};function we(C,M,j){if(j?(t.texParameteri(C,t.TEXTURE_WRAP_S,ie[M.wrapS]),t.texParameteri(C,t.TEXTURE_WRAP_T,ie[M.wrapT]),(C===t.TEXTURE_3D||C===t.TEXTURE_2D_ARRAY)&&t.texParameteri(C,t.TEXTURE_WRAP_R,ie[M.wrapR]),t.texParameteri(C,t.TEXTURE_MAG_FILTER,ce[M.magFilter]),t.texParameteri(C,t.TEXTURE_MIN_FILTER,ce[M.minFilter])):(t.texParameteri(C,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(C,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),(C===t.TEXTURE_3D||C===t.TEXTURE_2D_ARRAY)&&t.texParameteri(C,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),(M.wrapS!==Xn||M.wrapT!==Xn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(C,t.TEXTURE_MAG_FILTER,T(M.magFilter)),t.texParameteri(C,t.TEXTURE_MIN_FILTER,T(M.minFilter)),M.minFilter!==qt&&M.minFilter!==An&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),M.compareFunction&&(t.texParameteri(C,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(C,t.TEXTURE_COMPARE_FUNC,ge[M.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const J=e.get("EXT_texture_filter_anisotropic");if(M.magFilter===qt||M.minFilter!==Wc&&M.minFilter!==wa||M.type===Ji&&e.has("OES_texture_float_linear")===!1||a===!1&&M.type===Ta&&e.has("OES_texture_half_float_linear")===!1)return;(M.anisotropy>1||i.get(M).__currentAnisotropy)&&(t.texParameterf(C,J.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,r.getMaxAnisotropy())),i.get(M).__currentAnisotropy=M.anisotropy)}}function Me(C,M){let j=!1;C.__webglInit===void 0&&(C.__webglInit=!0,M.addEventListener("dispose",q));const J=M.source;let ee=m.get(J);ee===void 0&&(ee={},m.set(J,ee));const ae=V(M);if(ae!==C.__cacheKey){ee[ae]===void 0&&(ee[ae]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,j=!0),ee[ae].usedTimes++;const ve=ee[C.__cacheKey];ve!==void 0&&(ee[C.__cacheKey].usedTimes--,ve.usedTimes===0&&H(M)),C.__cacheKey=ae,C.__webglTexture=ee[ae].texture}return j}function Ke(C,M,j){let J=t.TEXTURE_2D;(M.isDataArrayTexture||M.isCompressedArrayTexture)&&(J=t.TEXTURE_2D_ARRAY),M.isData3DTexture&&(J=t.TEXTURE_3D);const ee=Me(C,M),ae=M.source;n.bindTexture(J,C.__webglTexture,t.TEXTURE0+j);const ve=i.get(ae);if(ae.version!==ve.__version||ee===!0){n.activeTexture(t.TEXTURE0+j),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,M.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,M.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE);const le=E(M)&&x(M.image)===!1;let Y=g(M.image,le,!1,c);Y=kt(M,Y);const _e=x(Y)||a,ye=s.convert(M.format,M.colorSpace);let Se=s.convert(M.type),pe=D(M.internalFormat,ye,Se,M.colorSpace);we(J,M,_e);let me;const ke=M.mipmaps,Je=a&&M.isVideoTexture!==!0,R=ve.__version===void 0||ee===!0,oe=S(M,Y,_e);if(M.isDepthTexture)pe=t.DEPTH_COMPONENT,a?M.type===Ji?pe=t.DEPTH_COMPONENT32F:M.type===Qi?pe=t.DEPTH_COMPONENT24:M.type===zr?pe=t.DEPTH24_STENCIL8:pe=t.DEPTH_COMPONENT16:M.type===Ji&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),M.format===Br&&pe===t.DEPTH_COMPONENT&&M.type!==Hh&&M.type!==Qi&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),M.type=Qi,Se=s.convert(M.type)),M.format===co&&pe===t.DEPTH_COMPONENT&&(pe=t.DEPTH_STENCIL,M.type!==zr&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),M.type=zr,Se=s.convert(M.type))),R&&(Je?n.texStorage2D(t.TEXTURE_2D,1,pe,Y.width,Y.height):n.texImage2D(t.TEXTURE_2D,0,pe,Y.width,Y.height,0,ye,Se,null));else if(M.isDataTexture)if(ke.length>0&&_e){Je&&R&&n.texStorage2D(t.TEXTURE_2D,oe,pe,ke[0].width,ke[0].height);for(let B=0,ne=ke.length;B>=1,ne>>=1}}else if(ke.length>0&&_e){Je&&R&&n.texStorage2D(t.TEXTURE_2D,oe,pe,ke[0].width,ke[0].height);for(let B=0,ne=ke.length;B0&&R++,n.texStorage2D(t.TEXTURE_CUBE_MAP,R,me,Y[0].width,Y[0].height));for(let B=0;B<6;B++)if(le){ke?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+B,0,0,0,Y[B].width,Y[B].height,Se,pe,Y[B].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+B,0,me,Y[B].width,Y[B].height,0,Se,pe,Y[B].data);for(let ne=0;ne=t.TEXTURE_CUBE_MAP_POSITIVE_X&&ee<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,J,ee,i.get(j).__webglTexture,0),n.bindFramebuffer(t.FRAMEBUFFER,null)}function N(C,M,j){if(t.bindRenderbuffer(t.RENDERBUFFER,C),M.depthBuffer&&!M.stencilBuffer){let J=t.DEPTH_COMPONENT16;if(j||Qe(M)){const ee=M.depthTexture;ee&&ee.isDepthTexture&&(ee.type===Ji?J=t.DEPTH_COMPONENT32F:ee.type===Qi&&(J=t.DEPTH_COMPONENT24));const ae=Ne(M);Qe(M)?d.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ae,J,M.width,M.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,ae,J,M.width,M.height)}else t.renderbufferStorage(t.RENDERBUFFER,J,M.width,M.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,C)}else if(M.depthBuffer&&M.stencilBuffer){const J=Ne(M);j&&Qe(M)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,J,t.DEPTH24_STENCIL8,M.width,M.height):Qe(M)?d.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,J,t.DEPTH24_STENCIL8,M.width,M.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,M.width,M.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,C)}else{const J=M.isWebGLMultipleRenderTargets===!0?M.texture:[M.texture];for(let ee=0;ee0&&Qe(C)===!1){const le=ae?M:[M];j.__webglMultisampledFramebuffer=t.createFramebuffer(),j.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,j.__webglMultisampledFramebuffer);for(let Y=0;Y0&&Qe(C)===!1){const M=C.isWebGLMultipleRenderTargets?C.texture:[C.texture],j=C.width,J=C.height;let ee=t.COLOR_BUFFER_BIT;const ae=[],ve=C.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,le=i.get(C),Y=C.isWebGLMultipleRenderTargets===!0;if(Y)for(let _e=0;_e0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function Dt(C){const M=o.render.frame;y.get(C)!==M&&(y.set(C,M),C.update())}function kt(C,M){const j=C.colorSpace,J=C.format,ee=C.type;return C.isCompressedTexture===!0||C.format===Ld||j!==mi&&j!==Hr&&(j===Oe?a===!1?e.has("EXT_sRGB")===!0&&J===$n?(C.format=Ld,C.minFilter=An,C.generateMipmaps=!1):M=Ky.sRGBToLinear(M):(J!==$n||ee!==fr)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",j)),M}this.allocateTextureUnit=L,this.resetTextureUnits=$,this.setTexture2D=z,this.setTexture2DArray=O,this.setTexture3D=F,this.setTextureCube=se,this.rebindTextures=Le,this.setupRenderTarget=be,this.updateRenderTargetMipmap=st,this.updateMultisampleRenderTarget=He,this.setupDepthRenderbuffer=Ee,this.setupFrameBufferTexture=Be,this.useMultisampledRTT=Qe}function AR(t,e,n){const i=n.isWebGL2;function r(s,o=Hr){let a;if(s===fr)return t.UNSIGNED_BYTE;if(s===Vy)return t.UNSIGNED_SHORT_4_4_4_4;if(s===Hy)return t.UNSIGNED_SHORT_5_5_5_1;if(s===$w)return t.BYTE;if(s===Yw)return t.SHORT;if(s===Hh)return t.UNSIGNED_SHORT;if(s===By)return t.INT;if(s===Qi)return t.UNSIGNED_INT;if(s===Ji)return t.FLOAT;if(s===Ta)return i?t.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===qw)return t.ALPHA;if(s===$n)return t.RGBA;if(s===Kw)return t.LUMINANCE;if(s===Zw)return t.LUMINANCE_ALPHA;if(s===Br)return t.DEPTH_COMPONENT;if(s===co)return t.DEPTH_STENCIL;if(s===Ld)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===Qw)return t.RED;if(s===Gy)return t.RED_INTEGER;if(s===Jw)return t.RG;if(s===Wy)return t.RG_INTEGER;if(s===jy)return t.RGBA_INTEGER;if(s===jc||s===Xc||s===$c||s===Yc)if(o===Oe)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===jc)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Xc)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===$c)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Yc)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===jc)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Xc)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===$c)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Yc)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===$m||s===Ym||s===qm||s===Km)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===$m)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Ym)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===qm)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Km)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===eT)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Zm||s===Qm)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===Zm)return o===Oe?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Qm)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Jm||s===eg||s===tg||s===ng||s===ig||s===rg||s===sg||s===og||s===ag||s===lg||s===ug||s===cg||s===fg||s===dg)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Jm)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===eg)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===tg)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===ng)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===ig)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===rg)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===sg)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===og)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===ag)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===lg)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===ug)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===cg)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===fg)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===dg)return o===Oe?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===qc)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===qc)return o===Oe?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===tT||s===hg||s===pg||s===mg)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===qc)return a.COMPRESSED_RED_RGTC1_EXT;if(s===hg)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===pg)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===mg)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===zr?i?t.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):t[s]!==void 0?t[s]:null}return{convert:r}}class bR extends pn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Dl extends Nt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const CR={type:"move"};class _f{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Dl,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 Dl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new P,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new P),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Dl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new P,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new P),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 n=this._hand;if(n)for(const i of e.hand.values())this._getHandJoint(n,i)}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,n,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,u=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(u&&e.hand){o=!0;for(const _ of e.hand.values()){const m=n.getJointPose(_,i),f=this._getHandJoint(u,_);m!==null&&(f.matrix.fromArray(m.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=m.radius),f.visible=m!==null}const c=u.joints["index-finger-tip"],h=u.joints["thumb-tip"],d=c.position.distanceTo(h.position),p=.02,y=.005;u.inputState.pinching&&d>p+y?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&d<=p-y&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=n.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(CR)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),u!==null&&(u.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new Dl;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}class RR extends yn{constructor(e,n,i,r,s,o,a,l,u,c){if(c=c!==void 0?c:Br,c!==Br&&c!==co)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&c===Br&&(i=Qi),i===void 0&&c===co&&(i=zr),super(null,r,s,o,a,l,c,i,u),this.isDepthTexture=!0,this.image={width:e,height:n},this.magFilter=a!==void 0?a:qt,this.minFilter=l!==void 0?l:qt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}class PR extends yo{constructor(e,n){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,u=null,c=null,h=null,d=null,p=null,y=null;const _=n.getContextAttributes();let m=null,f=null;const v=[],g=[],x=new pn;x.layers.enable(1),x.viewport=new rt;const E=new pn;E.layers.enable(2),E.viewport=new rt;const A=[x,E],b=new bR;b.layers.enable(1),b.layers.enable(2);let D=null,S=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(O){let F=v[O];return F===void 0&&(F=new _f,v[O]=F),F.getTargetRaySpace()},this.getControllerGrip=function(O){let F=v[O];return F===void 0&&(F=new _f,v[O]=F),F.getGripSpace()},this.getHand=function(O){let F=v[O];return F===void 0&&(F=new _f,v[O]=F),F.getHandSpace()};function T(O){const F=g.indexOf(O.inputSource);if(F===-1)return;const se=v[F];se!==void 0&&(se.update(O.inputSource,O.frame,u||o),se.dispatchEvent({type:O.type,data:O.inputSource}))}function q(){r.removeEventListener("select",T),r.removeEventListener("selectstart",T),r.removeEventListener("selectend",T),r.removeEventListener("squeeze",T),r.removeEventListener("squeezestart",T),r.removeEventListener("squeezeend",T),r.removeEventListener("end",q),r.removeEventListener("inputsourceschange",Q);for(let O=0;O=0&&(g[ie]=null,v[ie].disconnect(se))}for(let F=0;F=g.length){g.push(se),ie=ge;break}else if(g[ge]===null){g[ge]=se,ie=ge;break}if(ie===-1)break}const ce=v[ie];ce&&ce.connect(se)}}const k=new P,H=new P;function W(O,F,se){k.setFromMatrixPosition(F.matrixWorld),H.setFromMatrixPosition(se.matrixWorld);const ie=k.distanceTo(H),ce=F.projectionMatrix.elements,ge=se.projectionMatrix.elements,we=ce[14]/(ce[10]-1),Me=ce[14]/(ce[10]+1),Ke=(ce[9]+1)/ce[5],en=(ce[9]-1)/ce[5],Be=(ce[8]-1)/ce[0],N=(ge[8]+1)/ge[0],Ft=we*Be,Ee=we*N,Le=ie/(-Be+N),be=Le*-Be;F.matrixWorld.decompose(O.position,O.quaternion,O.scale),O.translateX(be),O.translateZ(Le),O.matrixWorld.compose(O.position,O.quaternion,O.scale),O.matrixWorldInverse.copy(O.matrixWorld).invert();const st=we+Le,He=Me+Le,Ne=Ft-be,Qe=Ee+(ie-be),Dt=Ke*Me/He*st,kt=en*Me/He*st;O.projectionMatrix.makePerspective(Ne,Qe,Dt,kt,st,He),O.projectionMatrixInverse.copy(O.projectionMatrix).invert()}function K(O,F){F===null?O.matrixWorld.copy(O.matrix):O.matrixWorld.multiplyMatrices(F.matrixWorld,O.matrix),O.matrixWorldInverse.copy(O.matrixWorld).invert()}this.updateCamera=function(O){if(r===null)return;b.near=E.near=x.near=O.near,b.far=E.far=x.far=O.far,(D!==b.near||S!==b.far)&&(r.updateRenderState({depthNear:b.near,depthFar:b.far}),D=b.near,S=b.far);const F=O.parent,se=b.cameras;K(b,F);for(let ie=0;ie0&&(m.alphaTest.value=f.alphaTest);const v=e.get(f).envMap;if(v&&(m.envMap.value=v,m.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap){m.lightMap.value=f.lightMap;const g=t.useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=f.lightMapIntensity*g,n(f.lightMap,m.lightMapTransform)}f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity,n(f.aoMap,m.aoMapTransform))}function o(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,f.map&&(m.map.value=f.map,n(f.map,m.mapTransform))}function a(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function l(m,f,v,g){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*v,m.scale.value=g*.5,f.map&&(m.map.value=f.map,n(f.map,m.uvTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,n(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function u(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map,n(f.map,m.mapTransform)),f.alphaMap&&(m.alphaMap.value=f.alphaMap,n(f.alphaMap,m.alphaMapTransform)),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest)}function c(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function h(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function d(m,f){m.metalness.value=f.metalness,f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap,n(f.metalnessMap,m.metalnessMapTransform)),m.roughness.value=f.roughness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap,n(f.roughnessMap,m.roughnessMapTransform)),e.get(f).envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function p(m,f,v){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap,n(f.sheenColorMap,m.sheenColorMapTransform)),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap,n(f.sheenRoughnessMap,m.sheenRoughnessMapTransform))),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap,n(f.clearcoatMap,m.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,n(f.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(m.clearcoatNormalMap.value=f.clearcoatNormalMap,n(f.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===ln&&m.clearcoatNormalScale.value.negate())),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap,n(f.iridescenceMap,m.iridescenceMapTransform)),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap,n(f.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=v.texture,m.transmissionSamplerSize.value.set(v.width,v.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap,n(f.transmissionMap,m.transmissionMapTransform)),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap,n(f.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(m.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(m.anisotropyMap.value=f.anisotropyMap,n(f.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap,n(f.specularColorMap,m.specularColorMapTransform)),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap,n(f.specularIntensityMap,m.specularIntensityMapTransform))}function y(m,f){f.matcap&&(m.matcap.value=f.matcap)}function _(m,f){const v=e.get(f).light;m.referencePosition.value.setFromMatrixPosition(v.matrixWorld),m.nearDistance.value=v.shadow.camera.near,m.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function DR(t,e,n,i){let r={},s={},o=[];const a=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(v,g){const x=g.program;i.uniformBlockBinding(v,x)}function u(v,g){let x=r[v.id];x===void 0&&(y(v),x=c(v),r[v.id]=x,v.addEventListener("dispose",m));const E=g.program;i.updateUBOMapping(v,E);const A=e.render.frame;s[v.id]!==A&&(d(v),s[v.id]=A)}function c(v){const g=h();v.__bindingPointIndex=g;const x=t.createBuffer(),E=v.__size,A=v.usage;return t.bindBuffer(t.UNIFORM_BUFFER,x),t.bufferData(t.UNIFORM_BUFFER,E,A),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,g,x),x}function h(){for(let v=0;v0){A=x%E;const Q=E-A;A!==0&&Q-T.boundary<0&&(x+=E-A,S.__offset=x)}x+=T.storage}return A=x%E,A>0&&(x+=E-A),v.__size=x,v.__cache={},this}function _(v){const g={boundary:0,storage:0};return typeof v=="number"?(g.boundary=4,g.storage=4):v.isVector2?(g.boundary=8,g.storage=8):v.isVector3||v.isColor?(g.boundary=16,g.storage=12):v.isVector4?(g.boundary=16,g.storage=16):v.isMatrix3?(g.boundary=48,g.storage=48):v.isMatrix4?(g.boundary=64,g.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),g}function m(v){const g=v.target;g.removeEventListener("dispose",m);const x=o.indexOf(g.__bindingPointIndex);o.splice(x,1),t.deleteBuffer(r[g.id]),delete r[g.id],delete s[g.id]}function f(){for(const v in r)t.deleteBuffer(r[v]);o=[],r={},s={}}return{bind:l,update:u,dispose:f}}function UR(){const t=Du("canvas");return t.style.display="block",t}class px{constructor(e={}){const{canvas:n=UR(),context:i=null,depth:r=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:u=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let d;i!==null?d=i.getContextAttributes().alpha:d=o;const p=new Uint32Array(4),y=new Int32Array(4);let _=null,m=null;const f=[],v=[];this.domElement=n,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=Oe,this.useLegacyLights=!0,this.toneMapping=Ui,this.toneMappingExposure=1;const g=this;let x=!1,E=0,A=0,b=null,D=-1,S=null;const T=new rt,q=new rt;let Q=null;const k=new qe(0);let H=0,W=n.width,K=n.height,$=1,L=null,V=null;const z=new rt(0,0,W,K),O=new rt(0,0,W,K);let F=!1;const se=new Wh;let ie=!1,ce=!1,ge=null;const we=new mt,Me=new Pe,Ke=new P,en={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Be(){return b===null?$:1}let N=i;function Ft(w,I){for(let G=0;G0?m=v[v.length-1]:m=null,f.pop(),f.length>0?_=f[f.length-1]:_=null};function Kh(w,I,G,U){if(w.visible===!1)return;if(w.layers.test(I.layers)){if(w.isGroup)G=w.renderOrder;else if(w.isLOD)w.autoUpdate===!0&&w.update(I);else if(w.isLight)m.pushLight(w),w.castShadow&&m.pushShadow(w);else if(w.isSprite){if(!w.frustumCulled||se.intersectsSprite(w)){U&&Ke.setFromMatrixPosition(w.matrixWorld).applyMatrix4(we);const xe=M.update(w),Te=w.material;Te.visible&&_.push(w,xe,Te,G,Ke.z,null)}}else if((w.isMesh||w.isLine||w.isPoints)&&(!w.frustumCulled||se.intersectsObject(w))){const xe=M.update(w),Te=w.material;if(U&&(w.boundingSphere!==void 0?(w.boundingSphere===null&&w.computeBoundingSphere(),Ke.copy(w.boundingSphere.center)):(xe.boundingSphere===null&&xe.computeBoundingSphere(),Ke.copy(xe.boundingSphere.center)),Ke.applyMatrix4(w.matrixWorld).applyMatrix4(we)),Array.isArray(Te)){const Ae=xe.groups;for(let ze=0,Re=Ae.length;ze0&&_x(X,de,I,G),U&&be.viewport(T.copy(U)),X.length>0&&Wa(X,I,G),de.length>0&&Wa(de,I,G),xe.length>0&&Wa(xe,I,G),be.buffers.depth.setTest(!0),be.buffers.depth.setMask(!0),be.buffers.color.setMask(!0),be.setPolygonOffset(!1)}function _x(w,I,G,U){const X=Le.isWebGL2;ge===null&&(ge=new Kr(1,1,{generateMipmaps:!0,type:Ee.has("EXT_color_buffer_half_float")?Ta:fr,minFilter:wa,samples:X?4:0})),g.getDrawingBufferSize(Me),X?ge.setSize(Me.x,Me.y):ge.setSize(Lu(Me.x),Lu(Me.y));const de=g.getRenderTarget();g.setRenderTarget(ge),g.getClearColor(k),H=g.getClearAlpha(),H<1&&g.setClearColor(16777215,.5),g.clear();const xe=g.toneMapping;g.toneMapping=Ui,Wa(w,G,U),Ne.updateMultisampleRenderTarget(ge),Ne.updateRenderTargetMipmap(ge);let Te=!1;for(let Ae=0,ze=I.length;Ae0),De=!!G.morphAttributes.position,ft=!!G.morphAttributes.normal,ht=!!G.morphAttributes.color,Nn=U.toneMapped?g.toneMapping:Ui,gi=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,gt=gi!==void 0?gi.length:0,Ge=He.get(U),uc=m.state.lights;if(ie===!0&&(ce===!0||w!==S)){const cn=w===S&&U.id===D;ve.setState(U,w,cn)}let At=!1;U.version===Ge.__version?(Ge.needsLights&&Ge.lightsStateVersion!==uc.state.version||Ge.outputColorSpace!==Te||X.isInstancedMesh&&Ge.instancing===!1||!X.isInstancedMesh&&Ge.instancing===!0||X.isSkinnedMesh&&Ge.skinning===!1||!X.isSkinnedMesh&&Ge.skinning===!0||Ge.envMap!==Ae||U.fog===!0&&Ge.fog!==de||Ge.numClippingPlanes!==void 0&&(Ge.numClippingPlanes!==ve.numPlanes||Ge.numIntersection!==ve.numIntersection)||Ge.vertexAlphas!==ze||Ge.vertexTangents!==Re||Ge.morphTargets!==De||Ge.morphNormals!==ft||Ge.morphColors!==ht||Ge.toneMapping!==Nn||Le.isWebGL2===!0&&Ge.morphTargetsCount!==gt)&&(At=!0):(At=!0,Ge.__version=U.version);let Mr=Ge.currentProgram;At===!0&&(Mr=ja(U,I,X));let ep=!1,Eo=!1,cc=!1;const Xt=Mr.getUniforms(),Er=Ge.uniforms;if(be.useProgram(Mr.program)&&(ep=!0,Eo=!0,cc=!0),U.id!==D&&(D=U.id,Eo=!0),ep||S!==w){if(Xt.setValue(N,"projectionMatrix",w.projectionMatrix),Le.logarithmicDepthBuffer&&Xt.setValue(N,"logDepthBufFC",2/(Math.log(w.far+1)/Math.LN2)),S!==w&&(S=w,Eo=!0,cc=!0),U.isShaderMaterial||U.isMeshPhongMaterial||U.isMeshToonMaterial||U.isMeshStandardMaterial||U.envMap){const cn=Xt.map.cameraPosition;cn!==void 0&&cn.setValue(N,Ke.setFromMatrixPosition(w.matrixWorld))}(U.isMeshPhongMaterial||U.isMeshToonMaterial||U.isMeshLambertMaterial||U.isMeshBasicMaterial||U.isMeshStandardMaterial||U.isShaderMaterial)&&Xt.setValue(N,"isOrthographic",w.isOrthographicCamera===!0),(U.isMeshPhongMaterial||U.isMeshToonMaterial||U.isMeshLambertMaterial||U.isMeshBasicMaterial||U.isMeshStandardMaterial||U.isShaderMaterial||U.isShadowMaterial||X.isSkinnedMesh)&&Xt.setValue(N,"viewMatrix",w.matrixWorldInverse)}if(X.isSkinnedMesh){Xt.setOptional(N,X,"bindMatrix"),Xt.setOptional(N,X,"bindMatrixInverse");const cn=X.skeleton;cn&&(Le.floatVertexTextures?(cn.boneTexture===null&&cn.computeBoneTexture(),Xt.setValue(N,"boneTexture",cn.boneTexture,Ne),Xt.setValue(N,"boneTextureSize",cn.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const fc=G.morphAttributes;if((fc.position!==void 0||fc.normal!==void 0||fc.color!==void 0&&Le.isWebGL2===!0)&&_e.update(X,G,Mr),(Eo||Ge.receiveShadow!==X.receiveShadow)&&(Ge.receiveShadow=X.receiveShadow,Xt.setValue(N,"receiveShadow",X.receiveShadow)),U.isMeshGouraudMaterial&&U.envMap!==null&&(Er.envMap.value=Ae,Er.flipEnvMap.value=Ae.isCubeTexture&&Ae.isRenderTargetTexture===!1?-1:1),Eo&&(Xt.setValue(N,"toneMappingExposure",g.toneMappingExposure),Ge.needsLights&&xx(Er,cc),de&&U.fog===!0&&J.refreshFogUniforms(Er,de),J.refreshMaterialUniforms(Er,U,$,K,ge),Zl.upload(N,Ge.uniformsList,Er,Ne)),U.isShaderMaterial&&U.uniformsNeedUpdate===!0&&(Zl.upload(N,Ge.uniformsList,Er,Ne),U.uniformsNeedUpdate=!1),U.isSpriteMaterial&&Xt.setValue(N,"center",X.center),Xt.setValue(N,"modelViewMatrix",X.modelViewMatrix),Xt.setValue(N,"normalMatrix",X.normalMatrix),Xt.setValue(N,"modelMatrix",X.matrixWorld),U.isShaderMaterial||U.isRawShaderMaterial){const cn=U.uniformsGroups;for(let dc=0,Mx=cn.length;dc0&&Ne.useMultisampledRTT(w)===!1?X=He.get(w).__webglMultisampledFramebuffer:X=Re,T.copy(w.viewport),q.copy(w.scissor),Q=w.scissorTest}else T.copy(z).multiplyScalar($).floor(),q.copy(O).multiplyScalar($).floor(),Q=F;if(be.bindFramebuffer(N.FRAMEBUFFER,X)&&Le.drawBuffers&&U&&be.drawBuffers(w,X),be.viewport(T),be.scissor(q),be.setScissorTest(Q),de){const Ae=He.get(w.texture);N.framebufferTexture2D(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0,N.TEXTURE_CUBE_MAP_POSITIVE_X+I,Ae.__webglTexture,G)}else if(xe){const Ae=He.get(w.texture),ze=I||0;N.framebufferTextureLayer(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0,Ae.__webglTexture,G||0,ze)}D=-1},this.readRenderTargetPixels=function(w,I,G,U,X,de,xe){if(!(w&&w.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Te=He.get(w).__webglFramebuffer;if(w.isWebGLCubeRenderTarget&&xe!==void 0&&(Te=Te[xe]),Te){be.bindFramebuffer(N.FRAMEBUFFER,Te);try{const Ae=w.texture,ze=Ae.format,Re=Ae.type;if(ze!==$n&&pe.convert(ze)!==N.getParameter(N.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const De=Re===Ta&&(Ee.has("EXT_color_buffer_half_float")||Le.isWebGL2&&Ee.has("EXT_color_buffer_float"));if(Re!==fr&&pe.convert(Re)!==N.getParameter(N.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Re===Ji&&(Le.isWebGL2||Ee.has("OES_texture_float")||Ee.has("WEBGL_color_buffer_float")))&&!De){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}I>=0&&I<=w.width-U&&G>=0&&G<=w.height-X&&N.readPixels(I,G,U,X,pe.convert(ze),pe.convert(Re),de)}finally{const Ae=b!==null?He.get(b).__webglFramebuffer:null;be.bindFramebuffer(N.FRAMEBUFFER,Ae)}}},this.copyFramebufferToTexture=function(w,I,G=0){const U=Math.pow(2,-G),X=Math.floor(I.image.width*U),de=Math.floor(I.image.height*U);Ne.setTexture2D(I,0),N.copyTexSubImage2D(N.TEXTURE_2D,G,0,0,w.x,w.y,X,de),be.unbindTexture()},this.copyTextureToTexture=function(w,I,G,U=0){const X=I.image.width,de=I.image.height,xe=pe.convert(G.format),Te=pe.convert(G.type);Ne.setTexture2D(G,0),N.pixelStorei(N.UNPACK_FLIP_Y_WEBGL,G.flipY),N.pixelStorei(N.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),N.pixelStorei(N.UNPACK_ALIGNMENT,G.unpackAlignment),I.isDataTexture?N.texSubImage2D(N.TEXTURE_2D,U,w.x,w.y,X,de,xe,Te,I.image.data):I.isCompressedTexture?N.compressedTexSubImage2D(N.TEXTURE_2D,U,w.x,w.y,I.mipmaps[0].width,I.mipmaps[0].height,xe,I.mipmaps[0].data):N.texSubImage2D(N.TEXTURE_2D,U,w.x,w.y,xe,Te,I.image),U===0&&G.generateMipmaps&&N.generateMipmap(N.TEXTURE_2D),be.unbindTexture()},this.copyTextureToTexture3D=function(w,I,G,U,X=0){if(g.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const de=w.max.x-w.min.x+1,xe=w.max.y-w.min.y+1,Te=w.max.z-w.min.z+1,Ae=pe.convert(U.format),ze=pe.convert(U.type);let Re;if(U.isData3DTexture)Ne.setTexture3D(U,0),Re=N.TEXTURE_3D;else if(U.isDataArrayTexture)Ne.setTexture2DArray(U,0),Re=N.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}N.pixelStorei(N.UNPACK_FLIP_Y_WEBGL,U.flipY),N.pixelStorei(N.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),N.pixelStorei(N.UNPACK_ALIGNMENT,U.unpackAlignment);const De=N.getParameter(N.UNPACK_ROW_LENGTH),ft=N.getParameter(N.UNPACK_IMAGE_HEIGHT),ht=N.getParameter(N.UNPACK_SKIP_PIXELS),Nn=N.getParameter(N.UNPACK_SKIP_ROWS),gi=N.getParameter(N.UNPACK_SKIP_IMAGES),gt=G.isCompressedTexture?G.mipmaps[0]:G.image;N.pixelStorei(N.UNPACK_ROW_LENGTH,gt.width),N.pixelStorei(N.UNPACK_IMAGE_HEIGHT,gt.height),N.pixelStorei(N.UNPACK_SKIP_PIXELS,w.min.x),N.pixelStorei(N.UNPACK_SKIP_ROWS,w.min.y),N.pixelStorei(N.UNPACK_SKIP_IMAGES,w.min.z),G.isDataTexture||G.isData3DTexture?N.texSubImage3D(Re,X,I.x,I.y,I.z,de,xe,Te,Ae,ze,gt.data):G.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),N.compressedTexSubImage3D(Re,X,I.x,I.y,I.z,de,xe,Te,Ae,gt.data)):N.texSubImage3D(Re,X,I.x,I.y,I.z,de,xe,Te,Ae,ze,gt),N.pixelStorei(N.UNPACK_ROW_LENGTH,De),N.pixelStorei(N.UNPACK_IMAGE_HEIGHT,ft),N.pixelStorei(N.UNPACK_SKIP_PIXELS,ht),N.pixelStorei(N.UNPACK_SKIP_ROWS,Nn),N.pixelStorei(N.UNPACK_SKIP_IMAGES,gi),X===0&&U.generateMipmaps&&N.generateMipmap(Re),be.unbindTexture()},this.initTexture=function(w){w.isCubeTexture?Ne.setTextureCube(w,0):w.isData3DTexture?Ne.setTexture3D(w,0):w.isDataArrayTexture||w.isCompressedArrayTexture?Ne.setTexture2DArray(w,0):Ne.setTexture2D(w,0),be.unbindTexture()},this.resetState=function(){E=0,A=0,b=null,be.reset(),me.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Pi}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Oe?Vr:Xy}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Vr?Oe:mi}}class OR extends px{}OR.prototype.isWebGL1Renderer=!0;class NR extends Nt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),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,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n}}class mx extends So{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new qe(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 nv=new P,iv=new P,rv=new mt,yf=new Jy,Ul=new Ha;class IR extends Nt{constructor(e=new On,n=new mx){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,i=[0];for(let r=1,s=n.count;rl)continue;d.applyMatrix4(this.matrixWorld);const D=e.ray.origin.distanceTo(d);De.far||n.push({distance:D,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this})}}else{const f=Math.max(0,o.start),v=Math.min(m.count,o.start+o.count);for(let g=f,x=v-1;gl)continue;d.applyMatrix4(this.matrixWorld);const A=e.ray.origin.distanceTo(d);Ae.far||n.push({distance:A,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s0)&&p.push(g,x,A),(f!==i-1||l{u.key in this.keyStates&&(this.keyStates[u.key]=!0)}),window.addEventListener("keyup",u=>{u.key in this.keyStates&&(this.keyStates[u.key]=!1)}),this.scene=new NR,this.scene.background=new qe(1052688);const r=new GR(5);this.scene.add(r),this.scene.add(new HR(3487056,1));const s=new zR(16772863,100,100);s.position.set(5,5,5),this.scene.add(s);const o=new VR(16777215,.5);this.scene.add(o);const a=new $h(1,10,10),l=new Yh({color:1157649});this.theMesh=new Yn(a,l),this.scene.add(this.theMesh),this._module=is(e,n,this,{actions:{render:{symbolName:null},invalidate:{symbolName:null},randomCameraAngle:{},updateCamAngle:{history:{}},prevCamAngle:{name:"Prev Cam",symbolName:null},nextCamAngle:{name:"Next Cam",symbolName:null},focusObject:{name:"Focus Last Object",symbolName:null},normalizeObject:{symbolName:null},zoomIn:{},zoomOut:{}},props:{isOrbitMode:{name:"Orbit",symbolName:"orbit",onToggle:Pt(()=>{this.isOrbitMode||(this._module.isPanMode.obs=!1),this._module.isOrbitMode.obs=!this.isOrbitMode})},isPanMode:{name:"Pan",symbolName:"pan",onToggle:Pt(()=>{this.isPanMode||(this._module.isOrbitMode.obs=!1),this._module.isPanMode.obs=!this.isPanMode})},focusDistance:{symbolName:null,valueMin:0,valueMax:100,valueStep:.1,onUpdate:(u,c)=>{this.updateCamera(),this.invalidate()}}}}),this._module.updateCamAngle.action.trackWith({isDummyCall:!0})(this.cameraAngle.x,this.cameraAngle.y),this._queueRender()}updateCamera(){const[e,n]=[Math.cos(this.cameraAngle.x),Math.sin(this.cameraAngle.x)],[i,r]=[Math.cos(this.cameraAngle.y),Math.sin(this.cameraAngle.y)],s=new P(e*i,r,n*i).multiplyScalar(this.focusDistance);this.camera.position.copy(this.focusPoint).add(s),this.camera.lookAt(this.focusPoint)}prevCamAngle(){this._module.updateCamAngle.action.history.tryPrev().call()}nextCamAngle(){this._module.updateCamAngle.action.history.tryNext().call()}updateCamAngle(e,n){this.cameraAngle.set(e,n),this.updateCamera(),this.invalidate()}zoomIn(){this._module.focusDistance.obs=this.focusDistance*.9,this.updateCamera(),this.invalidate()}zoomOut(){this._module.focusDistance.obs=this.focusDistance*1.11112,this.updateCamera(),this.invalidate()}randomCameraAngle(){this._module.updateCamAngle.action(Math.random()*Ly,Math.random()*KE-Td)}focusObject(){const e=new Zr().setFromObject(this.scene.children.at(-1));e.getCenter(this.focusPoint);const n=new Ha;e.getBoundingSphere(n),this._module.focusDistance.obs=n.radius,this.updateCamera(),this.invalidate()}normalizeObject(){const e=new Zr().setFromObject(this.scene.children.at(-1)),n=new P;e.getSize(n);const i=Math.max(n.x,n.y,n.z);this.scene.children.at(-1).scale.set(10/i,10/i,10/i),this.invalidate()}_queueRender(){requestAnimationFrame(()=>this._module.render.action())}invalidate(){this.renderIsQueued||(this._queueRender(),this.renderIsQueued=!0)}render(){this.renderer.render(this.scene,this.camera),this.root.count.obs=this.root.count.value+1,this.renderIsQueued=!1}}function jR(t,e){if(e.length<3)throw new Error("polyloop must have length >= 3");const n=p=>{const y=p.l.dot(p.r),_=Math.max(p.lLength,p.rLength)/Math.min(p.lLength,p.rLength);return-.95<=y&&y<=.99&&_<=100},i=(p,y)=>{const _=p.dot(y.l),m=p.dot(y.r);return _>=0&&m>=0&&_+m<=1},r=p=>{const y=p.l,_=p.r;y.copy(p.prev.value).sub(p.value),_.copy(p.next.value).sub(p.value),p.lLength=y.length(),p.rLength=_.length(),y.divideScalar(p.lLength),_.divideScalar(p.rLength)},s=p=>[t[e[p]+0],t[e[p]+1],t[e[p]+2]];let o=null,a=null;{const p=new P,y=new P,_=new P;{_.set(...s(1)),y.set(...s(0)).sub(_),p.set(...s(2)).sub(_),p.normalize();const f=new P().crossVectors(p,y).negate();y.crossVectors(p,f).normalize()}const m={};a=m;for(const f in e)_.set(...s(f)),a.next={value:new Pe(_.dot(p),_.dot(y)),index:e[f],prev:a,next:null,l:new Pe,lLength:null,r:new Pe,rLength:null},a=a.next;o=m.next,a.next=o,o.prev=a,a=o;do r(a),a=a.next;while(a!==o)}const l=p=>{p.prev.next=p.next,p.next.prev=p.prev},u=p=>{const y=p.value,_=p.prev.value,m=p.next.value;if((y.x-m.x)*(_.y-y.y)-(_.x-y.x)*(y.y-m.y)>=0)return!1;let v=p;do{if(v!==p&&v!==p.prev&&v!==p.next&&i(v.value,p))return!1;v=v.next}while(v!==p);return!0},c=[];let h=0;const d=e.length*e.length;for(a=o;a.next.next!==a.prev;){let p=!0;const y=a;do{if(h++,h>d)throw new Error("this smells like an infinite loop edge case");if(n(a)&&u(a)){c.push(a.prev.index,a.index,a.next.index),l(a),r(a.prev),r(a.next),p=!1;break}a=a.next}while(a!==y);if(a=a.prev,p)return console.log("no isBitesized triangles found"),c}return c.push(a.prev.index,a.index,a.next.index),console.log("N:",e.length," steps:",h," ratio: ",h/e.length),c}class XR{constructor(e){this.root=e,this.fileContent=null,this.points=null,this.faces=null,this.count=0,this._module=is(e,parent,this,{actions:{loadFromURL:{symbolName:null}}}),ic(this,{fileContent:!0,processContent:!0}),ly(()=>this.fileContent,()=>this.processContent())}loadFromURL(e){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="text",n.onload=Pt(()=>{this.fileContent=n.responseText}),n.send()}processContent(){console.log("processing file:",this.fileContent);const e=(this.fileContent.match(/#.*?POINT/g)||[]).length;console.log("pointCount: ",e);const n=(this.fileContent.match(/#.*?FACE/g)||[]).length;console.log("faceCount: ",n);const i=(this.fileContent.match(/#.*?POLYLOOP/g)||[]).length;console.log("polyloopCount: ",i),this.points=new Float32Array(e*3);const r={};let s=0;for(const u of this.fileContent.matchAll(/^#(\d+)=\s?IFCCARTESIANPOINT\(\((.*?),(.*?),(.*?)\)\);$/gm))r[u[1]]=s,this.points[s]=parseFloat(u[2]),this.points[s+1]=parseFloat(u[3]),this.points[s+2]=parseFloat(u[4]),s+=3;this.faces=[];for(const u of this.fileContent.matchAll(/^#(\d+)=\s?IFCPOLYLOOP\(\((.*?)\)\);$/gm)){const c=[];for(const h of u[2].matchAll(/#(\d+)/g)){const d=r[h[1]];c.push(d),console.log("POLY",u[1],"POINT:",h[1],"vertexIndex",d,this.points[d],this.points[d+1],this.points[d+2])}this.faces.push(...jR(this.points,c))}console.log("loaded",this.faces.length,"indexes");const o=new On;console.log(this.faces),o.setIndex(this.faces),o.setAttribute("position",new Ln(this.points,3)),o.computeVertexNormals();const a=new Yh({color:13391121,side:li}),l=new Yn(o,a);this.root.render.scene.add(l),this.root.render.focusObject()}}class $R{constructor(e,n){this.root=e,this.fileContent=null,this.points=null,this.faces=null,this.count=0,this._module=is(e,n,this,{actions:{loadFromURL:{symbolName:null}}}),ic(this,{fileContent:!0,processContent:!0}),ly(()=>this.fileContent,Pt(()=>this.processContent()))}loadFromURL(e){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="text",n.onload=Pt(()=>{this.fileContent=n.responseText}),n.send()}processContent(){console.log("processing file:",this.fileContent);const e=(this.fileContent.match(/v/g)||[]).length;console.log("v: ",e);const n=(this.fileContent.match(/f/g)||[]).length;console.log("f: ",n),this.points=new Float32Array(e*3);let i=0;for(const u of this.fileContent.matchAll(/^v (.*?) (.*?) (.*?)$/gm))this.points[i]=parseFloat(u[1]),this.points[i+1]=parseFloat(u[2]),this.points[i+2]=parseFloat(u[3]),i+=3;this.faces=[];const r=new P,s=new P;for(const u of this.fileContent.matchAll(/^f (.*?) (.*?) (.*?)$/gm)){let c=u.slice(1,4).map(h=>parseInt(h));r.add(s.set(c)),c=c.map(h=>h-1),this.faces.push(...c)}r.divideScalar(e),console.log("loaded",this.faces.length,"indexes");const o=new On;console.log(this.points),console.log(this.faces),o.setIndex(this.faces),o.setAttribute("position",new Ln(this.points,3)),o.computeVertexNormals();const a=new Yh({color:13391121}),l=new Yn(o,a);this.root.render._target.scene.add(l),this.root.render.focusObject.action()}}class YR{constructor(e,n){this.flow="row",this.contentWidthVu=6,this.contentHeightVu=2.2,this._module=is(e,n,this,{$inherited:[{from:n}],props:{flow:{symbolName:null},contentWidthVu:{symbolName:null},contentHeightVu:{symbolName:null}},comps:{contentWidth:{symbolName:null},contentLeftAt:{symbolName:null},contentTopAt:{symbolName:null}}})}contentWidth(){return this.contentWidthVu*this._module.vUnit.obs}contentLeftAt(e){return this._module.paddingLeft.obs()+e*this.contentWidthVu*this._module.vUnit.obs}contentTopAt(e){return this._module.paddingTop.obs()+e*this.contentHeightVu*this._module.vUnit.obs}}class qR{constructor(e,n){this._module=is(e,n,this,{children:{standardSlider:YR},$inherited:[{from:n}]})}}class KR{constructor(e,n){this.isThemeLight=!1,this.isThemeDark=!0,this.isThemeSystem=!1,this.isConfigUI=!1,this.mainLumDark=28.3,this.mainLumLight=84.8,this.unit="rem",this.rem=16,this.vUnit=1,this.iUnit=2.2,this.gap=.2,this._module=is(e,n,this,{actions:{},props:{isThemeLight:{name:"Light",symbolName:"themeLight",onToggle:Pt(()=>{this.isThemeLight||(this._module.isThemeDark.obs=!1,this._module.isThemeSystem.obs=!1,this._module.isThemeLight.obs=!this.isThemeLight)})},isThemeDark:{name:"Dark",symbolName:"themeDark",onToggle:Pt(()=>{this.isThemeDark||(this._module.isThemeLight.obs=!1,this._module.isThemeSystem.obs=!1,this._module.isThemeDark.obs=!this.isThemeDark)})},isThemeSystem:{name:"System",symbolName:"themeSystem",onToggle:Pt(()=>{this.isThemeSystem||(this._module.isThemeLight.obs=!1,this._module.isThemeDark.obs=!1,this._module.isThemeSystem.obs=!this.isThemeSystem)})},isConfigUI:{name:"Configure UI",symbolName:"configUI",onToggle:Pt(()=>{this._module.isConfigUI.obs=!this.isConfigUI})},vUnit:{name:"Visual Unit",symbolName:null,valueMin:.3,valueMax:3,valueStep:.005,onUpdate:i=>{document.documentElement.style.setProperty("--vUnit",i+"rem")}},iUnit:{name:"Interaction Unit",symbolName:null,valueMin:1,valueMax:10,valueStep:.01,onUpdate:i=>{document.documentElement.style.setProperty("--iUnit",i+"rem")}},rem:{name:"root font size px",symbolName:null},gap:{name:"gap between panels",symbolName:null}},comps:{paddingLeft:{symbolName:null,obs:()=>Math.max(0,(this._module.iUnit.obs-this._module.vUnit.obs)*.5),value:()=>Math.max(0,(this.iUnit-this.vUnit)*.5)},paddingRight:{symbolName:null,obs:()=>Math.max(0,(this._module.iUnit.obs-this._module.vUnit.obs)*.5),value:()=>Math.max(0,(this.iUnit-this.vUnit)*.5)},paddingTop:{symbolName:null,obs:()=>Math.max(0,(this._module.iUnit.obs-this._module.vUnit.obs)*.5),value:()=>Math.max(0,(this.iUnit-this.vUnit)*.5)},paddingBottom:{symbolName:null,obs:()=>Math.max(0,(this._module.iUnit.obs-this._module.vUnit.obs)*.5),value:()=>Math.max(0,(this.iUnit-this.vUnit)*.5)},elemWidth:{symbolName:null,obs:()=>Math.max(this._module.iUnit.obs,this._module.vUnit.obs),value:()=>Math.max(this.iUnit,this.vUnit)},elemHeight:{symbolName:null,obs:()=>Math.max(this._module.iUnit.obs,this._module.vUnit.obs),value:()=>Math.max(this.iUnit,this.vUnit)}},children:{presenters:qR}}),this._module.vUnit.obs=this.vUnit,this._module.iUnit.obs=this.iUnit}}class ZR{constructor(){this.count=0,this._module=is(null,null,this,{actions:{loadLucySample:{symbolName:null},loadInstituteSample:{symbolName:null},loadHausSample:{symbolName:null},loadChurchSample:{symbolName:null}},props:{count:{symbolName:null}},children:{ui:KR,render:WR,ifcParser:XR,objParser:$R}})}loadLucySample(){this._module.objParser.loadFromURL.action("./samples/lucy.obj")}loadInstituteSample(){this._module.ifcParser.loadFromURL.action("./samples/AC20-Institute-Var-2.ifc")}loadHausSample(){this._module.ifcParser.loadFromURL.action("./samples/AC20-FZK-Haus.ifc")}loadChurchSample(){this._module.objParser.loadFromURL.action("./samples/20221025SantAntiniDelAbad_Llombay1M_CC0.obj")}saveState(e){window.localStorage.setItem("state",JSON.stringify(e))}loadState(){return JSON.parse(window.localStorage.getItem("state"))}}const $e=new ZR()._module,Vn=Ba(({presenter:t=$e.ui,style:e,flexBasis:n,children:i,flow:r,isMutex:s=!1,anchor:o})=>{const a=Fe.useRef(null),l=Fe.useRef([]),[u,c]=Fe.useState(0),[h,d]=Fe.useReducer(()=>({}),{}),p=t.elemWidth.obs()*1.1,y=(_,m)=>{l.current[_]=m,d()};return Fe.useEffect(()=>{c(r=="row"?a.current.clientWidth:a.current.clientHeight)}),Fe.useEffect(()=>{l.current=i instanceof Array&&i.every(_=>_.type==Vn)?i.map(_=>_.props.flexBasis??1):[1]},[]),he.jsx("div",{ref:a,style:{...e,flexBasis:`${n}rem`,justifyContent:Rt.condShort([o=="start","flex-start"],[o=="center","center"],[o=="end","flex-end"],[!0,"flex-start"])},className:"elem panel "+r+(s?" mutex":""),children:i instanceof Array&&i.every(_=>_.type==Vn)?Rt.pipe(i,_=>_.map((m,f)=>Fe.cloneElement(m,{key:2*f+0,flexBasis:l.current[f]*p})),_=>[...Rt.weave(_,(m,f)=>Rt.isnun(m,f),(m,f,v)=>he.jsx(dw,{presenter:t,containerLength:u,getPrev:()=>l.current[v],getNext:()=>l.current[v+1],updatePrev:g=>y(v,g),updateNext:g=>y(v+1,g),flow:r},2*v+1))]):i})});const vx=({symbolId:t})=>he.jsx("svg",{className:"symbol",children:he.jsx("use",{href:t})});const ri=({action:t})=>he.jsxs("button",{className:"elem",onClick:t.onDone,children:[t.symbolId&&he.jsx(vx,{symbolId:t.symbolId}),t.symbolId&&he.jsx("span",{className:"spacer"}),he.jsx("span",{children:t.name})]});const Mf=Ba(({property:t,presenter:e})=>{const n=Fe.useRef(null),i=Fe.useRef(null),r=Fe.useRef(!1),s=Fe.useRef(0),o=Fe.useRef({x:0,y:0}).current,a=Fe.useRef({}).current,[l,u]=Fe.useState(!1),c=t.valueMax-t.valueMin,h=(t.obs-t.valueMin)/c,d=p=>{const y=Rt.condShort([e.flow.value=="row",(p.clientX-a.left)/a.width],[e.flow.value=="col",(p.clientY-a.top)/a.height]);gm(()=>{t.obs=Rt.pipe(y,_=>QE(_,t.valueMin,t.valueMax),_=>zm(_,t.valueMin,t.valueStep),_=>km(_,t.valueMin,t.valueMax))})};return zh({elementRef:i,onDown:p=>{if(u(!0),s.current=t.value,document.body.style.cursor=e.flow.value=="row"?"ew-resize":"ns-resize",r.current=p.target.className.includes("slider_knob"),r.current)o.x=p.screenX,o.y=p.screenY;else{const _=n.current.getBoundingClientRect();for(var y of["width","height","left","top"])a[y]=_[y];d(p)}},onMove:p=>{if(r.current){const y=Rt.condShort([e.flow.value=="row",p.screenX-o.x],[e.flow.value=="col",p.screenY-o.y]);gm(()=>{t.obs=Rt.pipe(s.current+y/(.1*e.iUnit.value*e.rem.value)*t.valueStep,_=>zm(_,t.valueMin,t.valueStep),_=>km(_,t.valueMin,t.valueMax))})}else d(p)},onUp:p=>{u(!1),document.body.style.cursor=""}}),he.jsxs("div",{className:"slider "+e.flow.value,tabIndex:0,ref:i,style:{width:e.elemWidth.obs()+e.contentWidth.obs()+"rem"},children:[he.jsx("div",{className:"slider_knob",style:{left:e.contentLeftAt.obs(h)-e.paddingLeft.obs()+"rem",backgroundColor:l?"var(--elem-highlight-active-color)":"var(--elem-highlight-inactive-color)"},children:he.jsx("div",{className:"slider_pointer"})}),he.jsx("div",{className:"slider_trackBar",ref:n,style:{width:e.contentWidth.obs()+"rem"}})]})});const Ms=Ba(({property:t})=>he.jsxs("button",{className:"elem flag "+(t.obs?"flag-active":"flag-inactive"),onClick:t.onToggle,children:[t.symbolId&&he.jsx(vx,{symbolId:t.symbolId}),t.symbolId&&he.jsx("span",{className:"spacer"}),he.jsx("span",{children:t.name})]})),QR=({})=>{const t=Fe.useRef(null),e=$e.render._target;return Fe.useEffect(()=>{const n=t.current;return n.appendChild(e.renderer.domElement),()=>n.removeChild(e.renderer.domElement)},[]),zh({elementRef:t,onDown:n=>{if(e.isOrbitMode)e.isOrbiting=!0,e.orbitStartMousePos.set(n.screenX,n.screenY),e.orbitStartCamAngle.copy(e.cameraAngle),e._module.updateCamAngle.action.trackWith({isDummyCall:!0})(e.cameraAngle.x,e.cameraAngle.y);else if(e.isPanMode){e.isPanning=!0,e.panStartMousePos.set(n.screenX,n.screenY),e.panStartPos.copy(e.focusPoint),e.panSpeed.set(.003*e.focusDistance,.003*e.focusDistance);const i=new P().copy(e.focusPoint).sub(e.camera.position);e.panUnitX.crossVectors(new P(0,1,0),i).normalize(),e.panUnitY.crossVectors(i,e.panUnitX).normalize()}},onMove:n=>{if(e.isOrbiting){const i=new Pe(n.screenX,n.screenY).sub(e.orbitStartMousePos);i.multiply(e.orbitSpeed),e.cameraAngle.copy(e.orbitStartCamAngle).add(i),e._module.updateCamAngle.action.trackWith({isOverwrite:!0})(ZE(e.cameraAngle.x,0,Ly),CT.clamp(e.cameraAngle.y,-Td,Td))}else if(e.isPanning){const i=new Pe(n.screenX,n.screenY).sub(e.panStartMousePos);i.multiply(e.panSpeed);const r=new P().copy(e.panUnitX).multiplyScalar(i.x),s=new P().copy(e.panUnitY).multiplyScalar(i.y);e.focusPoint.copy(e.panStartPos).add(r).add(s),e.updateCamera(),e.invalidate()}},onUp:n=>{e.isOrbiting=!1,e.isPanning=!1}}),he.jsx("div",{ref:t})},JR=({})=>he.jsx("div",{});Ba(({property:t})=>he.jsx("div",{className:"inputText elem",children:he.jsx("input",{label:"Name",value:t.obs,onChange:action(e=>t.obs=e.target.value)})}));const cv={configUI:{__html:` Vite + React - +